Implement/match MxMediaPresenter::EndAction (#276)

* Bootstrap MxMediaPresenter

* Implement/match MxMediaPresenter::EndAction

* Merge

* Remove garbage
This commit is contained in:
Christian Semmler 2023-11-13 05:22:58 -05:00 committed by GitHub
parent 8861acaf20
commit 8a1422f13e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 76 additions and 37 deletions

View file

@ -532,7 +532,7 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& ds)
} }
// OFFSET: LEGO1 0x1005b2f0 // OFFSET: LEGO1 0x1005b2f0
MxEntity* LegoOmni::FindWorld(const char* p_id, MxS32 p_entityId, MxCore* p_presenter) MxEntity* LegoOmni::FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter)
{ {
LegoWorld* foundEntity = NULL; LegoWorld* foundEntity = NULL;
if (strcmpi(p_id, g_current)) { if (strcmpi(p_id, g_current)) {

View file

@ -83,16 +83,16 @@ class LegoOmni : public MxOmni {
return !strcmp(name, LegoOmni::ClassName()) || MxOmni::IsA(name); return !strcmp(name, LegoOmni::ClassName()) || MxOmni::IsA(name);
} }
virtual void Init() override; // vtable+14 virtual void Init() override; // vtable+14
virtual MxResult Create(MxOmniCreateParam& p) override; // vtable+18 virtual MxResult Create(MxOmniCreateParam& p) override; // vtable+18
virtual void Destroy() override; // vtable+1c virtual void Destroy() override; // vtable+1c
virtual MxResult Start(MxDSAction* action) override; // vtable+20 virtual MxResult Start(MxDSAction* action) override; // vtable+20
virtual MxResult DeleteObject(MxDSAction& ds) override; // vtable+24 virtual MxResult DeleteObject(MxDSAction& ds) override; // vtable+24
virtual MxBool DoesEntityExist(MxDSAction& ds) override; // vtable+28 virtual MxBool DoesEntityExist(MxDSAction& ds) override; // vtable+28
virtual MxEntity* FindWorld(const char* p_id, MxS32 p_entityId, MxCore* p_presenter) override; // vtable+30 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 virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34
virtual void StartTimer() override; // vtable+38 virtual void StartTimer() override; // vtable+38
virtual void StopTimer() override; // vtable+3c virtual void StopTimer() override; // vtable+3c
LegoEntity* FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid); LegoEntity* FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid);

View file

@ -35,8 +35,10 @@ void MxCompositePresenter::VTable0x60(undefined4 p_unknown)
// TODO // TODO
} }
// OFFSET: LEGO1 0x1000caf0 STUB // OFFSET: LEGO1 0x1000caf0
void MxCompositePresenter::VTable0x64() MxBool MxCompositePresenter::VTable0x64(undefined4 p_unknown)
{ {
// TODO if (m_compositePresenter)
return m_compositePresenter->VTable0x64(p_unknown);
return TRUE;
} }

View file

@ -27,7 +27,7 @@ class MxCompositePresenter : public MxPresenter {
virtual void VTable0x58(); virtual void VTable0x58();
virtual void VTable0x5c(); virtual void VTable0x5c();
virtual void VTable0x60(undefined4 p_unknown); virtual void VTable0x60(undefined4 p_unknown);
virtual void VTable0x64(); virtual MxBool VTable0x64(undefined4 p_unknown);
private: private:
MxUnkList m_list; MxUnkList m_list;

View file

@ -17,7 +17,7 @@ class MxDSAction : public MxDSObject {
Flag_Bit4 = 0x08, Flag_Bit4 = 0x08,
Flag_Bit5 = 0x10, Flag_Bit5 = 0x10,
Flag_Enabled = 0x20, Flag_Enabled = 0x20,
Flag_Parsed = 0x80, Flag_World = 0x80,
Flag_Bit9 = 0x200, Flag_Bit9 = 0x200,
Flag_Bit10 = 0x400, Flag_Bit10 = 0x400,
}; };
@ -63,6 +63,7 @@ class MxDSAction : public MxDSObject {
inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; } inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; }
inline const MxVector3Data& GetLocation() const { return m_location; } inline const MxVector3Data& GetLocation() const { return m_location; }
inline void SetUnknown84(MxCore* p_unk84) { m_unk84 = p_unk84; } inline void SetUnknown84(MxCore* p_unk84) { m_unk84 = p_unk84; }
inline MxCore* GetUnknown8c() { return m_unk8c; }
inline void SetUnknown8c(MxCore* p_unk8c) { m_unk8c = p_unk8c; } inline void SetUnknown8c(MxCore* p_unk8c) { m_unk8c = p_unk8c; }
inline MxBool IsLooping() const { return m_flags & Flag_Looping; } inline MxBool IsLooping() const { return m_flags & Flag_Looping; }

