implement a few new functions

This commit is contained in:
Misha 2023-10-07 11:15:25 -04:00
parent 775ee9f05f
commit 69957fe6dc
8 changed files with 151 additions and 24 deletions

View File

@ -310,7 +310,7 @@ void LegoOmni::StartTimer()
// FIXME: Stub // FIXME: Stub
} }
void LegoOmni::vtable0x3c() void LegoOmni::StopTimer()
{ {
// FIXME: Stub // FIXME: Stub
} }

View File

@ -62,7 +62,7 @@ class LegoOmni : public MxOmni
virtual int vtable0x30(char*, int, MxCore*) override; virtual int vtable0x30(char*, int, MxCore*) override;
virtual void NotifyCurrentEntity() override; virtual void NotifyCurrentEntity() override;
virtual void StartTimer() override; virtual void StartTimer() override;
virtual void vtable0x3c() override; virtual void StopTimer() override;
virtual MxBool vtable40(); virtual MxBool vtable40();
LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; } LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; }

View File

@ -55,6 +55,8 @@ class MxNotificationManager : public MxCore
void Register(MxCore *p_listener); void Register(MxCore *p_listener);
void Unregister(MxCore *p_listener); void Unregister(MxCore *p_listener);
MxResult Send(MxCore *p_listener, MxParam *p_param); MxResult Send(MxCore *p_listener, MxParam *p_param);
inline void SetActive(MxBool p_active) { m_active = p_active; }
inline size_t GetQueueSize() { return m_queue->size(); }
private: private:
void FlushPending(MxCore *p_listener); void FlushPending(MxCore *p_listener);

View File

@ -39,7 +39,7 @@ void MxOmni::Init()
m_timer = NULL; m_timer = NULL;
m_streamer = NULL; m_streamer = NULL;
m_atomIdCounterSet = NULL; m_atomIdCounterSet = NULL;
m_unk64 = NULL; m_TimerRunning = FALSE;
} }
// OFFSET: LEGO1 0x100b0090 // OFFSET: LEGO1 0x100b0090
@ -86,16 +86,26 @@ void MxOmni::NotifyCurrentEntity()
// TODO // TODO
} }
// OFFSET: LEGO1 0x100b09d0 STUB // OFFSET: LEGO1 0x100b09d0
void MxOmni::StartTimer() 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 // OFFSET: LEGO1 0x100b0a00
void MxOmni::vtable0x3c() 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 // OFFSET: LEGO1 0x100b0690
@ -160,7 +170,21 @@ void MxOmni::SetInstance(MxOmni *instance)
// OFFSET: LEGO1 0x100af0c0 // OFFSET: LEGO1 0x100af0c0
MxResult MxOmni::Create(MxOmniCreateParam &p) MxResult MxOmni::Create(MxOmniCreateParam &p)
{ {
MxResult result = FAILURE;
m_atomIdCounterSet = new MxAtomIdCounterSet(); m_atomIdCounterSet = new MxAtomIdCounterSet();
if (m_atomIdCounterSet == NULL)
{
goto failure;
}
if (p.CreateFlags().CreateObjectFactory())
{
MxObjectFactory *objectFactory = new MxObjectFactory();
this->m_objectFactory = objectFactory;
if (objectFactory == NULL)
goto failure;
}
if (p.CreateFlags().CreateVariableTable()) if (p.CreateFlags().CreateVariableTable())
{ {
@ -168,7 +192,7 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
this->m_variableTable = variableTable; this->m_variableTable = variableTable;
if (variableTable == NULL) if (variableTable == NULL)
return FAILURE; goto failure;
} }
if (p.CreateFlags().CreateTimer()) if (p.CreateFlags().CreateTimer())
@ -180,24 +204,82 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
return FAILURE; return FAILURE;
} }
return SUCCESS; if (p.CreateFlags().CreateTickleManager())
{
MxTickleManager *tickleManager = new MxTickleManager();
this->m_tickleManager = tickleManager;
if (tickleManager == NULL)
goto failure;
}
if (p.CreateFlags().CreateNotificationManager())
{
MxNotificationManager *notificationManager = new MxNotificationManager();
this->m_notificationManager = notificationManager;
if (notificationManager == NULL)
goto failure;
}
if (p.CreateFlags().CreateStreamer())
{
MxStreamer *streamer = new MxStreamer();
this->m_streamer = streamer;
if (streamer == NULL)
goto failure;
}
if (p.CreateFlags().CreateVideoManager())
{
MxVideoManager *videoManager = new MxVideoManager();
this->m_videoManager = videoManager;
if (videoManager == NULL)
return FAILURE;
}
if (p.CreateFlags().CreateSoundManager())
{
MxSoundManager *soundManager = new MxSoundManager();
this->m_soundManager = soundManager;
//TODO
if (soundManager != NULL)
{
}
}
if (p.CreateFlags().CreateMusicManager())
{
}
result = SUCCESS;
failure:
if (result != SUCCESS)
{
Destroy();
}
return result;
} }
// OFFSET: LEGO1 0x100afe90 // OFFSET: LEGO1 0x100afe90
void MxOmni::Destroy() void MxOmni::Destroy()
{ {
// FIXME: Stub // FIXME: Stub
/*
// TODO: private members
if (m_notificationManager) { if (m_notificationManager) {
while (m_notificationManager->m_queue->size()) { while (m_notificationManager->GetQueueSize()) {
m_notificationManager->Tickle(); m_notificationManager->Tickle();
} }
m_notificationManager->SetActive(FALSE);
} }
m_notificationManager->m_active = 0;
*/
delete m_eventManager; delete m_eventManager;
delete m_soundManager; delete m_soundManager;
@ -226,8 +308,24 @@ void MxOmni::Destroy()
// OFFSET: LEGO1 0x100b07f0 // OFFSET: LEGO1 0x100b07f0
MxLong MxOmni::Notify(MxParam &p) MxLong MxOmni::Notify(MxParam &p)
{ {
// FIXME: Stub MxAutoLocker lock(&this->m_criticalsection);
return 0; MxLong result;
if (p.GetType() == 2)
{
result = HandleNotificationType2(p);
}
else
{
result = 0;
}
return result;
}
// OFFSET: LEGO1 0x100b0880 STUB
MxLong MxOmni::HandleNotificationType2(MxParam& p_param)
{
// TODO STUB
return FAILURE;
} }
// OFFSET: LEGO1 0x100acea0 // OFFSET: LEGO1 0x100acea0

View File

@ -16,6 +16,8 @@
#include "mxvariabletable.h" #include "mxvariabletable.h"
#include "mxvideomanager.h" #include "mxvideomanager.h"
#include "mxatomidcounter.h" #include "mxatomidcounter.h"
#include "mxmidimanager.h"
#include "mxautolocker.h"
// VTABLE 0x100dc168 // VTABLE 0x100dc168
// SIZE 0x68 // SIZE 0x68
@ -45,7 +47,7 @@ class MxOmni : public MxCore
virtual int vtable0x30(char*, int, MxCore*); // vtable+30 virtual int vtable0x30(char*, int, MxCore*); // vtable+30
virtual void NotifyCurrentEntity(); // vtable+34 virtual void NotifyCurrentEntity(); // vtable+34
virtual void StartTimer(); // vtable+38 virtual void StartTimer(); // vtable+38
virtual void vtable0x3c(); // vtable+3c virtual void StopTimer(); // vtable+3c
static void SetInstance(MxOmni* instance); static void SetInstance(MxOmni* instance);
HWND GetWindowHandle() const { return this->m_windowHandle; } HWND GetWindowHandle() const { return this->m_windowHandle; }
MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; } MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }
@ -79,7 +81,9 @@ class MxOmni : public MxCore
MxCriticalSection m_criticalsection; // 0x48 MxCriticalSection m_criticalsection; // 0x48
unsigned char m_unk64; // 0x64 MxBool m_TimerRunning; // 0x64
MxLong HandleNotificationType2(MxParam& p_param);
}; };
__declspec(dllexport) MxTickleManager * TickleManager(); __declspec(dllexport) MxTickleManager * TickleManager();
__declspec(dllexport) MxTimer * Timer(); __declspec(dllexport) MxTimer * Timer();

