From 5b98d7544a0c85decd844f734198578b7e1b2190 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Sat, 31 Aug 2024 14:00:07 -0400 Subject: [PATCH] Switch offline mod recompilation to use a base global event index instead of per-event global indices --- OfflineModRecomp/main.cpp | 4 ++-- src/recompilation.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OfflineModRecomp/main.cpp b/OfflineModRecomp/main.cpp index 440d49b..6e3477d 100644 --- a/OfflineModRecomp/main.cpp +++ b/OfflineModRecomp/main.cpp @@ -165,8 +165,8 @@ int main(int argc, const char** argv) { output_file << "RECOMP_EXPORT recomp_func_t* reference_symbol_funcs[" << std::max(size_t{1},num_reference_symbols) << "] = {0};\n\n"; // Write provided event array (maps internal event indices to global ones). - output_file << "// Mapping of internal event indices to global ones.\n"; - output_file << "RECOMP_EXPORT uint32_t event_indices[" << std::max(size_t{1}, mod_context.event_symbols.size()) <<"] = {0};\n\n"; + output_file << "// Base global event index for this mod's events.\n"; + output_file << "RECOMP_EXPORT uint32_t base_event_index;\n\n"; // Write the event trigger function pointer. output_file << "// Pointer to the runtime function for triggering events.\n"; diff --git a/src/recompilation.cpp b/src/recompilation.cpp index 26ca4cc..ca66ae6 100644 --- a/src/recompilation.cpp +++ b/src/recompilation.cpp @@ -242,11 +242,11 @@ bool process_instruction(const N64Recomp::Context& context, const N64Recomp::Fun if (reloc_section == N64Recomp::SectionEvent) { needs_link_branch = link_branch; if (indent) { - if (!print_unconditional_branch(" recomp_trigger_event(rdram, ctx, event_indices[{}])", reloc_reference_symbol)) { + if (!print_unconditional_branch(" recomp_trigger_event(rdram, ctx, base_event_index + {})", reloc_reference_symbol)) { return false; } } else { - if (!print_unconditional_branch("recomp_trigger_event(rdram, ctx, event_indices[{}])", reloc_reference_symbol)) { + if (!print_unconditional_branch("recomp_trigger_event(rdram, ctx, base_event_index + {})", reloc_reference_symbol)) { return false; } }