From f33372a5390e9ab11de2e1d8478cd9703b6bc088 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 6 Jan 2024 19:59:41 +0100 Subject: [PATCH] Use COMPAT_MODE macro to fix errors with mingw gcc 12.2 --- ISLE/isleapp.cpp | 6 ++++++ LEGO1/mxatomid.cpp | 5 +++++ LEGO1/mxcompositepresenter.cpp | 8 ++++++++ LEGO1/mxdiskstreamcontroller.cpp | 15 ++++++++++++++- LEGO1/mxmediapresenter.cpp | 8 ++++++++ LEGO1/mxomni.cpp | 13 +++++++++++++ LEGO1/mxpresenter.cpp | 12 ++++++++++++ LEGO1/mxstreamcontroller.cpp | 5 +++++ LEGO1/mxstreamer.cpp | 16 ++++++++++++++-- LEGO1/mxtransitionmanager.cpp | 5 +++++ 10 files changed, 90 insertions(+), 3 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index c402098d..ecaf87d0 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -132,9 +132,15 @@ BOOL IsleApp::SetupLegoOmni() char mediaPath[256]; GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath)); +#ifdef COMPAT_MODE + MxOmniCreateParam param(mediaPath, (struct HWND__*) m_windowHandle, m_videoParam, MxOmniCreateFlags()); + BOOL failure = Lego()->Create(param) == FAILURE; +#else BOOL failure = Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__*) m_windowHandle, m_videoParam, MxOmniCreateFlags()) ) == FAILURE; +#endif + if (!failure) { VariableTable()->SetVariable("ACTOR_01", ""); TickleManager()->SetClientTickleInterval(VideoManager(), 10); diff --git a/LEGO1/mxatomid.cpp b/LEGO1/mxatomid.cpp index 722f5432..6b614760 100644 --- a/LEGO1/mxatomid.cpp +++ b/LEGO1/mxatomid.cpp @@ -36,7 +36,12 @@ void MxAtomId::Destroy() // The dtor is called on the counter object immediately, // so this syntax should be correct. +#ifdef COMPAT_MODE + MxAtomIdCounter id_counter(m_internal); + MxAtomIdCounterSet::iterator it = AtomIdCounterSet()->find(&id_counter); +#else MxAtomIdCounterSet::iterator it = AtomIdCounterSet()->find(&MxAtomIdCounter(m_internal)); +#endif MxAtomIdCounter* counter = (MxAtomIdCounter*) (*it); counter->Dec(); diff --git a/LEGO1/mxcompositepresenter.cpp b/LEGO1/mxcompositepresenter.cpp index 7685fe57..a585b623 100644 --- a/LEGO1/mxcompositepresenter.cpp +++ b/LEGO1/mxcompositepresenter.cpp @@ -97,10 +97,18 @@ void MxCompositePresenter::EndAction() MxPresenter::EndAction(); if (action && action->GetOrigin()) { +#ifdef COMPAT_MODE + MxEndActionNotificationParam param(c_notificationEndAction, this, action, FALSE); + NotificationManager()->Send( + action->GetOrigin(), + ¶m + ); +#else NotificationManager()->Send( action->GetOrigin(), &MxEndActionNotificationParam(c_notificationEndAction, this, action, FALSE) ); +#endif } } diff --git a/LEGO1/mxdiskstreamcontroller.cpp b/LEGO1/mxdiskstreamcontroller.cpp index a7e95798..793f5586 100644 --- a/LEGO1/mxdiskstreamcontroller.cpp +++ b/LEGO1/mxdiskstreamcontroller.cpp @@ -23,8 +23,14 @@ MxDiskStreamController::~MxDiskStreamController() m_unk0xc4 = FALSE; m_unk0x70 = FALSE; - if (m_provider) + if (m_provider) { +#ifdef COMPAT_MODE + MxDSAction action; + m_provider->VTable0x20(&action); +#else m_provider->VTable0x20(&MxDSAction()); +#endif + } MxDSAction* action; while (m_unk0x3c.PopFront(action)) @@ -299,9 +305,16 @@ MxResult MxDiskStreamController::VTable0x24(MxDSAction* p_action) MxAutoLocker lock(&this->m_criticalSection); if (m_unk0x54.Find(p_action, FALSE) == NULL) { if (VTable0x30(p_action) == SUCCESS) { +#ifdef COMPAT_MODE + MxEndActionNotificationParam param(c_notificationEndAction, NULL, p_action, TRUE); + MxOmni::GetInstance()->NotifyCurrentEntity( + ¶m + ); +#else MxOmni::GetInstance()->NotifyCurrentEntity( &MxEndActionNotificationParam(c_notificationEndAction, NULL, p_action, TRUE) ); +#endif } } diff --git a/LEGO1/mxmediapresenter.cpp b/LEGO1/mxmediapresenter.cpp index ca5eb7d7..87345299 100644 --- a/LEGO1/mxmediapresenter.cpp +++ b/LEGO1/mxmediapresenter.cpp @@ -160,10 +160,18 @@ void MxMediaPresenter::EndAction() } if (action && action->GetOrigin()) { +#ifdef COMPAT_MODE + MxEndActionNotificationParam param(c_notificationEndAction, this, action, FALSE); + NotificationManager()->Send( + action->GetOrigin(), + ¶m + ); +#else NotificationManager()->Send( action->GetOrigin(), &MxEndActionNotificationParam(c_notificationEndAction, this, action, FALSE) ); +#endif } } } diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 8ae93d74..7a41b0c4 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -345,14 +345,27 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p if (object->StartAction(p_controller, &p_action) == SUCCESS) { if (sender) { +#ifdef COMPAT_MODE + MxType4NotificationParam param(this, &p_action, object); + NotificationManager()->Send(sender, ¶m); +#else NotificationManager()->Send(sender, &MxType4NotificationParam(this, &p_action, object)); +#endif } if (p_action.GetUnknown84()) { +#ifdef COMPAT_MODE + MxStartActionNotificationParam param(c_notificationStartAction, object, &p_action, FALSE); + NotificationManager()->Send( + p_action.GetUnknown84(), + ¶m + ); +#else NotificationManager()->Send( p_action.GetUnknown84(), &MxStartActionNotificationParam(c_notificationStartAction, object, &p_action, FALSE) ); +#endif } result = SUCCESS; } diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index b2404439..42d5c558 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -147,9 +147,16 @@ void MxPresenter::EndAction() MxAutoLocker lock(&this->m_criticalSection); if (!this->m_compositePresenter) { +#ifdef COMPAT_MODE + MxEndActionNotificationParam param(c_notificationEndAction, NULL, this->m_action, TRUE); + MxOmni::GetInstance()->NotifyCurrentEntity( + ¶m + ); +#else MxOmni::GetInstance()->NotifyCurrentEntity( &MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE) ); +#endif } this->m_action = NULL; @@ -195,7 +202,12 @@ void MxPresenter::SendToCompositePresenter(MxOmni* p_omni) if (m_compositePresenter) { MxAutoLocker lock(&m_criticalSection); +#ifdef COMPAT_MODE + MxNotificationParam param(MXPRESENTER_NOTIFICATION, this); + NotificationManager()->Send(m_compositePresenter, ¶m); +#else NotificationManager()->Send(m_compositePresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this)); +#endif m_action->SetOrigin(p_omni ? p_omni : MxOmni::GetInstance()); m_compositePresenter = NULL; diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index f351582a..c7e5556b 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -55,7 +55,12 @@ MxStreamController::~MxStreamController() if (m_provider) { MxStreamProvider* provider = m_provider; m_provider = NULL; +#ifdef COMPAT_MODE + MxDSAction action; + provider->VTable0x20(&action); +#else provider->VTable0x20(&MxDSAction()); +#endif delete provider; } diff --git a/LEGO1/mxstreamer.cpp b/LEGO1/mxstreamer.cpp index cd2272c6..b13d3db0 100644 --- a/LEGO1/mxstreamer.cpp +++ b/LEGO1/mxstreamer.cpp @@ -81,8 +81,14 @@ MxLong MxStreamer::Close(const char* p_name) if (c->FUN_100c20d0(ds)) delete c; - else + else { +#ifdef COMPAT_MODE + MxStreamerNotification notification(MXSTREAMER_DELETE_NOTIFY, NULL, c); + NotificationManager()->Send(this, ¬ification); +#else NotificationManager()->Send(this, &MxStreamerNotification(MXSTREAMER_DELETE_NOTIFY, NULL, c)); +#endif + } return SUCCESS; } @@ -185,8 +191,14 @@ MxLong MxStreamer::Notify(MxParam& p_param) if (c->FUN_100c20d0(ds)) delete c; - else + else { +#ifdef COMPAT_MODE + MxStreamerNotification notification(MXSTREAMER_DELETE_NOTIFY, NULL, c); + NotificationManager()->Send(this, ¬ification); +#else NotificationManager()->Send(this, &MxStreamerNotification(MXSTREAMER_DELETE_NOTIFY, NULL, c)); +#endif + } } return 0; diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index db658249..787c4866 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -140,7 +140,12 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld) LegoWorld* world = GetCurrentWorld(); if (world) { +#ifdef COMPAT_MODE + MxNotificationParam param(MXTRANSITIONMANAGER_TRANSITIONENDED, this); + world->Notify(param); +#else world->Notify(MxNotificationParam(MXTRANSITIONMANAGER_TRANSITIONENDED, this)); +#endif } } }