From 8281e195f708d6e3d36176d9ec471929619c6c5a Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sat, 7 Oct 2023 13:12:59 -0400 Subject: [PATCH] Implement MxOmni Start/stop timer (#181) * Implement start/stop timer * Mark StartDirectSound as stub * remove accidently committed files --- ISLE/isleapp.cpp | 4 ++-- LEGO1/legoomni.cpp | 11 ++++++++--- LEGO1/legoomni.h | 2 +- LEGO1/mxomni.cpp | 24 +++++++++++++++++------- LEGO1/mxomni.h | 4 ++-- LEGO1/mxsoundmanager.cpp | 21 ++++++++++++++++++++- LEGO1/mxsoundmanager.h | 4 ++++ 7 files changed, 54 insertions(+), 16 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 87f3ebe2..9aefae60 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -104,7 +104,7 @@ void IsleApp::Close() Lego()->RemoveWorld(ds.GetAtomId(), ds.GetObjectId()); Lego()->DeleteObject(ds); TransitionManager()->SetWaitIndicator(NULL); - Lego()->vtable0x3c(); + Lego()->StopTimer(); MxLong lVar8; do { @@ -243,7 +243,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine g_reqEnableRMDevice = 0; VideoManager()->EnableRMDevice(); g_rmDisabled = 0; - Lego()->vtable0x3c(); + Lego()->StopTimer(); } if (g_closed) { diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 2bff73af..f4480bb8 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -3,6 +3,7 @@ #include "mxbackgroundaudiomanager.h" #include "mxdsfile.h" #include "legogamestate.h" +#include "legoutil.h" // 0x100f4588 char *g_nocdSourceName = NULL; @@ -307,14 +308,18 @@ void LegoOmni::NotifyCurrentEntity() // FIXME: Stub } +// OFFSET: LEGO1 0x1005b640 void LegoOmni::StartTimer() { - // FIXME: Stub + MxOmni::StartTimer(); + SetAppCursor(2); } -void LegoOmni::vtable0x3c() +// OFFSET: LEGO1 0x1005b650 +void LegoOmni::StopTimer() { - // FIXME: Stub + MxOmni::StopTimer(); + SetAppCursor(0); } MxBool LegoOmni::vtable40() diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 122c77de..4de0d1b5 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -61,7 +61,7 @@ class LegoOmni : public MxOmni virtual int vtable0x30(char*, int, MxCore*) override; virtual void NotifyCurrentEntity() override; virtual void StartTimer() override; - virtual void vtable0x3c() override; + virtual void StopTimer() override; virtual MxBool vtable40(); LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; } diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index c4d6d471..d1db1398 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -2,7 +2,7 @@ #include "mxatomidcounter.h" #include "mxeventmanager.h" -#include "mxmusicmanager.h" +#include "mxmusicmanager.h" #include "mxnotificationmanager.h" #include "mxobjectfactory.h" #include "mxomnicreateparam.h" @@ -51,7 +51,7 @@ void MxOmni::Init() m_timer = NULL; m_streamer = NULL; m_atomIdCounterSet = NULL; - m_unk64 = NULL; + m_timerRunning = NULL; } // OFFSET: LEGO1 0x100b0090 @@ -98,16 +98,26 @@ void MxOmni::NotifyCurrentEntity() // TODO } -// OFFSET: LEGO1 0x100b09d0 STUB +// OFFSET: LEGO1 0x100b09d0 void MxOmni::StartTimer() { - // TODO + if (m_timerRunning == FALSE && m_timer != NULL && m_soundManager != NULL) + { + m_timer->Start(); + m_soundManager->vtable0x34(); + m_timerRunning = TRUE; + } } -// OFFSET: LEGO1 0x100b0a00 STUB -void MxOmni::vtable0x3c() +// OFFSET: LEGO1 0x100b0a00 +void MxOmni::StopTimer() { - // TODO + if (m_timerRunning != FALSE && m_timer != NULL && m_soundManager != NULL) + { + m_timer->Stop(); + m_soundManager->vtable0x38(); + m_timerRunning = FALSE; + } } // OFFSET: LEGO1 0x100b0690 diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index 585068ce..66682842 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -47,7 +47,7 @@ class MxOmni : public MxCore virtual int vtable0x30(char*, int, MxCore*); // vtable+30 virtual void NotifyCurrentEntity(); // vtable+34 virtual void StartTimer(); // vtable+38 - virtual void vtable0x3c(); // vtable+3c + virtual void StopTimer(); // vtable+3c static void SetInstance(MxOmni* instance); HWND GetWindowHandle() const { return this->m_windowHandle; } MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } @@ -81,7 +81,7 @@ class MxOmni : public MxCore MxCriticalSection m_criticalsection; // 0x48 - unsigned char m_unk64; // 0x64 + MxBool m_timerRunning; // 0x64 }; __declspec(dllexport) MxTickleManager * TickleManager(); __declspec(dllexport) MxTimer * Timer(); diff --git a/LEGO1/mxsoundmanager.cpp b/LEGO1/mxsoundmanager.cpp index 466843e3..e34534f9 100644 --- a/LEGO1/mxsoundmanager.cpp +++ b/LEGO1/mxsoundmanager.cpp @@ -46,4 +46,23 @@ void MxSoundManager::Destroy(MxBool p_param) if (!p_param) { MxAudioManager::Destroy(); } -} \ No newline at end of file +} + +// OFFSET: LEGO1 0x100ae8b0 STUB +MxResult MxSoundManager::StartDirectSound(undefined4 p_unknown1, MxBool p_unknown2) +{ + // TODO STUB + return FAILURE; +} + +// OFFSET: LEGO1 0x100aed10 STUB +void MxSoundManager::vtable0x34() +{ + // TODO STUB +} + +// OFFSET: LEGO1 0x100aee10 STUB +void MxSoundManager::vtable0x38() +{ + // TODO STUB +} diff --git a/LEGO1/mxsoundmanager.h b/LEGO1/mxsoundmanager.h index d41c6fdb..46eef2e7 100644 --- a/LEGO1/mxsoundmanager.h +++ b/LEGO1/mxsoundmanager.h @@ -14,6 +14,10 @@ class MxSoundManager : public MxAudioManager MxSoundManager(); virtual ~MxSoundManager() override; // vtable+0x0 + virtual MxResult StartDirectSound(undefined4 p_unknown1, MxBool p_unknown2); //vtable+0x30 + virtual void vtable0x34(); // vtable+0x34 + virtual void vtable0x38(); // vtable+0x38 + private: void Init(); void Destroy(MxBool);