mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
WIP
This commit is contained in:
parent
0ab8ebb770
commit
5ccb522ecc
@ -433,37 +433,48 @@ MxS32 MxDeviceEnumerate::ParseDeviceName(const char* p_deviceId)
|
|||||||
if (num < 0)
|
if (num < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
DeviceHex deviceHex;
|
GUID guid;
|
||||||
memcpy(&deviceHex, hex, sizeof(deviceHex));
|
memcpy(&guid, hex, sizeof(guid));
|
||||||
|
|
||||||
MxS32 result = ProcessDeviceBytes(num, deviceHex);
|
MxS32 result = ProcessDeviceBytes(num, guid);
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return ProcessDeviceBytes(-1, deviceHex);
|
return ProcessDeviceBytes(-1, guid);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009cf20
|
// FUNCTION: LEGO1 0x1009cf20
|
||||||
MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_num, DeviceHex& p_deviceHex)
|
MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_num, GUID& p_guid)
|
||||||
{
|
{
|
||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
MxS32 i = 0;
|
MxS32 i = 0;
|
||||||
MxS32 j = 0;
|
MxS32 j = 0;
|
||||||
DeviceHex deviceHex = p_deviceHex;
|
|
||||||
|
struct GUID4 {
|
||||||
|
MxS32 m_data1;
|
||||||
|
MxS32 m_data2;
|
||||||
|
MxS32 m_data3;
|
||||||
|
MxS32 m_data4;
|
||||||
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(GUID4) == sizeof(GUID), "Equal size");
|
||||||
|
|
||||||
|
GUID4 deviceGuid;
|
||||||
|
memcpy(&deviceGuid, &p_guid, sizeof(GUID4));
|
||||||
|
|
||||||
for (list<MxDeviceEnumerateElement>::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
for (list<MxDeviceEnumerateElement>::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||||
if (p_num >= 0 && p_num < i)
|
if (p_num >= 0 && p_num < i)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
GUID4 compareGuid;
|
||||||
MxDeviceEnumerateElement& elem = *it;
|
MxDeviceEnumerateElement& elem = *it;
|
||||||
for (list<MxDevice>::iterator it2 = elem.m_devices.begin(); it2 != elem.m_devices.end(); it2++) {
|
for (list<MxDevice>::iterator it2 = elem.m_devices.begin(); it2 != elem.m_devices.end(); it2++) {
|
||||||
DeviceHex guidHex;
|
memcpy(&compareGuid, (*it2).m_guid, sizeof(GUID4));
|
||||||
memcpy(&guidHex, (*it2).m_guid, sizeof(GUID));
|
|
||||||
|
|
||||||
if (deviceHex.hex1 == guidHex.hex1 && deviceHex.hex2 == guidHex.hex2 && deviceHex.hex3 == guidHex.hex3 &&
|
if (compareGuid.m_data1 == deviceGuid.m_data1 && compareGuid.m_data2 == deviceGuid.m_data2 &&
|
||||||
deviceHex.hex4 == guidHex.hex4 && i == p_num)
|
compareGuid.m_data3 == deviceGuid.m_data3 && compareGuid.m_data4 == deviceGuid.m_data4 && i == p_num)
|
||||||
return j;
|
return j;
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
|
|||||||
@ -150,13 +150,6 @@ struct MxDeviceEnumerateElement {
|
|||||||
// SIZE 0x14
|
// SIZE 0x14
|
||||||
class MxDeviceEnumerate {
|
class MxDeviceEnumerate {
|
||||||
public:
|
public:
|
||||||
struct DeviceHex {
|
|
||||||
MxS32 hex1;
|
|
||||||
MxS32 hex2;
|
|
||||||
MxS32 hex3;
|
|
||||||
MxS32 hex4;
|
|
||||||
};
|
|
||||||
|
|
||||||
MxDeviceEnumerate();
|
MxDeviceEnumerate();
|
||||||
// FUNCTION: LEGO1 0x1009c010
|
// FUNCTION: LEGO1 0x1009c010
|
||||||
~MxDeviceEnumerate() {}
|
~MxDeviceEnumerate() {}
|
||||||
@ -174,7 +167,7 @@ class MxDeviceEnumerate {
|
|||||||
);
|
);
|
||||||
const char* EnumerateErrorToString(HRESULT p_error);
|
const char* EnumerateErrorToString(HRESULT p_error);
|
||||||
MxS32 ParseDeviceName(const char* p_deviceId);
|
MxS32 ParseDeviceName(const char* p_deviceId);
|
||||||
MxS32 ProcessDeviceBytes(MxS32 p_num, DeviceHex& p_deviceHex);
|
MxS32 ProcessDeviceBytes(MxS32 p_num, GUID& p_guid);
|
||||||
MxResult FUN_1009d030(MxS32 p_und1, undefined** p_und2, undefined** p_und3);
|
MxResult FUN_1009d030(MxS32 p_und1, undefined** p_und2, undefined** p_und3);
|
||||||
MxResult FUN_1009d0d0();
|
MxResult FUN_1009d0d0();
|
||||||
MxResult FUN_1009d210();
|
MxResult FUN_1009d210();
|
||||||
|
|||||||
@ -21,8 +21,9 @@
|
|||||||
// We use `override` so newer compilers can tell us our vtables are valid,
|
// We use `override` so newer compilers can tell us our vtables are valid,
|
||||||
// however this keyword was added in C++11, so we define it as empty for
|
// however this keyword was added in C++11, so we define it as empty for
|
||||||
// compatibility with older compilers.
|
// compatibility with older compilers.
|
||||||
#if defined(_MSC_VER) && _MSC_VER <= 1200 // 1200 corresponds to VC6.0 but "override" was probably added even later
|
#if __cplusplus < 201103L
|
||||||
#define override
|
#define override
|
||||||
|
#define static_assert(expr, msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // COMPAT_H
|
#endif // COMPAT_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user