mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 10:41:15 +00:00
WIP
This commit is contained in:
parent
778b0f2108
commit
50541075eb
@ -57,18 +57,18 @@ MxResult LegoVideoManager::CreateDirect3D()
|
|||||||
MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
|
MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyMS, MxBool p_createThread)
|
||||||
{
|
{
|
||||||
MxBool paletteCreated = FALSE;
|
MxBool paletteCreated = FALSE;
|
||||||
undefined* und1 = NULL;
|
MxDeviceEnumerateElement* deviceEnumerate = NULL;
|
||||||
undefined* und2 = NULL;
|
MxDevice* device = NULL;
|
||||||
MxResult result = FAILURE;
|
MxResult result = FAILURE;
|
||||||
|
|
||||||
MxDeviceEnumerate100d9cc8 deviceEnumerate;
|
MxDeviceEnumerate100d9cc8 deviceEnumerator;
|
||||||
Vector3Data posVec(0.0, 1.25, -50.0);
|
Vector3Data posVec(0.0, 1.25, -50.0);
|
||||||
Vector3Data dirVec(0.0, 0.0, 1.0);
|
Vector3Data dirVec(0.0, 0.0, 1.0);
|
||||||
Vector3Data upVec(0.0, 1.0, 0.0);
|
Vector3Data upVec(0.0, 1.0, 0.0);
|
||||||
Matrix4Data outMatrix;
|
Matrix4Data outMatrix;
|
||||||
HWND hwnd = MxOmni::GetInstance()->GetWindowHandle();
|
HWND hwnd = MxOmni::GetInstance()->GetWindowHandle();
|
||||||
MxS32 bits = p_videoParam.Flags().Get16Bit() ? 16 : 8;
|
MxS32 bits = p_videoParam.Flags().Get16Bit() ? 16 : 8;
|
||||||
MxS32 und3 = -1;
|
MxS32 deviceNum = -1;
|
||||||
|
|
||||||
if (!p_videoParam.GetPalette()) {
|
if (!p_videoParam.GetPalette()) {
|
||||||
MxPalette* palette = new MxPalette;
|
MxPalette* palette = new MxPalette;
|
||||||
@ -85,26 +85,26 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
|||||||
if (CreateDirect3D() != SUCCESS)
|
if (CreateDirect3D() != SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (deviceEnumerate.DoEnumerate() != SUCCESS)
|
if (deviceEnumerator.DoEnumerate() != SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (p_videoParam.GetDeviceName()) {
|
if (p_videoParam.GetDeviceName()) {
|
||||||
und3 = deviceEnumerate.ParseDeviceName(p_videoParam.GetDeviceName());
|
deviceNum = deviceEnumerator.ParseDeviceName(p_videoParam.GetDeviceName());
|
||||||
if (und3 >= 0) {
|
if (deviceNum >= 0) {
|
||||||
if ((und3 = deviceEnumerate.FUN_1009d030(und3, &und1, &und2)) != SUCCESS)
|
if ((deviceNum = deviceEnumerator.GetDevice(deviceNum, deviceEnumerate, device)) != SUCCESS)
|
||||||
und3 = -1;
|
deviceNum = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (und3 < 0) {
|
if (deviceNum < 0) {
|
||||||
deviceEnumerate.FUN_1009d210();
|
deviceEnumerator.FUN_1009d210();
|
||||||
und3 = deviceEnumerate.FUN_1009d0d0();
|
deviceNum = deviceEnumerator.FUN_1009d0d0();
|
||||||
deviceEnumerate.FUN_1009d030(und3, &und1, &und2);
|
deviceEnumerator.GetDevice(deviceNum, deviceEnumerate, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_direct3d->FUN_1009b5f0(deviceEnumerate, und1, und2);
|
m_direct3d->FUN_1009b5f0(deviceEnumerator, deviceEnumerate, device);
|
||||||
|
|
||||||
if (!*((MxU32*) &und1[0x14]) && *((MxU32*) &und1[0xe0]) != 2)
|
if (!deviceEnumerate->m_ddCaps.dwCaps2 && deviceEnumerate->m_ddCaps.dwSVBRops[7] != 2)
|
||||||
p_videoParam.Flags().SetF2bit0(TRUE);
|
p_videoParam.Flags().SetF2bit0(TRUE);
|
||||||
else
|
else
|
||||||
p_videoParam.Flags().SetF2bit0(FALSE);
|
p_videoParam.Flags().SetF2bit0(FALSE);
|
||||||
|
|||||||
@ -126,7 +126,11 @@ BOOL MxDirect3D::D3DSetMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1009b5f0
|
// STUB: LEGO1 0x1009b5f0
|
||||||
BOOL MxDirect3D::FUN_1009b5f0(MxDeviceEnumerate& p_deviceEnumerate, undefined* p_und1, undefined* p_und2)
|
BOOL MxDirect3D::FUN_1009b5f0(
|
||||||
|
MxDeviceEnumerate& p_deviceEnumerator,
|
||||||
|
MxDeviceEnumerateElement* p_deviceEnumerate,
|
||||||
|
MxDevice* p_device
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -444,7 +448,7 @@ MxS32 MxDeviceEnumerate::ParseDeviceName(const char* p_deviceId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009cf20
|
// FUNCTION: LEGO1 0x1009cf20
|
||||||
MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_num, GUID& p_guid)
|
MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid)
|
||||||
{
|
{
|
||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
return -1;
|
return -1;
|
||||||
@ -465,7 +469,7 @@ MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_num, GUID& p_guid)
|
|||||||
memcpy(&deviceGuid, &p_guid, sizeof(GUID4));
|
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_deviceNum >= 0 && p_deviceNum < i)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
GUID4 compareGuid;
|
GUID4 compareGuid;
|
||||||
@ -474,7 +478,8 @@ MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_num, GUID& p_guid)
|
|||||||
memcpy(&compareGuid, (*it2).m_guid, sizeof(GUID4));
|
memcpy(&compareGuid, (*it2).m_guid, sizeof(GUID4));
|
||||||
|
|
||||||
if (compareGuid.m_data1 == deviceGuid.m_data1 && compareGuid.m_data2 == deviceGuid.m_data2 &&
|
if (compareGuid.m_data1 == deviceGuid.m_data1 && compareGuid.m_data2 == deviceGuid.m_data2 &&
|
||||||
compareGuid.m_data3 == deviceGuid.m_data3 && compareGuid.m_data4 == deviceGuid.m_data4 && i == p_num)
|
compareGuid.m_data3 == deviceGuid.m_data3 && compareGuid.m_data4 == deviceGuid.m_data4 &&
|
||||||
|
i == p_deviceNum)
|
||||||
return j;
|
return j;
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
@ -486,9 +491,33 @@ MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_num, GUID& p_guid)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1009d030
|
// FUNCTION: LEGO1 0x1009d030
|
||||||
MxResult MxDeviceEnumerate::FUN_1009d030(MxS32 p_und1, undefined** p_und2, undefined** p_und3)
|
MxResult MxDeviceEnumerate::GetDevice(
|
||||||
|
MxS32 p_deviceNum,
|
||||||
|
MxDeviceEnumerateElement*& p_deviceEnumerate,
|
||||||
|
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<MxDevice>::iterator it2 = p_deviceEnumerate->m_devices.begin();
|
||||||
|
it2 != p_deviceEnumerate->m_devices.end();
|
||||||
|
it2++) {
|
||||||
|
if (i == p_deviceNum) {
|
||||||
|
p_device = &*it2;
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,8 +527,54 @@ MxResult MxDeviceEnumerate::FUN_1009d0d0()
|
|||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x1009d210
|
// FUNCTION: LEGO1 0x1009d210
|
||||||
MxResult MxDeviceEnumerate::FUN_1009d210()
|
MxResult MxDeviceEnumerate::FUN_1009d210()
|
||||||
{
|
{
|
||||||
return FAILURE;
|
if (!m_initialized)
|
||||||
|
return FAILURE;
|
||||||
|
|
||||||
|
for (list<MxDeviceEnumerateElement>::iterator it = m_list.begin(); it != m_list.end();) {
|
||||||
|
MxDeviceEnumerateElement& elem = *it;
|
||||||
|
|
||||||
|
if (!FUN_1009d370(elem))
|
||||||
|
m_list.erase(it++);
|
||||||
|
else {
|
||||||
|
for (list<MxDevice>::iterator it2 = elem.m_devices.begin(); it2 != elem.m_devices.end();) {
|
||||||
|
MxDevice& device = *it2;
|
||||||
|
|
||||||
|
if (!FUN_1009d3d0(device))
|
||||||
|
elem.m_devices.erase(it2++);
|
||||||
|
else
|
||||||
|
it2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elem.m_devices.empty())
|
||||||
|
m_list.erase(it++);
|
||||||
|
else
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_list.empty() ? FAILURE : SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION: LEGO1 0x1009d370
|
||||||
|
MxBool MxDeviceEnumerate::FUN_1009d370(MxDeviceEnumerateElement& p_deviceEnumerate)
|
||||||
|
{
|
||||||
|
for (list<MxDisplayMode>::iterator it = p_deviceEnumerate.m_displayModes.begin();
|
||||||
|
it != p_deviceEnumerate.m_displayModes.end();
|
||||||
|
it++) {
|
||||||
|
if ((*it).m_width == 640 && (*it).m_height == 480) {
|
||||||
|
if ((*it).m_bitsPerPixel == 8 || (*it).m_bitsPerPixel == 16)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// STUB: LEGO1 0x1009d3d0
|
||||||
|
MxBool MxDeviceEnumerate::FUN_1009d3d0(MxDevice& p_device)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,8 @@ class MxDeviceModeFinder {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class MxDeviceEnumerate;
|
class MxDeviceEnumerate;
|
||||||
|
struct MxDeviceEnumerateElement;
|
||||||
|
struct MxDevice;
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100db800
|
// VTABLE: LEGO1 0x100db800
|
||||||
// SIZE 0x894
|
// SIZE 0x894
|
||||||
@ -43,7 +45,11 @@ class MxDirect3D : public MxDirectDraw {
|
|||||||
|
|
||||||
BOOL CreateIDirect3D();
|
BOOL CreateIDirect3D();
|
||||||
BOOL D3DSetMode();
|
BOOL D3DSetMode();
|
||||||
BOOL FUN_1009b5f0(MxDeviceEnumerate& p_deviceEnumerate, undefined* p_und1, undefined* p_und2);
|
BOOL FUN_1009b5f0(
|
||||||
|
MxDeviceEnumerate& p_deviceEnumerator,
|
||||||
|
MxDeviceEnumerateElement* p_deviceEnumerate,
|
||||||
|
MxDevice* p_device
|
||||||
|
);
|
||||||
|
|
||||||
inline MxDeviceModeFinder* GetDeviceModeFinder() { return this->m_pDeviceModeFinder; };
|
inline MxDeviceModeFinder* GetDeviceModeFinder() { return this->m_pDeviceModeFinder; };
|
||||||
inline IDirect3D* GetDirect3D() { return this->m_pDirect3d; }
|
inline IDirect3D* GetDirect3D() { return this->m_pDirect3d; }
|
||||||
@ -146,6 +152,12 @@ struct MxDeviceEnumerateElement {
|
|||||||
// SYNTHETIC: LEGO1 0x1009c290
|
// SYNTHETIC: LEGO1 0x1009c290
|
||||||
// MxDeviceEnumerateElement::MxDeviceEnumerateElement
|
// MxDeviceEnumerateElement::MxDeviceEnumerateElement
|
||||||
|
|
||||||
|
// SYNTHETIC: LEGO1 0x1009d450
|
||||||
|
// MxDeviceEnumerateElement::`scalar deleting destructor'
|
||||||
|
|
||||||
|
// SYNTHETIC: LEGO1 0x1009d470
|
||||||
|
// MxDevice::`scalar deleting destructor'
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100db814
|
// VTABLE: LEGO1 0x100db814
|
||||||
// SIZE 0x14
|
// SIZE 0x14
|
||||||
class MxDeviceEnumerate {
|
class MxDeviceEnumerate {
|
||||||
@ -167,10 +179,12 @@ 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, GUID& p_guid);
|
MxS32 ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid);
|
||||||
MxResult FUN_1009d030(MxS32 p_und1, undefined** p_und2, undefined** p_und3);
|
MxResult GetDevice(MxS32 p_deviceNum, MxDeviceEnumerateElement*& p_deviceEnumerate, MxDevice*& p_device);
|
||||||
MxResult FUN_1009d0d0();
|
MxResult FUN_1009d0d0();
|
||||||
MxResult FUN_1009d210();
|
MxResult FUN_1009d210();
|
||||||
|
MxBool FUN_1009d370(MxDeviceEnumerateElement& p_deviceEnumerate);
|
||||||
|
MxBool FUN_1009d3d0(MxDevice& p_device);
|
||||||
|
|
||||||
static void BuildErrorString(const char*, ...);
|
static void BuildErrorString(const char*, ...);
|
||||||
static BOOL CALLBACK
|
static BOOL CALLBACK
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user