Skip to content

Commit c5e268a

Browse files
authored
Fix issue where functions that were regenerated for hooking use the wrong index when triggering events (#112)
1 parent 327c34d commit c5e268a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

librecomp/src/mods.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,13 @@ N64Recomp::Context context_from_regenerated_list(const RegeneratedList& regenlis
12901290

12911291
reloc_out.address = reloc_in.section_offset + section_out.ram_addr;
12921292
reloc_out.target_section_offset = reloc_in.target_section_offset;
1293-
reloc_out.symbol_index = 0; // Unused for live recompilation.
1293+
if (reloc_in.target_section == N64Recomp::SectionEvent) {
1294+
// Symbol index holds the event index for event reference symbols.
1295+
reloc_out.symbol_index = reloc_in.target_section_offset;
1296+
}
1297+
else {
1298+
reloc_out.symbol_index = 0; // Unused for live recompilation.
1299+
}
12941300
reloc_out.target_section = reloc_in.target_section;
12951301
reloc_out.type = static_cast<N64Recomp::RelocType>(reloc_in.type);
12961302
reloc_out.reference_symbol = true;

0 commit comments

Comments
 (0)