From 3b155bfe380809bf18cd09da84c5cd6b3868fb7c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 12 Dec 2023 14:27:17 -0500 Subject: [PATCH] (Discussion/Proposals) Consistency regarding annotations of header-implemented functions (#316) * Open discussion * Move annotations of header-implemented functions back to `.h` files * Adjust `README.md` * Relocate annotation * linter * Comment markers in headers only, rename script, update github actions * type hint compat * Rename github action, better argparse for linter * Type hints, working test for byname ignore * Move annotation * CI rename and enable warnfail, enforce mode always on * Two step linting * or one step * continue on error * two jobs instead * Fixes --------- Co-authored-by: disinvite --- .github/workflows/analyze.yml | 32 +++++ .github/workflows/order.yml | 19 --- ISLE/isleapp.cpp | 3 - LEGO1/legoactioncontrolpresenter.h | 7 +- LEGO1/legoentity.cpp | 3 - LEGO1/legoentity.h | 17 +-- LEGO1/legoinputmanager.cpp | 24 ---- LEGO1/legoinputmanager.h | 24 ++++ LEGO1/legopathcontrollerlist.cpp | 24 ---- LEGO1/legopathcontrollerlist.h | 24 ++++ LEGO1/legoworld.cpp | 18 --- LEGO1/legoworld.h | 18 +++ LEGO1/legoworldlist.cpp | 21 --- LEGO1/legoworldlist.h | 21 +++ LEGO1/mxactionnotificationparam.cpp | 3 - LEGO1/mxactionnotificationparam.h | 3 + LEGO1/mxcompositepresenter.cpp | 21 --- LEGO1/mxcompositepresenter.h | 17 +++ LEGO1/mxcore.h | 9 +- LEGO1/mxdiskstreamcontroller.cpp | 12 -- LEGO1/mxdiskstreamcontroller.h | 12 ++ LEGO1/mxdsactionlist.cpp | 15 --- LEGO1/mxdsactionlist.h | 15 +++ LEGO1/mxdsmultiaction.cpp | 13 -- LEGO1/mxdsmultiaction.h | 12 ++ LEGO1/mxdsobject.h | 10 +- LEGO1/mxdsselectaction.cpp | 15 --- LEGO1/mxdsselectaction.h | 15 +++ LEGO1/mxloopingmidipresenter.cpp | 9 -- LEGO1/mxloopingmidipresenter.h | 5 + LEGO1/mxmediapresenter.cpp | 13 -- LEGO1/mxmediapresenter.h | 12 ++ LEGO1/mxpresenterlist.cpp | 24 ---- LEGO1/mxpresenterlist.h | 24 ++++ LEGO1/mxregion.cpp | 42 ------ LEGO1/mxregionlist.cpp | 45 ------- LEGO1/mxregionlist.h | 84 ++++++++++++ LEGO1/mxsoundmanager.cpp | 3 - LEGO1/mxsoundmanager.h | 3 + LEGO1/mxstillpresenter.cpp | 12 -- LEGO1/mxstillpresenter.h | 6 + LEGO1/mxstreamchunklist.cpp | 15 --- LEGO1/mxstreamchunklist.h | 15 +++ LEGO1/mxstreamcontroller.cpp | 44 ------ LEGO1/mxstreamcontroller.h | 44 ++++++ LEGO1/mxstringlist.cpp | 21 --- LEGO1/mxstringlist.h | 21 +++ LEGO1/mxvariabletable.cpp | 30 ----- LEGO1/mxvariabletable.h | 30 +++++ LEGO1/realtime/vector.cpp | 3 - LEGO1/realtime/vector.h | 6 +- LEGO1/tgl/d3drm/camera.cpp | 3 - LEGO1/tgl/d3drm/device.cpp | 3 - LEGO1/tgl/d3drm/group.cpp | 7 +- LEGO1/tgl/d3drm/impl.h | 27 ++++ LEGO1/tgl/d3drm/light.cpp | 3 - LEGO1/tgl/d3drm/mesh.cpp | 3 - LEGO1/tgl/d3drm/renderer.cpp | 3 - LEGO1/tgl/d3drm/texture.cpp | 5 +- LEGO1/tgl/d3drm/unk.cpp | 5 +- LEGO1/tgl/d3drm/view.cpp | 3 - LEGO1/viewmanager/viewroi.cpp | 2 - LEGO1/viewmanager/viewroi.h | 3 + tools/README.md | 2 +- tools/checkorder/checkorder.py | 127 ------------------ tools/decomplint/decomplint.py | 99 ++++++++++++++ .../isledecomp/isledecomp/parser/__init__.py | 1 + tools/isledecomp/isledecomp/parser/error.py | 30 +++++ tools/isledecomp/isledecomp/parser/linter.py | 99 ++++++++++++++ tools/isledecomp/isledecomp/parser/node.py | 6 - tools/isledecomp/isledecomp/parser/parser.py | 17 ++- tools/isledecomp/tests/test_linter.py | 85 ++++++++++++ tools/isledecomp/tests/test_parser.py | 17 +++ 73 files changed, 838 insertions(+), 650 deletions(-) create mode 100644 .github/workflows/analyze.yml delete mode 100644 .github/workflows/order.yml delete mode 100644 tools/checkorder/checkorder.py create mode 100644 tools/decomplint/decomplint.py create mode 100644 tools/isledecomp/isledecomp/parser/linter.py create mode 100644 tools/isledecomp/tests/test_linter.py diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml new file mode 100644 index 00000000..e139b8bf --- /dev/null +++ b/.github/workflows/analyze.yml @@ -0,0 +1,32 @@ +name: Analyze + +on: [push, pull_request] + +jobs: + decomplint-isle: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install python libraries + run: | + pip install -r tools/requirements.txt + + - name: Run decomplint.py + run: | + python3 tools/decomplint/decomplint.py ISLE --module ISLE --warnfail + + decomplint-lego1: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install python libraries + run: | + pip install -r tools/requirements.txt + + - name: Run decomplint.py + run: | + python3 tools/decomplint/decomplint.py LEGO1 --module LEGO1 --warnfail diff --git a/.github/workflows/order.yml b/.github/workflows/order.yml deleted file mode 100644 index d7ae315c..00000000 --- a/.github/workflows/order.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Check order - -on: [push, pull_request] - -jobs: - checkorder: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Install python libraries - run: | - pip install -r tools/requirements.txt - - - name: Run checkorder.py - run: | - python3 tools/checkorder/checkorder.py --verbose --enforce ISLE - python3 tools/checkorder/checkorder.py --verbose --enforce LEGO1 diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 8d1fe268..bbacb494 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -282,9 +282,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine return msg.wParam; } -// FUNCTION: ISLE 0x401c40 -// MxDSObject::SetAtomId - // FUNCTION: ISLE 0x401ca0 BOOL FindExistingInstance(void) { diff --git a/LEGO1/legoactioncontrolpresenter.h b/LEGO1/legoactioncontrolpresenter.h index 880ee148..943abe03 100644 --- a/LEGO1/legoactioncontrolpresenter.h +++ b/LEGO1/legoactioncontrolpresenter.h @@ -25,10 +25,6 @@ class LegoActionControlPresenter : public MxMediaPresenter { return !strcmp(name, LegoActionControlPresenter::ClassName()) || MxMediaPresenter::IsA(name); } - // TODO: Find proper compilation unit to put this - // SYNTHETIC: LEGO1 0x1000d1d0 - // LegoActionControlPresenter::`scalar deleting destructor' - virtual void ReadyTickle() override; // vtable+0x18 virtual void RepeatingTickle() override; // vtable+0x24 virtual void ParseExtra() override; // vtable+0x30 @@ -41,4 +37,7 @@ class LegoActionControlPresenter : public MxMediaPresenter { undefined4 m_unk0x64; // 0x64 }; +// SYNTHETIC: LEGO1 0x1000d1d0 +// LegoActionControlPresenter::`scalar deleting destructor' + #endif // LEGOACTIONCONTROLPRESENTER_H diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index 7e8a953f..9a1107dd 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -7,9 +7,6 @@ DECOMP_SIZE_ASSERT(LegoEntity, 0x68) -// FUNCTION: LEGO1 0x10001090 -// LegoEntity::SetWorldSpeed - // FUNCTION: LEGO1 0x1000c290 LegoEntity::~LegoEntity() { diff --git a/LEGO1/legoentity.h b/LEGO1/legoentity.h index f3da7325..5cb2be1f 100644 --- a/LEGO1/legoentity.h +++ b/LEGO1/legoentity.h @@ -38,14 +38,15 @@ class LegoEntity : public MxEntity { virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24 virtual void SetWorldTransform(Vector3Impl& p_loc, Vector3Impl& p_dir, Vector3Impl& p_up); // vtable+0x28 virtual void ResetWorldTransform(MxBool p_inVehicle); // vtable+0x2c - virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 - virtual void VTable0x34(); // vtable+0x34 - virtual void VTable0x38(); // vtable+0x38 - virtual void VTable0x3c(); // vtable+0x3c - virtual void VTable0x40(); // vtable+0x40 - virtual void VTable0x44(); // vtable+0x44 - virtual void VTable0x48(); // vtable+0x48 - virtual void VTable0x4c(); // vtable+0x4c + // FUNCTION: LEGO1 0x10001090 + virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 + virtual void VTable0x34(); // vtable+0x34 + virtual void VTable0x38(); // vtable+0x38 + virtual void VTable0x3c(); // vtable+0x3c + virtual void VTable0x40(); // vtable+0x40 + virtual void VTable0x44(); // vtable+0x44 + virtual void VTable0x48(); // vtable+0x48 + virtual void VTable0x4c(); // vtable+0x4c protected: void Init(); diff --git a/LEGO1/legoinputmanager.cpp b/LEGO1/legoinputmanager.cpp index 3572c9bd..04b1c5f1 100644 --- a/LEGO1/legoinputmanager.cpp +++ b/LEGO1/legoinputmanager.cpp @@ -56,27 +56,6 @@ MxResult LegoInputManager::Create(HWND p_hwnd) return SUCCESS; } -// TEMPLATE: LEGO1 0x1005bb80 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x1005bc30 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x1005bc80 -// MxList::~MxList - -// SYNTHETIC: LEGO1 0x1005bd50 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1005bdc0 -// MxList::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1005beb0 -// LegoEventQueue::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1005bf70 -// MxQueue::`scalar deleting destructor' - // FUNCTION: LEGO1 0x1005bfe0 void LegoInputManager::Destroy() { @@ -292,6 +271,3 @@ void LegoInputManager::KillTimer() ::KillTimer(omni->GetWindowHandle(), m_timer); } } - -// TEMPLATE: LEGO1 0x1005d010 -// MxListEntry::GetValue diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index 9a4fe6e7..11ededd8 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -90,4 +90,28 @@ class LegoInputManager : public MxPresenter { MxBool m_unk0x336; }; +// TEMPLATE: LEGO1 0x1005bb80 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x1005bc30 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x1005bc80 +// MxList::~MxList + +// SYNTHETIC: LEGO1 0x1005bd50 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1005bdc0 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1005beb0 +// LegoEventQueue::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1005bf70 +// MxQueue::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1005d010 +// MxListEntry::GetValue + #endif // LEGOINPUTMANAGER_H diff --git a/LEGO1/legopathcontrollerlist.cpp b/LEGO1/legopathcontrollerlist.cpp index 457729a4..18cf7b0e 100644 --- a/LEGO1/legopathcontrollerlist.cpp +++ b/LEGO1/legopathcontrollerlist.cpp @@ -11,32 +11,8 @@ MxS8 LegoPathControllerList::Compare(LegoPathController* p_a, LegoPathController return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } -// TEMPLATE: LEGO1 0x1001d230 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x1001d240 -// MxList::MxList - -// TEMPLATE: LEGO1 0x1001d2d0 -// MxCollection::~MxCollection - -// TEMPLATE: LEGO1 0x1001d320 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x1001d330 -// MxList::~MxList - // FUNCTION: LEGO1 0x1001d3c0 void LegoPathControllerList::Destroy(LegoPathController* p_controller) { delete p_controller; } - -// SYNTHETIC: LEGO1 0x1001d490 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1001d500 -// MxList::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1001d5b0 -// MxPtrList::`scalar deleting destructor' diff --git a/LEGO1/legopathcontrollerlist.h b/LEGO1/legopathcontrollerlist.h index 5a7d4c60..ac22b53d 100644 --- a/LEGO1/legopathcontrollerlist.h +++ b/LEGO1/legopathcontrollerlist.h @@ -23,4 +23,28 @@ class LegoPathControllerList : public MxPtrList { // VTABLE: LEGO1 0x100d6398 // class MxList +// TEMPLATE: LEGO1 0x1001d230 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x1001d240 +// MxList::MxList + +// TEMPLATE: LEGO1 0x1001d2d0 +// MxCollection::~MxCollection + +// TEMPLATE: LEGO1 0x1001d320 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x1001d330 +// MxList::~MxList + +// SYNTHETIC: LEGO1 0x1001d490 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001d500 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001d5b0 +// MxPtrList::`scalar deleting destructor' + #endif // LEGOPATHCONTROLLERLIST_H diff --git a/LEGO1/legoworld.cpp b/LEGO1/legoworld.cpp index 5129cca6..938abe3a 100644 --- a/LEGO1/legoworld.cpp +++ b/LEGO1/legoworld.cpp @@ -67,24 +67,6 @@ MxResult LegoWorld::SetAsCurrentWorld(MxDSObject& p_dsObject) return SUCCESS; } -// SYNTHETIC: LEGO1 0x1001eed0 -// MxPresenterListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x1001ef40 -// MxPtrListCursor::~MxPtrListCursor - -// SYNTHETIC: LEGO1 0x1001ef90 -// MxListCursor::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1001f000 -// MxPtrListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x1001f070 -// MxListCursor::~MxListCursor - -// FUNCTION: LEGO1 0x1001f0c0 -// MxPresenterListCursor::~MxPresenterListCursor - // FUNCTION: LEGO1 0x1001f5e0 MxLong LegoWorld::Notify(MxParam& p_param) { diff --git a/LEGO1/legoworld.h b/LEGO1/legoworld.h index 6bade062..8914604a 100644 --- a/LEGO1/legoworld.h +++ b/LEGO1/legoworld.h @@ -55,4 +55,22 @@ void FUN_10015820(MxU32 p_unk1, MxU32 p_unk2); void FUN_10015910(MxU32 p_unk1); void SetIsWorldActive(MxBool p_isWorldActive); +// SYNTHETIC: LEGO1 0x1001eed0 +// MxPresenterListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1001ef40 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x1001ef90 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001f000 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1001f070 +// MxListCursor::~MxListCursor + +// FUNCTION: LEGO1 0x1001f0c0 +// MxPresenterListCursor::~MxPresenterListCursor + #endif // LEGOWORLD_H diff --git a/LEGO1/legoworldlist.cpp b/LEGO1/legoworldlist.cpp index a62173b0..3c43744d 100644 --- a/LEGO1/legoworldlist.cpp +++ b/LEGO1/legoworldlist.cpp @@ -8,29 +8,8 @@ MxS8 LegoWorldList::Compare(LegoWorld* p_a, LegoWorld* p_b) return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } -// TEMPLATE: LEGO1 0x100598f0 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x10059900 -// MxCollection::~MxCollection - -// TEMPLATE: LEGO1 0x10059950 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x10059960 -// MxList::~MxList - // FUNCTION: LEGO1 0x100599f0 void LegoWorldList::Destroy(LegoWorld* p_world) { delete p_world; } - -// SYNTHETIC: LEGO1 0x10059ac0 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x10059b30 -// MxList::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x10059be0 -// MxPtrList::`scalar deleting destructor' diff --git a/LEGO1/legoworldlist.h b/LEGO1/legoworldlist.h index 5e9a7c37..0185ceee 100644 --- a/LEGO1/legoworldlist.h +++ b/LEGO1/legoworldlist.h @@ -24,4 +24,25 @@ class LegoWorldList : public MxPtrList { static void Destroy(LegoWorld*); }; +// TEMPLATE: LEGO1 0x100598f0 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x10059900 +// MxCollection::~MxCollection + +// TEMPLATE: LEGO1 0x10059950 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x10059960 +// MxList::~MxList + +// SYNTHETIC: LEGO1 0x10059ac0 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10059b30 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10059be0 +// MxPtrList::`scalar deleting destructor' + #endif // LEGOWORLDLIST_H diff --git a/LEGO1/mxactionnotificationparam.cpp b/LEGO1/mxactionnotificationparam.cpp index 291156f4..2122ba0d 100644 --- a/LEGO1/mxactionnotificationparam.cpp +++ b/LEGO1/mxactionnotificationparam.cpp @@ -14,6 +14,3 @@ MxNotificationParam* MxEndActionNotificationParam::Clone() { return new MxEndActionNotificationParam(c_notificationEndAction, this->m_sender, this->m_action, this->m_realloc); } - -// SYNTHETIC: LEGO1 0x100513a0 -// MxEndActionNotificationParam::`scalar deleting destructor' diff --git a/LEGO1/mxactionnotificationparam.h b/LEGO1/mxactionnotificationparam.h index c5d4316f..cbe73fe2 100644 --- a/LEGO1/mxactionnotificationparam.h +++ b/LEGO1/mxactionnotificationparam.h @@ -67,4 +67,7 @@ class MxEndActionNotificationParam : public MxActionNotificationParam { virtual MxNotificationParam* Clone() override; // vtable+0x4 }; +// SYNTHETIC: LEGO1 0x100513a0 +// MxEndActionNotificationParam::`scalar deleting destructor' + #endif diff --git a/LEGO1/mxcompositepresenter.cpp b/LEGO1/mxcompositepresenter.cpp index 6cf14956..1274baf8 100644 --- a/LEGO1/mxcompositepresenter.cpp +++ b/LEGO1/mxcompositepresenter.cpp @@ -17,33 +17,12 @@ MxBool MxCompositePresenter::VTable0x64(undefined4 p_unknown) return TRUE; } -// TEMPLATE: LEGO1 0x1004ae90 -// list >::_Buynode - // FUNCTION: LEGO1 0x100b60b0 MxCompositePresenter::MxCompositePresenter() { NotificationManager()->Register(this); } -// TEMPLATE: LEGO1 0x100b61a0 -// list >::~list > - -// FUNCTION: LEGO1 0x100b6210 -// MxCompositePresenter::ClassName - -// FUNCTION: LEGO1 0x100b6220 -// MxCompositePresenter::IsA - -// SYNTHETIC: LEGO1 0x100b62d0 -// MxCompositePresenter::`scalar deleting destructor' - -// FUNCTION: LEGO1 0x100b62f0 -// MxCompositePresenterList::~MxCompositePresenterList - -// TEMPLATE: LEGO1 0x100b6340 -// List::~List - // FUNCTION: LEGO1 0x100b6390 MxCompositePresenter::~MxCompositePresenter() { diff --git a/LEGO1/mxcompositepresenter.h b/LEGO1/mxcompositepresenter.h index 38df4516..a0ca62d5 100644 --- a/LEGO1/mxcompositepresenter.h +++ b/LEGO1/mxcompositepresenter.h @@ -15,12 +15,14 @@ class MxCompositePresenter : public MxPresenter { virtual MxLong Notify(MxParam& p) override; // vtable+0x04 + // FUNCTION: LEGO1 0x100b6210 inline virtual const char* ClassName() const override // vtable+0x0c { // GLOBAL: LEGO1 0x100f0774 return "MxCompositePresenter"; } + // FUNCTION: LEGO1 0x100b6220 inline virtual MxBool IsA(const char* name) const override // vtable+0x10 { return !strcmp(name, MxCompositePresenter::ClassName()) || MxPresenter::IsA(name); @@ -40,4 +42,19 @@ class MxCompositePresenter : public MxPresenter { MxCompositePresenterList m_list; // 0x40 }; +// TEMPLATE: LEGO1 0x1004ae90 +// list >::_Buynode + +// TEMPLATE: LEGO1 0x100b61a0 +// list >::~list > + +// SYNTHETIC: LEGO1 0x100b62d0 +// MxCompositePresenter::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x100b62f0 +// MxCompositePresenterList::~MxCompositePresenterList + +// TEMPLATE: LEGO1 0x100b6340 +// List::~List + #endif // MXCOMPOSITEPRESENTER_H diff --git a/LEGO1/mxcore.h b/LEGO1/mxcore.h index 4de691cc..6bae0ddb 100644 --- a/LEGO1/mxcore.h +++ b/LEGO1/mxcore.h @@ -8,13 +8,6 @@ class MxParam; -// TODO: Find proper compilation unit to put these -// FUNCTION: LEGO1 0x100140d0 -// MxCore::IsA - -// FUNCTION: LEGO1 0x100144c0 -// MxCore::ClassName - // VTABLE: LEGO1 0x100dc0f8 // SIZE 0x8 class MxCore { @@ -24,12 +17,14 @@ class MxCore { __declspec(dllexport) virtual MxLong Notify(MxParam& p); // vtable+04 virtual MxResult Tickle(); // vtable+08 + // FUNCTION: LEGO1 0x100144c0 inline virtual const char* ClassName() const // vtable+0c { // GLOBAL: LEGO1 0x100f007c return "MxCore"; } + // FUNCTION: LEGO1 0x100140d0 inline virtual MxBool IsA(const char* name) const // vtable+10 { return !strcmp(name, MxCore::ClassName()); diff --git a/LEGO1/mxdiskstreamcontroller.cpp b/LEGO1/mxdiskstreamcontroller.cpp index 70fdecaa..197ef841 100644 --- a/LEGO1/mxdiskstreamcontroller.cpp +++ b/LEGO1/mxdiskstreamcontroller.cpp @@ -13,18 +13,6 @@ MxDiskStreamController::MxDiskStreamController() m_unk8c = 0; } -// TEMPLATE: LEGO1 0x100c7330 -// list >::_Buynode - -// TEMPLATE: LEGO1 0x100c7420 -// list >::~list > - -// TEMPLATE: LEGO1 0x100c7490 -// list >::_Buynode - -// TEMPLATE: LEGO1 0x100c74e0 -// List::~List - // STUB: LEGO1 0x100c7530 MxDiskStreamController::~MxDiskStreamController() { diff --git a/LEGO1/mxdiskstreamcontroller.h b/LEGO1/mxdiskstreamcontroller.h index 2de006d1..fc9b7d7e 100644 --- a/LEGO1/mxdiskstreamcontroller.h +++ b/LEGO1/mxdiskstreamcontroller.h @@ -50,4 +50,16 @@ class MxDiskStreamController : public MxStreamController { undefined m_unkc4; // 0xc4 }; +// TEMPLATE: LEGO1 0x100c7330 +// list >::_Buynode + +// TEMPLATE: LEGO1 0x100c7420 +// list >::~list > + +// TEMPLATE: LEGO1 0x100c7490 +// list >::_Buynode + +// TEMPLATE: LEGO1 0x100c74e0 +// List::~List + #endif // MXDISKSTREAMCONTROLLER_H diff --git a/LEGO1/mxdsactionlist.cpp b/LEGO1/mxdsactionlist.cpp index a664f53e..2cfe4a59 100644 --- a/LEGO1/mxdsactionlist.cpp +++ b/LEGO1/mxdsactionlist.cpp @@ -17,18 +17,3 @@ void MxDSActionList::Destroy(MxDSAction* p_action) if (p_action) delete p_action; } - -// TEMPLATE: LEGO1 0x100c9cc0 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x100c9d20 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x100c9d30 -// MxList::~MxList - -// SYNTHETIC: LEGO1 0x100c9e30 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c9ea0 -// MxList::`scalar deleting destructor' diff --git a/LEGO1/mxdsactionlist.h b/LEGO1/mxdsactionlist.h index a467bf52..25343785 100644 --- a/LEGO1/mxdsactionlist.h +++ b/LEGO1/mxdsactionlist.h @@ -35,4 +35,19 @@ class MxDSActionListCursor : public MxListCursor { MxDSActionListCursor(MxDSActionList* p_list) : MxListCursor(p_list){}; }; +// TEMPLATE: LEGO1 0x100c9cc0 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x100c9d20 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x100c9d30 +// MxList::~MxList + +// SYNTHETIC: LEGO1 0x100c9e30 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c9ea0 +// MxList::`scalar deleting destructor' + #endif // MXDSACTIONLIST_H diff --git a/LEGO1/mxdsmultiaction.cpp b/LEGO1/mxdsmultiaction.cpp index b2b31abe..27cd806e 100644 --- a/LEGO1/mxdsmultiaction.cpp +++ b/LEGO1/mxdsmultiaction.cpp @@ -2,19 +2,6 @@ DECOMP_SIZE_ASSERT(MxDSMultiAction, 0x9c) -// TODO: Should be moved later -// SYNTHETIC: LEGO1 0x1004ad10 -// MxDSActionListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x1004ad80 -// MxListCursor::~MxListCursor - -// SYNTHETIC: LEGO1 0x1004add0 -// MxListCursor::`scalar deleting destructor' - -// FUNCTION: LEGO1 0x1004ae40 -// MxDSActionListCursor::~MxDSActionListCursor - // FUNCTION: LEGO1 0x100c9b90 MxDSMultiAction::MxDSMultiAction() { diff --git a/LEGO1/mxdsmultiaction.h b/LEGO1/mxdsmultiaction.h index acc98d4e..0190e4cd 100644 --- a/LEGO1/mxdsmultiaction.h +++ b/LEGO1/mxdsmultiaction.h @@ -43,4 +43,16 @@ class MxDSMultiAction : public MxDSAction { MxDSActionList* m_actions; // 0x98 }; +// SYNTHETIC: LEGO1 0x1004ad10 +// MxDSActionListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1004ad80 +// MxListCursor::~MxListCursor + +// SYNTHETIC: LEGO1 0x1004add0 +// MxListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x1004ae40 +// MxDSActionListCursor::~MxDSActionListCursor + #endif // MXDSMULTIACTION_H diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 967aadd7..4760b3ca 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -6,10 +6,6 @@ #include "mxcore.h" #include "mxdstypes.h" -// TODO: Find proper compilation unit to put this -// FUNCTION: LEGO1 0x10005530 -// MxDSObject::SetAtomId - // VTABLE: LEGO1 0x100dc868 // SIZE 0x2c class MxDSObject : public MxCore { @@ -61,4 +57,10 @@ class MxDSObject : public MxCore { MxDSObject* DeserializeDSObjectDispatch(char**, MxS16); +// FUNCTION: ISLE 0x401c40 +// MxDSObject::SetAtomId + +// FUNCTION: LEGO1 0x10005530 +// MxDSObject::SetAtomId + #endif // MXDSOBJECT_H diff --git a/LEGO1/mxdsselectaction.cpp b/LEGO1/mxdsselectaction.cpp index ed9b78ba..4bdfbd60 100644 --- a/LEGO1/mxdsselectaction.cpp +++ b/LEGO1/mxdsselectaction.cpp @@ -33,18 +33,6 @@ void MxDSSelectAction::CopyFrom(MxDSSelectAction& p_dsSelectAction) this->m_unk0xac->Append(string); } -// SYNTHETIC: LEGO1 0x100cbbd0 -// MxStringListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100cbc40 -// MxListCursor::~MxListCursor - -// SYNTHETIC: LEGO1 0x100cbc90 -// MxListCursor::`scalar deleting destructor' - -// FUNCTION: LEGO1 0x100cbd00 -// MxStringListCursor::~MxStringListCursor - // FUNCTION: LEGO1 0x100cbd50 MxDSSelectAction& MxDSSelectAction::operator=(MxDSSelectAction& p_dsSelectAction) { @@ -142,6 +130,3 @@ void MxDSSelectAction::Deserialize(char** p_source, MxS16 p_unk24) *p_source += extraFlag; } - -// TEMPLATE: LEGO1 0x100cc450 -// MxListEntry::GetValue diff --git a/LEGO1/mxdsselectaction.h b/LEGO1/mxdsselectaction.h index 7f57896b..44e40a2a 100644 --- a/LEGO1/mxdsselectaction.h +++ b/LEGO1/mxdsselectaction.h @@ -37,4 +37,19 @@ class MxDSSelectAction : public MxDSParallelAction { MxStringList* m_unk0xac; }; +// SYNTHETIC: LEGO1 0x100cbbd0 +// MxStringListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100cbc40 +// MxListCursor::~MxListCursor + +// SYNTHETIC: LEGO1 0x100cbc90 +// MxListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x100cbd00 +// MxStringListCursor::~MxStringListCursor + +// TEMPLATE: LEGO1 0x100cc450 +// MxListEntry::GetValue + #endif // MXDSSELECTACTION_H diff --git a/LEGO1/mxloopingmidipresenter.cpp b/LEGO1/mxloopingmidipresenter.cpp index 3d58e56b..84b33229 100644 --- a/LEGO1/mxloopingmidipresenter.cpp +++ b/LEGO1/mxloopingmidipresenter.cpp @@ -7,15 +7,6 @@ DECOMP_SIZE_ASSERT(MxLoopingMIDIPresenter, 0x58); -// FUNCTION: LEGO1 0x100b1830 -// MxLoopingMIDIPresenter::ClassName - -// FUNCTION: LEGO1 0x100b1840 -// MxLoopingMIDIPresenter::IsA - -// SYNTHETIC: LEGO1 0x100b19c0 -// MxLoopingMIDIPresenter::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100c2a80 void MxLoopingMIDIPresenter::StreamingTickle() { diff --git a/LEGO1/mxloopingmidipresenter.h b/LEGO1/mxloopingmidipresenter.h index 3f393581..a8fe2664 100644 --- a/LEGO1/mxloopingmidipresenter.h +++ b/LEGO1/mxloopingmidipresenter.h @@ -7,12 +7,14 @@ // SIZE 0x58 class MxLoopingMIDIPresenter : public MxMIDIPresenter { public: + // FUNCTION: LEGO1 0x100b1830 inline virtual const char* ClassName() const override // vtable+0xc { // GLOBAL: LEGO1 0x10101de0 return "MxLoopingMIDIPresenter"; } + // FUNCTION: LEGO1 0x100b1840 inline virtual MxBool IsA(const char* name) const override // vtable+0x10 { return !strcmp(name, MxLoopingMIDIPresenter::ClassName()) || MxMIDIPresenter::IsA(name); @@ -23,4 +25,7 @@ class MxLoopingMIDIPresenter : public MxMIDIPresenter { virtual MxResult PutData() override; // vtable+0x4c }; +// SYNTHETIC: LEGO1 0x100b19c0 +// MxLoopingMIDIPresenter::`scalar deleting destructor' + #endif // MXLOOPINGMIDIPRESENTER_H diff --git a/LEGO1/mxmediapresenter.cpp b/LEGO1/mxmediapresenter.cpp index 6ffdab71..b1b064cc 100644 --- a/LEGO1/mxmediapresenter.cpp +++ b/LEGO1/mxmediapresenter.cpp @@ -21,19 +21,6 @@ void MxMediaPresenter::Destroy() Destroy(FALSE); } -// TODO: These probably belong in another class -// SYNTHETIC: LEGO1 0x100b46e0 -// MxStreamChunkListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100b4750 -// MxListCursor::~MxListCursor - -// SYNTHETIC: LEGO1 0x100b47a0 -// MxListCursor::`scalar deleting destructor' - -// FUNCTION: LEGO1 0x100b4810 -// MxStreamChunkListCursor::~MxStreamChunkListCursor - // FUNCTION: LEGO1 0x100b54e0 void MxMediaPresenter::Init() { diff --git a/LEGO1/mxmediapresenter.h b/LEGO1/mxmediapresenter.h index 85ad612f..8807bcd2 100644 --- a/LEGO1/mxmediapresenter.h +++ b/LEGO1/mxmediapresenter.h @@ -49,4 +49,16 @@ class MxMediaPresenter : public MxPresenter { MxStreamChunk* NextChunk(); }; +// SYNTHETIC: LEGO1 0x100b46e0 +// MxStreamChunkListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100b4750 +// MxListCursor::~MxListCursor + +// SYNTHETIC: LEGO1 0x100b47a0 +// MxListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x100b4810 +// MxStreamChunkListCursor::~MxStreamChunkListCursor + #endif // MXMEDIAPRESENTER_H diff --git a/LEGO1/mxpresenterlist.cpp b/LEGO1/mxpresenterlist.cpp index 6dc0a0f2..adf48262 100644 --- a/LEGO1/mxpresenterlist.cpp +++ b/LEGO1/mxpresenterlist.cpp @@ -10,27 +10,3 @@ MxS8 MxPresenterList::Compare(MxPresenter* p_a, MxPresenter* p_b) { return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; } - -// TEMPLATE: LEGO1 0x1001cd20 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x1001cd30 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x1001cd40 -// MxList::MxList - -// TEMPLATE: LEGO1 0x1001cdd0 -// MxCollection::~MxCollection - -// TEMPLATE: LEGO1 0x1001ce20 -// MxList::~MxList - -// SYNTHETIC: LEGO1 0x1001cf70 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1001cfe0 -// MxList::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1001d090 -// MxPtrList::`scalar deleting destructor' diff --git a/LEGO1/mxpresenterlist.h b/LEGO1/mxpresenterlist.h index 23e7f6c2..e9ffc398 100644 --- a/LEGO1/mxpresenterlist.h +++ b/LEGO1/mxpresenterlist.h @@ -33,4 +33,28 @@ class MxPresenterListCursor : public MxPtrListCursor { // VTABLE: LEGO1 0x100d6368 // class MxList +// TEMPLATE: LEGO1 0x1001cd20 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x1001cd30 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x1001cd40 +// MxList::MxList + +// TEMPLATE: LEGO1 0x1001cdd0 +// MxCollection::~MxCollection + +// TEMPLATE: LEGO1 0x1001ce20 +// MxList::~MxList + +// SYNTHETIC: LEGO1 0x1001cf70 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001cfe0 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001d090 +// MxPtrList::`scalar deleting destructor' + #endif // MXPRESENTERLIST_H diff --git a/LEGO1/mxregion.cpp b/LEGO1/mxregion.cpp index 0ac28be1..afd546d6 100644 --- a/LEGO1/mxregion.cpp +++ b/LEGO1/mxregion.cpp @@ -86,24 +86,6 @@ void MxRegion::vtable18(MxRect32& p_rect) m_rect.UpdateBounds(p_rect); } -// SYNTHETIC: LEGO1 0x100c3be0 -// MxRegionListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100c3c50 -// MxPtrListCursor::~MxPtrListCursor - -// SYNTHETIC: LEGO1 0x100c3ca0 -// MxListCursor::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c3d10 -// MxPtrListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100c3d80 -// MxListCursor::~MxListCursor - -// FUNCTION: LEGO1 0x100c3dd0 -// MxRegionListCursor::~MxRegionListCursor - // FUNCTION: LEGO1 0x100c3e20 MxBool MxRegion::vtable1c(MxRect32& p_rect) { @@ -123,21 +105,6 @@ MxBool MxRegion::vtable1c(MxRect32& p_rect) return FALSE; } -// SYNTHETIC: LEGO1 0x100c4790 -// MxRegionLeftRightListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100c4800 -// MxPtrListCursor::~MxPtrListCursor - -// SYNTHETIC: LEGO1 0x100c4850 -// MxListCursor::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c48c0 -// MxPtrListCursor::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100c4930 -// MxListCursor::~MxListCursor - // FUNCTION: LEGO1 0x100c4c90 MxRegionTopBottom::MxRegionTopBottom(MxS32 p_top, MxS32 p_bottom) { @@ -200,15 +167,6 @@ void MxRegionTopBottom::FUN_100c5280(MxS32 p_left, MxS32 p_right) } } -// TEMPLATE: LEGO1 0x100c54f0 -// MxListCursor::MxListCursor - -// FUNCTION: LEGO1 0x100c5560 -// MxRegionLeftRightListCursor::~MxRegionLeftRightListCursor - -// TEMPLATE: LEGO1 0x100c55b0 -// MxListCursor::operator= - // FUNCTION: LEGO1 0x100c55d0 MxRegionTopBottom* MxRegionTopBottom::Clone() { diff --git a/LEGO1/mxregionlist.cpp b/LEGO1/mxregionlist.cpp index c1abb0e7..f2ae0d29 100644 --- a/LEGO1/mxregionlist.cpp +++ b/LEGO1/mxregionlist.cpp @@ -2,12 +2,6 @@ #include "mxregion.h" -// TEMPLATE: LEGO1 0x100c32e0 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x100c3340 -// MxCollection::Destroy - // FUNCTION: LEGO1 0x100c33e0 void MxRegionList::Destroy(MxRegionTopBottom* p_topBottom) { @@ -18,47 +12,8 @@ void MxRegionList::Destroy(MxRegionTopBottom* p_topBottom) } } -// SYNTHETIC: LEGO1 0x100c34d0 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c3540 -// MxList::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c35f0 -// MxPtrList::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100c4d80 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x100c4de0 -// MxCollection::Destroy - // FUNCTION: LEGO1 0x100c4e80 void MxRegionLeftRightList::Destroy(MxRegionLeftRight* p_leftRight) { delete p_leftRight; } - -// SYNTHETIC: LEGO1 0x100c4f50 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c4fc0 -// MxList::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c5070 -// MxPtrList::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100c54f0 -// MxListCursor::MxListCursor - -// TEMPLATE: LEGO1 0x100c58c0 -// MxList::_InsertEntry - -// TEMPLATE: LEGO1 0x100c5970 -// MxList::_InsertEntry - -// TEMPLATE: LEGO1 0x100c5a20 -// MxListEntry::MxListEntry - -// TEMPLATE: LEGO1 0x100c5a40 -// MxList::_DeleteEntry diff --git a/LEGO1/mxregionlist.h b/LEGO1/mxregionlist.h index 2938e38b..21bb3c23 100644 --- a/LEGO1/mxregionlist.h +++ b/LEGO1/mxregionlist.h @@ -68,4 +68,88 @@ class MxRegionLeftRightListCursor : public MxPtrListCursor { MxRegionLeftRightListCursor(MxRegionLeftRightList* p_list) : MxPtrListCursor(p_list){}; }; +// TEMPLATE: LEGO1 0x100c32e0 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x100c3340 +// MxCollection::Destroy + +// SYNTHETIC: LEGO1 0x100c34d0 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c3540 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c35f0 +// MxPtrList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c3be0 +// MxRegionListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c3c50 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x100c3ca0 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c3d10 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c3d80 +// MxListCursor::~MxListCursor + +// FUNCTION: LEGO1 0x100c3dd0 +// MxRegionListCursor::~MxRegionListCursor + +// SYNTHETIC: LEGO1 0x100c4790 +// MxRegionLeftRightListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c4800 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x100c4850 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c48c0 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c4930 +// MxListCursor::~MxListCursor + +// TEMPLATE: LEGO1 0x100c4d80 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x100c4de0 +// MxCollection::Destroy + +// SYNTHETIC: LEGO1 0x100c4f50 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c4fc0 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c5070 +// MxPtrList::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c54f0 +// MxListCursor::MxListCursor + +// FUNCTION: LEGO1 0x100c5560 +// MxRegionLeftRightListCursor::~MxRegionLeftRightListCursor + +// TEMPLATE: LEGO1 0x100c55b0 +// MxListCursor::operator= + +// TEMPLATE: LEGO1 0x100c58c0 +// MxList::_InsertEntry + +// TEMPLATE: LEGO1 0x100c5970 +// MxList::_InsertEntry + +// TEMPLATE: LEGO1 0x100c5a20 +// MxListEntry::MxListEntry + +// TEMPLATE: LEGO1 0x100c5a40 +// MxList::_DeleteEntry + #endif // MXREGIONLIST_H diff --git a/LEGO1/mxsoundmanager.cpp b/LEGO1/mxsoundmanager.cpp index 73555515..b212f9b4 100644 --- a/LEGO1/mxsoundmanager.cpp +++ b/LEGO1/mxsoundmanager.cpp @@ -15,9 +15,6 @@ MxSoundManager::MxSoundManager() Init(); } -// SYNTHETIC: LEGO1 0x100ae7b0 -// MxSoundManager::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100ae7d0 MxSoundManager::~MxSoundManager() { diff --git a/LEGO1/mxsoundmanager.h b/LEGO1/mxsoundmanager.h index b804ef23..9677e543 100644 --- a/LEGO1/mxsoundmanager.h +++ b/LEGO1/mxsoundmanager.h @@ -34,4 +34,7 @@ class MxSoundManager : public MxAudioManager { undefined m_unk38[4]; }; +// SYNTHETIC: LEGO1 0x100ae7b0 +// MxSoundManager::`scalar deleting destructor' + #endif // MXSOUNDMANAGER_H diff --git a/LEGO1/mxstillpresenter.cpp b/LEGO1/mxstillpresenter.cpp index 278b24cf..1d3c248e 100644 --- a/LEGO1/mxstillpresenter.cpp +++ b/LEGO1/mxstillpresenter.cpp @@ -13,24 +13,12 @@ DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c); // GLOBAL: LEGO1 0x10101eb0 const char* g_strBMP_ISMAP = "BMP_ISMAP"; -// FUNCTION: LEGO1 0x10043550 -// MxStillPresenter::~MxStillPresenter - // FUNCTION: LEGO1 0x100435b0 void MxStillPresenter::Destroy() { Destroy(FALSE); } -// FUNCTION: LEGO1 0x100435c0 -// MxStillPresenter::ClassName - -// FUNCTION: LEGO1 0x100435d0 -// MxStillPresenter::IsA - -// SYNTHETIC: LEGO1 0x100436e0 -// MxStillPresenter::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100b9c70 void MxStillPresenter::Destroy(MxBool p_fromDestructor) { diff --git a/LEGO1/mxstillpresenter.h b/LEGO1/mxstillpresenter.h index 6f434faa..52c4919b 100644 --- a/LEGO1/mxstillpresenter.h +++ b/LEGO1/mxstillpresenter.h @@ -9,14 +9,17 @@ class MxStillPresenter : public MxVideoPresenter { public: MxStillPresenter() { m_bitmapInfo = NULL; } + // FUNCTION: LEGO1 0x10043550 virtual ~MxStillPresenter() override { Destroy(TRUE); }; // vtable+0x00 + // FUNCTION: LEGO1 0x100435c0 inline virtual const char* ClassName() const override // vtable+0xc { // GLOBAL: LEGO1 0x100f0184 return "MxStillPresenter"; } + // FUNCTION: LEGO1 0x100435d0 inline virtual MxBool IsA(const char* name) const override // vtable+0x10 { return !strcmp(name, MxStillPresenter::ClassName()) || MxVideoPresenter::IsA(name); @@ -43,4 +46,7 @@ class MxStillPresenter : public MxVideoPresenter { MxBITMAPINFO* m_bitmapInfo; // 0x68 }; +// SYNTHETIC: LEGO1 0x100436e0 +// MxStillPresenter::`scalar deleting destructor' + #endif // MXSTILLPRESENTER_H diff --git a/LEGO1/mxstreamchunklist.cpp b/LEGO1/mxstreamchunklist.cpp index 3c4bee9c..b268c4ad 100644 --- a/LEGO1/mxstreamchunklist.cpp +++ b/LEGO1/mxstreamchunklist.cpp @@ -17,18 +17,3 @@ void MxStreamChunkList::Destroy(MxStreamChunk* p_chunk) if (p_chunk) delete p_chunk; } - -// TEMPLATE: LEGO1 0x100b5930 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x100b5990 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x100b59a0 -// MxList::~MxList - -// SYNTHETIC: LEGO1 0x100b5aa0 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100b5b10 -// MxList::`scalar deleting destructor' diff --git a/LEGO1/mxstreamchunklist.h b/LEGO1/mxstreamchunklist.h index 9661229c..154a091b 100644 --- a/LEGO1/mxstreamchunklist.h +++ b/LEGO1/mxstreamchunklist.h @@ -32,4 +32,19 @@ class MxStreamChunkListCursor : public MxListCursor { // VTABLE: LEGO1 0x100dc528 // class MxListCursor +// TEMPLATE: LEGO1 0x100b5930 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x100b5990 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x100b59a0 +// MxList::~MxList + +// SYNTHETIC: LEGO1 0x100b5aa0 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100b5b10 +// MxList::`scalar deleting destructor' + #endif // MXSTREAMCHUNKLIST_H diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index 6fafb2c7..7931adc6 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -34,50 +34,6 @@ MxStreamController::MxStreamController() m_action0x60 = NULL; } -// TEMPLATE: LEGO1 0x100c0d60 -// list >::~list > - -// TEMPLATE: LEGO1 0x100c0dd0 -// list >::~list > - -// TEMPLATE: LEGO1 0x100c0e40 -// list >::_Buynode - -// clang-format off -// TEMPLATE: LEGO1 0x100c0e70 -// list >::~list > -// clang-format on - -// TEMPLATE: LEGO1 0x100c0ee0 -// list >::_Buynode - -// FUNCTION: LEGO1 0x100c0fc0 -// MxStreamListMxDSSubscriber::~MxStreamListMxDSSubscriber - -// FUNCTION: LEGO1 0x100c1010 -// MxStreamListMxDSAction::~MxStreamListMxDSAction - -// FUNCTION: LEGO1 0x100c1060 -// MxStreamListMxNextActionDataStart::~MxStreamListMxNextActionDataStart - -// TEMPLATE: LEGO1 0x100c10b0 -// MxStreamList::~MxStreamList - -// TEMPLATE: LEGO1 0x100c1100 -// MxStreamList::~MxStreamList - -// TEMPLATE: LEGO1 0x100c1150 -// MxStreamList::~MxStreamList - -// TEMPLATE: LEGO1 0x100c11a0 -// List::~List - -// TEMPLATE: LEGO1 0x100c11f0 -// List::~List - -// TEMPLATE: LEGO1 0x100c1240 -// List::~List - // STUB: LEGO1 0x100c1290 MxStreamController::~MxStreamController() { diff --git a/LEGO1/mxstreamcontroller.h b/LEGO1/mxstreamcontroller.h index 9a763ba1..8f6ca1c2 100644 --- a/LEGO1/mxstreamcontroller.h +++ b/LEGO1/mxstreamcontroller.h @@ -60,4 +60,48 @@ class MxStreamController : public MxCore { MxDSAction* m_action0x60; // 0x60 }; +// TEMPLATE: LEGO1 0x100c0d60 +// list >::~list > + +// TEMPLATE: LEGO1 0x100c0dd0 +// list >::~list > + +// TEMPLATE: LEGO1 0x100c0e40 +// list >::_Buynode + +// clang-format off +// TEMPLATE: LEGO1 0x100c0e70 +// list >::~list > +// clang-format on + +// TEMPLATE: LEGO1 0x100c0ee0 +// list >::_Buynode + +// FUNCTION: LEGO1 0x100c0fc0 +// MxStreamListMxDSSubscriber::~MxStreamListMxDSSubscriber + +// FUNCTION: LEGO1 0x100c1010 +// MxStreamListMxDSAction::~MxStreamListMxDSAction + +// FUNCTION: LEGO1 0x100c1060 +// MxStreamListMxNextActionDataStart::~MxStreamListMxNextActionDataStart + +// TEMPLATE: LEGO1 0x100c10b0 +// MxStreamList::~MxStreamList + +// TEMPLATE: LEGO1 0x100c1100 +// MxStreamList::~MxStreamList + +// TEMPLATE: LEGO1 0x100c1150 +// MxStreamList::~MxStreamList + +// TEMPLATE: LEGO1 0x100c11a0 +// List::~List + +// TEMPLATE: LEGO1 0x100c11f0 +// List::~List + +// TEMPLATE: LEGO1 0x100c1240 +// List::~List + #endif // MXSTREAMCONTROLLER_H diff --git a/LEGO1/mxstringlist.cpp b/LEGO1/mxstringlist.cpp index 1c839a85..8a0a2ddc 100644 --- a/LEGO1/mxstringlist.cpp +++ b/LEGO1/mxstringlist.cpp @@ -3,24 +3,3 @@ #include "decomp.h" DECOMP_SIZE_ASSERT(MxListEntry, 0x18) - -// TEMPLATE: LEGO1 0x100cb3c0 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x100cb470 -// MxCollection::Destroy - -// TEMPLATE: LEGO1 0x100cb4c0 -// MxList::~MxList - -// TEMPLATE: LEGO1 0x100cbb40 -// MxList::Append - -// TEMPLATE: LEGO1 0x100cc2d0 -// MxList::_InsertEntry - -// TEMPLATE: LEGO1 0x100cc3c0 -// MxListEntry::MxListEntry - -// TEMPLATE: LEGO1 0x100cc450 -// MxListEntry::GetValue diff --git a/LEGO1/mxstringlist.h b/LEGO1/mxstringlist.h index cacb0be5..3b105d32 100644 --- a/LEGO1/mxstringlist.h +++ b/LEGO1/mxstringlist.h @@ -17,4 +17,25 @@ class MxStringListCursor : public MxListCursor { // VTABLE: LEGO1 0x100dd070 // class MxListCursor +// TEMPLATE: LEGO1 0x100cb3c0 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x100cb470 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x100cb4c0 +// MxList::~MxList + +// TEMPLATE: LEGO1 0x100cbb40 +// MxList::Append + +// TEMPLATE: LEGO1 0x100cc2d0 +// MxList::_InsertEntry + +// TEMPLATE: LEGO1 0x100cc3c0 +// MxListEntry::MxListEntry + +// TEMPLATE: LEGO1 0x100cc450 +// MxListEntry::GetValue + #endif // MXSTRINGLIST_H diff --git a/LEGO1/mxvariabletable.cpp b/LEGO1/mxvariabletable.cpp index dda73bee..d7c6f54f 100644 --- a/LEGO1/mxvariabletable.cpp +++ b/LEGO1/mxvariabletable.cpp @@ -1,29 +1,5 @@ #include "mxvariabletable.h" -// TEMPLATE: LEGO1 0x100afcd0 -// MxCollection::Compare - -// TEMPLATE: LEGO1 0x100afce0 -// MxCollection::~MxCollection - -// TEMPLATE: LEGO1 0x100afd30 -// MxCollection::Destroy - -// SYNTHETIC: LEGO1 0x100afd40 -// MxCollection::`scalar deleting destructor' - -// TEMPLATE: LEGO1 0x100afdb0 -// MxVariableTable::Destroy - -// TEMPLATE: LEGO1 0x100afdc0 -// MxHashTable::Hash - -// TEMPLATE: LEGO1 0x100b0bd0 -// MxHashTable::~MxHashTable - -// SYNTHETIC: LEGO1 0x100b0ca0 -// MxHashTable::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100b7330 MxS8 MxVariableTable::Compare(MxVariable* p_var0, MxVariable* p_var1) { @@ -88,9 +64,3 @@ const char* MxVariableTable::GetVariable(const char* p_key) return value; } - -// TEMPLATE: LEGO1 0x100b7ab0 -// MxHashTable::Resize - -// TEMPLATE: LEGO1 0x100b7b80 -// MxHashTable::_NodeInsert diff --git a/LEGO1/mxvariabletable.h b/LEGO1/mxvariabletable.h index 1a91da26..b8e831c9 100644 --- a/LEGO1/mxvariabletable.h +++ b/LEGO1/mxvariabletable.h @@ -26,4 +26,34 @@ class MxVariableTable : public MxHashTable { // VTABLE: LEGO1 0x100dc1e8 // class MxHashTable +// TEMPLATE: LEGO1 0x100afcd0 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x100afce0 +// MxCollection::~MxCollection + +// TEMPLATE: LEGO1 0x100afd30 +// MxCollection::Destroy + +// SYNTHETIC: LEGO1 0x100afd40 +// MxCollection::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100afdb0 +// MxVariableTable::Destroy + +// TEMPLATE: LEGO1 0x100afdc0 +// MxHashTable::Hash + +// TEMPLATE: LEGO1 0x100b0bd0 +// MxHashTable::~MxHashTable + +// SYNTHETIC: LEGO1 0x100b0ca0 +// MxHashTable::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100b7ab0 +// MxHashTable::Resize + +// TEMPLATE: LEGO1 0x100b7b80 +// MxHashTable::_NodeInsert + #endif // MXVARIABLETABLE_H diff --git a/LEGO1/realtime/vector.cpp b/LEGO1/realtime/vector.cpp index 54df74e4..5826fcec 100644 --- a/LEGO1/realtime/vector.cpp +++ b/LEGO1/realtime/vector.cpp @@ -60,9 +60,6 @@ float Vector2Impl::DotImpl(float* p_a, float* p_b) const return p_b[0] * p_a[0] + p_b[1] * p_a[1]; } -// FUNCTION: LEGO1 0x10002060 -// Vector2Impl::SetData - // FUNCTION: LEGO1 0x10002070 void Vector2Impl::EqualsImpl(float* p_data) { diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index ded96918..2b03d6c3 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -3,10 +3,6 @@ #include -// TODO: Find proper compilation unit to put this -// FUNCTION: LEGO1 0x1000c0f0 -// Vector2Impl::Vector2Impl - /* * A simple array of three floats that can be indexed into. */ @@ -64,6 +60,7 @@ struct Vector4 { // SIZE 0x8 class Vector2Impl { public: + // FUNCTION: LEGO1 0x1000c0f0 inline Vector2Impl(float* p_data) { this->SetData(p_data); } // vtable + 0x00 (no virtual destructor) @@ -76,6 +73,7 @@ class Vector2Impl { virtual void MullVectorImpl(float* p_value) = 0; virtual void DivScalarImpl(float* p_value) = 0; virtual float DotImpl(float* p_a, float* p_b) const = 0; + // FUNCTION: LEGO1 0x10002060 virtual void SetData(float* p_data) { this->m_data = p_data; } // vtable + 0x20 diff --git a/LEGO1/tgl/d3drm/camera.cpp b/LEGO1/tgl/d3drm/camera.cpp index 08aea939..5084c2ca 100644 --- a/LEGO1/tgl/d3drm/camera.cpp +++ b/LEGO1/tgl/d3drm/camera.cpp @@ -5,9 +5,6 @@ using namespace TglImpl; DECOMP_SIZE_ASSERT(Camera, 0x4); DECOMP_SIZE_ASSERT(CameraImpl, 0x8); -// SYNTHETIC: LEGO1 0x100a2560 -// TglImpl::CameraImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a36f0 void* CameraImpl::ImplementationDataPtr() { diff --git a/LEGO1/tgl/d3drm/device.cpp b/LEGO1/tgl/d3drm/device.cpp index 44307268..b991d417 100644 --- a/LEGO1/tgl/d3drm/device.cpp +++ b/LEGO1/tgl/d3drm/device.cpp @@ -4,9 +4,6 @@ using namespace TglImpl; -// SYNTHETIC: LEGO1 0x100a22c0 -// TglImpl::DeviceImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a2bf0 void* DeviceImpl::ImplementationDataPtr() { diff --git a/LEGO1/tgl/d3drm/group.cpp b/LEGO1/tgl/d3drm/group.cpp index 4e6bed96..022dc757 100644 --- a/LEGO1/tgl/d3drm/group.cpp +++ b/LEGO1/tgl/d3drm/group.cpp @@ -2,9 +2,6 @@ using namespace TglImpl; -// SYNTHETIC: LEGO1 0x100a2480 -// TglImpl::GroupImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a31d0 void* GroupImpl::ImplementationDataPtr() { @@ -109,13 +106,13 @@ Result GroupImpl::Remove(const Mesh* pMesh) return ResultVal(m_data->DeleteVisual(pMeshImpl->ImplementationData()->groupMesh)); } -// FUNCTION: LEGO1 0x100a34b0 STUB +// STUB: LEGO1 0x100a34b0 Result GroupImpl::RemoveAll() { return Error; } -// FUNCTION: LEGO1 0x100a34c0 STUB +// STUB: LEGO1 0x100a34c0 Result GroupImpl::Unknown() { return Error; diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index 89894c2d..5ba877bb 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -464,4 +464,31 @@ inline D3DRMMATRIX4D* Translate(const FloatMatrix4& tglMatrix4x4, D3DRMMATRIX4D& return &rD3DRMMatrix4x4; } +// SYNTHETIC: LEGO1 0x100a16d0 +// TglImpl::RendererImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a22c0 +// TglImpl::DeviceImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a23a0 +// TglImpl::ViewImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a2480 +// TglImpl::GroupImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a2560 +// TglImpl::CameraImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a2640 +// TglImpl::LightImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a2720 +// TglImpl::UnkImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a2800 +// TglImpl::TextureImpl::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100a3d80 +// TglImpl::MeshImpl::`scalar deleting destructor' + } /* namespace TglImpl */ diff --git a/LEGO1/tgl/d3drm/light.cpp b/LEGO1/tgl/d3drm/light.cpp index 2f62c4e6..5ceafa4b 100644 --- a/LEGO1/tgl/d3drm/light.cpp +++ b/LEGO1/tgl/d3drm/light.cpp @@ -5,9 +5,6 @@ using namespace TglImpl; DECOMP_SIZE_ASSERT(Light, 0x4); DECOMP_SIZE_ASSERT(LightImpl, 0x8); -// SYNTHETIC: LEGO1 0x100a2640 -// TglImpl::LightImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a3770 void* LightImpl::ImplementationDataPtr() { diff --git a/LEGO1/tgl/d3drm/mesh.cpp b/LEGO1/tgl/d3drm/mesh.cpp index d29ff2b3..f044d512 100644 --- a/LEGO1/tgl/d3drm/mesh.cpp +++ b/LEGO1/tgl/d3drm/mesh.cpp @@ -7,9 +7,6 @@ DECOMP_SIZE_ASSERT(D3DRMVERTEX, 0x24); DECOMP_SIZE_ASSERT(Mesh, 0x4); DECOMP_SIZE_ASSERT(MeshImpl, 0x8); -// SYNTHETIC: LEGO1 0x100a3d80 -// TglImpl::MeshImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a3ed0 void* MeshImpl::ImplementationDataPtr() { diff --git a/LEGO1/tgl/d3drm/renderer.cpp b/LEGO1/tgl/d3drm/renderer.cpp index 92d80d83..d098f7ff 100644 --- a/LEGO1/tgl/d3drm/renderer.cpp +++ b/LEGO1/tgl/d3drm/renderer.cpp @@ -13,9 +13,6 @@ Renderer* Tgl::CreateRenderer() return renderer; } -// SYNTHETIC: LEGO1 0x100a16d0 -// TglImpl::RendererImpl::`scalar deleting destructor' - // GLOBAL: LEGO1 0x1010103c IDirect3DRM* g_pD3DRM = NULL; diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index 5b733eae..2b2c3eb0 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -86,7 +86,7 @@ void TglD3DRMIMAGE::Destroy() delete m_image.palette; } -// FUNCTION: LEGO1 0x100a13e0 STUB +// STUB: LEGO1 0x100a13e0 Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer) { return Error; @@ -126,9 +126,6 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries) return Success; } -// SYNTHETIC: LEGO1 0x100a2800 -// TglImpl::TextureImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a3c10 Result TextureImpl::SetTexels(int width, int height, int bitsPerTexel, void* pTexels) { diff --git a/LEGO1/tgl/d3drm/unk.cpp b/LEGO1/tgl/d3drm/unk.cpp index 05785b2e..debc1484 100644 --- a/LEGO1/tgl/d3drm/unk.cpp +++ b/LEGO1/tgl/d3drm/unk.cpp @@ -5,16 +5,13 @@ using namespace TglImpl; DECOMP_SIZE_ASSERT(Unk, 0x4); DECOMP_SIZE_ASSERT(UnkImpl, 0x8); -// SYNTHETIC: LEGO1 0x100a2720 -// TglImpl::UnkImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a3830 void* UnkImpl::ImplementationDataPtr() { return reinterpret_cast(&m_data); } -// FUNCTION: LEGO1 0x100a3840 STUB +// STUB: LEGO1 0x100a3840 Result UnkImpl::SetMeshData( unsigned long faceCount, unsigned long vertexCount, diff --git a/LEGO1/tgl/d3drm/view.cpp b/LEGO1/tgl/d3drm/view.cpp index 116c2b98..f8302bc2 100644 --- a/LEGO1/tgl/d3drm/view.cpp +++ b/LEGO1/tgl/d3drm/view.cpp @@ -119,9 +119,6 @@ inline IDirect3DRMFrame* ViewportGetLightFrame(IDirect3DRMViewport* pViewport) return ViewportGetData(pViewport)->m_pLightFrame; } -// SYNTHETIC: LEGO1 0x100a23a0 -// TglImpl::ViewImpl::`scalar deleting destructor' - // FUNCTION: LEGO1 0x100a2d80 void* ViewImpl::ImplementationDataPtr() { diff --git a/LEGO1/viewmanager/viewroi.cpp b/LEGO1/viewmanager/viewroi.cpp index 47f340ac..bb5dcaab 100644 --- a/LEGO1/viewmanager/viewroi.cpp +++ b/LEGO1/viewmanager/viewroi.cpp @@ -34,8 +34,6 @@ void ViewROI::UpdateWorldData(const Matrix4Data& parent2world) } } -// SYNTHETIC: LEGO1 0x100aa250 -// ViewROI::`scalar deleting destructor' inline ViewROI::~ViewROI() { // SetLODList() will decrease refCount of LODList diff --git a/LEGO1/viewmanager/viewroi.h b/LEGO1/viewmanager/viewroi.h index 99e73d34..e54e6113 100644 --- a/LEGO1/viewmanager/viewroi.h +++ b/LEGO1/viewmanager/viewroi.h @@ -44,4 +44,7 @@ class ViewROI : public OrientableROI { void UpdateWorldData(const Matrix4Data& parent2world); }; +// SYNTHETIC: LEGO1 0x100aa250 +// ViewROI::`scalar deleting destructor' + #endif // VIEWROI_H diff --git a/tools/README.md b/tools/README.md index 91f61d8b..661df560 100644 --- a/tools/README.md +++ b/tools/README.md @@ -12,7 +12,7 @@ We are continually working on extending the capabilities of our "decompilation l All non-inlined functions in the code base with the exception of [3rd party code](/3rdparty) must be annotated with one of the following markers, which include the module name and address of the function as found in the original binaries. This information is then used to compare the recompiled assembly with the original assembly, resulting in an accuracy score. Functions in a given compilation unit must be ordered by their address in ascending order. -The annotations can be attached to the function implementation, which is the most common case, or use the "comment" syntax (see examples below) for functions that cannot be referred to directly (such as templated, synthetic or non-inlined inline functions). They should appear exclusively in `.cpp` files. +The annotations can be attached to the function implementation, which is the most common case, or use the "comment" syntax (see examples below) for functions that cannot be referred to directly (such as templated, synthetic or non-inlined inline functions). The latter should only ever appear in `.h` files. ### `FUNCTION` diff --git a/tools/checkorder/checkorder.py b/tools/checkorder/checkorder.py deleted file mode 100644 index 0cdba670..00000000 --- a/tools/checkorder/checkorder.py +++ /dev/null @@ -1,127 +0,0 @@ -import os -import sys -import argparse -from isledecomp.dir import walk_source_dir, is_file_cpp -from isledecomp.parser import DecompParser - - -def sig_truncate(sig: str) -> str: - """Helper to truncate function names to 50 chars and append ellipsis - if needed. Goal is to stay under 80 columns for tool output.""" - return f"{sig[:47]}{'...' if len(sig) >= 50 else ''}" - - -def check_file(filename: str, verbose: bool = False) -> bool: - """Open and read the given file, then check whether the code blocks - are in order. If verbose, print each block.""" - - parser = DecompParser() - with open(filename, "r", encoding="utf-8") as f: - parser.read_lines(f) - - just_offsets = [block.offset for block in parser.functions] - sorted_offsets = sorted(just_offsets) - file_out_of_order = just_offsets != sorted_offsets - - # TODO: When we add parser error severity, actual errors that obstruct - # parsing should probably be shown here regardless of verbose mode - - # If we detect inexact comments, don't print anything unless we are - # in verbose mode. If the file is out of order, we always print the - # file name. - should_report = (len(parser.alerts) > 0 and verbose) or file_out_of_order - - if not should_report and not file_out_of_order: - return False - - # Else: we are alerting to some problem in this file - print(filename) - if verbose: - if file_out_of_order: - order_lookup = {k: i for i, k in enumerate(sorted_offsets)} - prev_offset = 0 - - for fun in parser.functions: - msg = " ".join( - [ - " " if fun.offset > prev_offset else "!", - f"{fun.offset:08x}", - f"{fun.end_line - fun.line_number:4} lines", - f"{order_lookup[fun.offset]:3}", - " ", - sig_truncate(fun.name), - ] - ) - print(msg) - prev_offset = fun.offset - - for alert in parser.alerts: - print(f"* line {alert.line_number:4} {alert.code} ({alert.line})") - - print() - - return file_out_of_order - - -def parse_args(test_args: list | None = None) -> dict: - p = argparse.ArgumentParser( - description="Checks the source files to make sure the function offset comments are in order", - ) - p.add_argument("target", help="The file or directory to check.") - p.add_argument( - "--enforce", - action=argparse.BooleanOptionalAction, - default=False, - help="Fail with error code if target is out of order.", - ) - p.add_argument( - "--verbose", - action=argparse.BooleanOptionalAction, - default=False, - help=( - "Display each code block in the file and show " - "where each consecutive run of blocks is broken." - ), - ) - - if test_args is None: - args = p.parse_args() - else: - args = p.parse_args(test_args) - - return vars(args) - - -def main(): - args = parse_args() - - if os.path.isdir(args["target"]): - files_to_check = list(walk_source_dir(args["target"])) - elif os.path.isfile(args["target"]) and is_file_cpp(args["target"]): - files_to_check = [args["target"]] - else: - sys.exit("Invalid target") - - files_out_of_order = 0 - - for file in files_to_check: - is_jumbled = check_file(file, args["verbose"]) - if is_jumbled: - files_out_of_order += 1 - - if files_out_of_order > 0: - error_message = " ".join( - [ - str(files_out_of_order), - "files are" if files_out_of_order > 1 else "file is", - "out of order", - ] - ) - print(error_message) - - if files_out_of_order > 0 and args["enforce"]: - sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/tools/decomplint/decomplint.py b/tools/decomplint/decomplint.py new file mode 100644 index 00000000..2ceb42c2 --- /dev/null +++ b/tools/decomplint/decomplint.py @@ -0,0 +1,99 @@ +import os +import sys +import argparse +import colorama +from isledecomp.dir import walk_source_dir, is_file_cpp +from isledecomp.parser import DecompLinter + +colorama.init() + + +def display_errors(alerts, filename): + sorted_alerts = sorted(alerts, key=lambda a: a.line_number) + + for alert in sorted_alerts: + error_type = ( + f"{colorama.Fore.RED}error: " + if alert.is_error() + else f"{colorama.Fore.YELLOW}warning: " + ) + components = [ + colorama.Fore.LIGHTWHITE_EX, + filename, + ":", + str(alert.line_number), + " : ", + error_type, + colorama.Fore.LIGHTWHITE_EX, + alert.code.name.lower(), + ] + print("".join(components)) + + if alert.line is not None: + print(f"{colorama.Fore.WHITE} {alert.line}") + + +def parse_args() -> argparse.Namespace: + p = argparse.ArgumentParser( + description="Syntax checking and linting for decomp annotation markers." + ) + p.add_argument("target", help="The file or directory to check.") + p.add_argument( + "--module", + required=False, + type=str, + help="If present, run targeted checks for markers from the given module.", + ) + p.add_argument( + "--warnfail", + action=argparse.BooleanOptionalAction, + default=False, + help="Fail if syntax warnings are found.", + ) + + (args, _) = p.parse_known_args() + return args + + +def process_files(files, module=None): + warning_count = 0 + error_count = 0 + + linter = DecompLinter() + for filename in files: + success = linter.check_file(filename, module) + + warnings = [a for a in linter.alerts if a.is_warning()] + errors = [a for a in linter.alerts if a.is_error()] + + error_count += len(errors) + warning_count += len(warnings) + + if not success: + display_errors(linter.alerts, filename) + print() + + return (warning_count, error_count) + + +def main(): + args = parse_args() + + if os.path.isdir(args.target): + files_to_check = list(walk_source_dir(args.target)) + elif os.path.isfile(args.target) and is_file_cpp(args.target): + files_to_check = [args.target] + else: + sys.exit("Invalid target") + + (warning_count, error_count) = process_files(files_to_check, module=args.module) + + print(colorama.Style.RESET_ALL, end="") + + would_fail = error_count > 0 or (warning_count > 0 and args.warnfail) + if would_fail: + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/tools/isledecomp/isledecomp/parser/__init__.py b/tools/isledecomp/isledecomp/parser/__init__.py index c9394d4a..3034a562 100644 --- a/tools/isledecomp/isledecomp/parser/__init__.py +++ b/tools/isledecomp/isledecomp/parser/__init__.py @@ -1 +1,2 @@ from .parser import DecompParser +from .linter import DecompLinter diff --git a/tools/isledecomp/isledecomp/parser/error.py b/tools/isledecomp/isledecomp/parser/error.py index c18e3e29..638a806e 100644 --- a/tools/isledecomp/isledecomp/parser/error.py +++ b/tools/isledecomp/isledecomp/parser/error.py @@ -1,6 +1,9 @@ from enum import Enum +from typing import Optional +from dataclasses import dataclass +# TODO: poorly chosen name, should be AlertType or AlertCode or something class ParserError(Enum): # WARN: Stub function exceeds some line number threshold UNLIKELY_STUB = 100 @@ -29,6 +32,16 @@ class ParserError(Enum): # and the start of the function. We can ignore it, but the line shouldn't be there UNEXPECTED_BLANK_LINE = 107 + # WARN: We called the finish() method for the parser but had not reached the starting + # state of SEARCH + UNEXPECTED_END_OF_FILE = 108 + + # WARN: We found a marker to be referenced by name outside of a header file. + BYNAME_FUNCTION_IN_CPP = 109 + + # This code or higher is an error, not a warning + DECOMP_ERROR_START = 200 + # ERROR: We found a marker unexpectedly UNEXPECTED_MARKER = 200 @@ -39,3 +52,20 @@ class ParserError(Enum): # ERROR: The line following a synthetic marker was not a comment BAD_SYNTHETIC = 202 + + # ERROR: This function offset comes before the previous offset from the same module + # This hopefully gives some hint about which functions need to be rearranged. + FUNCTION_OUT_OF_ORDER = 203 + + +@dataclass +class ParserAlert: + code: ParserError + line_number: int + line: Optional[str] = None + + def is_warning(self) -> bool: + return self.code.value < ParserError.DECOMP_ERROR_START.value + + def is_error(self) -> bool: + return self.code.value >= ParserError.DECOMP_ERROR_START.value diff --git a/tools/isledecomp/isledecomp/parser/linter.py b/tools/isledecomp/isledecomp/parser/linter.py new file mode 100644 index 00000000..99c8e272 --- /dev/null +++ b/tools/isledecomp/isledecomp/parser/linter.py @@ -0,0 +1,99 @@ +from typing import List, Optional +from .parser import DecompParser +from .error import ParserAlert, ParserError + + +def get_checkorder_filter(module): + """Return a filter function on implemented functions in the given module""" + return lambda fun: fun.module == module and not fun.lookup_by_name + + +class DecompLinter: + def __init__(self) -> None: + self.alerts: List[ParserAlert] = [] + self._parser = DecompParser() + self._filename: str = "" + self._module: Optional[str] = None + + def reset(self): + self.alerts = [] + self._parser.reset() + self._filename = "" + self._module = None + + def file_is_header(self): + return self._filename.lower().endswith(".h") + + def _check_function_order(self): + """Rules: + 1. Only markers that are implemented in the file are considered. This means we + only look at markers that are cross-referenced with cvdump output by their line + number. Markers with the lookup_by_name flag set are ignored because we cannot + directly influence their order. + + 2. Order should be considered for a single module only. If we have multiple + markers for a single function (i.e. for LEGO1 functions linked statically to + ISLE) then the virtual address space will be very different. If we don't check + for one module only, we would incorrectly report that the file is out of order. + """ + + if self._module is None: + return + + checkorder_filter = get_checkorder_filter(self._module) + last_offset = None + for fun in filter(checkorder_filter, self._parser.functions): + if last_offset is not None: + if fun.offset < last_offset: + self.alerts.append( + ParserAlert( + code=ParserError.FUNCTION_OUT_OF_ORDER, + line_number=fun.line_number, + ) + ) + + last_offset = fun.offset + + def _check_offset_uniqueness(self): + # TODO + pass + + def _check_byname_allowed(self): + if self.file_is_header(): + return + + for fun in self._parser.functions: + if fun.lookup_by_name: + self.alerts.append( + ParserAlert( + code=ParserError.BYNAME_FUNCTION_IN_CPP, + line_number=fun.line_number, + ) + ) + + def check_lines(self, lines, filename, module=None): + """`lines` is a generic iterable to allow for testing with a list of strings. + We assume lines has the entire contents of the compilation unit.""" + + self.reset() + self._filename = filename + self._module = module + + self._parser.read_lines(lines) + + self._parser.finish() + self.alerts = self._parser.alerts[::] + + if self._module is not None: + self._check_byname_allowed() + self._check_offset_uniqueness() + + if not self.file_is_header(): + self._check_function_order() + + return len(self.alerts) == 0 + + def check_file(self, filename, module=None): + """Convenience method for decomplint cli tool""" + with open(filename, "r", encoding="utf-8") as f: + return self.check_lines(f, filename, module) diff --git a/tools/isledecomp/isledecomp/parser/node.py b/tools/isledecomp/isledecomp/parser/node.py index 0ee87000..721a24b9 100644 --- a/tools/isledecomp/isledecomp/parser/node.py +++ b/tools/isledecomp/isledecomp/parser/node.py @@ -6,12 +6,6 @@ class ParserNode: line_number: int -@dataclass -class ParserAlert(ParserNode): - code: int - line: str - - @dataclass class ParserSymbol(ParserNode): module: str diff --git a/tools/isledecomp/isledecomp/parser/parser.py b/tools/isledecomp/isledecomp/parser/parser.py index 89b79928..336d4b0c 100644 --- a/tools/isledecomp/isledecomp/parser/parser.py +++ b/tools/isledecomp/isledecomp/parser/parser.py @@ -12,12 +12,11 @@ remove_trailing_comment, ) from .node import ( - ParserAlert, ParserFunction, ParserVariable, ParserVtable, ) -from .error import ParserError +from .error import ParserAlert, ParserError class ReaderState(Enum): @@ -29,6 +28,7 @@ class ReaderState(Enum): IN_GLOBAL = 5 IN_FUNC_GLOBAL = 6 IN_VTABLE = 7 + DONE = 100 def marker_is_stub(marker: DecompMarker) -> bool: @@ -56,7 +56,7 @@ def marker_is_vtable(marker: DecompMarker) -> bool: class MarkerDict: - def __init__(self): + def __init__(self) -> None: self.markers: dict = {} def insert(self, marker: DecompMarker) -> bool: @@ -80,7 +80,7 @@ class DecompParser: # pylint: disable=too-many-instance-attributes # Could combine output lists into a single list to get under the limit, # but not right now - def __init__(self): + def __init__(self) -> None: # The lists to be populated as we parse self.functions: List[ParserFunction] = [] self.vtables: List[ParserVtable] = [] @@ -306,6 +306,9 @@ def _handle_marker(self, marker: DecompMarker): self._syntax_warning(ParserError.BOGUS_MARKER) def read_line(self, line: str): + if self.state == ReaderState.DONE: + return + self.last_line = line # TODO: Useful or hack for error reporting? self.line_number += 1 @@ -392,3 +395,9 @@ def read_line(self, line: str): def read_lines(self, lines: Iterable): for line in lines: self.read_line(line) + + def finish(self): + if self.state != ReaderState.SEARCH: + self._syntax_warning(ParserError.UNEXPECTED_END_OF_FILE) + + self.state = ReaderState.DONE diff --git a/tools/isledecomp/tests/test_linter.py b/tools/isledecomp/tests/test_linter.py new file mode 100644 index 00000000..cb3b8f27 --- /dev/null +++ b/tools/isledecomp/tests/test_linter.py @@ -0,0 +1,85 @@ +import pytest +from isledecomp.parser import DecompLinter +from isledecomp.parser.error import ParserError + + +@pytest.fixture(name="linter") +def fixture_linter(): + return DecompLinter() + + +def test_simple_in_order(linter): + lines = [ + "// FUNCTION: TEST 0x1000", + "void function1() {}", + "// FUNCTION: TEST 0x2000", + "void function2() {}", + "// FUNCTION: TEST 0x3000", + "void function3() {}", + ] + assert linter.check_lines(lines, "test.cpp", "TEST") is True + + +def test_simple_not_in_order(linter): + lines = [ + "// FUNCTION: TEST 0x1000", + "void function1() {}", + "// FUNCTION: TEST 0x3000", + "void function3() {}", + "// FUNCTION: TEST 0x2000", + "void function2() {}", + ] + assert linter.check_lines(lines, "test.cpp", "TEST") is False + assert len(linter.alerts) == 1 + + assert linter.alerts[0].code == ParserError.FUNCTION_OUT_OF_ORDER + # N.B. Line number given is the start of the function, not the marker + assert linter.alerts[0].line_number == 6 + + +def test_byname_ignored(linter): + """Should ignore lookup-by-name markers when checking order.""" + lines = [ + "// FUNCTION: TEST 0x1000", + "void function1() {}", + "// FUNCTION: TEST 0x3000", + "// MyClass::MyMethod", + "// FUNCTION: TEST 0x2000", + "void function2() {}", + ] + # This will fail because byname lookup does not belong in the cpp file + assert linter.check_lines(lines, "test.cpp", "TEST") is False + # but it should not fail for function order. + assert all( + alert.code != ParserError.FUNCTION_OUT_OF_ORDER for alert in linter.alerts + ) + + +def test_module_isolation(linter): + """Should check the order of markers from a single module only.""" + lines = [ + "// FUNCTION: ALPHA 0x0001", + "// FUNCTION: TEST 0x1000", + "void function1() {}", + "// FUNCTION: ALPHA 0x0002", + "// FUNCTION: TEST 0x2000", + "void function2() {}", + "// FUNCTION: ALPHA 0x0003", + "// FUNCTION: TEST 0x3000", + "void function3() {}", + ] + + assert linter.check_lines(lines, "test.cpp", "TEST") is True + assert linter.check_lines(lines, "test.cpp", "ALPHA") is True + + +def test_byname_headers_only(linter): + """Markers that ar referenced by name with cvdump belong in header files only.""" + lines = [ + "// FUNCTION: TEST 0x1000", + "// MyClass::~MyClass", + ] + + assert linter.check_lines(lines, "test.h", "TEST") is True + assert linter.check_lines(lines, "test.cpp", "TEST") is False + assert linter.alerts[0].code == ParserError.BYNAME_FUNCTION_IN_CPP diff --git a/tools/isledecomp/tests/test_parser.py b/tools/isledecomp/tests/test_parser.py index 30092a97..c31602f1 100644 --- a/tools/isledecomp/tests/test_parser.py +++ b/tools/isledecomp/tests/test_parser.py @@ -358,3 +358,20 @@ def test_function_is_commented(parser): ) assert len(parser.functions) == 0 + + +def test_unexpected_eof(parser): + """If a decomp marker finds its way to the last line of the file, + report that we could not get anything from it.""" + parser.read_lines( + [ + "// FUNCTION: TEST 0x1234", + "// Cls::Method", + "// FUNCTION: TEST 0x5555", + ] + ) + parser.finish() + + assert len(parser.functions) == 1 + assert len(parser.alerts) == 1 + assert parser.alerts[0].code == ParserError.UNEXPECTED_END_OF_FILE