Fixed incorrect alignment during mod section loading (#65)

This commit is contained in:
Wiseguy 2024-10-12 01:10:59 -04:00 committed by GitHub
parent 25e8bcc1e1
commit 9e9ae173ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -831,8 +831,10 @@ recomp::mods::CodeModLoadError recomp::mods::ModContext::load_mod_code(uint8_t*
MEM_B(i, (gpr)cur_section_addr) = binary_data[section.rom_addr + i];
}
mod.section_load_addresses[section_index] = cur_section_addr;
// Calculate the next section's address based on the size of this section and its bss.
cur_section_addr += section.size + section.bss_size;
// Align the next section's address to 16 bytes.
cur_section_addr = (cur_section_addr + 15) & ~15;
}
// Iterate over each section again after loading them to perform R_MIPS_32 relocations.