mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-24 04:26:55 -04: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:
parent
4a674d823b
commit
62b97b8f1f
@ -16,3 +16,10 @@ MxEventManager::~MxEventManager()
|
|||||||
void MxEventManager::Init()
|
void MxEventManager::Init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100c04a0 STUB
|
||||||
|
MxResult MxEventManager::vtable0x28(undefined4 p_unknown1, undefined p_unknown2)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define MXEVENTMANAGER_H
|
#define MXEVENTMANAGER_H
|
||||||
|
|
||||||
#include "mxmediamanager.h"
|
#include "mxmediamanager.h"
|
||||||
|
#include "decomp.h"
|
||||||
|
|
||||||
// VTABLE 0x100dc900
|
// VTABLE 0x100dc900
|
||||||
// SIZE 0x2c
|
// SIZE 0x2c
|
||||||
@ -10,7 +11,7 @@ class MxEventManager : public MxMediaManager
|
|||||||
public:
|
public:
|
||||||
MxEventManager();
|
MxEventManager();
|
||||||
virtual ~MxEventManager() override;
|
virtual ~MxEventManager() override;
|
||||||
|
virtual MxResult vtable0x28(undefined4 p_unknown1, MxU8 p_unknown2); // vtable+28
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
MxMediaManager();
|
MxMediaManager();
|
||||||
virtual ~MxMediaManager() override;
|
virtual ~MxMediaManager() override;
|
||||||
|
|
||||||
virtual MxResult Tickle(); // vtable+08
|
virtual MxResult Tickle() override; // vtable+08
|
||||||
virtual MxResult InitPresenters(); // vtable+14
|
virtual MxResult InitPresenters(); // vtable+14
|
||||||
virtual void Destroy(); // vtable+18
|
virtual void Destroy(); // vtable+18
|
||||||
virtual void AddPresenter(MxPresenter &p_presenter); // vtable+1c
|
virtual void AddPresenter(MxPresenter &p_presenter); // vtable+1c
|
||||||
|
113
LEGO1/mxomni.cpp
113
LEGO1/mxomni.cpp
@ -11,6 +11,7 @@
|
|||||||
#include "mxticklemanager.h"
|
#include "mxticklemanager.h"
|
||||||
#include "mxtimer.h"
|
#include "mxtimer.h"
|
||||||
#include "mxvideomanager.h"
|
#include "mxvideomanager.h"
|
||||||
|
#include "mxautolocker.h"
|
||||||
|
|
||||||
// 0x101015b8
|
// 0x101015b8
|
||||||
char g_hdPath[1024];
|
char g_hdPath[1024];
|
||||||
@ -182,7 +183,22 @@ 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;
|
||||||
|
}
|
||||||
|
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())
|
if (p.CreateFlags().CreateVariableTable())
|
||||||
{
|
{
|
||||||
@ -190,7 +206,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())
|
||||||
@ -202,7 +218,87 @@ MxResult MxOmni::Create(MxOmniCreateParam &p)
|
|||||||
return FAILURE;
|
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
|
// OFFSET: LEGO1 0x100afe90
|
||||||
@ -248,8 +344,19 @@ 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);
|
||||||
|
|
||||||
|
if (p.GetType() != MXSTREAMER_UNKNOWN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
return HandleNotificationType2(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OFFSET: LEGO1 0x100b0880 STUB
|
||||||
|
MxResult MxOmni::HandleNotificationType2(MxParam& p_param)
|
||||||
|
{
|
||||||
|
// TODO STUB
|
||||||
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100acea0
|
// OFFSET: LEGO1 0x100acea0
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
MxMusicManager* GetMusicManager() const { return this->m_musicManager; }
|
MxMusicManager* GetMusicManager() const { return this->m_musicManager; }
|
||||||
MxEventManager* GetEventManager() const { return this->m_eventManager; }
|
MxEventManager* GetEventManager() const { return this->m_eventManager; }
|
||||||
MxAtomIdCounterSet* GetAtomIdCounterSet() const { return this->m_atomIdCounterSet; }
|
MxAtomIdCounterSet* GetAtomIdCounterSet() const { return this->m_atomIdCounterSet; }
|
||||||
|
MxResult HandleNotificationType2(MxParam& p_param);
|
||||||
protected:
|
protected:
|
||||||
static MxOmni* g_instance;
|
static MxOmni* g_instance;
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ public:
|
|||||||
__declspec(dllexport) MxOmniCreateParam(const char *mediaPath, struct HWND__ *windowHandle, MxVideoParam &vparam, MxOmniCreateFlags flags);
|
__declspec(dllexport) MxOmniCreateParam(const char *mediaPath, struct HWND__ *windowHandle, MxVideoParam &vparam, MxOmniCreateFlags flags);
|
||||||
|
|
||||||
const MxOmniCreateFlags& CreateFlags() const { return this->m_createFlags; }
|
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:
|
private:
|
||||||
MxString m_mediaPath;
|
MxString m_mediaPath;
|
||||||
|
@ -7,16 +7,24 @@
|
|||||||
|
|
||||||
class MxCore;
|
class MxCore;
|
||||||
|
|
||||||
|
enum MxParamType
|
||||||
|
{
|
||||||
|
MXSTREAMER_UNKNOWN = 2,
|
||||||
|
MXPRESENTER_NOTIFICATION = 5,
|
||||||
|
MXSTREAMER_DELETE_NOTIFY = 6,
|
||||||
|
MXTRANSITIONMANAGER_TRANSITIONENDED = 24
|
||||||
|
};
|
||||||
|
|
||||||
// VTABLE 0x100d56e0
|
// VTABLE 0x100d56e0
|
||||||
class MxParam : public MxOmniCreateParamBase
|
class MxParam : public MxOmniCreateParamBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline MxParam(MxS32 p_type, MxCore *p_sender) : MxOmniCreateParamBase(), m_type(p_type), m_sender(p_sender){}
|
inline MxParam(MxParamType p_type, MxCore *p_sender) : MxOmniCreateParamBase(), m_type(p_type), m_sender(p_sender){}
|
||||||
|
|
||||||
virtual ~MxParam() override {} // vtable+0x0 (scalar deleting destructor)
|
virtual ~MxParam() override {} // vtable+0x0 (scalar deleting destructor)
|
||||||
virtual MxParam *Clone(); // vtable+0x4
|
virtual MxParam *Clone(); // vtable+0x4
|
||||||
|
|
||||||
inline MxS32 GetType() const
|
inline MxParamType GetType() const
|
||||||
{
|
{
|
||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
@ -27,7 +35,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MxS32 m_type; // 0x4
|
MxParamType m_type; // 0x4
|
||||||
MxCore *m_sender; // 0x8
|
MxCore *m_sender; // 0x8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,8 +65,7 @@ void MxPresenter::SendTo_unkPresenter(MxOmni *p_omni)
|
|||||||
if (m_unkPresenter) {
|
if (m_unkPresenter) {
|
||||||
MxAutoLocker lock(&m_criticalSection);
|
MxAutoLocker lock(&m_criticalSection);
|
||||||
|
|
||||||
// TOOD: magic number used for notification type. replace with enum
|
NotificationManager()->Send(m_unkPresenter, &MxParam(MXPRESENTER_NOTIFICATION, this));
|
||||||
NotificationManager()->Send(m_unkPresenter, &MxParam(5, this));
|
|
||||||
|
|
||||||
m_action->SetOmni(p_omni ? p_omni : MxOmni::GetInstance());
|
m_action->SetOmni(p_omni ? p_omni : MxOmni::GetInstance());
|
||||||
m_unkPresenter = NULL;
|
m_unkPresenter = NULL;
|
||||||
|
@ -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,11 @@ 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);
|
||||||
|
|
||||||
// TODO
|
MakeSourceName(sourceName, p_filename);
|
||||||
|
this->atom = MxAtomId(sourceName, LookupMode_LowerCase2);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxStreamer, 0x2c);
|
DECOMP_SIZE_ASSERT(MxStreamer, 0x2c);
|
||||||
|
|
||||||
#define MXSTREAMER_DELETE_NOTIFY 6
|
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100b8f00
|
// OFFSET: LEGO1 0x100b8f00
|
||||||
MxStreamer::MxStreamer()
|
MxStreamer::MxStreamer()
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
class MxStreamerNotification : public MxParam
|
class MxStreamerNotification : public MxParam
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline MxStreamerNotification(MxS32 p_type, MxCore *p_sender, MxStreamController *p_ctrlr) : MxParam(p_type, p_sender)
|
inline MxStreamerNotification(MxParamType p_type, MxCore *p_sender, MxStreamController *p_ctrlr) : MxParam(p_type, p_sender)
|
||||||
{
|
{
|
||||||
m_controller = p_ctrlr;
|
m_controller = p_ctrlr;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
|
|||||||
LegoWorld *world = GetCurrentWorld();
|
LegoWorld *world = GetCurrentWorld();
|
||||||
|
|
||||||
if (world) {
|
if (world) {
|
||||||
world->Notify(MxParam(0x18, this));
|
world->Notify(MxParam(MXTRANSITIONMANAGER_TRANSITIONENDED, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,3 +111,15 @@ MxLong MxVideoManager::RealizePalette(MxPalette *p_palette)
|
|||||||
this->m_criticalSection.Leave();
|
this->m_criticalSection.Leave();
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
@ -13,7 +13,9 @@ class MxVideoManager : public MxMediaManager
|
|||||||
public:
|
public:
|
||||||
virtual ~MxVideoManager();
|
virtual ~MxVideoManager();
|
||||||
|
|
||||||
virtual MxResult Tickle(); // vtable+0x8
|
virtual MxResult Tickle() override; // 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) void InvalidateRect(MxRect32 &);
|
||||||
__declspec(dllexport) virtual MxLong RealizePalette(MxPalette *); // vtable+0x30
|
__declspec(dllexport) virtual MxLong RealizePalette(MxPalette *); // vtable+0x30
|
||||||
|
Loading…
x
Reference in New Issue
Block a user