From c5e268aa0f71cf06a10a001da981dc3e02e7dff0 Mon Sep 17 00:00:00 2001 From: Wiseguy <68165316+Mr-Wiseguy@users.noreply.github.com> Date: Sat, 3 May 2025 02:45:08 -0400 Subject: [PATCH] Fix issue where functions that were regenerated for hooking use the wrong index when triggering events (#112) --- librecomp/src/mods.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/librecomp/src/mods.cpp b/librecomp/src/mods.cpp index d55e4e2..eb7eef8 100644 --- a/librecomp/src/mods.cpp +++ b/librecomp/src/mods.cpp @@ -1290,7 +1290,13 @@ N64Recomp::Context context_from_regenerated_list(const RegeneratedList& regenlis reloc_out.address = reloc_in.section_offset + section_out.ram_addr; reloc_out.target_section_offset = reloc_in.target_section_offset; - reloc_out.symbol_index = 0; // Unused for live recompilation. + if (reloc_in.target_section == N64Recomp::SectionEvent) { + // Symbol index holds the event index for event reference symbols. + reloc_out.symbol_index = reloc_in.target_section_offset; + } + else { + reloc_out.symbol_index = 0; // Unused for live recompilation. + } reloc_out.target_section = reloc_in.target_section; reloc_out.type = static_cast(reloc_in.type); reloc_out.reference_symbol = true;