1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-15 06:06:04 +00:00

Fix check_ordering.py checking for shifted/nonmatching-besides-relocs (#1961)

This commit is contained in:
Dragorn421 2024-06-19 06:16:02 +02:00 committed by GitHub
parent 8d83727429
commit adcc1cecb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -153,13 +153,15 @@ def main():
base_value = read_u32(base, file.vrom + reloc.offset_32)
build_value = read_u32(build, file.vrom + reloc.offset_32)
elif reloc.offset_hi16 is not None and reloc.offset_lo16 is not None:
if read_u16(base, file.vrom + reloc.offset_hi16) != read_u16(
build, file.vrom + reloc.offset_hi16
) or read_u16(base, file.vrom + reloc.offset_hi16) != read_u16(
build, file.vrom + reloc.offset_hi16
if (
read_u16(base, file.vrom + reloc.offset_hi16)
!= read_u16(build, file.vrom + reloc.offset_hi16)
) or (
read_u16(base, file.vrom + reloc.offset_lo16)
!= read_u16(build, file.vrom + reloc.offset_lo16)
):
print(
f"Error: Reference to {reloc.name} in {file.filepath} is in a shifted portion of the ROM.\n"
f"Error: Reference to {reloc.name} in {file.filepath} is in a shifted (or non-matching even ignoring relocs) portion of the ROM.\n"
"Please ensure that the only differences between the baserom and the current build are due to data ordering.",
file=sys.stderr,
)
@ -187,7 +189,9 @@ def main():
for mapfile_segment in source_code_segments:
for file in mapfile_segment:
pointers_in_section = [
p for p in pointers if file.vram <= p.build_value < file.vram + file.size
p
for p in pointers
if file.vram <= p.build_value < file.vram + file.size
]
if not pointers_in_section:
continue