diff --git a/LEGO1/legopalettepresenter.cpp b/LEGO1/legopalettepresenter.cpp index 86b99b0a..6b3981a7 100644 --- a/LEGO1/legopalettepresenter.cpp +++ b/LEGO1/legopalettepresenter.cpp @@ -8,14 +8,34 @@ LegoPalettePresenter::LegoPalettePresenter() Init(); } -// OFFSET: LEGO1 0x1007a070 STUB +// OFFSET: LEGO1 0x1007a070 LegoPalettePresenter::~LegoPalettePresenter() { - // TODO + Destroy(TRUE); } // OFFSET: LEGO1 0x1007a0d0 void LegoPalettePresenter::Init() { - this->m_unk64 = 0; + m_palette = NULL; +} + +// OFFSET: LEGO1 0x1007a0e0 +void LegoPalettePresenter::Destroy(MxBool p_fromDestructor) +{ + m_criticalSection.Enter(); + if (m_palette) { + delete m_palette; + } + Init(); + m_criticalSection.Leave(); + if (!p_fromDestructor) { + MxVideoPresenter::Destroy(FALSE); + } +} + +// OFFSET: LEGO1 0x1007a120 +void LegoPalettePresenter::Destroy() +{ + Destroy(FALSE); } diff --git a/LEGO1/legopalettepresenter.h b/LEGO1/legopalettepresenter.h index 7688d0af..9d500e08 100644 --- a/LEGO1/legopalettepresenter.h +++ b/LEGO1/legopalettepresenter.h @@ -2,6 +2,7 @@ #define LEGOPALETTEPRESENTER_H #include "decomp.h" +#include "mxpalette.h" #include "mxvideopresenter.h" // VTABLE 0x100d9aa0 @@ -9,7 +10,7 @@ class LegoPalettePresenter : public MxVideoPresenter { public: LegoPalettePresenter(); - virtual ~LegoPalettePresenter(); // vtable+0x0 + virtual ~LegoPalettePresenter() override; // vtable+0x0 // OFFSET: LEGO1 0x10079f30 inline const char* ClassName() const override // vtable+0xc @@ -24,10 +25,12 @@ class LegoPalettePresenter : public MxVideoPresenter { return !strcmp(name, ClassName()) || MxVideoPresenter::IsA(name); } + virtual void Destroy() override; // vtable+0x38 private: void Init(); + void Destroy(MxBool p_fromDestructor); - undefined4 m_unk64; + MxPalette* m_palette; }; #endif // LEGOPALETTEPRESENTER_H