From 68efe9ac918a616d839c5be847acff2b36b07f75 Mon Sep 17 00:00:00 2001 From: vMidz <147055059+vMidz@users.noreply.github.com> Date: Mon, 9 Oct 2023 23:53:18 +0300 Subject: [PATCH] implement EndAction implement EndAction +offsets commenets --- LEGO1/mxdsobject.h | 19 ++++++++------- LEGO1/mxomni.cpp | 5 ++-- LEGO1/mxomni.h | 2 +- LEGO1/mxpresenter.cpp | 17 ++++++++++--- LEGO1/mxpresenter.h | 10 ++++---- LEGO1/mxstreamer.cpp | 14 +++++++++++ LEGO1/mxstreamer.h | 57 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 103 insertions(+), 21 deletions(-) diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index e340789a..23255164 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -46,16 +46,17 @@ class MxDSObject : public MxCore inline void SetType(MxDSType p_type) { this->m_type = p_type; } inline MxDSType GetType() const { return (MxDSType) this->m_type; } + MxU32 m_sizeOnDisk; // 0x8 + MxU16 m_type; // 0xc + char* m_sourceName; // 0x10 + undefined4 m_unk14; // 0x14 + char *m_objectName; // 0x18 + MxU32 m_objectId; // 0x1c + MxAtomId m_atomId; // 0x20 + MxS16 m_unk24; // 0x24 + undefined4 m_unk28; // 0x28 private: - MxU32 m_sizeOnDisk; - MxU16 m_type; - char* m_sourceName; - undefined4 m_unk14; - char *m_objectName; - MxU32 m_objectId; - MxAtomId m_atomId; - MxS16 m_unk24; - undefined4 m_unk28; + }; MxDSObject *DeserializeDSObjectDispatch(char **, MxS16); diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 69473b0d..5cdf24e2 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -93,10 +93,9 @@ int MxOmni::vtable0x30(char*, int, MxCore*) return 0; } -// OFFSET: LEGO1 0x100aefc0 STUB -void MxOmni::NotifyCurrentEntity() +// OFFSET: LEGO1 0x100aefc0 +void MxOmni::NotifyCurrentEntity(MxParam *p_param) { - // TODO } // OFFSET: LEGO1 0x100b09d0 diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index 9b2c6581..265db29b 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -45,7 +45,7 @@ class MxOmni : public MxCore virtual MxBool DoesEntityExist(MxDSAction &ds); // vtable+28 virtual void vtable0x2c(); // vtable+2c virtual int vtable0x30(char*, int, MxCore*); // vtable+30 - virtual void NotifyCurrentEntity(); // vtable+34 + virtual void NotifyCurrentEntity(MxParam *p_param); // vtable+34 virtual void StartTimer(); // vtable+38 virtual void StopTimer(); // vtable+3c virtual MxBool IsTimerRunning(); //vtable+40 diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index f8f60386..823f8094 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -6,7 +6,7 @@ #include "mxdsanim.h" #include "mxdssound.h" #include "mxnotificationmanager.h" - +#include "mxstreamer.h" #include "decomp.h" #include "define.h" @@ -135,10 +135,21 @@ MxLong MxPresenter::StartAction(MxStreamController *, MxDSAction *p_action) return SUCCESS; } -// OFFSET: LEGO1 0x100b4e40 STUB +// OFFSET: LEGO1 0x100b4e40 void MxPresenter::EndAction() { - // TODO + if (this->m_action == FALSE) + return; + MxAutoLocker lock(&this->m_criticalSection); + if (!this->m_unkPresenter) + { + MxOmni::GetInstance()->NotifyCurrentEntity(&MxUnknown2(MXSTREAMER_UNKNOWN, NULL, this->m_action, TRUE)); + } + + this->m_action = FALSE; + MxS32 previousTickleState = 1 << m_currentTickleState; + this->m_previousTickleStates |= previousTickleState; + this->m_currentTickleState = TickleState_Idle; } // OFFSET: LEGO1 0x100b52d0 diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index 959533c5..bcdc5aac 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -79,11 +79,11 @@ class MxPresenter : public MxCore __declspec(dllexport) void Init(); void SendTo_unkPresenter(MxOmni *); TickleState m_currentTickleState; // 0x8 - MxU32 m_previousTickleStates; - MxPoint32 m_location; - MxS32 m_displayZ; - MxDSAction *m_action; // 0 - MxCriticalSection m_criticalSection; + MxU32 m_previousTickleStates; // 0x0c + MxPoint32 m_location; // 0x10 + MxS32 m_displayZ; // 0x18 + MxDSAction *m_action; // 0x1c + MxCriticalSection m_criticalSection; // 0x20 MxPresenter *m_unkPresenter; // 0x3c }; diff --git a/LEGO1/mxstreamer.cpp b/LEGO1/mxstreamer.cpp index 8e7cc231..014bec34 100644 --- a/LEGO1/mxstreamer.cpp +++ b/LEGO1/mxstreamer.cpp @@ -8,6 +8,8 @@ #include DECOMP_SIZE_ASSERT(MxStreamer, 0x2c); +DECOMP_SIZE_ASSERT(MxUnknown1, 0x14) +DECOMP_SIZE_ASSERT(MxUnknown2, 0x14) // OFFSET: LEGO1 0x100b8f00 MxStreamer::MxStreamer() @@ -179,3 +181,15 @@ MxStreamerSubClass1::MxStreamerSubClass1(undefined4 size) ptr[i] = 0; } } + +// OFFSET: LEGO1 0x100510c0 +MxParam *MxUnknown1::Clone() +{ + return new MxUnknown1(this->m_type, this->m_sender, this->m_action, this->m_realloc); +} + +// OFFSET: LEGO1 0x10051270 +MxParam *MxUnknown2::Clone() +{ + return new MxUnknown2(MXSTREAMER_UNKNOWN, this->m_sender, this->m_action, this->m_realloc); +} diff --git a/LEGO1/mxstreamer.h b/LEGO1/mxstreamer.h index 515be51b..0f33546c 100644 --- a/LEGO1/mxstreamer.h +++ b/LEGO1/mxstreamer.h @@ -105,4 +105,61 @@ class MxStreamer : public MxCore }; +// VTABLE 0x100d8350 +// SIZE 0x14 +class MxUnknown1 : public MxParam +{ +public: + inline MxUnknown1(MxParamType p_type, MxCore *p_sender, MxDSAction *p_action, MxBool p_reallocAction) : MxParam(p_type, p_sender) + { + MxDSAction *oldAction = p_action; + this->m_realloc = p_reallocAction; + if (p_reallocAction) + { + this->m_action = new MxDSAction(); + } + else + { + this->m_action = oldAction; + return; + } + + this->m_action->SetAtomId(oldAction->m_atomId); + + this->m_action->m_objectId = oldAction->m_objectId; + this->m_action->m_unk24 = oldAction->m_unk24; + } + + inline virtual MxUnknown1::~MxUnknown1() override // 0x100511e0 + { + if (this->m_realloc == FALSE) + { + return; + } + if (this->m_action) + { + delete this->m_action; + } + } + + virtual MxParam *Clone() override; // vtable+0x4 + + MxDSAction *m_action; // 0xc + MxBool m_realloc; // 0x10 +}; + +// VTABLE 0x100d8358 +// SIZE 0x14 +class MxUnknown2 : public MxUnknown1 +{ + +public: + inline MxUnknown2(MxParamType p_type, MxCore *p_sender, MxDSAction *p_action, MxBool p_reallocAction) + : MxUnknown1(p_type, p_sender, p_action, p_reallocAction) {} + + inline virtual ~MxUnknown2() override {}; // 0x100513a0 + + virtual MxParam *Clone() override; // vtable+0x4 +}; + #endif // MXSTREAMER_H