Rename class

This commit is contained in:
Christian Semmler 2024-01-04 14:11:29 -05:00
parent 8a56b1c50b
commit f8ddb0d289
2 changed files with 42 additions and 42 deletions

View File

@ -2,7 +2,7 @@
#include <stdio.h> // for vsprintf #include <stdio.h> // for vsprintf
DECOMP_SIZE_ASSERT(MxDeviceModeFinder, 0xe4); DECOMP_SIZE_ASSERT(MxAssignedDevice, 0xe4);
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894); DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
DECOMP_SIZE_ASSERT(MxDevice, 0x1a4); DECOMP_SIZE_ASSERT(MxDevice, 0x1a4);
DECOMP_SIZE_ASSERT(MxDisplayMode, 0x0c); DECOMP_SIZE_ASSERT(MxDisplayMode, 0x0c);
@ -15,7 +15,7 @@ MxDirect3D::MxDirect3D()
this->m_pDirect3d = NULL; this->m_pDirect3d = NULL;
this->m_pDirect3dDevice = NULL; this->m_pDirect3dDevice = NULL;
this->m_unk0x88c = NULL; this->m_unk0x88c = NULL;
this->m_pDeviceModeFinder = NULL; this->m_pAssignedDevice = NULL;
} }
// FUNCTION: LEGO1 0x1009b140 // FUNCTION: LEGO1 0x1009b140
@ -73,9 +73,9 @@ void MxDirect3D::Destroy()
this->m_pDirect3d = NULL; this->m_pDirect3d = NULL;
} }
if (this->m_pDeviceModeFinder) { if (this->m_pAssignedDevice) {
delete m_pDeviceModeFinder; delete m_pAssignedDevice;
this->m_pDeviceModeFinder = NULL; this->m_pAssignedDevice = NULL;
} }
// This should get deleted by MxDirectDraw::Destroy // This should get deleted by MxDirectDraw::Destroy
@ -118,7 +118,7 @@ BOOL MxDirect3D::CreateIDirect3D()
BOOL MxDirect3D::D3DSetMode() BOOL MxDirect3D::D3DSetMode()
{ {
// TODO // TODO
// if (m_pDeviceModeFinder) // if (m_pAssignedDevice)
Error("This device cannot support the current display mode", 0); Error("This device cannot support the current display mode", 0);
OutputDebugString("MxDirect3D::D3DSetMode() front lock failed\n"); OutputDebugString("MxDirect3D::D3DSetMode() front lock failed\n");
OutputDebugString("MxDirect3D::D3DSetMode() back lock failed\n"); OutputDebugString("MxDirect3D::D3DSetMode() back lock failed\n");
@ -128,70 +128,70 @@ BOOL MxDirect3D::D3DSetMode()
// FUNCTION: LEGO1 0x1009b5f0 // FUNCTION: LEGO1 0x1009b5f0
BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device) BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device)
{ {
if (m_pDeviceModeFinder) { if (m_pAssignedDevice) {
delete m_pDeviceModeFinder; delete m_pAssignedDevice;
m_pDeviceModeFinder = NULL; m_pAssignedDevice = NULL;
m_pCurrentDeviceModesList = NULL; m_pCurrentDeviceModesList = NULL;
} }
MxDeviceModeFinder* deviceModeFinder = new MxDeviceModeFinder; MxAssignedDevice* assignedDevice = new MxAssignedDevice;
MxS32 i = 0; MxS32 i = 0;
for (list<MxDriver>::iterator it = p_deviceEnumerator.m_list.begin(); it != p_deviceEnumerator.m_list.end(); it++) { for (list<MxDriver>::iterator it = p_deviceEnumerator.m_list.begin(); it != p_deviceEnumerator.m_list.end(); it++) {
MxDriver& driver = *it; MxDriver& driver = *it;
if (&driver == p_driver) { if (&driver == p_driver) {
deviceModeFinder->m_deviceInfo = new MxDirectDraw::DeviceModesInfo; assignedDevice->m_deviceInfo = new MxDirectDraw::DeviceModesInfo;
if (driver.m_guid) { if (driver.m_guid) {
deviceModeFinder->m_deviceInfo->m_guid = new GUID; assignedDevice->m_deviceInfo->m_guid = new GUID;
memcpy(deviceModeFinder->m_deviceInfo->m_guid, driver.m_guid, sizeof(GUID)); memcpy(assignedDevice->m_deviceInfo->m_guid, driver.m_guid, sizeof(GUID));
} }
deviceModeFinder->m_deviceInfo->m_count = driver.m_displayModes.size(); assignedDevice->m_deviceInfo->m_count = driver.m_displayModes.size();
if (deviceModeFinder->m_deviceInfo->m_count > 0) { if (assignedDevice->m_deviceInfo->m_count > 0) {
deviceModeFinder->m_deviceInfo->m_modeArray = assignedDevice->m_deviceInfo->m_modeArray =
new MxDirectDraw::Mode[deviceModeFinder->m_deviceInfo->m_count]; new MxDirectDraw::Mode[assignedDevice->m_deviceInfo->m_count];
MxS32 j = 0; MxS32 j = 0;
for (list<MxDisplayMode>::iterator it2 = driver.m_displayModes.begin(); for (list<MxDisplayMode>::iterator it2 = driver.m_displayModes.begin();
it2 != driver.m_displayModes.end(); it2 != driver.m_displayModes.end();
it2++) { it2++) {
deviceModeFinder->m_deviceInfo->m_modeArray[j].m_width = (*it2).m_width; assignedDevice->m_deviceInfo->m_modeArray[j].m_width = (*it2).m_width;
deviceModeFinder->m_deviceInfo->m_modeArray[j].m_height = (*it2).m_height; assignedDevice->m_deviceInfo->m_modeArray[j].m_height = (*it2).m_height;
deviceModeFinder->m_deviceInfo->m_modeArray[j].m_bitsPerPixel = (*it2).m_bitsPerPixel; assignedDevice->m_deviceInfo->m_modeArray[j].m_bitsPerPixel = (*it2).m_bitsPerPixel;
j++; j++;
} }
} }
memcpy( memcpy(
&deviceModeFinder->m_deviceInfo->m_ddcaps, &assignedDevice->m_deviceInfo->m_ddcaps,
&driver.m_ddCaps, &driver.m_ddCaps,
sizeof(deviceModeFinder->m_deviceInfo->m_ddcaps) sizeof(assignedDevice->m_deviceInfo->m_ddcaps)
); );
if (i == 0) if (i == 0)
deviceModeFinder->m_flags |= MxDeviceModeFinder::Flag_Bit2; assignedDevice->m_flags |= MxAssignedDevice::Flag_Bit2;
for (list<MxDevice>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end(); it2++) { for (list<MxDevice>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end(); it2++) {
MxDevice& device = *it2; MxDevice& device = *it2;
if (&device != p_device) if (&device != p_device)
continue; continue;
memcpy(&deviceModeFinder->m_guid, device.m_guid, sizeof(deviceModeFinder->m_guid)); memcpy(&assignedDevice->m_guid, device.m_guid, sizeof(assignedDevice->m_guid));
D3DDEVICEDESC* desc; D3DDEVICEDESC* desc;
if (device.m_HWDesc.dcmColorModel) { if (device.m_HWDesc.dcmColorModel) {
deviceModeFinder->m_flags |= MxDeviceModeFinder::Flag_HardwareMode; assignedDevice->m_flags |= MxAssignedDevice::Flag_HardwareMode;
desc = &device.m_HWDesc; desc = &device.m_HWDesc;
} }
else else
desc = &device.m_HELDesc; desc = &device.m_HELDesc;
memcpy(&deviceModeFinder->m_desc, desc, sizeof(deviceModeFinder->m_desc)); memcpy(&assignedDevice->m_desc, desc, sizeof(assignedDevice->m_desc));
m_pDeviceModeFinder = deviceModeFinder; m_pAssignedDevice = assignedDevice;
m_pCurrentDeviceModesList = deviceModeFinder->m_deviceInfo; m_pCurrentDeviceModesList = assignedDevice->m_deviceInfo;
break; break;
} }
} }
@ -199,8 +199,8 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_dr
i++; i++;
} }
if (!m_pDeviceModeFinder) { if (!m_pAssignedDevice) {
delete deviceModeFinder; delete assignedDevice;
return FALSE; return FALSE;
} }
@ -208,13 +208,13 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_dr
} }
// FUNCTION: LEGO1 0x1009b8b0 // FUNCTION: LEGO1 0x1009b8b0
MxDeviceModeFinder::MxDeviceModeFinder() MxAssignedDevice::MxAssignedDevice()
{ {
memset(this, 0, sizeof(*this)); memset(this, 0, sizeof(*this));
} }
// FUNCTION: LEGO1 0x1009b8d0 // FUNCTION: LEGO1 0x1009b8d0
MxDeviceModeFinder::~MxDeviceModeFinder() MxAssignedDevice::~MxAssignedDevice()
{ {
if (m_deviceInfo) { if (m_deviceInfo) {
delete m_deviceInfo; delete m_deviceInfo;

View File

@ -11,21 +11,21 @@
class MxDirect3D; class MxDirect3D;
// SIZE 0xe4 // SIZE 0xe4
class MxDeviceModeFinder { class MxAssignedDevice {
public: public:
enum { enum {
Flag_HardwareMode = 0x01, Flag_HardwareMode = 0x01,
Flag_Bit2 = 0x02 Flag_Bit2 = 0x02
}; };
MxDeviceModeFinder(); MxAssignedDevice();
~MxDeviceModeFinder(); ~MxAssignedDevice();
friend class MxDirect3D; friend class MxDirect3D;
private: private:
GUID m_guid; // 0x00 GUID m_guid; // 0x00
undefined4 m_flags; // 0x10 MxU32 m_flags; // 0x10
D3DDEVICEDESC m_desc; // 0x14 D3DDEVICEDESC m_desc; // 0x14
MxDirectDraw::DeviceModesInfo* m_deviceInfo; // 0xe0 MxDirectDraw::DeviceModesInfo* m_deviceInfo; // 0xe0
}; };
@ -59,12 +59,12 @@ class MxDirect3D : public MxDirectDraw {
BOOL D3DSetMode(); BOOL D3DSetMode();
BOOL SetDevice(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device); BOOL SetDevice(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device);
inline MxDeviceModeFinder* GetDeviceModeFinder() { return this->m_pDeviceModeFinder; }; inline MxAssignedDevice* GetDeviceModeFinder() { return this->m_pAssignedDevice; };
inline IDirect3D* GetDirect3D() { return this->m_pDirect3d; } inline IDirect3D* GetDirect3D() { return this->m_pDirect3d; }
inline IDirect3DDevice* GetDirect3DDevice() { return this->m_pDirect3dDevice; } inline IDirect3DDevice* GetDirect3DDevice() { return this->m_pDirect3dDevice; }
private: private:
MxDeviceModeFinder* m_pDeviceModeFinder; // 0x880 MxAssignedDevice* m_pAssignedDevice; // 0x880
IDirect3D* m_pDirect3d; // 0x884 IDirect3D* m_pDirect3d; // 0x884
IDirect3DDevice* m_pDirect3dDevice; // 0x888 IDirect3DDevice* m_pDirect3dDevice; // 0x888
undefined4 m_unk0x88c; // 0x88c undefined4 m_unk0x88c; // 0x88c