Implement/match display mode enumeration (#396)

* Implement/match display mode enumeration

* Improve match of EnumDirectDrawCallback

* Fix annotations
This commit is contained in:
Christian Semmler
2024-01-03 12:12:17 -05:00
committed by GitHub
parent 31a5562034
commit 106dd7cebc
2 changed files with 44 additions and 27 deletions

View File

@@ -5,7 +5,7 @@
DECOMP_SIZE_ASSERT(MxDeviceModeFinder, 0xe4);
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
DECOMP_SIZE_ASSERT(MxDeviceEnumerate0x178Element, 0x1a4);
DECOMP_SIZE_ASSERT(MxDeviceEnumerate0x184Element, 0x0c);
DECOMP_SIZE_ASSERT(MxDeviceDisplayMode, 0x0c);
DECOMP_SIZE_ASSERT(MxDeviceEnumerateElement, 0x190);
DECOMP_SIZE_ASSERT(MxDeviceEnumerate, 0x14);
@@ -218,8 +218,8 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
device.m_driverName = NULL;
memset(&device.m_ddCaps, 0, sizeof(device.m_ddCaps));
LPDIRECTDRAW lpDD = NULL;
LPDIRECT3D2 lpDirect3d2 = NULL;
LPDIRECTDRAW lpDD = NULL;
MxDeviceEnumerateElement& newDevice = m_list.back();
HRESULT result = DirectDrawCreate(newDevice.m_guid, &lpDD, NULL);
@@ -273,14 +273,15 @@ void MxDeviceEnumerate::BuildErrorString(const char* p_format, ...)
OutputDebugString(buf);
}
// STUB: LEGO1 0x1009c4f0
HRESULT CALLBACK DisplayModesEnumerateCallback(LPDDSURFACEDESC, LPVOID)
// FUNCTION: LEGO1 0x1009c4f0
HRESULT CALLBACK MxDeviceEnumerate::DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_context)
{
return TRUE;
MxDeviceEnumerate* deviceEnumerate = (MxDeviceEnumerate*) p_context;
return deviceEnumerate->EnumDisplayModesCallback(p_ddsd);
}
// STUB: LEGO1 0x1009c510
HRESULT CALLBACK DevicesEnumerateCallback(
HRESULT CALLBACK MxDeviceEnumerate::DevicesEnumerateCallback(
LPGUID p_lpGuid,
LPSTR p_lpDeviceDescription,
LPSTR p_lpDeviceName,
@@ -292,6 +293,18 @@ HRESULT CALLBACK DevicesEnumerateCallback(
return TRUE;
}
// FUNCTION: LEGO1 0x1009c540
HRESULT MxDeviceEnumerate::EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd)
{
MxDeviceDisplayMode displayMode;
displayMode.m_width = p_ddsd->dwWidth;
displayMode.m_height = p_ddsd->dwHeight;
displayMode.m_bitsPerPixel = p_ddsd->ddpfPixelFormat.dwRGBBitCount;
m_list.back().m_displayModes.push_back(displayMode);
return DDENUMRET_OK;
}
// FUNCTION: LEGO1 0x1009c6c0
MxResult MxDeviceEnumerate::DoEnumerate()
{
@@ -309,7 +322,8 @@ MxResult MxDeviceEnumerate::DoEnumerate()
}
// FUNCTION: LEGO1 0x1009c710
BOOL CALLBACK DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context)
BOOL CALLBACK
MxDeviceEnumerate::DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context)
{
MxDeviceEnumerate* deviceEnumerate = (MxDeviceEnumerate*) p_context;
return deviceEnumerate->EnumDirectDrawCallback(p_guid, p_driverDesc, p_driverName);