From 526c6af1f6330b1999224a859073677283e03ca2 Mon Sep 17 00:00:00 2001 From: ecumber Date: Sun, 18 Jun 2023 22:36:07 -0700 Subject: [PATCH] Implement a few Mx* functions / add data types (#25) * Implement a few Mx* functions / add data types * added more information, fixed formatting issues * further cleanup --------- Co-authored-by: itsmattkc <34096995+itsmattkc@users.noreply.github.com> --- ISLE/isle.cpp | 5 +++ LEGO1/legoinputmanager.h | 2 + LEGO1/legoomni.cpp | 6 +-- LEGO1/legoomni.h | 83 +++++++++++------------------------ LEGO1/mxcore.h | 10 ++--- LEGO1/mxdsfile.cpp | 6 +++ LEGO1/mxdsfile.h | 3 ++ LEGO1/mxeventmanager.h | 9 ++++ LEGO1/mxmusicmanager.h | 9 ++++ LEGO1/mxnotificationmanager.h | 9 ++++ LEGO1/mxobjectfactory.h | 9 ++++ LEGO1/mxomni.cpp | 41 ++++++++++------- LEGO1/mxomni.h | 50 +++++++++++++++++---- LEGO1/mxsoundmanager.h | 9 ++++ LEGO1/mxstreamcontroller.h | 2 + LEGO1/mxticklemanager.h | 2 + 16 files changed, 164 insertions(+), 91 deletions(-) create mode 100644 LEGO1/mxdsfile.cpp create mode 100644 LEGO1/mxeventmanager.h create mode 100644 LEGO1/mxmusicmanager.h create mode 100644 LEGO1/mxnotificationmanager.h create mode 100644 LEGO1/mxobjectfactory.h create mode 100644 LEGO1/mxsoundmanager.h diff --git a/ISLE/isle.cpp b/ISLE/isle.cpp index 140e1862..3517cb78 100644 --- a/ISLE/isle.cpp +++ b/ISLE/isle.cpp @@ -1,7 +1,12 @@ #include "isle.h" #include "define.h" +#include "legoanimationmanager.h" +#include "legobuildingmanager.h" +#include "legomodelpresenter.h" #include "legoomni.h" +#include "legopartpresenter.h" +#include "legoworldpresenter.h" #include "mxdirectdraw.h" #include "mxdsaction.h" #include "mxomni.h" diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index d5d177d0..714b4ce7 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -1,6 +1,8 @@ #ifndef LEGOINPUTMANAGER_H #define LEGOINPUTMANAGER_H +#include "mxcore.h" + __declspec(dllexport) enum NotificationId { NONE = 0, diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 07ad6c19..a49344a7 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -1,17 +1,15 @@ #include "legoomni.h" -LegoOmni *LegoOmni::m_instance = NULL; - // OFFSET: LEGO1 0x1005ad10 LegoOmni *LegoOmni::GetInstance() { - return m_instance; + return (LegoOmni *) m_instance; } // OFFSET: LEGO1 0x10015700 LegoOmni *Lego() { - return LegoOmni::GetInstance(); + return (LegoOmni *) MxOmni::GetInstance(); } // OFFSET: LEGO1 0x10015720 diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 42421e22..778d0ac4 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -1,35 +1,23 @@ #ifndef LEGOOMNI_H #define LEGOOMNI_H +#include "legoentity.h" +#include "legoinputmanager.h" +#include "legogamestate.h" +#include "legonavcontroller.h" +#include "legoroi.h" +#include "legovideomanager.h" +#include "mxatomid.h" #include "mxbackgroundaudiomanager.h" #include "mxdsaction.h" #include "mxdsfile.h" #include "mxdsobject.h" -#include "mxomnicreateparam.h" -#include "mxresult.h" -#include "mxstreamer.h" -#include "mxticklemanager.h" -#include "mxtimer.h" +#include "mxomni.h" #include "mxtransitionmanager.h" -#include "legoanimationmanager.h" -#include "legobuildingmanager.h" -#include "legoentity.h" -#include "legogamestate.h" -#include "legoinputmanager.h" -#include "legomodelpresenter.h" -#include "legopartpresenter.h" -#include "legoroi.h" -#include "legoworldpresenter.h" -#include "legovideomanager.h" class LegoSoundManager; -class MxEventManager; -class MxMusicManager; -class MxNotificationManager; -class MxSoundManager; -// class LegoOmni : public MxOmni -class LegoOmni +class LegoOmni : public MxOmni { public: __declspec(dllexport) void CreateBackgroundAudio(); @@ -38,15 +26,14 @@ class LegoOmni __declspec(dllexport) static void CreateInstance(); __declspec(dllexport) static LegoOmni *GetInstance(); - virtual ~LegoOmni(); + virtual ~LegoOmni(); // vtable+00 - virtual void vtable04(); - virtual void vtable08(); - virtual void vtable0c(); - virtual void vtable10(); - virtual void vtable14(); - virtual MxResult Create(const MxOmniCreateParam &p); - virtual void vtable1c(); + virtual long Notify(MxParam &p); // vtable+04 + virtual const char *GetClassName() const; // vtable+0c + virtual MxBool IsClass(const char *name) const; // vtable+10; + virtual void Init(); // vtable+14 + virtual MxResult Create(MxOmniCreateParam &p); // vtable+18 + virtual void Destroy(); // vtable+1c virtual void vtable20(); virtual void vtable24(MxDSAction &ds); virtual MxBool vtable28(MxDSAction &ds); @@ -57,40 +44,20 @@ class LegoOmni virtual void vtable3c(); virtual unsigned char vtable40(); - LegoVideoManager *GetVideoManager() { return m_videoMgr; } + LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; } LegoInputManager *GetInputManager() { return m_inputMgr; } private: - int m_unk04; - int m_unk08; - int m_unk0c; - int m_unk10; - int m_unk14; - int m_unk18; - int m_unk1c; - int m_unk20; - int m_unk24; - int m_unk28; - LegoVideoManager *m_videoMgr; - int m_unk30; - int m_unk34; - int m_unk38; - int m_unk3c; - int m_unk40; - int m_unk44; - int m_unk48; - int m_unk4c; - int m_unk50; - int m_unk54; - int m_unk58; - int m_unk5c; - int m_unk60; - int m_unk64; int m_unk68; int m_unk6c; - LegoInputManager *m_inputMgr; - - static LegoOmni *m_instance; + LegoInputManager *m_inputMgr; // 0x70 + char m_unk74[0x10]; + LegoNavController *m_navController; // 0x84 + char m_unk88[0x14]; + LegoGameState *m_gameState; // 0x9c + char m_unka0[0x94]; + MxBackgroundAudioManager *m_bkgAudioManager; // 0x134 + MxTransitionManager *m_transitionManager; // 0x138 }; diff --git a/LEGO1/mxcore.h b/LEGO1/mxcore.h index b4038b06..64e916a1 100644 --- a/LEGO1/mxcore.h +++ b/LEGO1/mxcore.h @@ -9,11 +9,11 @@ class MxCore { public: __declspec(dllexport) MxCore(); - __declspec(dllexport) virtual ~MxCore(); - __declspec(dllexport) virtual long Notify(MxParam &p); - virtual long Tickle(); - virtual const char *GetClassName() const; - virtual MxBool IsClass(const char *name) const; + __declspec(dllexport) virtual ~MxCore(); // vtable+00 + __declspec(dllexport) virtual long Notify(MxParam &p); // vtable+04 + virtual long Tickle(); // vtable+08 + virtual const char *GetClassName() const; // vtable+0c + virtual MxBool IsClass(const char *name) const; // vtable+10 private: unsigned int m_id; diff --git a/LEGO1/mxdsfile.cpp b/LEGO1/mxdsfile.cpp new file mode 100644 index 00000000..27d6668d --- /dev/null +++ b/LEGO1/mxdsfile.cpp @@ -0,0 +1,6 @@ +#include "mxdsfile.h" + +unsigned long MxDSFile::GetBufferSize() +{ + return this->m_buffersize; +} diff --git a/LEGO1/mxdsfile.h b/LEGO1/mxdsfile.h index d8f9440c..d28928dc 100644 --- a/LEGO1/mxdsfile.h +++ b/LEGO1/mxdsfile.h @@ -12,6 +12,9 @@ class MxDSFile __declspec(dllexport) virtual long Open(unsigned long); __declspec(dllexport) virtual long Read(unsigned char *,unsigned long); __declspec(dllexport) virtual long Seek(long,int); +private: + char m_unknown[0x70]; + unsigned long m_buffersize; }; #endif // MXDSFILE_H diff --git a/LEGO1/mxeventmanager.h b/LEGO1/mxeventmanager.h new file mode 100644 index 00000000..5d187256 --- /dev/null +++ b/LEGO1/mxeventmanager.h @@ -0,0 +1,9 @@ +#ifndef MXEVENTMANAGER_H +#define MXEVENTMANAGER_H + +class MxEventManager +{ + +}; + +#endif // MXEVENTMANAGER_H diff --git a/LEGO1/mxmusicmanager.h b/LEGO1/mxmusicmanager.h new file mode 100644 index 00000000..23134708 --- /dev/null +++ b/LEGO1/mxmusicmanager.h @@ -0,0 +1,9 @@ +#ifndef MXMUSICMANAGER_H +#define MXMUSICMANAGER_H + +class MxMusicManager +{ + +}; + +#endif // MXMUSICMANAGER_H diff --git a/LEGO1/mxnotificationmanager.h b/LEGO1/mxnotificationmanager.h new file mode 100644 index 00000000..afa378e1 --- /dev/null +++ b/LEGO1/mxnotificationmanager.h @@ -0,0 +1,9 @@ +#ifndef MXNOTIFICATIONMANAGER_H +#define MXNOTIFICATIONMANAGER_H + +class MxNotificationManager +{ + +}; + +#endif // MXNOTIFICATIONMANAGER_H diff --git a/LEGO1/mxobjectfactory.h b/LEGO1/mxobjectfactory.h new file mode 100644 index 00000000..ad341edd --- /dev/null +++ b/LEGO1/mxobjectfactory.h @@ -0,0 +1,9 @@ +#ifndef MXOBJECTFACTORY_H +#define MXOBJECTFACTORY_H + +class MxObjectFactory +{ + +}; + +#endif MXOBJECTFACTORY_H diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 4e808d0c..bd58ee16 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -1,16 +1,25 @@ -#include "mxomni.h" - -// OFFSET: LEGO1 0x100af0c0 -MxResult MxOmni::Create(const MxOmniCreateParam &p) -{ - if (p.CreateFlags().CreateTimer()) - { - MxTimer *timer = new MxTimer(); - this->m_Timer = timer; - - if (timer == NULL) - return FAILURE; - } - - return SUCCESS; -} +#include "mxomni.h" + +// 0x101015b0 +MxOmni* MxOmni::m_instance = NULL; + +// OFFSET: LEGO1 0x100b0680 +MxOmni *MxOmni::GetInstance() +{ + return m_instance; +} + +// OFFSET: LEGO1 0x100af0c0 +MxResult MxOmni::Create(MxOmniCreateParam &p) +{ + if (p.CreateFlags().CreateTimer()) + { + MxTimer *timer = new MxTimer(); + this->m_timer = timer; + + if (timer == NULL) + return FAILURE; + } + + return SUCCESS; +} diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index 5a121323..59c1828a 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -1,12 +1,22 @@ #ifndef MXOMNI_H #define MXOMNI_H -#include "mxresult.h" -#include "mxomnicreateparam.h" +#include "mxcriticalsection.h" +#include "mxeventmanager.h" +#include "mxmusicmanager.h" +#include "mxnotificationmanager.h" +#include "mxobjectfactory.h" #include "mxomnicreateflags.h" +#include "mxomnicreateparam.h" +#include "mxresult.h" +#include "mxsoundmanager.h" +#include "mxstreamer.h" +#include "mxticklemanager.h" #include "mxtimer.h" +#include "mxvariabletable.h" +#include "mxvideomanager.h" -class MxOmni +class MxOmni : public MxCore { public: __declspec(dllexport) static void DestroyInstance(); @@ -18,13 +28,37 @@ class MxOmni __declspec(dllexport) static void SetHD(const char *s); __declspec(dllexport) static void SetSound3D(unsigned char); - MxResult MxOmni::Create(const MxOmniCreateParam &p); + virtual ~MxOmni(); - MxTimer* GetTimer() const { return this->m_Timer; } + virtual long Notify(MxParam &p); // vtable+04 + virtual void Init(); // vtable+14 + virtual MxResult Create(MxOmniCreateParam &p); // vtable+18 + virtual void Destroy(); // vtable+1c + + MxTimer* GetTimer() const { return this->m_timer; } + +protected: + static MxOmni* m_instance; + + MxString m_mediaPath; // 0x8 + HWND *m_windowHandle; // 0x18; + MxObjectFactory *m_objectFactory; // 0x1C + MxVariableTable* m_variableTable; //0x20 + MxTickleManager* m_tickleManager; //0x24 + MxNotificationManager* m_notificationManager; //0x28 + MxVideoManager *m_videoManager; //0x2C + MxSoundManager* m_soundManager; //0x30 + MxMusicManager* m_musicManager; //0x34 + MxEventManager* m_eventManager; //0x38 + MxTimer* m_timer; //0x3C + MxStreamer* m_streamer; //0x40 + + char unknown44[0x4]; // 0x44 + + MxCriticalSection m_criticalsection; // 0x48 + + char unknown64[0x4]; // 0x64 -private: - char padding[0x3c]; - MxTimer* m_Timer; }; #endif // MXOMNI_H diff --git a/LEGO1/mxsoundmanager.h b/LEGO1/mxsoundmanager.h new file mode 100644 index 00000000..7c0b0cf1 --- /dev/null +++ b/LEGO1/mxsoundmanager.h @@ -0,0 +1,9 @@ +#ifndef MXSOUNDMANAGER_H +#define MXSOUNDMANAGER_H + +class MxSoundManager +{ + +}; + +#endif // MXSOUNDMANAGER_H diff --git a/LEGO1/mxstreamcontroller.h b/LEGO1/mxstreamcontroller.h index d98699cd..dba24176 100644 --- a/LEGO1/mxstreamcontroller.h +++ b/LEGO1/mxstreamcontroller.h @@ -1,6 +1,8 @@ #ifndef MXSTREAMCONTROLLER_H #define MXSTREAMCONTROLLER_H +#include "mxatomid.h" + class MxStreamController { public: diff --git a/LEGO1/mxticklemanager.h b/LEGO1/mxticklemanager.h index d39022f7..afcea455 100644 --- a/LEGO1/mxticklemanager.h +++ b/LEGO1/mxticklemanager.h @@ -1,6 +1,8 @@ #ifndef MXTICKLEMANAGER_H #define MXTICKLEMANAGER_H +#include "mxcore.h" + class MxTickleManager : public MxCore { public: