implement mxomni::create, and match MxStreamController::Open

This commit is contained in:
Misha 2023-10-07 13:18:17 -04:00
parent 5164ef1a54
commit 7a601bf703
10 changed files with 175 additions and 13 deletions

View File

@ -15,4 +15,11 @@ MxEventManager::~MxEventManager()
// OFFSET: LEGO1 0x100c0450
void MxEventManager::Init()
{
}
}
// OFFSET: LEGO1 0x100c04a0 STUB
MxResult MxEventManager::vtable0x28(undefined4 p_unknown1, undefined p_unknown2)
{
//TODO
return FAILURE;
}

View File

@ -2,6 +2,7 @@
#define MXEVENTMANAGER_H
#include "mxmediamanager.h"
#include "decomp.h"
// VTABLE 0x100dc900
// SIZE 0x2c
@ -10,7 +11,7 @@ class MxEventManager : public MxMediaManager
public:
MxEventManager();
virtual ~MxEventManager() override;
virtual MxResult vtable0x28(undefined4 p_unknown1, MxU8 p_unknown2); // vtable+28
private:
void Init();
};

View File

@ -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"
@ -11,6 +11,7 @@
#include "mxticklemanager.h"
#include "mxtimer.h"
#include "mxvideomanager.h"
#include "mxautolocker.h"
// 0x101015b8
char g_hdPath[1024];
@ -172,7 +173,22 @@ 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;
}
m_mediaPath = p.GetMediaPath();
m_windowHandle = p.GetWindowHandle();
if (p.CreateFlags().CreateObjectFactory())
{
MxObjectFactory *objectFactory = new MxObjectFactory();
this->m_objectFactory = objectFactory;
if (objectFactory == NULL)
goto failure;
}
if (p.CreateFlags().CreateVariableTable())
{
@ -180,7 +196,7 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
this->m_variableTable = variableTable;
if (variableTable == NULL)
return FAILURE;
goto failure;
}
if (p.CreateFlags().CreateTimer())
@ -192,7 +208,87 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
return FAILURE;
}
return SUCCESS;
if (p.CreateFlags().CreateTickleManager())
{
this->m_tickleManager = new MxTickleManager();
if (m_tickleManager == NULL)
goto failure;
}
if (p.CreateFlags().CreateNotificationManager())
{
MxNotificationManager *notificationManager = new MxNotificationManager();
this->m_notificationManager = notificationManager;
if (notificationManager == NULL || notificationManager->Create(100, 0) != SUCCESS)
goto failure;
}
if (p.CreateFlags().CreateStreamer())
{
MxStreamer *streamer = new MxStreamer();
this->m_streamer = streamer;
if (streamer == NULL || streamer->Init() != SUCCESS)
goto failure;
}
if (p.CreateFlags().CreateVideoManager())
{
MxVideoManager *videoManager = new MxVideoManager();
this->m_videoManager = videoManager;
if (videoManager != NULL && videoManager->vtable0x2c(p.GetVideoParam(), 100, 0) != SUCCESS)
{
delete m_videoManager;
m_videoManager = NULL;
}
}
if (p.CreateFlags().CreateSoundManager())
{
MxSoundManager *soundManager = new MxSoundManager();
this->m_soundManager = soundManager;
//TODO
if (soundManager != NULL && soundManager->StartDirectSound(10, 0) != SUCCESS)
{
delete m_soundManager;
m_soundManager = NULL;
}
}
if (p.CreateFlags().CreateMusicManager())
{
MxMusicManager *musicManager = new MxMusicManager();
this->m_musicManager = musicManager;
if (musicManager != NULL && musicManager->StartMIDIThread(50, 0) != SUCCESS)
{
delete m_musicManager;
m_musicManager = NULL;
}
}
if (p.CreateFlags().CreateEventManager())
{
MxEventManager *eventManager = new MxEventManager();
this->m_eventManager = eventManager;
if (m_eventManager != NULL && m_eventManager->vtable0x28(50, 0) != SUCCESS)
{
delete m_eventManager;
m_eventManager = NULL;
}
}
result = SUCCESS;
failure:
if (result != SUCCESS)
{
Destroy();
}
return result;
}
// OFFSET: LEGO1 0x100afe90
@ -238,8 +334,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

@ -61,6 +61,7 @@ class MxOmni : public MxCore
MxMusicManager* GetMusicManager() const { return this->m_musicManager; }
MxEventManager* GetEventManager() const { return this->m_eventManager; }
MxAtomIdCounterSet* GetAtomIdCounterSet() const { return this->m_atomIdCounterSet; }
MxLong HandleNotificationType2(MxParam& p_param);
protected:
static MxOmni* g_instance;

View File

@ -14,6 +14,9 @@ class MxOmniCreateParam : public MxOmniCreateParamBase
__declspec(dllexport) MxOmniCreateParam(const char *mediaPath, struct HWND__ *windowHandle, MxVideoParam &vparam, MxOmniCreateFlags flags);
const MxOmniCreateFlags& CreateFlags() const { return this->m_createFlags; }
const MxString GetMediaPath() const { return m_mediaPath; }
const HWND GetWindowHandle() const { return m_windowHandle; }
MxVideoParam& GetVideoParam() { return m_videoParam; }
private:
MxString m_mediaPath;

View File

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

View File

@ -34,7 +34,7 @@ MxResult MxVideoManager::Tickle()
UpdateRegion();
m_region->Reset();
return SUCCESS;
}
@ -54,13 +54,13 @@ MxResult MxVideoManager::Init()
void MxVideoManager::SortPresenterList()
{
if (this->m_presenters->GetCount() <= 1)
return;
return;
MxPresenterListCursor a(this->m_presenters);
MxPresenterListCursor b(this->m_presenters);
MxU32 count = this->m_presenters->GetCount() - 1;
MxBool finished;
if (count != 0) {
do {
a.Reset();
@ -111,3 +111,15 @@ MxLong MxVideoManager::RealizePalette(MxPalette *p_palette)
this->m_criticalSection.Leave();
return 0;
}
// OFFSET: LEGO1 0x100be600 STUB
void MxVideoManager::vtable0x28()
{
}
// OFFSET: LEGO1 0x100bebe0 STUB
MxResult MxVideoManager::vtable0x2c(MxVideoParam& p_videoParam, undefined4 p_unknown1, MxU8 p_unknown2)
{
return FAILURE;
}

View File

@ -14,6 +14,8 @@ class MxVideoManager : public MxMediaManager
virtual ~MxVideoManager();
virtual MxResult Tickle(); // vtable+0x8
virtual void vtable0x28(); // vtable+0x28 (TODO ARGUMENTS)
virtual MxResult vtable0x2c(MxVideoParam& p_videoParam, undefined4 p_unknown1, MxU8 p_unknown2); // vtable+0x2c
__declspec(dllexport) void InvalidateRect(MxRect32 &);
__declspec(dllexport) virtual MxLong RealizePalette(MxPalette *); // vtable+0x30