mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2025-10-30 08:02:11 +00:00
Change overlay_slot.offset config to text_address
This commit is contained in:
parent
cf29be0942
commit
4a186ec8b5
1 changed files with 7 additions and 7 deletions
|
|
@ -622,7 +622,7 @@ struct RSPRecompilerOverlayConfig {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RSPRecompilerOverlaySlotConfig {
|
struct RSPRecompilerOverlaySlotConfig {
|
||||||
size_t offset;
|
size_t text_address;
|
||||||
std::vector<RSPRecompilerOverlayConfig> overlays;
|
std::vector<RSPRecompilerOverlayConfig> overlays;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -751,13 +751,13 @@ bool read_config(const std::filesystem::path& config_path, RSPRecompilerConfig&
|
||||||
overlay_slots_array->for_each([&](toml::table slot){
|
overlay_slots_array->for_each([&](toml::table slot){
|
||||||
RSPRecompilerOverlaySlotConfig slot_config;
|
RSPRecompilerOverlaySlotConfig slot_config;
|
||||||
|
|
||||||
std::optional<uint32_t> offset = slot["offset"].value<uint32_t>();
|
std::optional<uint32_t> text_address = slot["text_address"].value<uint32_t>();
|
||||||
if (offset.has_value()) {
|
if (text_address.has_value()) {
|
||||||
slot_config.offset = offset.value();
|
slot_config.text_address = text_address.value();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw toml::parse_error(
|
throw toml::parse_error(
|
||||||
fmt::format("Missing offset in config file at overlay slot {}", slot_idx).c_str(),
|
fmt::format("Missing text_address in config file at overlay slot {}", slot_idx).c_str(),
|
||||||
config_data.source());
|
config_data.source());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -920,7 +920,7 @@ void create_overlay_swap_function(const std::string& function_name, std::ofstrea
|
||||||
for (size_t i = 0; i < config.overlay_slots.size(); i++) {
|
for (size_t i = 0; i < config.overlay_slots.size(); i++) {
|
||||||
const RSPRecompilerOverlaySlotConfig& slot = config.overlay_slots[i];
|
const RSPRecompilerOverlaySlotConfig& slot = config.overlay_slots[i];
|
||||||
|
|
||||||
uint32_t imemAddress = (config.text_address & rsp_mem_mask) + slot.offset;
|
uint32_t imemAddress = slot.text_address & rsp_mem_mask;
|
||||||
fmt::print(output_file, " {{ 0x{:04X}, {} }},\n",
|
fmt::print(output_file, " {{ 0x{:04X}, {} }},\n",
|
||||||
imemAddress, i);
|
imemAddress, i);
|
||||||
}
|
}
|
||||||
|
|
@ -1112,7 +1112,7 @@ int main(int argc, const char** argv) {
|
||||||
|
|
||||||
for (const RSPRecompilerOverlaySlotConfig &slot_config : config.overlay_slots) {
|
for (const RSPRecompilerOverlaySlotConfig &slot_config : config.overlay_slots) {
|
||||||
OverlaySlot slot{};
|
OverlaySlot slot{};
|
||||||
slot.offset = slot_config.offset;
|
slot.offset = (slot_config.text_address - config.text_address) & rsp_mem_mask;
|
||||||
|
|
||||||
for (const RSPRecompilerOverlayConfig &overlay_config : slot_config.overlays) {
|
for (const RSPRecompilerOverlayConfig &overlay_config : slot_config.overlays) {
|
||||||
Overlay overlay{};
|
Overlay overlay{};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue