1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-09 05:44:26 +00:00

In fix_bss.py, really always use BSS section start from map file (#2085)

This commit is contained in:
cadmic 2024-08-25 07:43:07 -07:00 committed by GitHub
parent 7056423e5b
commit 7c2e0383f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View file

@ -69,3 +69,5 @@ u8 gSoundModeList[] = {
u8 gAudioSpecId = 0;
u8 D_80133418 = 0;
u8 D_8016F0E0[0xA0]; // unused

View file

@ -1,6 +1,5 @@
#include "global.h"
u8 D_8016F0E0[0xA0]; // unused
AudioContext gAudioCtx;
AudioCustomUpdateFunction gAudioCustomUpdateFunction;
s32 D_801755D8[3]; // unused

View file

@ -401,9 +401,6 @@ def determine_base_bss_ordering(
build_bss_symbols: list[BssSymbol],
bss_section: BssSection,
) -> list[BssSymbol]:
# For the baserom, assume that the lowest address is the start of the BSS section. This might
# not be true if the first BSS variable is not referenced, but in practice this doesn't seem
# to happen for the files which typically have BSS ordering issues.
base_start_address = min(p.base_value for p in bss_section.pointers)
found_symbols: dict[str, BssSymbol] = {}
@ -775,10 +772,16 @@ def main():
for file, bss_section in bss_sections.items():
if not bss_section.pointers:
continue
# Try to detect if the section is shifted by comparing the lowest
# address among any pointer into the section between base and build
# The following heuristic doesn't work for z_locale, since the first pointer into BSS is not
# at the start of the section. Fortunately z_locale either has one BSS variable (in GC versions)
# or none (in N64 versions), so we can just skip it.
if str(file) == "src/boot/z_locale.c":
continue
# For the baserom, assume that the lowest address is the start of the BSS section. This might
# not be true if the first BSS variable is not referenced, but in practice this doesn't happen
# (except for z_locale above).
base_min_address = min(p.base_value for p in bss_section.pointers)
build_min_address = min(p.build_value for p in bss_section.pointers)
build_min_address = bss_section.start_address
if not all(
p.build_value - build_min_address == p.base_value - base_min_address
for p in bss_section.pointers