diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b663cb0..1d1ee26d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,6 +161,7 @@ add_library(lego1 SHARED LEGO1/mxramstreamcontroller.cpp LEGO1/mxramstreamprovider.cpp LEGO1/mxregion.cpp + LEGO1/mxregionlist.cpp LEGO1/mxscheduler.cpp LEGO1/mxsemaphore.cpp LEGO1/mxsmkpresenter.cpp diff --git a/LEGO1/mxregion.cpp b/LEGO1/mxregion.cpp index d16a1504..ac2353ba 100644 --- a/LEGO1/mxregion.cpp +++ b/LEGO1/mxregion.cpp @@ -1,11 +1,24 @@ #include "mxregion.h" +#include + DECOMP_SIZE_ASSERT(MxRegion, 0x1c); -// OFFSET: LEGO1 0x100c31c0 STUB +// OFFSET: LEGO1 0x100c31c0 MxRegion::MxRegion() +{ + m_list = new MxRegionList; + m_rect.m_left = INT_MAX; + m_rect.m_top = INT_MAX; + m_rect.m_right = -1; + m_rect.m_bottom = - 1; +} + +// OFFSET: LEGO1 0x100c3660 STUB +MxBool MxRegion::vtable20() { // TODO + return FALSE; } // OFFSET: LEGO1 0x100c3690 STUB @@ -31,10 +44,3 @@ void MxRegion::vtable1c() { // TODO } - -// OFFSET: LEGO1 0x100c3660 STUB -MxBool MxRegion::vtable20() -{ - // TODO - return FALSE; -} \ No newline at end of file diff --git a/LEGO1/mxregion.h b/LEGO1/mxregion.h index f68139a0..64e4c9e2 100644 --- a/LEGO1/mxregion.h +++ b/LEGO1/mxregion.h @@ -2,9 +2,25 @@ #define MXREGION_H #include "mxcore.h" +#include "mxregionlist.h" #include "mxrect32.h" #include "decomp.h" +// SIZE 0x0c +struct MxRegionTopBottom +{ + MxS32 m_top; + MxS32 m_bottom; + MxRegionLeftRightList *m_leftRightList; +}; + +// SIZE 0x08 +struct MxRegionLeftRight +{ + MxS32 m_left; + MxS32 m_right; +}; + // VTABLE 0x100dcae8 // SIZE 0x1c class MxRegion : public MxCore @@ -21,9 +37,7 @@ public: inline MxRect32 &GetRect() { return this->m_rect; } private: - // A container (probably MxList) holding MxRect32 - // MxList *m_rects; - undefined4 m_unk08; + MxRegionList *m_list; MxRect32 m_rect; }; diff --git a/LEGO1/mxregionlist.cpp b/LEGO1/mxregionlist.cpp new file mode 100644 index 00000000..a25cda73 --- /dev/null +++ b/LEGO1/mxregionlist.cpp @@ -0,0 +1,18 @@ +#include "mxregionlist.h" +#include "mxregion.h" + +// OFFSET: LEGO1 0x100c4e80 +void MxRegionLeftRightListParent::Destroy(MxRegionLeftRight *p_leftRight) +{ + delete p_leftRight; +} + +// OFFSET: LEGO1 0x100c33e0 +void MxRegionListParent::Destroy(MxRegionTopBottom *p_topBottom) +{ + if (p_topBottom) { + if (p_topBottom->m_leftRightList) + delete p_topBottom->m_leftRightList; + delete p_topBottom; + } +} \ No newline at end of file diff --git a/LEGO1/mxregionlist.h b/LEGO1/mxregionlist.h new file mode 100644 index 00000000..1dcc8865 --- /dev/null +++ b/LEGO1/mxregionlist.h @@ -0,0 +1,41 @@ +#ifndef MXREGIONLIST_H +#define MXREGIONLIST_H + +#include "mxlist.h" + +struct MxRegionLeftRight; +struct MxRegionTopBottom; + +// VTABLE 0x100dcc70 +// SIZE 0x18 +class MxRegionLeftRightListParent : public MxList +{ +public: + static void Destroy(MxRegionLeftRight *p_leftRight); + + MxRegionLeftRightListParent() { + m_customDestructor = Destroy; + } +}; + +// VTABLE 0x100dcc88 +// SIZE 0x18 +class MxRegionLeftRightList : public MxRegionLeftRightListParent {}; + +// VTABLE 0x100dcb40 +// SIZE 0x18 +class MxRegionListParent : public MxList +{ +public: + static void Destroy(MxRegionTopBottom *p_topBottom); + + MxRegionListParent() { + m_customDestructor = Destroy; + } +}; + +// VTABLE 0x100dcb58 +// SIZE 0x18 +class MxRegionList : public MxRegionListParent {}; + +#endif // MXREGIONLIST_H