mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-02-16 19:50:52 -05:00
Implement/match display mode enumeration (#396)
* Implement/match display mode enumeration * Improve match of EnumDirectDrawCallback * Fix annotations
This commit is contained in:
parent
31a5562034
commit
106dd7cebc
2 changed files with 44 additions and 27 deletions
|
@ -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);
|
||||
|
|
|
@ -66,11 +66,13 @@ struct MxDeviceEnumerate0x178Element {
|
|||
};
|
||||
|
||||
// SIZE 0x0c
|
||||
struct MxDeviceEnumerate0x184Element {
|
||||
undefined m_unk0x00[0x0c]; // 0x00
|
||||
struct MxDeviceDisplayMode {
|
||||
DWORD m_width; // 0x00
|
||||
DWORD m_height; // 0x04
|
||||
DWORD m_bitsPerPixel; // 0x08
|
||||
|
||||
MxBool operator==(MxDeviceEnumerate0x184Element) const { return TRUE; }
|
||||
MxBool operator<(MxDeviceEnumerate0x184Element) const { return TRUE; }
|
||||
MxBool operator==(MxDeviceDisplayMode) const { return TRUE; }
|
||||
MxBool operator<(MxDeviceDisplayMode) const { return TRUE; }
|
||||
};
|
||||
|
||||
// SIZE 0x190
|
||||
|
@ -86,7 +88,7 @@ struct MxDeviceEnumerateElement {
|
|||
char* m_driverName; // 0x08
|
||||
DDCAPS m_ddCaps; // 0x0c
|
||||
list<MxDeviceEnumerate0x178Element> m_unk0x178; // 0x178
|
||||
list<MxDeviceEnumerate0x184Element> m_unk0x184; // 0x184
|
||||
list<MxDeviceDisplayMode> m_displayModes; // 0x184
|
||||
|
||||
MxBool operator==(MxDeviceEnumerateElement) const { return TRUE; }
|
||||
MxBool operator<(MxDeviceEnumerateElement) const { return TRUE; }
|
||||
|
@ -94,19 +96,19 @@ struct MxDeviceEnumerateElement {
|
|||
|
||||
// clang-format off
|
||||
// TEMPLATE: LEGO1 0x1009b900
|
||||
// list<MxDeviceEnumerate0x184Element,allocator<MxDeviceEnumerate0x184Element> >::~list<MxDeviceEnumerate0x184Element,allocator<MxDeviceEnumerate0x184Element> >
|
||||
// list<MxDeviceEnumerate0x178Element,allocator<MxDeviceEnumerate0x178Element> >::~list<MxDeviceEnumerate0x178Element,allocator<MxDeviceEnumerate0x178Element> >
|
||||
// clang-format on
|
||||
|
||||
// clang-format off
|
||||
// TEMPLATE: LEGO1 0x1009b970
|
||||
// list<MxDeviceEnumerate0x178Element,allocator<MxDeviceEnumerate0x178Element> >::~list<MxDeviceEnumerate0x178Element,allocator<MxDeviceEnumerate0x178Element> >
|
||||
// list<MxDeviceDisplayMode,allocator<MxDeviceDisplayMode> >::~list<MxDeviceDisplayMode,allocator<MxDeviceDisplayMode> >
|
||||
// clang-format on
|
||||
|
||||
// TEMPLATE: LEGO1 0x1009b9e0
|
||||
// List<MxDeviceEnumerate0x184Element>::~List<MxDeviceEnumerate0x184Element>
|
||||
// List<MxDeviceEnumerate0x178Element>::~List<MxDeviceEnumerate0x178Element>
|
||||
|
||||
// TEMPLATE: LEGO1 0x1009ba30
|
||||
// List<MxDeviceEnumerate0x178Element>::~List<MxDeviceEnumerate0x178Element>
|
||||
// List<MxDeviceDisplayMode>::~List<MxDeviceDisplayMode>
|
||||
|
||||
// Compiler-generated copy ctor
|
||||
// SYNTHETIC: LEGO1 0x1009c290
|
||||
|
@ -121,6 +123,7 @@ public:
|
|||
virtual MxResult DoEnumerate(); // vtable+0x00
|
||||
|
||||
BOOL EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
||||
HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd);
|
||||
const char* EnumerateErrorToString(HRESULT p_error);
|
||||
MxS32 ParseDeviceName(const char* p_deviceId);
|
||||
MxResult FUN_1009d030(MxS32 p_und1, undefined** p_und2, undefined** p_und3);
|
||||
|
@ -128,23 +131,23 @@ public:
|
|||
MxResult FUN_1009d210();
|
||||
|
||||
static void BuildErrorString(const char*, ...);
|
||||
static BOOL CALLBACK
|
||||
DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context);
|
||||
static HRESULT CALLBACK DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_context);
|
||||
static HRESULT CALLBACK DevicesEnumerateCallback(
|
||||
LPGUID p_lpGuid,
|
||||
LPSTR p_lpDeviceDescription,
|
||||
LPSTR p_lpDeviceName,
|
||||
LPD3DDEVICEDESC p_pHWDesc,
|
||||
LPD3DDEVICEDESC p_pHELDesc,
|
||||
LPVOID p_context
|
||||
);
|
||||
|
||||
private:
|
||||
list<MxDeviceEnumerateElement> m_list; // 0x04
|
||||
MxBool m_unk0x10; // 0x10
|
||||
};
|
||||
|
||||
BOOL CALLBACK DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context);
|
||||
HRESULT CALLBACK DisplayModesEnumerateCallback(LPDDSURFACEDESC, LPVOID);
|
||||
HRESULT CALLBACK DevicesEnumerateCallback(
|
||||
LPGUID p_lpGuid,
|
||||
LPSTR p_lpDeviceDescription,
|
||||
LPSTR p_lpDeviceName,
|
||||
LPD3DDEVICEDESC p_pHWDesc,
|
||||
LPD3DDEVICEDESC p_pHELDesc,
|
||||
LPVOID p_context
|
||||
);
|
||||
|
||||
// VTABLE: LEGO1 0x100d9cc8
|
||||
// SIZE 0x14
|
||||
class MxDeviceEnumerate100d9cc8 : public MxDeviceEnumerate {};
|
||||
|
|
Loading…
Reference in a new issue