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
}
void LegoOmni::vtable0x3c()
void LegoOmni::StopTimer()
{
// FIXME: Stub
}

View File

@ -62,7 +62,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; }

View File

@ -55,6 +55,8 @@ class MxNotificationManager : public MxCore
void Register(MxCore *p_listener);
void Unregister(MxCore *p_listener);
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:
void FlushPending(MxCore *p_listener);

View File

@ -39,7 +39,7 @@ void MxOmni::Init()
m_timer = NULL;
m_streamer = NULL;
m_atomIdCounterSet = NULL;
m_unk64 = NULL;
m_TimerRunning = FALSE;
}
// OFFSET: LEGO1 0x100b0090
@ -86,16 +86,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
@ -160,7 +170,21 @@ void MxOmni::SetInstance(MxOmni *instance)
// OFFSET: LEGO1 0x100af0c0
MxResult MxOmni::Create(MxOmniCreateParam &p)
{
MxResult result = FAILURE;
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())
{
@ -168,7 +192,7 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
this->m_variableTable = variableTable;
if (variableTable == NULL)
return FAILURE;
goto failure;
}
if (p.CreateFlags().CreateTimer())
@ -180,24 +204,82 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
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
void MxOmni::Destroy()
{
// FIXME: Stub
/*
// TODO: private members
if (m_notificationManager) {
while (m_notificationManager->m_queue->size()) {
while (m_notificationManager->GetQueueSize()) {
m_notificationManager->Tickle();
}
m_notificationManager->SetActive(FALSE);
}
m_notificationManager->m_active = 0;
*/
delete m_eventManager;
delete m_soundManager;
@ -226,8 +308,24 @@ void MxOmni::Destroy()
// OFFSET: LEGO1 0x100b07f0
MxLong MxOmni::Notify(MxParam &p)
{
// FIXME: Stub
return 0;
MxAutoLocker lock(&this->m_criticalsection);
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

View File

@ -16,6 +16,8 @@
#include "mxvariabletable.h"
#include "mxvideomanager.h"
#include "mxatomidcounter.h"
#include "mxmidimanager.h"
#include "mxautolocker.h"
// VTABLE 0x100dc168
// SIZE 0x68
@ -45,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; }
@ -79,7 +81,9 @@ class MxOmni : public MxCore
MxCriticalSection m_criticalsection; // 0x48
unsigned char m_unk64; // 0x64
MxBool m_TimerRunning; // 0x64
MxLong HandleNotificationType2(MxParam& p_param);
};
__declspec(dllexport) MxTickleManager * TickleManager();
__declspec(dllexport) MxTimer * Timer();

View File

@ -46,4 +46,23 @@ void MxSoundManager::Destroy(MxBool p_param)
if (!p_param) {
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();
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);

View File

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