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-02-07 06:11:45 -05:00
|
|
|
#if !defined(MXDIRECTX_FOR_CONFIG)
|
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 {
|
2024-01-17 11:53:53 -05:00
|
|
|
c_hardwareMode = 0x01,
|
|
|
|
c_primaryDevice = 0x02
|
2024-01-04 14:37:15 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2024-02-09 18:40:52 -05:00
|
|
|
struct Direct3DDeviceInfo;
|
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();
|
2024-02-01 15:42:10 -05:00
|
|
|
~MxDirect3D() override;
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2024-02-01 15:42:10 -05:00
|
|
|
BOOL Create(
|
2023-10-24 19:38:27 -04:00
|
|
|
HWND hWnd,
|
|
|
|
BOOL fullscreen_1,
|
|
|
|
BOOL surface_fullscreen,
|
|
|
|
BOOL onlySystemMemory,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int bpp,
|
|
|
|
const PALETTEENTRY* pPaletteEntries,
|
|
|
|
int paletteEntryCount
|
2024-02-01 15:42:10 -05:00
|
|
|
) override; // vtable+0x04
|
|
|
|
void Destroy() override; // vtable+0x08
|
|
|
|
void DestroyButNotDirectDraw() override; // vtable+0x0c
|
2023-10-24 19:38:27 -04:00
|
|
|
|
2024-02-09 18:40:52 -05:00
|
|
|
inline MxAssignedDevice* AssignedDevice() { return this->m_assignedDevice; }
|
|
|
|
inline IDirect3D2* Direct3D() { return this->m_pDirect3d; }
|
|
|
|
inline IDirect3DDevice2* Direct3DDevice() { return this->m_pDirect3dDevice; }
|
|
|
|
|
|
|
|
BOOL SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, Direct3DDeviceInfo* p_device);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BOOL D3DCreate();
|
2023-10-24 19:38:27 -04:00
|
|
|
BOOL D3DSetMode();
|
|
|
|
|
2024-02-09 18:40:52 -05:00
|
|
|
int ZBufferDepth(MxAssignedDevice* p_assignedDevice);
|
2023-09-10 08:56:16 -04:00
|
|
|
|
2024-01-18 08:34:14 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1009b120
|
|
|
|
// MxDirect3D::`scalar deleting destructor'
|
|
|
|
|
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
|
2024-02-09 18:40:52 -05:00
|
|
|
BOOL m_bTexturesDisabled; // 0x88c
|
2024-01-04 16:16:16 -05:00
|
|
|
undefined4 m_unk0x890; // 0x890
|
2023-08-06 16:26:14 -04:00
|
|
|
};
|
2024-02-07 06:11:45 -05:00
|
|
|
#endif
|
2023-08-06 16:26:14 -04:00
|
|
|
|
2024-01-03 11:35:55 -05:00
|
|
|
// SIZE 0x1a4
|
2024-02-09 18:40:52 -05:00
|
|
|
struct Direct3DDeviceInfo {
|
|
|
|
Direct3DDeviceInfo() {}
|
|
|
|
~Direct3DDeviceInfo();
|
|
|
|
Direct3DDeviceInfo(
|
2024-01-03 12:50:25 -05:00
|
|
|
LPGUID p_guid,
|
|
|
|
LPSTR p_deviceDesc,
|
|
|
|
LPSTR p_deviceName,
|
|
|
|
LPD3DDEVICEDESC p_HWDesc,
|
|
|
|
LPD3DDEVICEDESC p_HELDesc
|
|
|
|
);
|
|
|
|
|
2024-02-09 18:40:52 -05:00
|
|
|
void Initialize(
|
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 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-02-09 18:40:52 -05:00
|
|
|
int operator==(Direct3DDeviceInfo) const { return 0; }
|
|
|
|
int operator<(Direct3DDeviceInfo) 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
|
2024-02-09 18:40:52 -05:00
|
|
|
list<Direct3DDeviceInfo> m_devices; // 0x178
|
2024-01-03 12:50:25 -05:00
|
|
|
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
|
2024-02-07 06:11:45 -05:00
|
|
|
// TEMPLATE: CONFIG 0x401000
|
2024-01-03 11:35:55 -05:00
|
|
|
// TEMPLATE: LEGO1 0x1009b900
|
2024-02-09 18:40:52 -05:00
|
|
|
// list<Direct3DDeviceInfo,allocator<Direct3DDeviceInfo> >::~list<Direct3DDeviceInfo,allocator<Direct3DDeviceInfo> >
|
2024-01-03 11:35:55 -05:00
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
// clang-format off
|
2024-02-07 06:11:45 -05:00
|
|
|
// TEMPLATE: CONFIG 0x401070
|
2024-01-03 11:35:55 -05:00
|
|
|
// 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
|
|
|
|
|
2024-02-07 06:11:45 -05:00
|
|
|
// TEMPLATE: CONFIG 0x4010e0
|
2024-01-03 11:35:55 -05:00
|
|
|
// TEMPLATE: LEGO1 0x1009b9e0
|
2024-02-09 18:40:52 -05:00
|
|
|
// List<Direct3DDeviceInfo>::~List<Direct3DDeviceInfo>
|
2024-01-03 11:35:55 -05:00
|
|
|
|
2024-02-07 06:11:45 -05:00
|
|
|
// TEMPLATE: CONFIG 0x401130
|
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
|
2024-02-07 06:11:45 -05:00
|
|
|
// TEMPLATE: CONFIG 0x401650
|
2024-01-03 12:50:25 -05:00
|
|
|
// 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
|
|
|
|
|
2024-02-07 06:11:45 -05:00
|
|
|
// TEMPLATE: CONFIG 0x4016c0
|
2024-01-03 12:50:25 -05:00
|
|
|
// 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-02-07 06:11:45 -05:00
|
|
|
// SYNTHETIC: CONFIG 0x401990
|
2024-01-03 11:35:55 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1009c290
|
2024-01-03 22:03:02 -05:00
|
|
|
// MxDriver::MxDriver
|
|
|
|
|
2024-02-07 06:11:45 -05:00
|
|
|
// SYNTHETIC: CONFIG 0x401b00
|
2024-01-14 16:28:46 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1009c400
|
2024-02-09 18:40:52 -05:00
|
|
|
// list<Direct3DDeviceInfo,allocator<Direct3DDeviceInfo> >::insert
|
2024-01-14 16:28:46 -05:00
|
|
|
|
2024-02-07 06:11:45 -05:00
|
|
|
// SYNTHETIC: CONFIG 0x401b60
|
2024-01-14 16:28:46 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1009c460
|
|
|
|
// list<MxDisplayMode,allocator<MxDisplayMode> >::insert
|
|
|
|
|
2024-01-03 22:03:02 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1009d450
|
|
|
|
// MxDriver::`scalar deleting destructor'
|
|
|
|
|
|
|
|
// SYNTHETIC: LEGO1 0x1009d470
|
2024-02-09 18:40:52 -05:00
|
|
|
// Direct3DDeviceInfo::`scalar deleting destructor'
|
2024-01-03 11:35:55 -05:00
|
|
|
|
2024-02-07 06:11:45 -05:00
|
|
|
// VTABLE: CONFIG 0x00406000
|
2024-01-01 19:17:38 -05:00
|
|
|
// VTABLE: LEGO1 0x100db814
|
|
|
|
// SIZE 0x14
|
|
|
|
class MxDeviceEnumerate {
|
|
|
|
public:
|
|
|
|
MxDeviceEnumerate();
|
2024-02-07 06:11:45 -05:00
|
|
|
~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);
|
2024-02-09 18:40:52 -05:00
|
|
|
int GetDevice(int p_deviceNum, MxDriver*& p_driver, Direct3DDeviceInfo*& p_device);
|
2024-02-07 06:11:45 -05:00
|
|
|
|
|
|
|
#if defined(MXDIRECTX_FOR_CONFIG)
|
2024-02-09 18:40:52 -05:00
|
|
|
int FormatDeviceName(char* p_buffer, const MxDriver* p_driver, const Direct3DDeviceInfo* p_device) const;
|
2024-02-07 06:11:45 -05:00
|
|
|
#endif
|
|
|
|
|
2024-01-07 12:07:22 -05:00
|
|
|
int FUN_1009d0d0();
|
|
|
|
int FUN_1009d210();
|
2024-02-07 06:11:45 -05:00
|
|
|
unsigned char DriverSupportsRequiredDisplayMode(MxDriver& p_driver);
|
2024-02-09 18:40:52 -05:00
|
|
|
unsigned char FUN_1009d3d0(Direct3DDeviceInfo& 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-02-04 09:46:15 -05:00
|
|
|
static int SupportsMMX();
|
|
|
|
static int SupportsCPUID();
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2024-01-04 14:37:15 -05:00
|
|
|
friend class MxDirect3D;
|
|
|
|
|
2024-02-07 06:11:45 -05:00
|
|
|
const list<MxDriver>& GetDriverList() const { return m_list; }
|
|
|
|
|
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
|
|
|
|
2024-01-14 16:28:46 -05:00
|
|
|
// SYNTHETIC: LEGO1 0x1007b590
|
|
|
|
// MxDeviceEnumerate100d9cc8::~MxDeviceEnumerate100d9cc8
|
|
|
|
|
2023-10-24 19:24:29 -04:00
|
|
|
#endif // MXDIRECT3D_H
|