From da3ad91b2027316a8132039da19f42961da51ab5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 21 Jun 2023 23:33:08 +0200 Subject: [PATCH 01/10] recomp.py: use argparse to parse arguments (#30) * recomp.py: use argparse to parse arguments * Address code revew comments * reccomp.py: -h/--help for help -H/--htmp for html * update CI to use new arg * slight string updates --------- Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com> --- .github/workflows/build.yml | 4 +-- tools/reccomp/reccomp.py | 69 ++++++++++++++----------------------- 2 files changed, 27 insertions(+), 46 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 335b9699..e865a1c0 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/reccomp/reccomp.py -h ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB ISLE - python3 tools/reccomp/reccomp.py -h LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB LEGO1 + python3 tools/reccomp/reccomp.py -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB ISLE + python3 tools/reccomp/reccomp.py -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB LEGO1 - name: Upload Artifact uses: actions/upload-artifact@master diff --git a/tools/reccomp/reccomp.py b/tools/reccomp/reccomp.py index f1f378ae..4e234a61 100755 --- a/tools/reccomp/reccomp.py +++ b/tools/reccomp/reccomp.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import argparse from capstone import * import difflib import struct @@ -7,60 +8,40 @@ import os import sys -def print_usage(): - print('Usage: %s [options] \n' % sys.argv[0]) - print('\t-v, --verbose \t\t\tPrint assembly diff for specific function (original file\'s offset)') - print('\t-h, --html \t\t\tGenerate searchable HTML summary of status and diffs') - sys.exit(1) +parser = argparse.ArgumentParser(allow_abbrev=False, + description='Recomp Compare: compare an original EXE with a recompiled EXE + PDB.') +parser.add_argument('original', metavar='original-binary', help='The original binary') +parser.add_argument('recompiled', metavar='recompiled-binary', help='The recompiled binary') +parser.add_argument('pdb', metavar='recompiled-pdb', help='The PDB of the recompiled binary') +parser.add_argument('decomp_dir', metavar='decomp-dir', help='The decompiled source tree') +parser.add_argument('--verbose', '-v', metavar='offset', help='Print assembly diff for specific function (original file\'s offset)') +parser.add_argument('--html', '-H', metavar='output-file', help='Generate searchable HTML summary of status and diffs') + +args = parser.parse_args() -positional_args = [] verbose = None -skip = False -html = None +if args.verbose: + try: + verbose = int(args.verbose, 16) + except ValueError: + parser.error('invalid verbose argument') +html = args.html -for i, arg in enumerate(sys.argv): - if skip: - skip = False - continue - - if arg.startswith('-'): - # A flag rather than a positional arg - flag = arg[1:] - - if flag == 'v' or flag == '-verbose': - verbose = int(sys.argv[i + 1], 16) - skip = True - elif flag == 'h' or flag == '-html': - html = sys.argv[i + 1] - skip = True - else: - print('Unknown flag: %s' % arg) - print_usage() - else: - positional_args.append(arg) - -if len(positional_args) != 5: - print_usage() - -original = positional_args[1] +original = args.original if not os.path.isfile(original): - print('Invalid input: Original binary does not exist') - sys.exit(1) + parser.error('Original binary does not exist') -recomp = positional_args[2] +recomp = args.recompiled if not os.path.isfile(recomp): - print('Invalid input: Recompiled binary does not exist') - sys.exit(1) + parser.error('Recompiled binary does not exist') -syms = positional_args[3] +syms = args.pdb if not os.path.isfile(syms): - print('Invalid input: Symbols PDB does not exist') - sys.exit(1) + parser.error('Symbols PDB does not exist') -source = positional_args[4] +source = args.decomp_dir if not os.path.isdir(source): - print('Invalid input: Source directory does not exist') - sys.exit(1) + parser.error('Source directory does not exist') # Declare a class that can automatically convert virtual executable addresses # to file addresses From fa63d7e34162bfbce5d4730f8b010a58b0c67065 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Wed, 21 Jun 2023 14:36:09 -0700 Subject: [PATCH 02/10] rename reccomp to reccmp Sorry to everyone's muscle memory, but I think this is better. The idea for the name was "recomp compare", but it's too easy to read it as "recomp with a typo". This should fix that, as well as be slightly easier to write since it's shorter. --- .github/workflows/build.yml | 4 ++-- tools/{reccomp => reccmp}/cvdump.exe | Bin tools/{reccomp/reccomp.py => reccmp/reccmp.py} | 2 +- tools/{reccomp => reccmp}/template.html | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename tools/{reccomp => reccmp}/cvdump.exe (100%) rename tools/{reccomp/reccomp.py => reccmp/reccmp.py} (99%) rename tools/{reccomp => reccmp}/template.html (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e865a1c0..91a218f5 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/reccomp/reccomp.py -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB ISLE - python3 tools/reccomp/reccomp.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 ISLE + python3 tools/reccmp/reccmp.py -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB LEGO1 - name: Upload Artifact uses: actions/upload-artifact@master diff --git a/tools/reccomp/cvdump.exe b/tools/reccmp/cvdump.exe similarity index 100% rename from tools/reccomp/cvdump.exe rename to tools/reccmp/cvdump.exe diff --git a/tools/reccomp/reccomp.py b/tools/reccmp/reccmp.py similarity index 99% rename from tools/reccomp/reccomp.py rename to tools/reccmp/reccmp.py index 4e234a61..02189dfe 100755 --- a/tools/reccomp/reccomp.py +++ b/tools/reccmp/reccmp.py @@ -9,7 +9,7 @@ import sys parser = argparse.ArgumentParser(allow_abbrev=False, - description='Recomp Compare: compare an original EXE with a recompiled EXE + PDB.') + description='Recompilation Compare: compare an original EXE with a recompiled EXE + PDB.') parser.add_argument('original', metavar='original-binary', help='The original binary') parser.add_argument('recompiled', metavar='recompiled-binary', help='The recompiled binary') parser.add_argument('pdb', metavar='recompiled-pdb', help='The PDB of the recompiled binary') diff --git a/tools/reccomp/template.html b/tools/reccmp/template.html similarity index 100% rename from tools/reccomp/template.html rename to tools/reccmp/template.html From 4d531d1de5f38f003c1725fcb7ad13bbc4c99d6f Mon Sep 17 00:00:00 2001 From: MS Date: Wed, 21 Jun 2023 17:43:01 -0400 Subject: [PATCH 03/10] reccomp: add option to hide 100% matching functions (#35) * add option to hide 100% matching functions * slight formatting improvement --------- Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com> --- tools/reccmp/template.html | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/tools/reccmp/template.html b/tools/reccmp/template.html index fdc41b20..9b03e4ec 100644 --- a/tools/reccmp/template.html +++ b/tools/reccmp/template.html @@ -67,6 +67,12 @@ #sortind { margin: 0 0.5em; } + + .filters { + font-size: 10pt; + text-align: center; + margin: 0.5em 0 1em 0; + } @@ -230,8 +250,10 @@

Decompilation Status

-
-
+
+ + +
AddressNameMatching
From fa8e4523bdc4f7c8c2483b7fa45eaa8b99b98594 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 22 Jun 2023 00:18:37 +0200 Subject: [PATCH 04/10] isle: match Isle::Tick and FindExistingInstance (#32) * match Isle::Tick and FindExistingInstance * add offset comments * inline Isle::Tick * move inline MxDSObject, remove mx.cpp --- ISLE/define.cpp | 3 - ISLE/define.h | 4 +- ISLE/isle.cpp | 68 +------------- ISLE/isle.h | 70 ++++++++++++++ ISLE/mx.cpp | 7 -- LEGO1/mxdsobject.cpp | 5 +- LEGO1/mxdsobject.h | 10 +- isle.mak | 215 ++++++++++++++++--------------------------- isle.mdp | Bin 50688 -> 50688 bytes 9 files changed, 157 insertions(+), 225 deletions(-) delete mode 100644 ISLE/mx.cpp diff --git a/ISLE/define.cpp b/ISLE/define.cpp index a5122188..b5501b08 100644 --- a/ISLE/define.cpp +++ b/ISLE/define.cpp @@ -38,6 +38,3 @@ int g_startupDelay = 200; // 0x4101c0 long g_lastFrameTime = 0; - -// 0x4101dc -const char *WINDOW_TITLE = "LEGO\xAE"; diff --git a/ISLE/define.h b/ISLE/define.h index 36f69993..7adc751e 100644 --- a/ISLE/define.h +++ b/ISLE/define.h @@ -7,8 +7,10 @@ class Isle; extern Isle *g_isle; extern int g_closed; +// 0x4101c4 #define WNDCLASS_NAME "Lego Island MainNoM App" -extern const char *WINDOW_TITLE; +// 0x4101dc +#define WINDOW_TITLE "LEGO\xAE" extern unsigned char g_mousedown; extern unsigned char g_mousemoved; extern RECT g_windowRect; diff --git a/ISLE/isle.cpp b/ISLE/isle.cpp index a58ad707..9f3c50c4 100644 --- a/ISLE/isle.cpp +++ b/ISLE/isle.cpp @@ -1,10 +1,8 @@ #include "isle.h" -#include "define.h" #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legomodelpresenter.h" -#include "legoomni.h" #include "legopartpresenter.h" #include "legoworldpresenter.h" #include "mxdirectdraw.h" @@ -78,7 +76,7 @@ Isle::~Isle() void Isle::Close() { MxDSAction ds; - ds.SetUnknown24(0xFFFE); + ds.SetUnknown24(-2); if (Lego()) { GameState()->Save(0); @@ -574,67 +572,3 @@ MxResult Isle::SetupWindow(HINSTANCE hInstance) return SUCCESS; } - -// OFFSET: ISLE 0x402c20 -void Isle::Tick(BOOL sleepIfNotNextFrame) -{ - if (this->m_windowActive) { - if (!Lego()) return; - if (!TickleManager()) return; - if (!Timer()) return; - - long currentTime = Timer()->GetRealTime(); - if (currentTime < g_lastFrameTime) { - g_lastFrameTime = -this->m_frameDelta; - } - if (this->m_frameDelta + g_lastFrameTime < currentTime) { - if (!Lego()->vtable40()) { - TickleManager()->Tickle(); - } - g_lastFrameTime = currentTime; - - if (g_startupDelay == 0) { - return; - } - - g_startupDelay--; - if (g_startupDelay != 0) { - return; - } - - LegoOmni::GetInstance()->CreateBackgroundAudio(); - BackgroundAudioManager()->Enable(this->m_useMusic); - - MxStreamController *stream = Streamer()->Open("\\lego\\scripts\\isle\\isle", 0); - MxDSAction ds; - - if (!stream) { - stream = Streamer()->Open("\\lego\\scripts\\nocd", 0); - if (!stream) { - return; - } - - ds.SetAtomId(stream->atom); - ds.SetUnknown24(0xFFFF); - ds.SetUnknown1c(0); - VideoManager()->EnableFullScreenMovie(TRUE, TRUE); - - if (Start(&ds) != SUCCESS) { - return; - } - } else { - ds.SetAtomId(stream->atom); - ds.SetUnknown24(0xFFFF); - ds.SetUnknown1c(0); - if (Start(&ds) != SUCCESS) { - return; - } - this->m_gameStarted = 1; - } - return; - } - if (sleepIfNotNextFrame == 0) return; - } - - Sleep(0); -} diff --git a/ISLE/isle.h b/ISLE/isle.h index 4d6b73c4..b11f4c09 100644 --- a/ISLE/isle.h +++ b/ISLE/isle.h @@ -3,6 +3,9 @@ #include +#include "define.h" + +#include "legoomni.h" #include "mxresult.h" #include "mxvideoparam.h" @@ -77,4 +80,71 @@ class Isle }; +// OFFSET: ISLE 0x401c40 +inline void MxDSObject::SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } + +// OFFSET: ISLE 0x402c20 +inline void Isle::Tick(BOOL sleepIfNotNextFrame) +{ + if (this->m_windowActive) { + if (!Lego()) return; + if (!TickleManager()) return; + if (!Timer()) return; + + long currentTime = Timer()->GetRealTime(); + if (currentTime < g_lastFrameTime) { + g_lastFrameTime = -this->m_frameDelta; + } + if (this->m_frameDelta + g_lastFrameTime < currentTime) { + if (!Lego()->vtable40()) { + TickleManager()->Tickle(); + } + g_lastFrameTime = currentTime; + + if (g_startupDelay == 0) { + return; + } + + g_startupDelay--; + if (g_startupDelay != 0) { + return; + } + + LegoOmni::GetInstance()->CreateBackgroundAudio(); + BackgroundAudioManager()->Enable(this->m_useMusic); + + MxStreamController *stream = Streamer()->Open("\\lego\\scripts\\isle\\isle", 0); + MxDSAction ds; + + if (!stream) { + stream = Streamer()->Open("\\lego\\scripts\\nocd", 0); + if (!stream) { + return; + } + + ds.SetAtomId(stream->atom); + ds.SetUnknown24(-1); + ds.SetUnknown1c(0); + VideoManager()->EnableFullScreenMovie(TRUE, TRUE); + + if (Start(&ds) != SUCCESS) { + return; + } + } else { + ds.SetAtomId(stream->atom); + ds.SetUnknown24(-1); + ds.SetUnknown1c(0); + if (Start(&ds) != SUCCESS) { + return; + } + this->m_gameStarted = 1; + } + return; + } + if (sleepIfNotNextFrame == 0) return; + } + + Sleep(0); +} + #endif // ISLE_H diff --git a/ISLE/mx.cpp b/ISLE/mx.cpp deleted file mode 100644 index c0417e5a..00000000 --- a/ISLE/mx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "mxdsobject.h" - -// OFFSET: ISLE 0x00401c40 -void MxDSObject::SetAtomId(MxAtomId p_atomId) -{ - this->m_atomId = p_atomId; -} \ No newline at end of file diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index 5e7d7103..8142ba9d 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -6,14 +6,11 @@ // OFFSET: LEGO1 0x100bf6a0 MxDSObject::MxDSObject() { - // The following code yields 100% matching assembly if m_unk24 is declared as (signed) short. - // However, in other areas m_unk24 (notably, ISLE.EXE) is treated as unsigned short. - // Since we don't have a proper solution yet, we are using a union to work around this discrepancy. this->m_unk0c = 0; this->m_unk10 = 0; this->m_unk14 = 0; this->m_name = NULL; - this->m_unk24signed = -1; + this->m_unk24 = -1; this->m_unk1c = -1; this->m_unk28 = 0; } diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 99c62dd2..4f59d4bb 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -15,7 +15,7 @@ class MxDSObject : public MxCore inline int GetUnknown1c() { return this->m_unk1c; } inline void SetUnknown1c(int p_unk1c) { this->m_unk1c = p_unk1c; } - inline void SetUnknown24(unsigned short p_unk24) { this->m_unk24 = p_unk24; } + inline void SetUnknown24(short p_unk24) { this->m_unk24 = p_unk24; } void SetAtomId(MxAtomId p_atomId); @@ -27,13 +27,7 @@ class MxDSObject : public MxCore char *m_name; int m_unk1c; MxAtomId m_atomId; - // So far, implementing MxDSObject::MxDSObject correctly required that m_unk24 is declared a (signed) short. - // Most of the other game's code appears to treat it as unsigned short, however. - // This union is a workaround until we have figured this out. - union { - unsigned short m_unk24; - short m_unk24signed; - }; + short m_unk24; unsigned short m_unk26; int m_unk28; }; diff --git a/isle.mak b/isle.mak index f0f905ff..acbf2236 100644 --- a/isle.mak +++ b/isle.mak @@ -288,7 +288,6 @@ CLEAN : -@erase "$(INTDIR)\isle.obj" -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" - -@erase "$(INTDIR)\mx.obj" -@erase "$(INTDIR)\vc40.pdb" -@erase ".\Release\ISLE.EXE" -@erase ".\Release\ISLE.PDB" @@ -350,7 +349,6 @@ LINK32_OBJS= \ "$(INTDIR)\isle.obj" \ "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" \ - "$(INTDIR)\mx.obj" \ ".\Release\LEGO1.LIB" ".\Release\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -380,7 +378,6 @@ CLEAN : -@erase "$(INTDIR)\isle.obj" -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" - -@erase "$(INTDIR)\mx.obj" -@erase "$(INTDIR)\vc40.idb" -@erase "$(INTDIR)\vc40.pdb" -@erase ".\Debug\ISLE.EXE" @@ -444,7 +441,6 @@ LINK32_OBJS= \ "$(INTDIR)\isle.obj" \ "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" \ - "$(INTDIR)\mx.obj" \ ".\LEGO1\Debug\LEGO1.lib" ".\Debug\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -497,6 +493,9 @@ DEP_CPP_DLLMA=\ # Begin Source File SOURCE=.\LEGO1\legoomni.cpp + +!IF "$(CFG)" == "LEGO1 - Win32 Release" + DEP_CPP_LEGOO=\ ".\LEGO1\lego3dmanager.h"\ ".\LEGO1\lego3dview.h"\ @@ -545,6 +544,39 @@ DEP_CPP_LEGOO=\ $(CPP) $(CPP_PROJ) $(SOURCE) +!ELSEIF "$(CFG)" == "LEGO1 - Win32 Debug" + +DEP_CPP_LEGOO=\ + ".\LEGO1\lego3dmanager.h"\ + ".\LEGO1\lego3dview.h"\ + ".\LEGO1\legoentity.h"\ + ".\LEGO1\legogamestate.h"\ + ".\LEGO1\legoinc.h"\ + ".\LEGO1\legoinputmanager.h"\ + ".\LEGO1\legonavcontroller.h"\ + ".\LEGO1\legoomni.h"\ + ".\LEGO1\legoroi.h"\ + ".\LEGO1\legovideomanager.h"\ + ".\LEGO1\mxatomid.h"\ + ".\LEGO1\mxbackgroundaudiomanager.h"\ + ".\LEGO1\mxbool.h"\ + ".\LEGO1\mxcore.h"\ + ".\LEGO1\mxcriticalsection.h"\ + ".\LEGO1\mxdsaction.h"\ + ".\LEGO1\mxdsfile.h"\ + ".\LEGO1\mxdsobject.h"\ + ".\LEGO1\mxeventmanager.h"\ + ".\LEGO1\mxomni.h"\ + ".\LEGO1\mxtimer.h"\ + ".\LEGO1\viewmanager.h"\ + + +"$(INTDIR)\legoomni.obj" : $(SOURCE) $(DEP_CPP_LEGOO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + # End Source File ################################################################################ # Begin Source File @@ -741,6 +773,9 @@ DEP_CPP_MXOMNICR=\ # Begin Source File SOURCE=.\LEGO1\legonavcontroller.cpp + +!IF "$(CFG)" == "LEGO1 - Win32 Release" + DEP_CPP_LEGON=\ ".\LEGO1\lego3dmanager.h"\ ".\LEGO1\lego3dview.h"\ @@ -790,6 +825,40 @@ DEP_CPP_LEGON=\ $(CPP) $(CPP_PROJ) $(SOURCE) +!ELSEIF "$(CFG)" == "LEGO1 - Win32 Debug" + +DEP_CPP_LEGON=\ + ".\LEGO1\lego3dmanager.h"\ + ".\LEGO1\lego3dview.h"\ + ".\LEGO1\legoentity.h"\ + ".\LEGO1\legogamestate.h"\ + ".\LEGO1\legoinc.h"\ + ".\LEGO1\legoinputmanager.h"\ + ".\LEGO1\legonavcontroller.h"\ + ".\LEGO1\legoomni.h"\ + ".\LEGO1\legoroi.h"\ + ".\LEGO1\legoutil.h"\ + ".\LEGO1\legovideomanager.h"\ + ".\LEGO1\mxatomid.h"\ + ".\LEGO1\mxbackgroundaudiomanager.h"\ + ".\LEGO1\mxbool.h"\ + ".\LEGO1\mxcore.h"\ + ".\LEGO1\mxcriticalsection.h"\ + ".\LEGO1\mxdsaction.h"\ + ".\LEGO1\mxdsfile.h"\ + ".\LEGO1\mxdsobject.h"\ + ".\LEGO1\mxeventmanager.h"\ + ".\LEGO1\mxomni.h"\ + ".\LEGO1\mxtimer.h"\ + ".\LEGO1\viewmanager.h"\ + + +"$(INTDIR)\legonavcontroller.obj" : $(SOURCE) $(DEP_CPP_LEGON) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + # End Source File ################################################################################ # Begin Source File @@ -850,9 +919,6 @@ DEP_CPP_DEFIN=\ # Begin Source File SOURCE=.\ISLE\isle.cpp - -!IF "$(CFG)" == "ISLE - Win32 Release" - DEP_CPP_ISLE_=\ ".\ISLE\define.h"\ ".\ISLE\isle.h"\ @@ -910,90 +976,36 @@ DEP_CPP_ISLE_=\ $(CPP) $(CPP_PROJ) $(SOURCE) -!ELSEIF "$(CFG)" == "ISLE - Win32 Debug" - -DEP_CPP_ISLE_=\ - ".\ISLE\define.h"\ - ".\ISLE\isle.h"\ - ".\ISLE\res\resource.h"\ - ".\LEGO1\lego3dmanager.h"\ - ".\LEGO1\lego3dview.h"\ - ".\LEGO1\legoanimationmanager.h"\ - ".\LEGO1\legobuildingmanager.h"\ - ".\LEGO1\legoentity.h"\ - ".\LEGO1\legogamestate.h"\ - ".\LEGO1\legoinc.h"\ - ".\LEGO1\legoinputmanager.h"\ - ".\LEGO1\legomodelpresenter.h"\ - ".\LEGO1\legonavcontroller.h"\ - ".\LEGO1\legoomni.h"\ - ".\LEGO1\legopartpresenter.h"\ - ".\LEGO1\legoroi.h"\ - ".\LEGO1\legovideomanager.h"\ - ".\LEGO1\legoworldpresenter.h"\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbackgroundaudiomanager.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxcriticalsection.h"\ - ".\LEGO1\mxdirectdraw.h"\ - ".\LEGO1\mxdsaction.h"\ - ".\LEGO1\mxdsfile.h"\ - ".\LEGO1\mxdsobject.h"\ - ".\LEGO1\mxeventmanager.h"\ - ".\LEGO1\mxmusicmanager.h"\ - ".\LEGO1\mxnotificationmanager.h"\ - ".\LEGO1\mxobjectfactory.h"\ - ".\LEGO1\mxomni.h"\ - ".\LEGO1\mxomnicreateflags.h"\ - ".\LEGO1\mxomnicreateparam.h"\ - ".\LEGO1\mxomnicreateparambase.h"\ - ".\LEGO1\mxresult.h"\ - ".\LEGO1\mxsoundmanager.h"\ - ".\LEGO1\mxstreamcontroller.h"\ - ".\LEGO1\mxstreamer.h"\ - ".\LEGO1\mxstring.h"\ - ".\LEGO1\mxticklemanager.h"\ - ".\LEGO1\mxtimer.h"\ - ".\LEGO1\mxtransitionmanager.h"\ - ".\LEGO1\mxvariabletable.h"\ - ".\LEGO1\mxvideomanager.h"\ - ".\LEGO1\mxvideoparam.h"\ - ".\LEGO1\viewmanager.h"\ - - -"$(INTDIR)\isle.obj" : $(SOURCE) $(DEP_CPP_ISLE_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - # End Source File ################################################################################ # Begin Source File SOURCE=.\ISLE\main.cpp - -!IF "$(CFG)" == "ISLE - Win32 Release" - DEP_CPP_MAIN_=\ ".\ISLE\define.h"\ ".\ISLE\isle.h"\ + ".\ISLE\res\resource.h"\ ".\LEGO1\lego3dmanager.h"\ ".\LEGO1\lego3dview.h"\ + ".\LEGO1\legoanimationmanager.h"\ + ".\LEGO1\legobuildingmanager.h"\ ".\LEGO1\legoentity.h"\ ".\LEGO1\legogamestate.h"\ ".\LEGO1\legoinc.h"\ ".\LEGO1\legoinputmanager.h"\ + ".\LEGO1\legomodelpresenter.h"\ ".\LEGO1\legonavcontroller.h"\ ".\LEGO1\legoomni.h"\ + ".\LEGO1\legopartpresenter.h"\ ".\LEGO1\legoroi.h"\ ".\LEGO1\legovideomanager.h"\ + ".\LEGO1\legoworldpresenter.h"\ ".\LEGO1\mxatomid.h"\ ".\LEGO1\mxbackgroundaudiomanager.h"\ ".\LEGO1\mxbool.h"\ ".\LEGO1\mxcore.h"\ ".\LEGO1\mxcriticalsection.h"\ + ".\LEGO1\mxdirectdraw.h"\ ".\LEGO1\mxdsaction.h"\ ".\LEGO1\mxdsfile.h"\ ".\LEGO1\mxdsobject.h"\ @@ -1026,57 +1038,6 @@ DEP_CPP_MAIN_=\ $(CPP) $(CPP_PROJ) $(SOURCE) -!ELSEIF "$(CFG)" == "ISLE - Win32 Debug" - -DEP_CPP_MAIN_=\ - ".\ISLE\define.h"\ - ".\ISLE\isle.h"\ - ".\LEGO1\lego3dmanager.h"\ - ".\LEGO1\lego3dview.h"\ - ".\LEGO1\legoentity.h"\ - ".\LEGO1\legogamestate.h"\ - ".\LEGO1\legoinc.h"\ - ".\LEGO1\legoinputmanager.h"\ - ".\LEGO1\legonavcontroller.h"\ - ".\LEGO1\legoomni.h"\ - ".\LEGO1\legoroi.h"\ - ".\LEGO1\legovideomanager.h"\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbackgroundaudiomanager.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxcriticalsection.h"\ - ".\LEGO1\mxdsaction.h"\ - ".\LEGO1\mxdsfile.h"\ - ".\LEGO1\mxdsobject.h"\ - ".\LEGO1\mxeventmanager.h"\ - ".\LEGO1\mxmusicmanager.h"\ - ".\LEGO1\mxnotificationmanager.h"\ - ".\LEGO1\mxobjectfactory.h"\ - ".\LEGO1\mxomni.h"\ - ".\LEGO1\mxomnicreateflags.h"\ - ".\LEGO1\mxomnicreateparam.h"\ - ".\LEGO1\mxomnicreateparambase.h"\ - ".\LEGO1\mxresult.h"\ - ".\LEGO1\mxsoundmanager.h"\ - ".\LEGO1\mxstreamcontroller.h"\ - ".\LEGO1\mxstreamer.h"\ - ".\LEGO1\mxstring.h"\ - ".\LEGO1\mxticklemanager.h"\ - ".\LEGO1\mxtimer.h"\ - ".\LEGO1\mxtransitionmanager.h"\ - ".\LEGO1\mxvariabletable.h"\ - ".\LEGO1\mxvideomanager.h"\ - ".\LEGO1\mxvideoparam.h"\ - ".\LEGO1\viewmanager.h"\ - - -"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - # End Source File ################################################################################ # Begin Source File @@ -1517,22 +1478,6 @@ SOURCE=.\LEGO1\mxvideoparamflags.h !ENDIF # End Project Dependency -################################################################################ -# Begin Source File - -SOURCE=.\ISLE\mx.cpp -DEP_CPP_MX_CP=\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxdsobject.h"\ - - -"$(INTDIR)\mx.obj" : $(SOURCE) $(DEP_CPP_MX_CP) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File # End Target # End Project ################################################################################ diff --git a/isle.mdp b/isle.mdp index e164ac1ec45b5477842f4919ab402efe54cf7ffe..a35b41d166591b9a4cb0900d43013fff86967b52 100644 GIT binary patch delta 457 zcmZqZVQ%PQ-oPQnTAW{+mok}gn#$zdiOVMQ)vTM`FqL((QA^n-84e*lvIcl%UGU0A zsB%r-SR}eRE9n~d=7PL;f|C^{C{Ny1tup!TERD%eYBVR?Rd#NERe6CC=Ag|+E%VqW zOO&Z>PM^G+b#p~k4%24a$xk7y$)dA`CqF6{+MKz6I?Ln_-2$5>D%?1*nK}7Y2gfIQ3GP^X5GAd#%adMF*O>K@5~b3EW~w#PavIvAzg498w1EA zJBss}HVblnVBEBZg^8V&fq^Z7nPu|+jq#JS)^$&Qw!UI=?)u8fS2iR}RFIe)x1ntE zzKsdIKxGUPKn$iQJ8rC Date: Wed, 21 Jun 2023 17:01:48 -0700 Subject: [PATCH 05/10] reccmp: revert using debug offsets --- tools/reccmp/reccmp.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/reccmp/reccmp.py b/tools/reccmp/reccmp.py index 02189dfe..36f917fa 100755 --- a/tools/reccmp/reccmp.py +++ b/tools/reccmp/reccmp.py @@ -118,14 +118,23 @@ def __init__(self, pdb, file): if current_section == 'SYMBOLS' and 'S_GPROC32' in line: addr = int(line[26:34], 16) - debug_offs = line_dump[i + 2] - debug_start = int(debug_offs[22:30], 16) - debug_end = int(debug_offs[43:], 16) + info = RecompiledInfo() info.addr = addr + recompfile.imagebase + recompfile.textvirt - info.start = debug_start - info.size = debug_end - debug_start + + use_dbg_offs = False + if use_dbg_offs: + debug_offs = line_dump[i + 2] + debug_start = int(debug_offs[22:30], 16) + debug_end = int(debug_offs[43:], 16) + + info.start = debug_start + info.size = debug_end - debug_start + else: + info.start = 0 + info.size = int(line[41:49], 16) + info.name = line[77:] self.funcs[addr] = info From 30ef923bf4477cd3ad6b4e889c19d244bc94b1f1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 22 Jun 2023 08:13:15 +0200 Subject: [PATCH 06/10] hotfix: messed up structure due to windows.h (#37) --- ISLE/define.h | 2 +- ISLE/isle.h | 3 +-- ISLE/main.cpp | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ISLE/define.h b/ISLE/define.h index 7adc751e..27a347b7 100644 --- a/ISLE/define.h +++ b/ISLE/define.h @@ -1,7 +1,7 @@ #ifndef DEFINE_H #define DEFINE_H -#include +#include "legoinc.h" class Isle; diff --git a/ISLE/isle.h b/ISLE/isle.h index b11f4c09..8eb37fa7 100644 --- a/ISLE/isle.h +++ b/ISLE/isle.h @@ -1,8 +1,7 @@ #ifndef ISLE_H #define ISLE_H -#include - +#include "legoinc.h" #include "define.h" #include "legoomni.h" diff --git a/ISLE/main.cpp b/ISLE/main.cpp index 6e4c6621..632ed43d 100644 --- a/ISLE/main.cpp +++ b/ISLE/main.cpp @@ -1,9 +1,10 @@ #include -#include +#include "legoinc.h" #include "define.h" -#include "isle.h" + #include "legoomni.h" +#include "isle.h" // OFFSET: ISLE 0x401ca0 BOOL FindExistingInstance(void) From 598ca01df52d0187b86813e2fa7be41dea1ce620 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 22 Jun 2023 00:43:37 -0700 Subject: [PATCH 07/10] gitignore ISLE.EXE/LEGO1.DLL --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b1838781..ef562599 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ Debug/ Release/ *.ncb +ISLE.EXE +LEGO1.DLL From 12395ac41aaf278fb980c0f81c8ba4301de2a00c Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 22 Jun 2023 00:44:28 -0700 Subject: [PATCH 08/10] reccmp: further improve accuracy --- tools/reccmp/reccmp.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/reccmp/reccmp.py b/tools/reccmp/reccmp.py index 36f917fa..993c51f2 100755 --- a/tools/reccmp/reccmp.py +++ b/tools/reccmp/reccmp.py @@ -198,7 +198,14 @@ def get_recompiled_address(self, filename, line): def sanitize(file, mnemonic, op_str): offsetplaceholder = '' - if mnemonic == 'call' or mnemonic == 'jmp': + op_str_is_number = False + try: + int(op_str, 16) + op_str_is_number = True + except ValueError: + pass + + if (mnemonic == 'call' or mnemonic == 'jmp') and op_str_is_number: # Filter out "calls" because the offsets we're not currently trying to # match offsets. As long as there's a call in the right place, it's # probably accurate. From 66a010a19fa9c2b635afb2897be88ec18364e72b Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 22 Jun 2023 00:45:56 -0700 Subject: [PATCH 09/10] move inlined MxDSObject::SetAtomId to main header We've confirmed that, despite a function being declared inline, msvc will still make a conventional call in some circumstances. As such, I feel like this is warranted because it's most likely what a developer would have actually written. --- ISLE/isle.h | 3 -- LEGO1/mxdsobject.cpp | 6 ---- LEGO1/mxdsobject.h | 4 ++- isle.mak | 82 ++----------------------------------------- isle.mdp | Bin 50688 -> 48128 bytes 5 files changed, 5 insertions(+), 90 deletions(-) diff --git a/ISLE/isle.h b/ISLE/isle.h index 8eb37fa7..e556a5c4 100644 --- a/ISLE/isle.h +++ b/ISLE/isle.h @@ -79,9 +79,6 @@ class Isle }; -// OFFSET: ISLE 0x401c40 -inline void MxDSObject::SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } - // OFFSET: ISLE 0x402c20 inline void Isle::Tick(BOOL sleepIfNotNextFrame) { diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index 8142ba9d..7323f446 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -34,9 +34,3 @@ void MxDSObject::SetObjectName(const char *p_name) } } } - -// OFFSET: LEGO1 0x10005530 -void MxDSObject::SetAtomId(MxAtomId p_atomId) -{ - this->m_atomId = p_atomId; -} diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 4f59d4bb..468076f7 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -17,7 +17,9 @@ class MxDSObject : public MxCore inline void SetUnknown1c(int p_unk1c) { this->m_unk1c = p_unk1c; } inline void SetUnknown24(short p_unk24) { this->m_unk24 = p_unk24; } - void SetAtomId(MxAtomId p_atomId); + // OFFSET: ISLE 0x401c40 + // OFFSET: LEGO1 0x10005530 + inline void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } private: int m_unk08; diff --git a/isle.mak b/isle.mak index acbf2236..53c8f2bd 100644 --- a/isle.mak +++ b/isle.mak @@ -493,9 +493,6 @@ DEP_CPP_DLLMA=\ # Begin Source File SOURCE=.\LEGO1\legoomni.cpp - -!IF "$(CFG)" == "LEGO1 - Win32 Release" - DEP_CPP_LEGOO=\ ".\LEGO1\lego3dmanager.h"\ ".\LEGO1\lego3dview.h"\ @@ -544,45 +541,13 @@ DEP_CPP_LEGOO=\ $(CPP) $(CPP_PROJ) $(SOURCE) -!ELSEIF "$(CFG)" == "LEGO1 - Win32 Debug" - -DEP_CPP_LEGOO=\ - ".\LEGO1\lego3dmanager.h"\ - ".\LEGO1\lego3dview.h"\ - ".\LEGO1\legoentity.h"\ - ".\LEGO1\legogamestate.h"\ - ".\LEGO1\legoinc.h"\ - ".\LEGO1\legoinputmanager.h"\ - ".\LEGO1\legonavcontroller.h"\ - ".\LEGO1\legoomni.h"\ - ".\LEGO1\legoroi.h"\ - ".\LEGO1\legovideomanager.h"\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbackgroundaudiomanager.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxcriticalsection.h"\ - ".\LEGO1\mxdsaction.h"\ - ".\LEGO1\mxdsfile.h"\ - ".\LEGO1\mxdsobject.h"\ - ".\LEGO1\mxeventmanager.h"\ - ".\LEGO1\mxomni.h"\ - ".\LEGO1\mxtimer.h"\ - ".\LEGO1\viewmanager.h"\ - - -"$(INTDIR)\legoomni.obj" : $(SOURCE) $(DEP_CPP_LEGOO) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - # End Source File ################################################################################ # Begin Source File SOURCE=.\LEGO1\mxcriticalsection.cpp DEP_CPP_MXCRI=\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxcriticalsection.h"\ @@ -596,6 +561,7 @@ DEP_CPP_MXCRI=\ SOURCE=.\LEGO1\mxautolocker.cpp DEP_CPP_MXAUT=\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxautolocker.h"\ ".\LEGO1\mxcriticalsection.h"\ @@ -773,9 +739,6 @@ DEP_CPP_MXOMNICR=\ # Begin Source File SOURCE=.\LEGO1\legonavcontroller.cpp - -!IF "$(CFG)" == "LEGO1 - Win32 Release" - DEP_CPP_LEGON=\ ".\LEGO1\lego3dmanager.h"\ ".\LEGO1\lego3dview.h"\ @@ -825,40 +788,6 @@ DEP_CPP_LEGON=\ $(CPP) $(CPP_PROJ) $(SOURCE) -!ELSEIF "$(CFG)" == "LEGO1 - Win32 Debug" - -DEP_CPP_LEGON=\ - ".\LEGO1\lego3dmanager.h"\ - ".\LEGO1\lego3dview.h"\ - ".\LEGO1\legoentity.h"\ - ".\LEGO1\legogamestate.h"\ - ".\LEGO1\legoinc.h"\ - ".\LEGO1\legoinputmanager.h"\ - ".\LEGO1\legonavcontroller.h"\ - ".\LEGO1\legoomni.h"\ - ".\LEGO1\legoroi.h"\ - ".\LEGO1\legoutil.h"\ - ".\LEGO1\legovideomanager.h"\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbackgroundaudiomanager.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxcriticalsection.h"\ - ".\LEGO1\mxdsaction.h"\ - ".\LEGO1\mxdsfile.h"\ - ".\LEGO1\mxdsobject.h"\ - ".\LEGO1\mxeventmanager.h"\ - ".\LEGO1\mxomni.h"\ - ".\LEGO1\mxtimer.h"\ - ".\LEGO1\viewmanager.h"\ - - -"$(INTDIR)\legonavcontroller.obj" : $(SOURCE) $(DEP_CPP_LEGON) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - # End Source File ################################################################################ # Begin Source File @@ -984,28 +913,21 @@ SOURCE=.\ISLE\main.cpp DEP_CPP_MAIN_=\ ".\ISLE\define.h"\ ".\ISLE\isle.h"\ - ".\ISLE\res\resource.h"\ ".\LEGO1\lego3dmanager.h"\ ".\LEGO1\lego3dview.h"\ - ".\LEGO1\legoanimationmanager.h"\ - ".\LEGO1\legobuildingmanager.h"\ ".\LEGO1\legoentity.h"\ ".\LEGO1\legogamestate.h"\ ".\LEGO1\legoinc.h"\ ".\LEGO1\legoinputmanager.h"\ - ".\LEGO1\legomodelpresenter.h"\ ".\LEGO1\legonavcontroller.h"\ ".\LEGO1\legoomni.h"\ - ".\LEGO1\legopartpresenter.h"\ ".\LEGO1\legoroi.h"\ ".\LEGO1\legovideomanager.h"\ - ".\LEGO1\legoworldpresenter.h"\ ".\LEGO1\mxatomid.h"\ ".\LEGO1\mxbackgroundaudiomanager.h"\ ".\LEGO1\mxbool.h"\ ".\LEGO1\mxcore.h"\ ".\LEGO1\mxcriticalsection.h"\ - ".\LEGO1\mxdirectdraw.h"\ ".\LEGO1\mxdsaction.h"\ ".\LEGO1\mxdsfile.h"\ ".\LEGO1\mxdsobject.h"\ diff --git a/isle.mdp b/isle.mdp index a35b41d166591b9a4cb0900d43013fff86967b52..0a0a443d90e0d5a067e5d1e0ed2b0de17456ba1b 100644 GIT binary patch literal 48128 zcmeHPTX!7A5w1m&k!*u6l5H@Tn42Mh7h3|7fJgxO5*rbN1=t}=&Kb>)b|;>T&g`sM z{}X;d9(f^e;VJL=6M4>`Ak{t7(>*(V83%J@uS(}g+9Q44Q}uOqcU5&y-PpQzaSrC; zuKDw{FfN|tKZ%ut!+^5k{p;XpO_~Y@=HYS0 z1n46%KnxHA!~iis49p?}pZ_?AiJq&S?_eG7%&*U)ilh@UKnxHA!~iis3^*9L`A_l(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0SWN zEKVn^@LFx@C*vU=Y^m@R51&R6i??V zN?d|MIIFMRp(x}e^)tReAtsfbj}6@0R0vC|<-)mRT%V%Uuytj;n1fMDk@@|Kag<2u^h!4DP%rN9pchL~dLbbE32z%%WGo z*?fI8Zxl)Rd%egUQ_~IXy3o|enaoO)@ZrZ2$$PGY?7zNHE{4lbZv17P7%x|HoAnu< zOtg^K#Pq@oOt{F?)YO#+@8(UaMu?-xJy?CQypFsbW$Si&VT_nA)|B)@XY{K``a~GI zyxdRKD24&vyV=T&K2xl&Sc}mM@w`%gtENbd*Y4ay<7j{qiu!}TYc~)*?GJ-6cDIoE zEfDqk>SB!fq_SJMG8IO(mWmB+HxohJ%RNvH2nFes;@4LdmCN(y(!BGm$^WQ7%odpR z`Ql?0e&#Mh$s&?o2%ppe+k!MF2ILx)mr$m~W z1R5Xlunrm@*`5o1bDH?^vB9v^q#GM~Lw{t(?ZPmdxCJ%#RFI}YxdtgZ7YGj!+SQ&6 z#=B9U3&a+R6>g_EJ1E4SwAO>m-kGn5@ZYvtG)0Bs?~T_&KElod2ggDTRikB;YwMysf$_7 zwV+(t$*hVOlq>IhRMjF=PWDTy`MxA7Tj!ZplS#RYg-%r^=B3M(L=RqU%LPYdTF405#{X8dKKBN8c`YwX@!?R8EBi#>A`~7y= zr(d8yvXyb&YDGah+fAX9ek3>He>V%?|NEbZ;cNH@{O9YL!v|~={^PY$vJdu?)BV=rRT=P^OxHNYrdFoUnoelax-aiP|o^PSg684Y$R&0YM8!i-}L zK6o$>o!ibZUJdQrj=$q!=skcp()`$K$n3as_W1#?Z}B>Ve`A-8=a;weo#8`cRyD0k zwN03kpK5CVh%AwUQa0^>xW?pzNMiY<9v&cun8 zUY#?D&78kRXAo*oyi#XCCnT@e83abpx3Hwt@Sf79L~&!^Sc=4AfQNV;&nQWzc Date: Thu, 22 Jun 2023 01:05:00 -0700 Subject: [PATCH 10/10] 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