From fa5417f58ab3488f3c7d77b0633110b9fceee8b8 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 21 Jul 2023 21:28:13 -0400 Subject: [PATCH] lego1: match MxVideoManager::RealizePalette (#92) * Match MxVideoManager::RealizePalette * Rename class * Name some functions --- LEGO1/mxdisplaysurface.h | 34 ++++++++++++++++++++++++++++++++++ LEGO1/mxvideomanager.cpp | 8 ++++---- LEGO1/mxvideomanager.h | 3 ++- 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 LEGO1/mxdisplaysurface.h diff --git a/LEGO1/mxdisplaysurface.h b/LEGO1/mxdisplaysurface.h new file mode 100644 index 00000000..9da02fda --- /dev/null +++ b/LEGO1/mxdisplaysurface.h @@ -0,0 +1,34 @@ +#ifndef MXDISPLAYSURFACE_H +#define MXDISPLAYSURFACE_H + +#include + +#include "mxcore.h" +#include "mxpalette.h" +#include "mxvideoparam.h" + +#include "decomp.h" + +// VTABLE 0x100dc768 +class MxDisplaySurface : public MxCore +{ +public: + MxDisplaySurface(); + virtual ~MxDisplaySurface() override; + + virtual MxResult Init(MxVideoParam *p_videoParam, LPDIRECTDRAWSURFACE p_surface1, LPDIRECTDRAWSURFACE p_surface2, LPDIRECTDRAWCLIPPER p_clipper); + virtual MxResult Create(MxVideoParam *p_videoParam); + virtual void Clear(); + virtual void SetPalette(MxPalette *p_palette); + virtual void vtable24(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4); + virtual MxBool vtable28(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4); + virtual MxBool vtable2c(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool); + virtual MxBool vtable30(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, undefined4, MxBool); + virtual undefined4 vtable34(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4); + virtual void Display(undefined4, undefined4, undefined4, undefined4, undefined4, undefined4); + virtual undefined4 vtable3c(undefined4*); + virtual undefined4 vtable40(undefined4); + virtual undefined4 vtable44(undefined4, undefined4*, undefined4, undefined4); +}; + +#endif // MXDISPLAYSURFACE_H diff --git a/LEGO1/mxvideomanager.cpp b/LEGO1/mxvideomanager.cpp index af4995ae..7663743d 100644 --- a/LEGO1/mxvideomanager.cpp +++ b/LEGO1/mxvideomanager.cpp @@ -25,7 +25,7 @@ int MxVideoManager::Init() { this->m_pDirectDraw = NULL; this->m_unk54 = NULL; - this->m_unk58 = NULL; + this->m_displaySurface = NULL; this->m_unk5c = 0; this->m_videoParam.SetPalette(NULL); this->m_unk60 = FALSE; @@ -45,10 +45,10 @@ MxLong MxVideoManager::RealizePalette(MxPalette *p_palette) this->m_criticalSection.Enter(); - if (p_palette && this->m_videoParam.GetPalette()) - { + if (p_palette && this->m_videoParam.GetPalette()) { p_palette->GetEntries(paletteEntries); - // TODO + this->m_videoParam.GetPalette()->SetEntries(paletteEntries); + this->m_displaySurface->SetPalette(this->m_videoParam.GetPalette()); } this->m_criticalSection.Leave(); diff --git a/LEGO1/mxvideomanager.h b/LEGO1/mxvideomanager.h index 2061ec6b..34511885 100644 --- a/LEGO1/mxvideomanager.h +++ b/LEGO1/mxvideomanager.h @@ -2,6 +2,7 @@ #define MXVIDEOMANAGER_H #include "mxunknown100dc6b0.h" +#include "mxdisplaysurface.h" #include "mxvideoparam.h" // VTABLE 0x100dc810 @@ -26,7 +27,7 @@ class MxVideoManager : public MxUnknown100dc6b0 MxVideoParam m_videoParam; LPDIRECTDRAW m_pDirectDraw; LPDIRECTDRAWSURFACE m_unk54; - void* m_unk58; + MxDisplaySurface *m_displaySurface; int m_unk5c; MxBool m_unk60; };