Implement LegoVideoManager::DrawFPS (#1243)

* Implement LegoVideoManager::DrawFPS

* Implement MxDisplaySurface::FUN_100bc8b0

* Match functions

* type

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Anonymous Maarten
2024-12-20 17:05:40 +01:00
committed by GitHub
parent 7ed2ac9ccc
commit 6f3f8c2ade
3 changed files with 158 additions and 3 deletions

View File

@@ -109,6 +109,8 @@ public:
MxU8 p_bpp
);
LPDIRECTDRAWSURFACE FUN_100bc8b0(MxS32 width, MxS32 height);
private:
MxU8 CountTotalBitsSetTo1(MxU32 p_param);
MxU8 CountContiguousBitsSetTo1(MxU32 p_param);

View File

@@ -1092,3 +1092,39 @@ MxBool MxDisplaySurface::VTable0x2c(
{
return 0;
}
// FUNCTION: LEGO1 0x100bc8b0
LPDIRECTDRAWSURFACE MxDisplaySurface::FUN_100bc8b0(MxS32 width, MxS32 height)
{
LPDIRECTDRAWSURFACE surface = NULL;
LPDIRECTDRAW ddraw = MVideoManager()->GetDirectDraw();
MxVideoParam& unused = MVideoManager()->GetVideoParam();
DDSURFACEDESC surfaceDesc;
memset(&surfaceDesc, 0, sizeof(surfaceDesc));
surfaceDesc.dwSize = sizeof(surfaceDesc);
if (ddraw->GetDisplayMode(&surfaceDesc) != DD_OK) {
return NULL;
}
if (surfaceDesc.ddpfPixelFormat.dwRGBBitCount != 16) {
return NULL;
}
surfaceDesc.dwWidth = width;
surfaceDesc.dwHeight = height;
surfaceDesc.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
surfaceDesc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN;
if (ddraw->CreateSurface(&surfaceDesc, &surface, NULL) != DD_OK) {
surfaceDesc.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
surfaceDesc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
if (ddraw->CreateSurface(&surfaceDesc, &surface, NULL) != DD_OK) {
return NULL;
}
}
return surface;
}