mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-12-03 12:47:05 -05:00
Implement/match device enumeration (#397)
* Implement/match device enumeration * Update skip
This commit is contained in:
parent
106dd7cebc
commit
5ee268a36c
3 changed files with 160 additions and 35 deletions
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxDeviceModeFinder, 0xe4);
|
DECOMP_SIZE_ASSERT(MxDeviceModeFinder, 0xe4);
|
||||||
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
|
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
|
||||||
DECOMP_SIZE_ASSERT(MxDeviceEnumerate0x178Element, 0x1a4);
|
DECOMP_SIZE_ASSERT(MxDevice, 0x1a4);
|
||||||
DECOMP_SIZE_ASSERT(MxDeviceDisplayMode, 0x0c);
|
DECOMP_SIZE_ASSERT(MxDisplayMode, 0x0c);
|
||||||
DECOMP_SIZE_ASSERT(MxDeviceEnumerateElement, 0x190);
|
DECOMP_SIZE_ASSERT(MxDeviceEnumerateElement, 0x190);
|
||||||
DECOMP_SIZE_ASSERT(MxDeviceEnumerate, 0x14);
|
DECOMP_SIZE_ASSERT(MxDeviceEnumerate, 0x14);
|
||||||
|
|
||||||
|
@ -162,10 +162,8 @@ MxDeviceEnumerateElement::~MxDeviceEnumerateElement()
|
||||||
{
|
{
|
||||||
if (m_guid)
|
if (m_guid)
|
||||||
delete m_guid;
|
delete m_guid;
|
||||||
|
|
||||||
if (m_driverDesc)
|
if (m_driverDesc)
|
||||||
delete[] m_driverDesc;
|
delete[] m_driverDesc;
|
||||||
|
|
||||||
if (m_driverName)
|
if (m_driverName)
|
||||||
delete[] m_driverName;
|
delete[] m_driverName;
|
||||||
}
|
}
|
||||||
|
@ -199,6 +197,72 @@ void MxDeviceEnumerateElement::Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009bd20
|
||||||
|
MxDevice::MxDevice(
|
||||||
|
LPGUID p_guid,
|
||||||
|
LPSTR p_deviceDesc,
|
||||||
|
LPSTR p_deviceName,
|
||||||
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
memset(this, 0, sizeof(*this));
|
||||||
|
|
||||||
|
Init(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009bd60
|
||||||
|
MxDevice::~MxDevice()
|
||||||
|
{
|
||||||
|
if (m_guid)
|
||||||
|
delete m_guid;
|
||||||
|
if (m_deviceDesc)
|
||||||
|
delete[] m_deviceDesc;
|
||||||
|
if (m_deviceName)
|
||||||
|
delete[] m_deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009bda0
|
||||||
|
void MxDevice::Init(
|
||||||
|
LPGUID p_guid,
|
||||||
|
LPSTR p_deviceDesc,
|
||||||
|
LPSTR p_deviceName,
|
||||||
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (m_deviceDesc) {
|
||||||
|
delete[] m_deviceDesc;
|
||||||
|
m_deviceDesc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_deviceName) {
|
||||||
|
delete[] m_deviceName;
|
||||||
|
m_deviceName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_guid) {
|
||||||
|
m_guid = new GUID;
|
||||||
|
memcpy(m_guid, p_guid, sizeof(*m_guid));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_deviceDesc) {
|
||||||
|
m_deviceDesc = new char[strlen(p_deviceDesc) + 1];
|
||||||
|
strcpy(m_deviceDesc, p_deviceDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_deviceName) {
|
||||||
|
m_deviceName = new char[strlen(p_deviceName) + 1];
|
||||||
|
strcpy(m_deviceName, p_deviceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_HWDesc)
|
||||||
|
memcpy(&m_HWDesc, p_HWDesc, sizeof(m_HWDesc));
|
||||||
|
|
||||||
|
if (p_HELDesc)
|
||||||
|
memcpy(&m_HELDesc, p_HELDesc, sizeof(m_HELDesc));
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009bec0
|
// FUNCTION: LEGO1 0x1009bec0
|
||||||
MxDeviceEnumerate::MxDeviceEnumerate()
|
MxDeviceEnumerate::MxDeviceEnumerate()
|
||||||
{
|
{
|
||||||
|
@ -243,7 +307,7 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
|
||||||
if (result != DD_OK)
|
if (result != DD_OK)
|
||||||
BuildErrorString("D3D enum devices failed: %s\n", EnumerateErrorToString(result));
|
BuildErrorString("D3D enum devices failed: %s\n", EnumerateErrorToString(result));
|
||||||
else {
|
else {
|
||||||
if (newDevice.m_unk0x178.empty()) {
|
if (newDevice.m_devices.empty()) {
|
||||||
m_list.pop_back();
|
m_list.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,23 +344,24 @@ HRESULT CALLBACK MxDeviceEnumerate::DisplayModesEnumerateCallback(LPDDSURFACEDES
|
||||||
return deviceEnumerate->EnumDisplayModesCallback(p_ddsd);
|
return deviceEnumerate->EnumDisplayModesCallback(p_ddsd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1009c510
|
// FUNCTION: LEGO1 0x1009c510
|
||||||
HRESULT CALLBACK MxDeviceEnumerate::DevicesEnumerateCallback(
|
HRESULT CALLBACK MxDeviceEnumerate::DevicesEnumerateCallback(
|
||||||
LPGUID p_lpGuid,
|
LPGUID p_guid,
|
||||||
LPSTR p_lpDeviceDescription,
|
LPSTR p_deviceDesc,
|
||||||
LPSTR p_lpDeviceName,
|
LPSTR p_deviceName,
|
||||||
LPD3DDEVICEDESC p_pHWDesc,
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
LPD3DDEVICEDESC p_pHELDesc,
|
LPD3DDEVICEDESC p_HELDesc,
|
||||||
LPVOID p_context
|
LPVOID p_context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return TRUE;
|
MxDeviceEnumerate* deviceEnumerate = (MxDeviceEnumerate*) p_context;
|
||||||
|
return deviceEnumerate->EnumDevicesCallback(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009c540
|
// FUNCTION: LEGO1 0x1009c540
|
||||||
HRESULT MxDeviceEnumerate::EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd)
|
HRESULT MxDeviceEnumerate::EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd)
|
||||||
{
|
{
|
||||||
MxDeviceDisplayMode displayMode;
|
MxDisplayMode displayMode;
|
||||||
displayMode.m_width = p_ddsd->dwWidth;
|
displayMode.m_width = p_ddsd->dwWidth;
|
||||||
displayMode.m_height = p_ddsd->dwHeight;
|
displayMode.m_height = p_ddsd->dwHeight;
|
||||||
displayMode.m_bitsPerPixel = p_ddsd->ddpfPixelFormat.dwRGBBitCount;
|
displayMode.m_bitsPerPixel = p_ddsd->ddpfPixelFormat.dwRGBBitCount;
|
||||||
|
@ -305,6 +370,21 @@ HRESULT MxDeviceEnumerate::EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd)
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009c5d0
|
||||||
|
HRESULT MxDeviceEnumerate::EnumDevicesCallback(
|
||||||
|
LPGUID p_guid,
|
||||||
|
LPSTR p_deviceDesc,
|
||||||
|
LPSTR p_deviceName,
|
||||||
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
MxDevice device(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
||||||
|
m_list.back().m_devices.push_back(device);
|
||||||
|
memset(&device, 0, sizeof(device));
|
||||||
|
return DDENUMRET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009c6c0
|
// FUNCTION: LEGO1 0x1009c6c0
|
||||||
MxResult MxDeviceEnumerate::DoEnumerate()
|
MxResult MxDeviceEnumerate::DoEnumerate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,21 +58,43 @@ class MxDirect3D : public MxDirectDraw {
|
||||||
};
|
};
|
||||||
|
|
||||||
// SIZE 0x1a4
|
// SIZE 0x1a4
|
||||||
struct MxDeviceEnumerate0x178Element {
|
struct MxDevice {
|
||||||
undefined m_unk0x00[0x1a4]; // 0x00
|
MxDevice() {}
|
||||||
|
~MxDevice();
|
||||||
|
MxDevice(
|
||||||
|
LPGUID p_guid,
|
||||||
|
LPSTR p_deviceDesc,
|
||||||
|
LPSTR p_deviceName,
|
||||||
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
|
);
|
||||||
|
|
||||||
MxBool operator==(MxDeviceEnumerate0x178Element) const { return TRUE; }
|
void Init(
|
||||||
MxBool operator<(MxDeviceEnumerate0x178Element) const { return TRUE; }
|
LPGUID p_guid,
|
||||||
|
LPSTR p_deviceDesc,
|
||||||
|
LPSTR p_deviceName,
|
||||||
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
|
);
|
||||||
|
|
||||||
|
LPGUID m_guid; // 0x00
|
||||||
|
char* m_deviceDesc; // 0x04
|
||||||
|
char* m_deviceName; // 0x08
|
||||||
|
D3DDEVICEDESC m_HWDesc; // 0x0c
|
||||||
|
D3DDEVICEDESC m_HELDesc; // 0xd8
|
||||||
|
|
||||||
|
MxBool operator==(MxDevice) const { return TRUE; }
|
||||||
|
MxBool operator<(MxDevice) const { return TRUE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// SIZE 0x0c
|
// SIZE 0x0c
|
||||||
struct MxDeviceDisplayMode {
|
struct MxDisplayMode {
|
||||||
DWORD m_width; // 0x00
|
DWORD m_width; // 0x00
|
||||||
DWORD m_height; // 0x04
|
DWORD m_height; // 0x04
|
||||||
DWORD m_bitsPerPixel; // 0x08
|
DWORD m_bitsPerPixel; // 0x08
|
||||||
|
|
||||||
MxBool operator==(MxDeviceDisplayMode) const { return TRUE; }
|
MxBool operator==(MxDisplayMode) const { return TRUE; }
|
||||||
MxBool operator<(MxDeviceDisplayMode) const { return TRUE; }
|
MxBool operator<(MxDisplayMode) const { return TRUE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// SIZE 0x190
|
// SIZE 0x190
|
||||||
|
@ -87,8 +109,8 @@ struct MxDeviceEnumerateElement {
|
||||||
char* m_driverDesc; // 0x04
|
char* m_driverDesc; // 0x04
|
||||||
char* m_driverName; // 0x08
|
char* m_driverName; // 0x08
|
||||||
DDCAPS m_ddCaps; // 0x0c
|
DDCAPS m_ddCaps; // 0x0c
|
||||||
list<MxDeviceEnumerate0x178Element> m_unk0x178; // 0x178
|
list<MxDevice> m_devices; // 0x178
|
||||||
list<MxDeviceDisplayMode> m_displayModes; // 0x184
|
list<MxDisplayMode> m_displayModes; // 0x184
|
||||||
|
|
||||||
MxBool operator==(MxDeviceEnumerateElement) const { return TRUE; }
|
MxBool operator==(MxDeviceEnumerateElement) const { return TRUE; }
|
||||||
MxBool operator<(MxDeviceEnumerateElement) const { return TRUE; }
|
MxBool operator<(MxDeviceEnumerateElement) const { return TRUE; }
|
||||||
|
@ -96,21 +118,31 @@ struct MxDeviceEnumerateElement {
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// TEMPLATE: LEGO1 0x1009b900
|
// TEMPLATE: LEGO1 0x1009b900
|
||||||
// list<MxDeviceEnumerate0x178Element,allocator<MxDeviceEnumerate0x178Element> >::~list<MxDeviceEnumerate0x178Element,allocator<MxDeviceEnumerate0x178Element> >
|
// list<MxDevice,allocator<MxDevice> >::~list<MxDevice,allocator<MxDevice> >
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// TEMPLATE: LEGO1 0x1009b970
|
// TEMPLATE: LEGO1 0x1009b970
|
||||||
// list<MxDeviceDisplayMode,allocator<MxDeviceDisplayMode> >::~list<MxDeviceDisplayMode,allocator<MxDeviceDisplayMode> >
|
// list<MxDisplayMode,allocator<MxDisplayMode> >::~list<MxDisplayMode,allocator<MxDisplayMode> >
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// TEMPLATE: LEGO1 0x1009b9e0
|
// TEMPLATE: LEGO1 0x1009b9e0
|
||||||
// List<MxDeviceEnumerate0x178Element>::~List<MxDeviceEnumerate0x178Element>
|
// List<MxDevice>::~List<MxDevice>
|
||||||
|
|
||||||
// TEMPLATE: LEGO1 0x1009ba30
|
// TEMPLATE: LEGO1 0x1009ba30
|
||||||
// List<MxDeviceDisplayMode>::~List<MxDeviceDisplayMode>
|
// List<MxDisplayMode>::~List<MxDisplayMode>
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
// TEMPLATE: LEGO1 0x1009bf50
|
||||||
|
// list<MxDeviceEnumerateElement,allocator<MxDeviceEnumerateElement> >::~list<MxDeviceEnumerateElement,allocator<MxDeviceEnumerateElement> >
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
// TEMPLATE: LEGO1 0x1009bfc0
|
||||||
|
// List<MxDeviceEnumerateElement>::~List<MxDeviceEnumerateElement>
|
||||||
|
|
||||||
// Compiler-generated copy ctor
|
// Compiler-generated copy ctor
|
||||||
|
// Part of this function are two more synthetic sub-routines,
|
||||||
|
// LEGO1 0x1009c400 and LEGO1 0x1009c460
|
||||||
// SYNTHETIC: LEGO1 0x1009c290
|
// SYNTHETIC: LEGO1 0x1009c290
|
||||||
// MxDeviceEnumerateElement::MxDeviceEnumerateElement
|
// MxDeviceEnumerateElement::MxDeviceEnumerateElement
|
||||||
|
|
||||||
|
@ -119,11 +151,20 @@ struct MxDeviceEnumerateElement {
|
||||||
class MxDeviceEnumerate {
|
class MxDeviceEnumerate {
|
||||||
public:
|
public:
|
||||||
MxDeviceEnumerate();
|
MxDeviceEnumerate();
|
||||||
|
// FUNCTION: LEGO1 0x1009c010
|
||||||
|
~MxDeviceEnumerate() {}
|
||||||
|
|
||||||
virtual MxResult DoEnumerate(); // vtable+0x00
|
virtual MxResult DoEnumerate(); // vtable+0x00
|
||||||
|
|
||||||
BOOL EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
BOOL EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
||||||
HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd);
|
HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd);
|
||||||
|
HRESULT EnumDevicesCallback(
|
||||||
|
LPGUID p_guid,
|
||||||
|
LPSTR p_deviceDesc,
|
||||||
|
LPSTR p_deviceName,
|
||||||
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
|
);
|
||||||
const char* EnumerateErrorToString(HRESULT p_error);
|
const char* EnumerateErrorToString(HRESULT p_error);
|
||||||
MxS32 ParseDeviceName(const char* p_deviceId);
|
MxS32 ParseDeviceName(const char* p_deviceId);
|
||||||
MxResult FUN_1009d030(MxS32 p_und1, undefined** p_und2, undefined** p_und3);
|
MxResult FUN_1009d030(MxS32 p_und1, undefined** p_und2, undefined** p_und3);
|
||||||
|
@ -135,11 +176,11 @@ class MxDeviceEnumerate {
|
||||||
DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context);
|
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 DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_context);
|
||||||
static HRESULT CALLBACK DevicesEnumerateCallback(
|
static HRESULT CALLBACK DevicesEnumerateCallback(
|
||||||
LPGUID p_lpGuid,
|
LPGUID p_guid,
|
||||||
LPSTR p_lpDeviceDescription,
|
LPSTR p_deviceDesc,
|
||||||
LPSTR p_lpDeviceName,
|
LPSTR p_deviceName,
|
||||||
LPD3DDEVICEDESC p_pHWDesc,
|
LPD3DDEVICEDESC p_HWDesc,
|
||||||
LPD3DDEVICEDESC p_pHELDesc,
|
LPD3DDEVICEDESC p_HELDesc,
|
||||||
LPVOID p_context
|
LPVOID p_context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ GetNoCD_SourceName(): 'DLL exported function'
|
||||||
m_3dView: 'Allow this variable name'
|
m_3dView: 'Allow this variable name'
|
||||||
m_3dManager: 'Allow this variable name'
|
m_3dManager: 'Allow this variable name'
|
||||||
m_16bitPal: 'Allow this variable name'
|
m_16bitPal: 'Allow this variable name'
|
||||||
|
m_HWDesc: 'Allow this variable name'
|
||||||
|
m_HELDesc: 'Allow this variable name'
|
||||||
|
p_HWDesc: 'Allow this variable name'
|
||||||
|
p_HELDesc: 'Allow this variable name'
|
||||||
p_milliseconds: 'Probably a bug with function call'
|
p_milliseconds: 'Probably a bug with function call'
|
||||||
m_increaseAmount: "Can't currently detect member in union"
|
m_increaseAmount: "Can't currently detect member in union"
|
||||||
m_increaseFactor: "Can't currently detect member in union"
|
m_increaseFactor: "Can't currently detect member in union"
|
||||||
|
|
Loading…
Reference in a new issue