2023-08-06 16:26:14 -04:00
|
|
|
#ifndef MXDIRECT3D_H
|
|
|
|
#define MXDIRECT3D_H
|
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "decomp.h"
|
2023-08-06 16:26:14 -04:00
|
|
|
#include "mxdirectdraw.h"
|
2024-01-08 04:58:49 -05:00
|
|
|
#include "mxstl/stlcompat.h"
|
2023-08-06 16:26:14 -04:00
|
|
|
|
|
|
|
#include <d3d.h>
|
|
|
|
|
2024-01-04 14:37:15 -05:00
|
|
|
class MxDirect3D;
|
|
|
|
|
2023-09-10 08:56:16 -04:00
|
|
|
// SIZE 0xe4
|
2024-01-04 14:37:15 -05:00
|
|
|
class MxAssignedDevice {
|
2023-09-10 08:56:16 -04:00
|
|
|
public:
|
2024-01-04 14:37:15 -05:00
|
|
|
enum {
|
|
|
|
Flag_HardwareMode = 0x01,
|
|
|
|
Flag_PrimaryDevice = 0x02
|
|
|
|
};
|
|
|
|
|
|
|
|
MxAssignedDevice();
|
|
|
|
~MxAssignedDevice();
|
|
|
|
|
2024-01-07 12:07:22 -05:00
|
|
|
inline unsigned int GetFlags() { return m_flags; }
|
2024-01-05 14:38:34 -05:00
|
|
|
inline D3DDEVICEDESC& GetDesc() { return m_desc; }
|
|
|
|
|
2024-01-04 14:37:15 -05:00
|
|
|
friend class MxDirect3D;
|
2023-09-10 08:56:16 -04:00
|
|
|
|
2024-01-04 06:35:28 -05:00
|
|
|
private:
|
2024-01-04 14:37:15 -05:00
|
|
|
GUID m_guid; // 0x00
|
2024-01-07 12:07:22 -05:00
|
|
|
unsigned int m_flags; // 0x10
|
2024-01-04 14:37:15 -05:00
|
|
|
D3DDEVICEDESC m_desc; // 0x14
|
2024-01-01 19:17:38 -05:00
|
|
|
MxDirectDraw::DeviceModesInfo* m_deviceInfo; // 0xe0
|
2023-09-10 08:56:16 -04:00
|
|
|
};
|
|
|
|
|
2024-01-01 19:17:38 -05:00
|
|
|
class MxDeviceEnumerate;
|
2024-01-03 22:03:02 -05:00
|
|
|
struct MxDriver;
|
|
|
|
struct MxDevice;
|
2023-09-10 08:56:16 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// VTABLE: LEGO1 0x100db800
|
2023-08-06 16:26:14 -04:00
|
|
|
// SIZE 0x894
|
2023-10-24 19:38:27 -04:00
|
|
|
class MxDirect3D : public MxDirectDraw {
|
2023-08-06 16:26:14 -04:00
|
|
|
public:
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDirect3D();
|
|
|
|
virtual ~MxDirect3D();
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
virtual BOOL Create(
|
|
|
|
HWND hWnd,
|
|
|
|
BOOL fullscreen_1,
|
|
|
|
BOOL surface_fullscreen,
|
|
|
|
BOOL onlySystemMemory,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int bpp,
|
|
|
|
const PALETTEENTRY* pPaletteEntries,
|
|
|
|
int paletteEntryCount
|
2024-01-01 19:17:38 -05:00
|
|
|
) override; // vtable+0x04
|
|
|
|
virtual void Destroy() override; // vtable+0x08
|
|
|
|
virtual void DestroyButNotDirectDraw() override; // vtable+0x0c
|
2023-10-24 19:38:27 -04:00
|
|
|
|
|
|
|
BOOL CreateIDirect3D();
|
|
|
|
BOOL D3DSetMode();
|
2024-01-04 15:35:52 -05:00
|
|
|
DWORD GetZBufferBitDepth(MxAssignedDevice* p_assignedDevice);
|
2024-01-04 14:37:15 -05:00
|
|
|
BOOL SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, MxDevice* p_device);
|
2023-10-24 19:38:27 -04:00
|
|
|
|
2024-01-04 14:37:15 -05:00
|
|
|
inline MxAssignedDevice* GetAssignedDevice() { return this->m_assignedDevice; };
|
2024-01-04 16:16:16 -05:00
|
|
|
inline IDirect3D2* GetDirect3D() { return this->m_pDirect3d; }
|
|
|
|
inline IDirect3DDevice2* GetDirect3DDevice() { return this->m_pDirect3dDevice; }
|
2023-09-10 08:56:16 -04:00
|
|
|
|
2023-08-06 16:26:14 -04:00
|
|
|
private:
|
2024-01-04 16:16:16 -05:00
|
|
|
MxAssignedDevice* m_assignedDevice; // 0x880
|
|
|
|
IDirect3D2* m_pDirect3d; // 0x884
|
|
|
|
IDirect3DDevice2* m_pDirect3dDevice; // 0x888
|
|
|
|
BOOL m_unk0x88c; // 0x88c
|
|
|
|
undefined4 m_unk0x890; // 0x890
|
2023-08-06 16:26:14 -04:00
|
|
|
};
|
|
|
|
|
2024-01-03 11:35:55 -05:00
|
|
|
// SIZE 0x1a4
|
2024-01-03 12:50:25 -05:00
|
|
|
struct MxDevice {
|
|
|
|
MxDevice() {}
|
|
|
|
~MxDevice();
|
|
|
|
MxDevice(
|
|
|
|
LPGUID p_guid,
|
|
|
|
LPSTR p_deviceDesc,
|
|
|
|
LPSTR p_deviceName,
|
|
|
|
LPD3DDEVICEDESC p_HWDesc,
|
|
|
|
LPD3DDEVICEDESC p_HELDesc
|
|
|
|
);
|
|
|
|
|
|
|
|
void Init(
|
|
|
|
LPGUID p_guid,
|
|
|
|
LPSTR p_deviceDesc,
|
|
|
|
LPSTR p_deviceName,
|
|
|
|
LPD3DDEVICEDESC p_HWDesc,
|
|
|
|
LPD3DDEVICEDESC p_HELDesc
|
|
|
|
);
|
2024-01-03 11:35:55 -05:00
|
|
|
|
2024-01-03 12:50:25 -05:00
|
|
|
LPGUID m_guid; // 0x00
|
|
|
|
char* m_deviceDesc; // 0x04
|
|
|
|
char* m_deviceName; // 0x08
|
|
|
|
D3DDEVICEDESC m_HWDesc; // 0x0c
|
|
|
|
D3DDEVICEDESC m_HELDesc; // 0xd8
|
|
|
|
|
2024-01-07 12:07:22 -05:00
|
|
|
int operator==(MxDevice) const { return 0; }
|
|
|
|
int operator<(MxDevice) const { return 0; }
|
2024-01-03 11:35:55 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// SIZE 0x0c
|
2024-01-03 12:50:25 -05:00
|
|
|
struct MxDisplayMode {
|
2024-01-03 12:12:17 -05:00
|
|
|
DWORD m_width; // 0x00
|
|
|
|
DWORD m_height; // 0x04
|
|
|
|
DWORD m_bitsPerPixel; // 0x08
|
2024-01-03 11:35:55 -05:00
|
|
|
|
2024-01-07 12:07:22 -05:00
|
|
|
int operator==(MxDisplayMode) const { return 0; }
|
|
|
|
int operator<(MxDisplayMode) const { return 0; }
|
2024-01-03 11:35:55 -05:00
|
|
|
};
|
|
|
|
|
2024-01-01 19:17:38 -05:00
|
|
|
// SIZE 0x190
|
2024-01-03 22:03:02 -05:00
|
|
|
struct MxDriver {
|
|
|
|
MxDriver() {}
|
|
|
|
~MxDriver();
|
|
|
|
MxDriver(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
2024-01-03 11:35:55 -05:00
|
|
|
|
|
|
|
void Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
|
|
|
|
2024-01-03 12:50:25 -05:00
|
|
|
LPGUID m_guid; // 0x00
|
|
|
|
char* m_driverDesc; // 0x04
|
|
|
|
char* m_driverName; // 0x08
|
|
|
|
DDCAPS m_ddCaps; // 0x0c
|
|
|
|
list<MxDevice> m_devices; // 0x178
|
|
|
|
list<MxDisplayMode> m_displayModes; // 0x184
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2024-01-07 12:07:22 -05:00
|
|
|
int operator==(MxDriver) const { return 0; }
|
|
|
|
int operator<(MxDriver) const { return 0; }
|
2024-01-01 19:17:38 -05:00
|
|
|
};
|
|
|
|
|
2024-01-03 11:35:55 -05:00
|
|
|
// clang-format off
|
|
|
|
// TEMPLATE: LEGO1 0x1009b900
|
2024-01-03 12:50:25 -05:00
|
|
|
// list<MxDevice,allocator<MxDevice> >::~list<MxDevice,allocator<MxDevice> >
|
2024-01-03 11:35:55 -05:00
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
// TEMPLATE: LEGO1 0x1009b970
|
2024-01-03 12:50:25 -05:00
|
|
|
// list<MxDisplayMode,allocator<MxDisplayMode> >::~list<MxDisplayMode,allocator<MxDisplayMode> >
|
2024-01-03 11:35:55 -05:00
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
// TEMPLATE: LEGO1 0x1009b9e0
|
2024-01-03 12:50:25 -05:00
|
|
|
// List<MxDevice>::~List<MxDevice>
|
2024-01-03 11:35:55 -05:00
|
|
|
|
|
|
|
// TEMPLATE: LEGO1 0x1009ba30
|
2024-01-03 12:50:25 -05:00
|
|
|
// List<MxDisplayMode>::~List<MxDisplayMode>
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
// TEMPLATE: LEGO1 0x1009bf50
|
2024-01-03 22:03:02 -05:00
|
|
|
// list<MxDriver,allocator<MxDriver> >::~list<MxDriver,allocator<MxDriver> >
|
2024-01-03 12:50:25 -05:00
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
// TEMPLATE: LEGO1 0x1009bfc0
|
2024-01-03 22:03:02 -05:00
|
|
|
// List<MxDriver>::~List<MxDriver>
|
2024-01-03 11:35:55 -05:00
|
|
|
|
|
|
|
// Compiler-generated copy ctor
|
2024-01-03 12:50:25 -05:00
|
|
|
// Part of this function are two more synthetic sub-routines,
|
|
|
|
// LEGO1 0x1009c400 and LEGO1 0x1009c460
|
2024-01-03 11:35:55 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1009c290
|
2024-01-03 22:03:02 -05:00
|
|
|
// MxDriver::MxDriver
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x1009d450
|
|
|
|
// MxDriver::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x1009d470
|
|
|
|
// MxDevice::`scalar deleting destructor'
|
2024-01-03 11:35:55 -05:00
|
|
|
|
2024-01-01 19:17:38 -05:00
|
|
|
// VTABLE: LEGO1 0x100db814
|
|
|
|
// SIZE 0x14
|
|
|
|
class MxDeviceEnumerate {
|
|
|
|
public:
|
|
|
|
MxDeviceEnumerate();
|
2024-01-03 12:50:25 -05:00
|
|
|
// FUNCTION: LEGO1 0x1009c010
|
|
|
|
~MxDeviceEnumerate() {}
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2024-01-07 12:07:22 -05:00
|
|
|
virtual int DoEnumerate(); // vtable+0x00
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2024-01-03 11:35:55 -05:00
|
|
|
BOOL EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
|
2024-01-03 12:12:17 -05:00
|
|
|
HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd);
|
2024-01-03 12:50:25 -05:00
|
|
|
HRESULT EnumDevicesCallback(
|
|
|
|
LPGUID p_guid,
|
|
|
|
LPSTR p_deviceDesc,
|
|
|
|
LPSTR p_deviceName,
|
|
|
|
LPD3DDEVICEDESC p_HWDesc,
|
|
|
|
LPD3DDEVICEDESC p_HELDesc
|
|
|
|
);
|
2024-01-01 19:17:38 -05:00
|
|
|
const char* EnumerateErrorToString(HRESULT p_error);
|
2024-01-07 12:07:22 -05:00
|
|
|
int ParseDeviceName(const char* p_deviceId);
|
|
|
|
int ProcessDeviceBytes(int p_deviceNum, GUID& p_guid);
|
|
|
|
int GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device);
|
|
|
|
int FUN_1009d0d0();
|
|
|
|
int FUN_1009d210();
|
|
|
|
unsigned char FUN_1009d370(MxDriver& p_driver);
|
|
|
|
unsigned char FUN_1009d3d0(MxDevice& p_device);
|
2024-01-01 19:17:38 -05:00
|
|
|
|
|
|
|
static void BuildErrorString(const char*, ...);
|
2024-01-03 12:12:17 -05:00
|
|
|
static BOOL CALLBACK
|
|
|
|
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 DevicesEnumerateCallback(
|
2024-01-03 12:50:25 -05:00
|
|
|
LPGUID p_guid,
|
|
|
|
LPSTR p_deviceDesc,
|
|
|
|
LPSTR p_deviceName,
|
|
|
|
LPD3DDEVICEDESC p_HWDesc,
|
|
|
|
LPD3DDEVICEDESC p_HELDesc,
|
2024-01-03 12:12:17 -05:00
|
|
|
LPVOID p_context
|
|
|
|
);
|
2024-01-03 22:03:02 -05:00
|
|
|
static undefined4 FUN_1009d1a0();
|
|
|
|
static undefined4 FUN_1009d1e0();
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2024-01-04 14:37:15 -05:00
|
|
|
friend class MxDirect3D;
|
|
|
|
|
2024-01-03 11:35:55 -05:00
|
|
|
private:
|
2024-01-07 12:07:22 -05:00
|
|
|
list<MxDriver> m_list; // 0x04
|
|
|
|
unsigned char m_initialized; // 0x10
|
2024-01-01 19:17:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// VTABLE: LEGO1 0x100d9cc8
|
|
|
|
// SIZE 0x14
|
|
|
|
class MxDeviceEnumerate100d9cc8 : public MxDeviceEnumerate {};
|
2023-09-10 08:56:16 -04:00
|
|
|
|
2023-10-24 19:24:29 -04:00
|
|
|
#endif // MXDIRECT3D_H
|