From 727c748ecdb09e2990e55d8bd5015b487f935ad3 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 16 Oct 2023 19:20:52 -0400 Subject: [PATCH] Implement/match MxVideoManager::InvalidateRect and UpdateRegion (#214) * Implement/match MxVideoManager::InvalidateRect and UpdateRegion * Update comment --- LEGO1/mxregion.cpp | 5 +++-- LEGO1/mxregion.h | 14 ++++++++------ LEGO1/mxvideomanager.cpp | 37 +++++++++++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/LEGO1/mxregion.cpp b/LEGO1/mxregion.cpp index 8b275e24..d16a1504 100644 --- a/LEGO1/mxregion.cpp +++ b/LEGO1/mxregion.cpp @@ -21,7 +21,7 @@ void MxRegion::Reset() } // OFFSET: LEGO1 0x100c3750 STUB -void MxRegion::vtable18() +void MxRegion::vtable18(MxRect32 &p_rect) { // TODO } @@ -33,7 +33,8 @@ void MxRegion::vtable1c() } // OFFSET: LEGO1 0x100c3660 STUB -void MxRegion::vtable20() +MxBool MxRegion::vtable20() { // TODO + return FALSE; } \ No newline at end of file diff --git a/LEGO1/mxregion.h b/LEGO1/mxregion.h index 92493c32..f68139a0 100644 --- a/LEGO1/mxregion.h +++ b/LEGO1/mxregion.h @@ -2,6 +2,7 @@ #define MXREGION_H #include "mxcore.h" +#include "mxrect32.h" #include "decomp.h" // VTABLE 0x100dcae8 @@ -13,16 +14,17 @@ public: virtual ~MxRegion() override; virtual void Reset(); - virtual void vtable18(); + virtual void vtable18(MxRect32 &p_rect); virtual void vtable1c(); - virtual void vtable20(); + virtual MxBool vtable20(); + + inline MxRect32 &GetRect() { return this->m_rect; } private: // A container (probably MxList) holding MxRect32 - // MxList *m_rects; - // 4 coordinates (could be MxRect32) - // MxS32 left, top, right, bottom; - undefined pad[0x14]; + // MxList *m_rects; + undefined4 m_unk08; + MxRect32 m_rect; }; #endif // MXREGION_H diff --git a/LEGO1/mxvideomanager.cpp b/LEGO1/mxvideomanager.cpp index 3581add8..d0945178 100644 --- a/LEGO1/mxvideomanager.cpp +++ b/LEGO1/mxvideomanager.cpp @@ -120,10 +120,34 @@ void MxVideoManager::SortPresenterList() } } -// OFFSET: LEGO1 0x100be3e0 STUB +// OFFSET: LEGO1 0x100be3e0 void MxVideoManager::UpdateRegion() { - // TODO + if (m_region->vtable20() == FALSE) { + MxS32 left, top, right, bottom; + MxRect32 ®ionRect = m_region->GetRect(); + + left = m_videoParam.GetRect().m_left; + if (left <= regionRect.m_left) + left = regionRect.m_left; + + top = regionRect.m_top; + if (top <= m_videoParam.GetRect().m_top) + top = m_videoParam.GetRect().m_top; + + right = regionRect.m_right; + if (right >= m_videoParam.GetRect().m_right) + right = m_videoParam.GetRect().m_right; + + bottom = m_videoParam.GetRect().m_bottom; + if (bottom >= regionRect.m_bottom) + bottom = regionRect.m_bottom; + + m_displaySurface->Display( + left, top, left, top, + right - left + 1, bottom - top + 1 + ); + } } // OFFSET: LEGO1 0x100bea50 @@ -132,10 +156,15 @@ void MxVideoManager::Destroy() Destroy(FALSE); } -// OFFSET: LEGO1 0x100bea60 STUB +// OFFSET: LEGO1 0x100bea60 void MxVideoManager::InvalidateRect(MxRect32 &p_rect) { - // TODO + m_criticalSection.Enter(); + + if (m_region) + m_region->vtable18(p_rect); + + m_criticalSection.Leave(); } // OFFSET: LEGO1 0x100bebe0