Action more info when it doesn't match and fix first diff (#662)

* Update linux-compile.yml

* fix first-diff

* Update first-diff.py

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
coco875 2024-08-16 23:45:32 +02:00 committed by GitHub
parent 6885c23c67
commit 9f920f2040
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View File

@ -27,4 +27,4 @@ jobs:
cp -r complementary_file/* .
echo "${{ secrets.AES_KEY }}" | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom.us.z64.aes -out baserom.us.z64
make assets
make -j
make -j || ./first-diff.py

View File

@ -2,6 +2,7 @@
import os.path
import argparse
from subprocess import check_call
import re
# TODO: -S argument for shifted ROMs
@ -118,8 +119,9 @@ def search_map(rom_addr):
if "noload" in line or "noload" in prev_line:
ram_offset = None
continue
ram = int(line[16 : 16 + 18], 0)
rom = int(line[59 : 59 + 18], 0)
hex_number = re.findall(r"0x[0-9a-fA-F]+", line)
ram = int(hex_number[0], 0) # int(line[16 : 16 + 18], 0)
rom = int(hex_number[2], 0)# int(line[59 : 59 + 18], 0)
ram_offset = ram - rom
continue
prev_line = line
@ -131,10 +133,11 @@ def search_map(rom_addr):
or " 0x" not in line
):
continue
ram = int(line[16 : 16 + 18], 0)
hex_number = re.findall(r"0x[0-9a-fA-F]+", line)
ram = int(hex_number[0], 0) # int(line[16 : 16 + 18], 0)
rom = ram - ram_offset
fn = line.split()[-1]
if "0x" in fn:
if fn.startswith("0x"):
ram_offset = None
continue
if rom > rom_addr or (rom_addr & 0x80000000 and ram > rom_addr):
@ -265,7 +268,7 @@ for i in range(24, len(mybin), 4):
map_search_diff.append(search_map(i))
if diffs == 0:
print("No differences!")
exit()
exit(0)
definite_shift = diffs > shift_cap
if not definite_shift:
if (diffs > 1):
@ -288,7 +291,7 @@ if diffs > 100:
+ basemap
+ " and rerun this script."
)
exit()
exit(1)
if not map_diff():
print(f"No ROM shift{' (!?)' if definite_shift else ''}")