From adcc1cecb129b4dba1ede0c8904decf25e8921ef Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 19 Jun 2024 06:16:02 +0200 Subject: [PATCH] Fix check_ordering.py checking for shifted/nonmatching-besides-relocs (#1961) --- tools/check_ordering.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/check_ordering.py b/tools/check_ordering.py index cd03ea1e70..83eecfacb4 100755 --- a/tools/check_ordering.py +++ b/tools/check_ordering.py @@ -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