From cb80c50736df60a4e7c719448d42419f6ae7f554 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 16 Dec 2023 13:05:42 -0500 Subject: [PATCH] A bunch of fixes --- LEGO1/lego3dmanager.h | 4 ++-- LEGO1/legoomni.cpp | 6 ++---- LEGO1/legoomni.h | 2 +- LEGO1/legoworld.h | 2 +- LEGO1/mxactionnotificationparam.h | 13 ++++-------- LEGO1/mxomni.cpp | 33 +++++++++++++++---------------- LEGO1/mxomni.h | 18 ++++++++--------- LEGO1/mxpresenter.h | 1 - LEGO1/mxstreamcontroller.cpp | 6 +++--- LEGO1/mxstreamcontroller.h | 2 +- 10 files changed, 39 insertions(+), 48 deletions(-) diff --git a/LEGO1/lego3dmanager.h b/LEGO1/lego3dmanager.h index aed0ae1e..3e1cf202 100644 --- a/LEGO1/lego3dmanager.h +++ b/LEGO1/lego3dmanager.h @@ -8,8 +8,8 @@ class Lego3DManager { inline Lego3DView* GetLego3DView() { return this->m_3dView; } private: - undefined4 m_unk0x00; - undefined4 m_unk0x04; + undefined4 m_unk0x00; // 0x00 + undefined4 m_unk0x04; // 0x04 Lego3DView* m_3dView; // 0x08 }; diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index eab190ac..1dd1bde8 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -236,8 +236,7 @@ void FUN_1001a700() // FUNCTION: LEGO1 0x1003dd70 LegoROI* PickROI(MxLong p_a, MxLong p_b) { - LegoVideoManager* vid = VideoManager(); - return vid->Get3DManager()->GetLego3DView()->PickROI(p_a, p_b); + return VideoManager()->Get3DManager()->GetLego3DView()->PickROI(p_a, p_b); } // STUB: LEGO1 0x1003ddc0 @@ -562,10 +561,9 @@ LegoEntity* LegoOmni::FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_ent } // STUB: LEGO1 0x1005b1d0 -MxResult LegoOmni::DeleteObject(MxDSAction& p_dsAction) +void LegoOmni::DeleteObject(MxDSAction& p_dsAction) { // TODO - return FAILURE; } // FUNCTION: LEGO1 0x1005b2f0 diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 20f09922..d671f6f4 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -89,7 +89,7 @@ class LegoOmni : public MxOmni { virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18 virtual void Destroy() override; // vtable+1c virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20 - virtual MxResult DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 + virtual void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28 virtual MxEntity* FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override; // vtable+30 virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 diff --git a/LEGO1/legoworld.h b/LEGO1/legoworld.h index 70e025fb..60989527 100644 --- a/LEGO1/legoworld.h +++ b/LEGO1/legoworld.h @@ -51,7 +51,7 @@ class LegoWorld : public LegoEntity { MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up); void FUN_10073400(); void FUN_10073430(); - int GetCurrPathInfo(LegoPathBoundary** p_path, int& p_value); + MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); protected: LegoPathControllerList m_list0x68; // 0x68 diff --git a/LEGO1/mxactionnotificationparam.h b/LEGO1/mxactionnotificationparam.h index 3088cd4b..24d9e5e1 100644 --- a/LEGO1/mxactionnotificationparam.h +++ b/LEGO1/mxactionnotificationparam.h @@ -66,9 +66,6 @@ class MxStartActionNotificationParam : public MxActionNotificationParam { { } - // FUNCTION: LEGO1 0x100b04a0 - inline virtual ~MxStartActionNotificationParam() override {} - virtual MxNotificationParam* Clone() override; // vtable+0x4 }; @@ -99,21 +96,19 @@ class MxType4NotificationParam : public MxActionNotificationParam { m_unk0x14 = p_unk0x14; } - // FUNCTION: LEGO1 0x100b0630 - inline virtual ~MxType4NotificationParam() override {} - virtual MxNotificationParam* Clone() override; // vtable+0x4 private: MxPresenter* m_unk0x14; // 0x14 }; -// SYNTHETIC: LEGO1 0x100b0430 -// MxStartActionNotificationParam::`scalar deleting destructor' - // SYNTHETIC: LEGO1 0x100513a0 // MxEndActionNotificationParam::`scalar deleting destructor' +// SYNTHETIC: LEGO1 0x100b0430 +// MxStartActionNotificationParam::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x100b05c0 // MxType4NotificationParam::`scalar deleting destructor' + #endif diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 5c489215..561974da 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -114,9 +114,9 @@ MxEventManager* EventManager() } // FUNCTION: LEGO1 0x100acf70 -MxResult DeleteObject(MxDSAction& p_dsAction) +void DeleteObject(MxDSAction& p_dsAction) { - return MxOmni::GetInstance()->DeleteObject(p_dsAction); + MxOmni::GetInstance()->DeleteObject(p_dsAction); } // FUNCTION: LEGO1 0x100aef10 @@ -313,14 +313,11 @@ MxResult MxOmni::Start(MxDSAction* p_dsAction) } // FUNCTION: LEGO1 0x100b00c0 -MxResult MxOmni::DeleteObject(MxDSAction& p_dsAction) +void MxOmni::DeleteObject(MxDSAction& p_dsAction) { - MxResult result; if (m_streamer != NULL) { - result = m_streamer->DeleteObject(&p_dsAction); + m_streamer->DeleteObject(&p_dsAction); } - - return result; } // FUNCTION: LEGO1 0x100b00e0 @@ -328,10 +325,11 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p { MxResult result = FAILURE; MxPresenter* object = (MxPresenter*) m_objectFactory->Create(PresenterNameDispatch(p_action)); + if (object) { if (object->AddToManager() == SUCCESS) { - MxPresenter* sender = (MxPresenter*) p_action.GetUnknown28(); - if (sender == NULL && (sender = (MxPresenter*) p_controller->FUN_100c1e70(p_action)) == NULL) { + MxPresenter* sender = p_action.GetUnknown28(); + if (sender == NULL && (sender = p_controller->FUN_100c1e70(p_action)) == NULL) { if (p_action.GetOrigin() == NULL) { p_action.SetOrigin(this); } @@ -345,10 +343,7 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p if (object->StartAction(p_controller, &p_action) == SUCCESS) { if (sender) { - NotificationManager()->Send( - p_action.GetUnknown84(), - &MxType4NotificationParam(this, &p_action, object) - ); + NotificationManager()->Send(sender, &MxType4NotificationParam(this, &p_action, object)); } if (p_action.GetUnknown84()) { @@ -379,9 +374,10 @@ void MxOmni::DestroyInstance() } } -MxBool MxOmni::FUN_100b06b0(MxDSAction* p_action) +// STUB: LEGO1 0x100b06b0 +MxBool MxOmni::FUN_100b06b0(MxDSAction* p_action, const char* p_name) { - // TODO STUB + // TODO return FAILURE; } @@ -401,9 +397,11 @@ MxLong MxOmni::HandleActionEnd(MxParam& p_param) { MxDSAction* action = ((MxEndActionNotificationParam&) p_param).GetAction(); MxStreamController* controller = Streamer()->GetOpenStream(action->GetAtomId().GetInternal()); + if (controller != NULL) { - if (controller->GetUnk0x54().Find(action, FALSE)) { - if (FUN_100b06b0(action) == FALSE) { + action = controller->GetUnk0x54().Find(action, FALSE); + if (action) { + if (FUN_100b06b0(action, "LegoLoopingAnimPresenter") == FALSE) { delete controller->GetUnk0x54().Find(action, TRUE); } } @@ -416,6 +414,7 @@ MxLong MxOmni::HandleActionEnd(MxParam& p_param) if (((MxEndActionNotificationParam&) p_param).GetAction()) { delete ((MxEndActionNotificationParam&) p_param).GetAction(); } + return 1; } diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index 16f1a320..7bac0723 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -45,7 +45,7 @@ class MxOmni : public MxCore { virtual MxResult Create(MxOmniCreateParam& p_param); // vtable+18 virtual void Destroy(); // vtable+1c virtual MxResult Start(MxDSAction* p_dsAction); // vtable+20 - virtual MxResult DeleteObject(MxDSAction& p_dsAction); // vtable+24 + virtual void DeleteObject(MxDSAction& p_dsAction); // vtable+24 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28 virtual MxResult CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action); // vtable+2c virtual MxEntity* FindWorld(const char*, MxS32, MxPresenter*); // vtable+30 @@ -53,8 +53,10 @@ class MxOmni : public MxCore { virtual void StartTimer(); // vtable+38 virtual void StopTimer(); // vtable+3c virtual MxBool IsTimerRunning(); // vtable+40 + static void SetInstance(MxOmni* p_instance); - static MxBool FUN_100b06b0(MxDSAction* p_action); + static MxBool FUN_100b06b0(MxDSAction* p_action, const char* p_name); + HWND GetWindowHandle() const { return this->m_windowHandle; } MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } MxNotificationManager* GetNotificationManager() const { return this->m_notificationManager; } @@ -84,13 +86,11 @@ class MxOmni : public MxCore { MxEventManager* m_eventManager; // 0x38 MxTimer* m_timer; // 0x3C MxStreamer* m_streamer; // 0x40 - - MxAtomIdCounterSet* m_atomIdCounterSet; // 0x44 - - MxCriticalSection m_criticalsection; // 0x48 - - MxBool m_timerRunning; // 0x64 + MxAtomIdCounterSet* m_atomIdCounterSet; // 0x44 + MxCriticalSection m_criticalsection; // 0x48 + MxBool m_timerRunning; // 0x64 }; + __declspec(dllexport) MxTickleManager* TickleManager(); __declspec(dllexport) MxTimer* Timer(); __declspec(dllexport) MxStreamer* Streamer(); @@ -103,7 +103,7 @@ __declspec(dllexport) MxNotificationManager* NotificationManager(); MxVideoManager* MVideoManager(); MxAtomIdCounterSet* AtomIdCounterSet(); MxObjectFactory* ObjectFactory(); -MxResult DeleteObject(MxDSAction& p_dsAction); +void DeleteObject(MxDSAction& p_dsAction); void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last); #endif // MXOMNI_H diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index 41b255dc..fae7021a 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -10,7 +10,6 @@ class MxCompositePresenter; class MxStreamController; -class MxPresenter; // VTABLE: LEGO1 0x100d4d38 // SIZE 0x40 diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index 47742680..d18f4bcc 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -134,14 +134,14 @@ MxResult MxStreamController::VTable0x30(MxDSAction* p_action) } // FUNCTION: LEGO1 0x100c1e70 -MxCore* MxStreamController::FUN_100c1e70(MxDSAction& p_action) +MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action) { MxAutoLocker locker(&m_criticalSection); - MxCore* result = NULL; + MxPresenter* result = NULL; if (p_action.GetObjectId() != -1) { MxDSAction* action = m_unk0x3c.Find(&p_action, FALSE); if (action != NULL) { - result = (MxCore*) action->GetUnknown28(); + result = action->GetUnknown28(); } } diff --git a/LEGO1/mxstreamcontroller.h b/LEGO1/mxstreamcontroller.h index 3329237f..803e12b9 100644 --- a/LEGO1/mxstreamcontroller.h +++ b/LEGO1/mxstreamcontroller.h @@ -44,7 +44,7 @@ class MxStreamController : public MxCore { MxResult FUN_100c1800(MxDSAction* p_action, MxU32 p_val); MxBool FUN_100c20d0(MxDSObject& p_obj); MxResult FUN_100c1a00(MxDSAction* p_action, MxU32 p_bufferval); - MxCore* FUN_100c1e70(MxDSAction& p_action); + MxPresenter* FUN_100c1e70(MxDSAction& p_action); MxResult FUN_100c1f00(MxDSAction* p_action); inline MxAtomId& GetAtom() { return m_atom; };