View file

@ -1,6 +1,9 @@
#include "mxmediapresenter.h" #include "mxmediapresenter.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxcompositepresenter.h"
#include "mxnotificationmanager.h"
#include "mxstreamchunk.h" #include "mxstreamchunk.h"
DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50); DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50);
@ -122,10 +125,37 @@ MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAct
return result; return result;
} }
// OFFSET: LEGO1 0x100b5bc0 STUB // OFFSET: LEGO1 0x100b5bc0
void MxMediaPresenter::EndAction() void MxMediaPresenter::EndAction()
{ {
// TODO MxAutoLocker lock(&m_criticalSection);
if (!m_action)
return;
m_currentChunk = NULL;
if (m_action->GetFlags() & MxDSAction::Flag_World &&
(!m_compositePresenter || !m_compositePresenter->VTable0x64(2))) {
MxPresenter::Enable(FALSE);
SetTickleState(TickleState::TickleState_Idle);
}
else {
MxDSAction* action = m_action;
MxPresenter::EndAction();
if (m_subscriber) {
delete m_subscriber;
m_subscriber = NULL;
}
if (action && action->GetUnknown8c()) {
NotificationManager()->Send(
action->GetUnknown8c(),
&MxEndActionNotificationParam(c_notificationEndAction, this, action, FALSE)
);
}
}
} }
// OFFSET: LEGO1 0x100b5f10 STUB // OFFSET: LEGO1 0x100b5f10 STUB

View file

@ -92,7 +92,7 @@ void MxOmni::Vtable0x2c()
} }
// OFFSET: LEGO1 0x100aefb0 // OFFSET: LEGO1 0x100aefb0
MxEntity* MxOmni::FindWorld(const char*, MxS32, MxCore*) MxEntity* MxOmni::FindWorld(const char*, MxS32, MxPresenter*)
{ {
return NULL; return NULL;
} }

View file

