From 9651ece809734f791b664f8cf75b83cadef110cb Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:31:19 -0400 Subject: [PATCH] Improve accuracy of MxOmni::CreatePresenter (#407) * Improve accuracy of MxOmni::CreatePresenter * Update mxactionnotificationparam.cpp * Match to 100% --------- Co-authored-by: Christian Semmler --- LEGO1/mxactionnotificationparam.cpp | 7 ++++++- LEGO1/mxomni.cpp | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/LEGO1/mxactionnotificationparam.cpp b/LEGO1/mxactionnotificationparam.cpp index b5d84832..5573677f 100644 --- a/LEGO1/mxactionnotificationparam.cpp +++ b/LEGO1/mxactionnotificationparam.cpp @@ -18,7 +18,12 @@ MxNotificationParam* MxEndActionNotificationParam::Clone() // FUNCTION: LEGO1 0x100b0300 MxNotificationParam* MxStartActionNotificationParam::Clone() { - return new MxEndActionNotificationParam(c_notificationStartAction, this->m_sender, this->m_action, this->m_realloc); + return new MxStartActionNotificationParam( + c_notificationStartAction, + this->m_sender, + this->m_action, + this->m_realloc + ); } // FUNCTION: LEGO1 0x100b04f0 diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 561974da..8ae93d74 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -324,22 +324,24 @@ void MxOmni::DeleteObject(MxDSAction& p_dsAction) MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action) { MxResult result = FAILURE; - MxPresenter* object = (MxPresenter*) m_objectFactory->Create(PresenterNameDispatch(p_action)); + const char* name = PresenterNameDispatch(p_action); + MxPresenter* object = (MxPresenter*) m_objectFactory->Create(name); if (object) { if (object->AddToManager() == SUCCESS) { 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); - } + if (!sender) + sender = p_controller->FUN_100c1e70(p_action); - object->SetCompositePresenter(NULL); - } - else { + if (sender) { p_action.SetOrigin(sender); object->SetCompositePresenter((MxCompositePresenter*) sender); } + else { + if (!p_action.GetOrigin()) + p_action.SetOrigin(this); + object->SetCompositePresenter(NULL); + } if (object->StartAction(p_controller, &p_action) == SUCCESS) { if (sender) { @@ -349,13 +351,14 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p if (p_action.GetUnknown84()) { NotificationManager()->Send( p_action.GetUnknown84(), - &MxStartActionNotificationParam(c_notificationStartAction, this, &p_action, FALSE) + &MxStartActionNotificationParam(c_notificationStartAction, object, &p_action, FALSE) ); } result = SUCCESS; } } } + return result; }