Start MxDisplaySurface::SetPalette()

This commit is contained in:
Joshua Peisach 2023-12-24 16:56:21 -05:00
parent afd24fbe18
commit 8a7d9fbff7
No known key found for this signature in database
GPG Key ID: 41C3D4189AFEDB5A

View File

@ -2,6 +2,7 @@
#include "mxomni.h" #include "mxomni.h"
#include "mxvideomanager.h" #include "mxvideomanager.h"
#include <windows.h>
DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac); DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac);
@ -216,9 +217,30 @@ void MxDisplaySurface::Clear()
this->Reset(); this->Reset();
} }
// STUB: LEGO1 0x100baae0 // FUNCTION: LEGO1 0x100baae0
void MxDisplaySurface::SetPalette(MxPalette* p_palette) void MxDisplaySurface::SetPalette(MxPalette* p_palette)
{ {
HDC hdc;
HPALETTE hpal;
LOGPALETTE lpal;
if((this->m_surfaceDesc).ddpfPixelFormat.dwFlags & 0x20) {
this->m_ddSurface1->SetPalette(p_palette->CreateNativePalette());
this->m_ddSurface2->SetPalette(p_palette->CreateNativePalette());
if(((this->m_videoParam).Flags().GetFlipSurfaces()) == 0) {
lpal.palVersion = 0x300;
lpal.palNumEntries = 256;
// FIXME: this loop
memset(lpal.palPalEntry, lpal.palNumEntries, 0);
hpal = CreatePalette(&lpal);
hdc = ::GetDC(0);
SelectPalette(hdc, hpal, 0);
RealizePalette(hdc);
::ReleaseDC(0, hdc);
DeleteObject(hpal);
}
}
// TODO: Second half of this function
} }
// STUB: LEGO1 0x100bacc0 // STUB: LEGO1 0x100bacc0