Use COMPAT_MODE macro to fix errors with mingw gcc 12.2

This commit is contained in:
Anonymous Maarten 2024-01-06 19:59:41 +01:00
parent dc3500f631
commit f33372a539
10 changed files with 90 additions and 3 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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(),
&param
);
#else
NotificationManager()->Send(
action->GetOrigin(),
&MxEndActionNotificationParam(c_notificationEndAction, this, action, FALSE)
);
#endif
}
}

View File

@ -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(
&param
);
#else
MxOmni::GetInstance()->NotifyCurrentEntity(
&MxEndActionNotificationParam(c_notificationEndAction, NULL, p_action, TRUE)
);
#endif
}
}

View File

@ -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(),
&param
);
#else
NotificationManager()->Send(
action->GetOrigin(),
&MxEndActionNotificationParam(c_notificationEndAction, this, action, FALSE)
);
#endif
}
}
}

View File

@ -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, &param);
#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(),
&param
);
#else
NotificationManager()->Send(
p_action.GetUnknown84(),
&MxStartActionNotificationParam(c_notificationStartAction, object, &p_action, FALSE)
);
#endif
}
result = SUCCESS;
}

View File

@ -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(
&param
);
#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, &param);
#else
NotificationManager()->Send(m_compositePresenter, &MxNotificationParam(MXPRESENTER_NOTIFICATION, this));
#endif
m_action->SetOrigin(p_omni ? p_omni : MxOmni::GetInstance());
m_compositePresenter = NULL;

View File

@ -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;
}

View File

@ -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, &notification);
#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, &notification);
#else
NotificationManager()->Send(this, &MxStreamerNotification(MXSTREAMER_DELETE_NOTIFY, NULL, c));
#endif
}
}
return 0;

View File

@ -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
}
}
}