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; } }