@ -14,6 +14,7 @@ class MxNotificationManager;
class MxNotificationParam; class MxNotificationParam;
class MxObjectFactory; class MxObjectFactory;
class MxOmniCreateParam; class MxOmniCreateParam;
class MxPresenter;
class MxSoundManager; class MxSoundManager;
class MxStreamer; class MxStreamer;
class MxTickleManager; class MxTickleManager;
@ -46,7 +47,7 @@ class MxOmni : public MxCore {
virtual MxResult DeleteObject(MxDSAction& p_dsAction); // vtable+24 virtual MxResult DeleteObject(MxDSAction& p_dsAction); // vtable+24
virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28
virtual void Vtable0x2c(); // vtable+2c virtual void Vtable0x2c(); // vtable+2c
virtual MxEntity* FindWorld(const char*, MxS32, MxCore*); // vtable+30 virtual MxEntity* FindWorld(const char*, MxS32, MxPresenter*); // vtable+30
virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34 virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34
virtual void StartTimer(); // vtable+38 virtual void StartTimer(); // vtable+38
virtual void StopTimer(); // vtable+3c virtual void StopTimer(); // vtable+3c

View file

@ -5,6 +5,7 @@
#include "legoomni.h" #include "legoomni.h"
#include "mxactionnotificationparam.h" #include "mxactionnotificationparam.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "mxcompositepresenter.h"
#include "mxdsanim.h" #include "mxdsanim.h"
#include "mxdssound.h" #include "mxdssound.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
@ -22,7 +23,7 @@ void MxPresenter::Init()
m_action = NULL; m_action = NULL;
m_location = MxPoint32(0, 0); m_location = MxPoint32(0, 0);
m_displayZ = 0; m_displayZ = 0;
m_unkPresenter = NULL; m_compositePresenter = NULL;
m_previousTickleStates = 0; m_previousTickleStates = 0;
} }
@ -49,24 +50,24 @@ void MxPresenter::ParseExtra()
MxS32 val = token ? atoi(token) : 0; MxS32 val = token ? atoi(token) : 0;
MxEntity* result = MxOmni::GetInstance()->FindWorld(t_token, val, this); MxEntity* result = MxOmni::GetInstance()->FindWorld(t_token, val, this);
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_Parsed); m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_World);
if (result) if (result)
SendTo_unkPresenter(MxOmni::GetInstance()); SendToCompositePresenter(MxOmni::GetInstance());
} }
} }
} }
// OFFSET: LEGO1 0x100b5120 // OFFSET: LEGO1 0x100b5120
void MxPresenter::SendTo_unkPresenter(MxOmni* p_omni) void MxPresenter::SendToCompositePresenter(MxOmni* p_omni)
{ {
if (m_unkPresenter) { if (m_compositePresenter) {
MxAutoLocker lock(&m_criticalSection); MxAutoLocker lock(&m_criticalSection);
NotificationManager()->Send(m_unkPresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this)); NotificationManager()->Send(m_compositePresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this));
m_action->SetUnknown8c(p_omni ? p_omni : MxOmni::GetInstance()); m_action->SetUnknown8c(p_omni ? p_omni : MxOmni::GetInstance());
m_unkPresenter = NULL; m_compositePresenter = NULL;
} }
} }
@ -138,8 +139,10 @@ void MxPresenter::EndAction()
{ {
if (this->m_action == FALSE) if (this->m_action == FALSE)
return; return;
MxAutoLocker lock(&this->m_criticalSection); MxAutoLocker lock(&this->m_criticalSection);
if (!this->m_unkPresenter) {
if (!this->m_compositePresenter) {
MxOmni::GetInstance()->NotifyCurrentEntity( MxOmni::GetInstance()->NotifyCurrentEntity(
&MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE) &MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE)
); );

View file

@ -8,6 +8,7 @@
#include "mxomni.h" #include "mxomni.h"
#include "mxpoint32.h" #include "mxpoint32.h"
class MxCompositePresenter;
class MxStreamController; class MxStreamController;
// VTABLE 0x100d4d38 // VTABLE 0x100d4d38
@ -75,14 +76,15 @@ class MxPresenter : public MxCore {
protected: protected:
__declspec(dllexport) void Init(); __declspec(dllexport) void Init();
void SendTo_unkPresenter(MxOmni*); void SendToCompositePresenter(MxOmni*);
TickleState m_currentTickleState; // 0x8
MxU32 m_previousTickleStates; // 0x0c TickleState m_currentTickleState; // 0x8
MxPoint32 m_location; // 0x10 MxU32 m_previousTickleStates; // 0x0c
MxS32 m_displayZ; // 0x18 MxPoint32 m_location; // 0x10
MxDSAction* m_action; // 0x1c MxS32 m_displayZ; // 0x18
MxCriticalSection m_criticalSection; // 0x20 MxDSAction* m_action; // 0x1c
MxPresenter* m_unkPresenter; // 0x3c MxCriticalSection m_criticalSection; // 0x20
MxCompositePresenter* m_compositePresenter; // 0x3c
}; };
const char* PresenterNameDispatch(const MxDSAction&); const char* PresenterNameDispatch(const MxDSAction&);

View file

@ -468,7 +468,7 @@ void MxTransitionManager::SetWaitIndicator(MxVideoPresenter* p_waitIndicator)
{ {
// End current wait indicator // End current wait indicator
if (m_waitIndicator != NULL) { if (m_waitIndicator != NULL) {
m_waitIndicator->GetAction()->SetFlags(m_waitIndicator->GetAction()->GetFlags() & ~MxDSAction::Flag_Parsed); m_waitIndicator->GetAction()->SetFlags(m_waitIndicator->GetAction()->GetFlags() & ~MxDSAction::Flag_World);
m_waitIndicator->EndAction(); m_waitIndicator->EndAction();
m_waitIndicator = NULL; m_waitIndicator = NULL;
} }