mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement MxOmni::Create (#182)
* implement mxomni::create, and match MxStreamController::Open * Use enum for mxparam type * Fix return type * Match MxOmni::Notify * Remove unused variable * Added override keywords --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
115
LEGO1/mxomni.cpp
115
LEGO1/mxomni.cpp
@@ -11,6 +11,7 @@
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxtimer.h"
|
||||
#include "mxvideomanager.h"
|
||||
#include "mxautolocker.h"
|
||||
|
||||
// 0x101015b8
|
||||
char g_hdPath[1024];
|
||||
@@ -182,7 +183,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())
|
||||
{
|
||||
@@ -190,7 +206,7 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
|
||||
this->m_variableTable = variableTable;
|
||||
|
||||
if (variableTable == NULL)
|
||||
return FAILURE;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (p.CreateFlags().CreateTimer())
|
||||
@@ -202,7 +218,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
|
||||
@@ -248,8 +344,19 @@ void MxOmni::Destroy()
|
||||
// OFFSET: LEGO1 0x100b07f0
|
||||
MxLong MxOmni::Notify(MxParam &p)
|
||||
{
|
||||
// FIXME: Stub
|
||||
return 0;
|
||||
MxAutoLocker lock(&this->m_criticalsection);
|
||||
|
||||
if (p.GetType() != MXSTREAMER_UNKNOWN)
|
||||
return 0;
|
||||
|
||||
return HandleNotificationType2(p);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100b0880 STUB
|
||||
MxResult MxOmni::HandleNotificationType2(MxParam& p_param)
|
||||
{
|
||||
// TODO STUB
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100acea0
|
||||
|
Reference in New Issue
Block a user