isle-portable/LEGO1/mxomni.h
Joshua Peisach f8b1995a83
LEGO1: MxPalette (#56)
* MxPalette - add missing member variables, Detach function

* mb

* MxPalette: give bob the builder his constructor

* push progress, gn

* avoid hexadecimal

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* fix MxPalette::GetDefaultPalette

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* aaaaaaaaaaaaaa

* Revert "fix MxPalette::GetDefaultPalette"

This reverts commit 63f2215737d3bcd286f67dcf1a04fdf8a234d41b.

* Implement MxPalette::Clone (doesn't match)

* fix MxPalette structure and match ctor/dtor

* Matching progress for MxPalette::GetDefaultPalette

* Implement ApplySystemEntriesToPalette except the memcpy calls

* implement SetSkyColor (doesn't match)

* Use MxTypes instead of generics

* prefer decimal values than hex for m_entries

* Update mxpalette.cpp

* Push MxPalette progress - read comments in code.

* improved MxPalette::operator==, will be 100% when MSVC feels like making it so

* improved MxPalette::SetSkyColor, will be 100% when MSVC feels like making it so

* improved MxPalette::Clone, will be 100% when MSVC feels like making it so

* Fixes

- reordered the functions in order of where they are in the hex because recmp.py sometimes kept saying it couldn't find the symbol (??)
- clone returns a pointer, not a ref
- worked a bit on setpalette/applysysentriestopalette

* Match GetDefaultPalette a bit more

* fix: MxPalette::GetDefaultPalette is now 100% matching

* fix: MxPalette::ApplySystemEntriesToPalette is now 100% matching

* tidy: rename `DC` var in GetDefaultPalette to `hdc`

* fix: MxPalette::SetPalette is now functionally matching

Not assembly matching yet because of MSVC weirdness.
At some point it will probably start matching, because
the structure seems to be accurate.

* fix: MxPalette rgbquad ctor functionally matches

Not quite ASM matching yet because of weird
register allocation mismatches.

* fix: I forgot to commit mxpalette.h...

* tidy: use Mx* primitives instead of builtins

* refactor: remove MxPalette::FromBitmapPalette

* fix: call ApplySystemEntriesToPalette from MxPalette(const RGBQUAD *)

* rename MxPalette::SetPalette to MxPalette::SetEntries

* fix: I once again forgot to commit mxpalette.h...

* feat: add/match MxPalette::Reset [0x100BF490]

* fix: add MVideoManager() to mxomni header

* refactor: change unk50 in MxVideoManager to LPDIRECTDRAW

* feat: add/match MxPalette::CreateNativePalette [0x100BF000]

* fix: MxPalette::SetSkyColor is 100% matching

* Annotate MxPalette members' offsets

* Annotate the global default aplette

* use hex size

* remove unnecessary variable offset listing

* Update LEGO1/mxpalette.cpp

---------

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
Co-authored-by: Christian Semmler <mail@csemmler.com>
Co-authored-by: ktkaufman03 <ktkaufman@wpi.edu>
Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com>
2023-07-15 22:51:24 -07:00

82 lines
3 KiB
C++

#ifndef MXOMNI_H
#define MXOMNI_H
#include "mxcriticalsection.h"
#include "mxeventmanager.h"
#include "mxmusicmanager.h"
#include "mxnotificationmanager.h"
#include "mxobjectfactory.h"
#include "mxomnicreateflags.h"
#include "mxomnicreateparam.h"
#include "mxsoundmanager.h"
#include "mxstreamer.h"
#include "mxticklemanager.h"
#include "mxtimer.h"
#include "mxvariabletable.h"
#include "mxvideomanager.h"
// VTABLE 0x100dc168
// SIZE 0x68
class MxOmni : public MxCore
{
public:
__declspec(dllexport) static void DestroyInstance();
__declspec(dllexport) static const char *GetCD();
__declspec(dllexport) static const char *GetHD();
__declspec(dllexport) static MxOmni *GetInstance();
__declspec(dllexport) static MxBool IsSound3D();
__declspec(dllexport) static void SetCD(const char *p_cd);
__declspec(dllexport) static void SetHD(const char *p_hd);
__declspec(dllexport) static void SetSound3D(MxBool p_3dsound);
MxOmni();
virtual ~MxOmni() override;
virtual MxLong Notify(MxParam &p); // vtable+04
virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam &p); // vtable+18
virtual void Destroy(); // vtable+1c
static void SetInstance(MxOmni* instance);
MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }
MxNotificationManager* GetNotificationManager() const { return this->m_notificationManager; }
MxTickleManager* GetTickleManager() const { return this->m_tickleManager; }
MxTimer* GetTimer() const { return this->m_timer; }
MxStreamer* GetStreamer() const { return this->m_streamer; }
MxSoundManager* GetSoundManager() const { return this->m_soundManager; }
MxVideoManager* GetVideoManager() const { return this->m_videoManager; }
MxVariableTable* GetVariableTable() const { return this->m_variableTable; }
MxMusicManager* GetMusicManager() const { return this->m_musicManager; }
MxEventManager* GetEventManager() const { return this->m_eventManager; }
protected:
static MxOmni* g_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
int m_unk44; // 0x44
MxCriticalSection m_criticalsection; // 0x48
unsigned char m_unk64; // 0x64
};
__declspec(dllexport) MxTickleManager * TickleManager();
__declspec(dllexport) MxTimer * Timer();
__declspec(dllexport) MxStreamer * Streamer();
__declspec(dllexport) MxSoundManager * MSoundManager();
__declspec(dllexport) MxVariableTable * VariableTable();
__declspec(dllexport) MxMusicManager * MusicManager();
__declspec(dllexport) MxEventManager * EventManager();
__declspec(dllexport) MxNotificationManager * NotificationManager();
MxVideoManager * MVideoManager();
#endif // MXOMNI_H