View File

@ -46,4 +46,23 @@ void MxSoundManager::Destroy(MxBool p_param)
if (!p_param) { if (!p_param) {
MxAudioManager::Destroy(); MxAudioManager::Destroy();
} }
} }
// OFFSET: LEGO1 0x100ae8b0
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
}

View File

@ -14,6 +14,9 @@ class MxSoundManager : public MxAudioManager
MxSoundManager(); MxSoundManager();
virtual ~MxSoundManager() override; // vtable+0x0 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: private:
void Init(); void Init();
void Destroy(MxBool); void Destroy(MxBool);

View File

@ -1,6 +1,7 @@
#include "mxstreamcontroller.h" #include "mxstreamcontroller.h"
#include "mxautolocker.h" #include "mxautolocker.h"
#include "legoomni.h"
// OFFSET: LEGO1 0x100c0b90 STUB // OFFSET: LEGO1 0x100c0b90 STUB
MxStreamController::MxStreamController() MxStreamController::MxStreamController()
@ -24,10 +25,10 @@ MxBool MxStreamController::FUN_100c20d0(MxDSObject &p_obj)
// OFFSET: LEGO1 0x100c1520 // OFFSET: LEGO1 0x100c1520
MxResult MxStreamController::Open(const char *p_filename) MxResult MxStreamController::Open(const char *p_filename)
{ {
char sourceName [256];
MxAutoLocker locker(&m_criticalSection); MxAutoLocker locker(&m_criticalSection);
MakeSourceName(sourceName, p_filename);
// TODO this->atom = MxAtomId(sourceName, LookupMode_LowerCase2);
return SUCCESS; return SUCCESS;
} }