From 749a1f419b34c9b11e5504abd93e32aebe750d60 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 22 Jun 2023 01:05:00 -0700 Subject: [PATCH] reccmp: support inlined functions that may have been compiled into both files --- .github/workflows/build.yml | 4 ++-- tools/reccmp/reccmp.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91a218f5..07fe411d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,8 +60,8 @@ jobs: C:\msys64\usr\bin\wget.exe https://legoisland.org/download/ISLE.EXE C:\msys64\usr\bin\wget.exe https://legoisland.org/download/LEGO1.DLL pip install capstone - python3 tools/reccmp/reccmp.py -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB ISLE - python3 tools/reccmp/reccmp.py -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB LEGO1 + python3 tools/reccmp/reccmp.py -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB . + python3 tools/reccmp/reccmp.py -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB . - name: Upload Artifact uses: actions/upload-artifact@master diff --git a/tools/reccmp/reccmp.py b/tools/reccmp/reccmp.py index 993c51f2..6e9826ce 100755 --- a/tools/reccmp/reccmp.py +++ b/tools/reccmp/reccmp.py @@ -259,6 +259,10 @@ def parse_asm(file, addr, size): total_accuracy = 0 htmlinsert = [] +# Generate basename of original file, used in locating OFFSET lines +basename = os.path.basename(os.path.splitext(original)[0]) +pattern = '// OFFSET:' + for subdir, dirs, files in os.walk(source): for file in files: srcfilename = os.path.join(os.path.abspath(subdir), file) @@ -273,9 +277,14 @@ def parse_asm(file, addr, size): if not line: break - if line.startswith('// OFFSET:'): - par = line[10:].strip().split() + line = line.strip() + + if line.startswith(pattern): + par = line[len(pattern):].strip().split() module = par[0] + if module != basename: + continue + addr = int(par[1], 16) find_open_bracket = line