From a899b06f5a6d2f8c0c333c3c6a504249169b5fb6 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:35:52 -0400 Subject: [PATCH] implement MxDirect3D::GetZBufferDepth (#402) * GetZBufferDepth * Match --------- Co-authored-by: Christian Semmler --- LEGO1/mxdirect3d.cpp | 22 ++++++++++++++++++++++ LEGO1/mxdirect3d.h | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/LEGO1/mxdirect3d.cpp b/LEGO1/mxdirect3d.cpp index 544252aa..517a9aad 100644 --- a/LEGO1/mxdirect3d.cpp +++ b/LEGO1/mxdirect3d.cpp @@ -122,6 +122,28 @@ BOOL MxDirect3D::D3DSetMode() return TRUE; } +// FUNCTION: LEGO1 0x1009b5a0 +DWORD MxDirect3D::GetZBufferBitDepth(MxAssignedDevice* p_assignedDevice) +{ + DWORD bitDepth; + + if (p_assignedDevice->m_desc.dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) + bitDepth = p_assignedDevice->m_desc.dwDeviceZBufferBitDepth; + else + bitDepth = 0; + + if (bitDepth & DDBD_32) + return 32; + if (bitDepth & DDBD_24) + return 24; + if (bitDepth & DDBD_16) + return 16; + if (bitDepth & DDBD_8) + return 8; + + return -1; +} + // FUNCTION: LEGO1 0x1009b5f0 BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, MxDevice* p_device) { diff --git a/LEGO1/mxdirect3d.h b/LEGO1/mxdirect3d.h index 4877159b..8ad41593 100644 --- a/LEGO1/mxdirect3d.h +++ b/LEGO1/mxdirect3d.h @@ -23,7 +23,7 @@ public: friend class MxDirect3D; -private: +public: GUID m_guid; // 0x00 MxU32 m_flags; // 0x10 D3DDEVICEDESC m_desc; // 0x14 @@ -57,6 +57,7 @@ public: BOOL CreateIDirect3D(); BOOL D3DSetMode(); + DWORD GetZBufferBitDepth(MxAssignedDevice* p_assignedDevice); BOOL SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, MxDevice* p_device); inline MxAssignedDevice* GetAssignedDevice() { return this->m_assignedDevice; };