mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 02:31:15 +00:00
Implement/match most remaining MxDirect3D device enumeration functions
This commit is contained in:
parent
29facdf35f
commit
7c6af73418
@ -57,7 +57,7 @@ MxResult LegoVideoManager::CreateDirect3D()
|
||||
MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
{
|
||||
MxBool paletteCreated = FALSE;
|
||||
MxDeviceEnumerateElement* deviceEnumerate = NULL;
|
||||
MxDriver* driver = NULL;
|
||||
MxDevice* device = NULL;
|
||||
MxResult result = FAILURE;
|
||||
|
||||
@ -91,7 +91,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
if (p_videoParam.GetDeviceName()) {
|
||||
deviceNum = deviceEnumerator.ParseDeviceName(p_videoParam.GetDeviceName());
|
||||
if (deviceNum >= 0) {
|
||||
if ((deviceNum = deviceEnumerator.GetDevice(deviceNum, deviceEnumerate, device)) != SUCCESS)
|
||||
if ((deviceNum = deviceEnumerator.GetDevice(deviceNum, driver, device)) != SUCCESS)
|
||||
deviceNum = -1;
|
||||
}
|
||||
}
|
||||
@ -99,12 +99,12 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
if (deviceNum < 0) {
|
||||
deviceEnumerator.FUN_1009d210();
|
||||
deviceNum = deviceEnumerator.FUN_1009d0d0();
|
||||
deviceEnumerator.GetDevice(deviceNum, deviceEnumerate, device);
|
||||
deviceEnumerator.GetDevice(deviceNum, driver, device);
|
||||
}
|
||||
|
||||
m_direct3d->FUN_1009b5f0(deviceEnumerator, deviceEnumerate, device);
|
||||
m_direct3d->FUN_1009b5f0(deviceEnumerator, driver, device);
|
||||
|
||||
if (!deviceEnumerate->m_ddCaps.dwCaps2 && deviceEnumerate->m_ddCaps.dwSVBRops[7] != 2)
|
||||
if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2)
|
||||
p_videoParam.Flags().SetF2bit0(TRUE);
|
||||
else
|
||||
p_videoParam.Flags().SetF2bit0(FALSE);
|
||||
|
||||
@ -6,7 +6,7 @@ DECOMP_SIZE_ASSERT(MxDeviceModeFinder, 0xe4);
|
||||
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
|
||||
DECOMP_SIZE_ASSERT(MxDevice, 0x1a4);
|
||||
DECOMP_SIZE_ASSERT(MxDisplayMode, 0x0c);
|
||||
DECOMP_SIZE_ASSERT(MxDeviceEnumerateElement, 0x190);
|
||||
DECOMP_SIZE_ASSERT(MxDriver, 0x190);
|
||||
DECOMP_SIZE_ASSERT(MxDeviceEnumerate, 0x14);
|
||||
|
||||
// FUNCTION: LEGO1 0x1009b0a0
|
||||
@ -126,11 +126,7 @@ BOOL MxDirect3D::D3DSetMode()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1009b5f0
|
||||
BOOL MxDirect3D::FUN_1009b5f0(
|
||||
MxDeviceEnumerate& p_deviceEnumerator,
|
||||
MxDeviceEnumerateElement* p_deviceEnumerate,
|
||||
MxDevice* p_device
|
||||
)
|
||||
BOOL MxDirect3D::FUN_1009b5f0(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -151,7 +147,7 @@ MxDeviceModeFinder::~MxDeviceModeFinder()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009ba80
|
||||
MxDeviceEnumerateElement::MxDeviceEnumerateElement(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
|
||||
MxDriver::MxDriver(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
|
||||
{
|
||||
m_guid = NULL;
|
||||
m_driverDesc = NULL;
|
||||
@ -162,7 +158,7 @@ MxDeviceEnumerateElement::MxDeviceEnumerateElement(LPGUID p_guid, LPSTR p_driver
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009bb80
|
||||
MxDeviceEnumerateElement::~MxDeviceEnumerateElement()
|
||||
MxDriver::~MxDriver()
|
||||
{
|
||||
if (m_guid)
|
||||
delete m_guid;
|
||||
@ -173,7 +169,7 @@ MxDeviceEnumerateElement::~MxDeviceEnumerateElement()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009bc30
|
||||
void MxDeviceEnumerateElement::Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
|
||||
void MxDriver::Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
|
||||
{
|
||||
if (m_driverDesc) {
|
||||
delete[] m_driverDesc;
|
||||
@ -276,7 +272,7 @@ MxDeviceEnumerate::MxDeviceEnumerate()
|
||||
// FUNCTION: LEGO1 0x1009c070
|
||||
BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
|
||||
{
|
||||
MxDeviceEnumerateElement device(p_guid, p_driverDesc, p_driverName);
|
||||
MxDriver device(p_guid, p_driverDesc, p_driverName);
|
||||
m_list.push_back(device);
|
||||
|
||||
// Must be zeroed because held resources are copied by pointer only
|
||||
@ -288,7 +284,7 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
|
||||
|
||||
LPDIRECT3D2 lpDirect3d2 = NULL;
|
||||
LPDIRECTDRAW lpDD = NULL;
|
||||
MxDeviceEnumerateElement& newDevice = m_list.back();
|
||||
MxDriver& newDevice = m_list.back();
|
||||
HRESULT result = DirectDrawCreate(newDevice.m_guid, &lpDD, NULL);
|
||||
|
||||
if (result != DD_OK)
|
||||
@ -468,12 +464,12 @@ MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid)
|
||||
GUID4 deviceGuid;
|
||||
memcpy(&deviceGuid, &p_guid, sizeof(GUID4));
|
||||
|
||||
for (list<MxDeviceEnumerateElement>::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
if (p_deviceNum >= 0 && p_deviceNum < i)
|
||||
return -1;
|
||||
|
||||
GUID4 compareGuid;
|
||||
MxDeviceEnumerateElement& deviceEnumerate = *it;
|
||||
MxDriver& deviceEnumerate = *it;
|
||||
for (list<MxDevice>::iterator it2 = deviceEnumerate.m_devices.begin(); it2 != deviceEnumerate.m_devices.end();
|
||||
it2++) {
|
||||
memcpy(&compareGuid, (*it2).m_guid, sizeof(GUID4));
|
||||
@ -493,21 +489,15 @@ MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009d030
|
||||
MxResult MxDeviceEnumerate::GetDevice(
|
||||
MxS32 p_deviceNum,
|
||||
MxDeviceEnumerateElement*& p_deviceEnumerate,
|
||||
MxDevice*& p_device
|
||||
)
|
||||
MxResult MxDeviceEnumerate::GetDevice(MxS32 p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device)
|
||||
{
|
||||
if (p_deviceNum >= 0 && m_initialized) {
|
||||
MxS32 i = 0;
|
||||
|
||||
for (list<MxDeviceEnumerateElement>::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
p_deviceEnumerate = &*it;
|
||||
for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||
p_driver = &*it;
|
||||
|
||||
for (list<MxDevice>::iterator it2 = p_deviceEnumerate->m_devices.begin();
|
||||
it2 != p_deviceEnumerate->m_devices.end();
|
||||
it2++) {
|
||||
for (list<MxDevice>::iterator it2 = p_driver->m_devices.begin(); it2 != p_driver->m_devices.end(); it2++) {
|
||||
if (i == p_deviceNum) {
|
||||
p_device = &*it2;
|
||||
return SUCCESS;
|
||||
@ -536,7 +526,7 @@ MxS32 MxDeviceEnumerate::FUN_1009d0d0()
|
||||
MxS32 k = -1;
|
||||
MxU32 und = FUN_1009d1a0();
|
||||
|
||||
for (list<MxDeviceEnumerateElement>::iterator it = m_list.begin();; it++) {
|
||||
for (list<MxDriver>::iterator it = m_list.begin();; it++) {
|
||||
if (it == m_list.end())
|
||||
return k;
|
||||
|
||||
@ -575,8 +565,8 @@ MxResult MxDeviceEnumerate::FUN_1009d210()
|
||||
if (!m_initialized)
|
||||
return FAILURE;
|
||||
|
||||
for (list<MxDeviceEnumerateElement>::iterator it = m_list.begin(); it != m_list.end();) {
|
||||
MxDeviceEnumerateElement& deviceEnumerate = *it;
|
||||
for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end();) {
|
||||
MxDriver& deviceEnumerate = *it;
|
||||
|
||||
if (!FUN_1009d370(deviceEnumerate))
|
||||
m_list.erase(it++);
|
||||
@ -602,10 +592,9 @@ MxResult MxDeviceEnumerate::FUN_1009d210()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1009d370
|
||||
MxBool MxDeviceEnumerate::FUN_1009d370(MxDeviceEnumerateElement& p_deviceEnumerate)
|
||||
MxBool MxDeviceEnumerate::FUN_1009d370(MxDriver& p_driver)
|
||||
{
|
||||
for (list<MxDisplayMode>::iterator it = p_deviceEnumerate.m_displayModes.begin();
|
||||
it != p_deviceEnumerate.m_displayModes.end();
|
||||
for (list<MxDisplayMode>::iterator it = p_driver.m_displayModes.begin(); it != p_driver.m_displayModes.end();
|
||||
it++) {
|
||||
if ((*it).m_width == 640 && (*it).m_height == 480) {
|
||||
if ((*it).m_bitsPerPixel == 8 || (*it).m_bitsPerPixel == 16)
|
||||
|
||||
@ -19,7 +19,7 @@ class MxDeviceModeFinder {
|
||||
};
|
||||
|
||||
class MxDeviceEnumerate;
|
||||
struct MxDeviceEnumerateElement;
|
||||
struct MxDriver;
|
||||
struct MxDevice;
|
||||
|
||||
// VTABLE: LEGO1 0x100db800
|
||||
@ -45,11 +45,7 @@ class MxDirect3D : public MxDirectDraw {
|
||||
|
||||
BOOL CreateIDirect3D();
|
||||
BOOL D3DSetMode();
|
||||
BOOL FUN_1009b5f0(
|
||||
MxDeviceEnumerate& p_deviceEnumerator,
|
||||
MxDeviceEnumerateElement* p_deviceEnumerate,
|
||||
MxDevice* p_device
|
||||
);
|
||||
BOOL FUN_1009b5f0(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device);
|
||||
|
||||
inline MxDeviceModeFinder* GetDeviceModeFinder() { return this->m_pDeviceModeFinder; };
|
||||
inline IDirect3D* GetDirect3D() { return this->m_pDirect3d; }
|
||||
@ -104,10 +100,10 @@ struct MxDisplayMode {
|
||||
};
|
||||
|
||||
// SIZE 0x190
|
||||
struct MxDeviceEnumerateElement {
|
||||
MxDeviceEnumerateElement() {}
|
||||
~MxDeviceEnumerateElement();
|
||||
MxDeviceEnumerateElement(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
||||
struct MxDriver {
|
||||
MxDriver() {}
|
||||
~MxDriver();
|
||||
MxDriver(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
||||
|
||||
void Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
||||
|
||||
@ -118,8 +114,8 @@ struct MxDeviceEnumerateElement {
|
||||
list<MxDevice> m_devices; // 0x178
|
||||
list<MxDisplayMode> m_displayModes; // 0x184
|
||||
|
||||
MxBool operator==(MxDeviceEnumerateElement) const { return TRUE; }
|
||||
MxBool operator<(MxDeviceEnumerateElement) const { return TRUE; }
|
||||
MxBool operator==(MxDriver) const { return TRUE; }
|
||||
MxBool operator<(MxDriver) const { return TRUE; }
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
@ -140,20 +136,20 @@ struct MxDeviceEnumerateElement {
|
||||
|
||||
// clang-format off
|
||||
// TEMPLATE: LEGO1 0x1009bf50
|
||||
// list<MxDeviceEnumerateElement,allocator<MxDeviceEnumerateElement> >::~list<MxDeviceEnumerateElement,allocator<MxDeviceEnumerateElement> >
|
||||
// list<MxDriver,allocator<MxDriver> >::~list<MxDriver,allocator<MxDriver> >
|
||||
// clang-format on
|
||||
|
||||
// TEMPLATE: LEGO1 0x1009bfc0
|
||||
// List<MxDeviceEnumerateElement>::~List<MxDeviceEnumerateElement>
|
||||
// List<MxDriver>::~List<MxDriver>
|
||||
|
||||
// Compiler-generated copy ctor
|
||||
// Part of this function are two more synthetic sub-routines,
|
||||
// LEGO1 0x1009c400 and LEGO1 0x1009c460
|
||||
// SYNTHETIC: LEGO1 0x1009c290
|
||||
// MxDeviceEnumerateElement::MxDeviceEnumerateElement
|
||||
// MxDriver::MxDriver
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1009d450
|
||||
// MxDeviceEnumerateElement::`scalar deleting destructor'
|
||||
// MxDriver::`scalar deleting destructor'
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1009d470
|
||||
// MxDevice::`scalar deleting destructor'
|
||||
@ -180,10 +176,10 @@ class MxDeviceEnumerate {
|
||||
const char* EnumerateErrorToString(HRESULT p_error);
|
||||
MxS32 ParseDeviceName(const char* p_deviceId);
|
||||
MxS32 ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid);
|
||||
MxResult GetDevice(MxS32 p_deviceNum, MxDeviceEnumerateElement*& p_deviceEnumerate, MxDevice*& p_device);
|
||||
MxResult GetDevice(MxS32 p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device);
|
||||
MxS32 FUN_1009d0d0();
|
||||
MxResult FUN_1009d210();
|
||||
MxBool FUN_1009d370(MxDeviceEnumerateElement& p_deviceEnumerate);
|
||||
MxBool FUN_1009d370(MxDriver& p_driver);
|
||||
MxBool FUN_1009d3d0(MxDevice& p_device);
|
||||
|
||||
static void BuildErrorString(const char*, ...);
|
||||
@ -202,8 +198,8 @@ class MxDeviceEnumerate {
|
||||
static undefined4 FUN_1009d1e0();
|
||||
|
||||
private:
|
||||
list<MxDeviceEnumerateElement> m_list; // 0x04
|
||||
MxBool m_initialized; // 0x10
|
||||
list<MxDriver> m_list; // 0x04
|
||||
MxBool m_initialized; // 0x10
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100d9cc8
|
||||
|
||||
Loading…
Reference in New Issue
Block a user