|
| 1 | +#ifndef GOL_DEVICELIST_H |
| 2 | +#define GOL_DEVICELIST_H |
| 3 | + |
| 4 | +#include "types.h" |
| 5 | + |
| 6 | +#include <d3d.h> |
| 7 | +#include <windows.h> |
| 8 | + |
| 9 | +template <typename T> |
| 10 | +class GolVector { |
| 11 | + GolVector() |
| 12 | + { |
| 13 | + m_size = 0; |
| 14 | + m_data = NULL; |
| 15 | + } |
| 16 | + ~GolVector() { Clear(); } |
| 17 | + void Clear() |
| 18 | + { |
| 19 | + LegoU32 i; |
| 20 | + |
| 21 | + for (i = 0; i < m_size; i++) { |
| 22 | + m_data[i].Clear(); |
| 23 | + } |
| 24 | + } |
| 25 | + LegoU32 m_size; |
| 26 | + T* m_data; |
| 27 | +}; |
| 28 | + |
| 29 | +// SIZE 0x10 |
| 30 | +class GolDeviceList { |
| 31 | +public: |
| 32 | + struct GolD3DDeviceInfo; |
| 33 | + struct GolD3DDriverInfo; |
| 34 | + |
| 35 | + struct GolD3DDeviceInfo { |
| 36 | + GolD3DDriverInfo* m_driver; // 0x00 |
| 37 | + BOOL m_validGuid; // 0x04 |
| 38 | + BOOL m_hwAccelerated; // 0x08 |
| 39 | + GUID m_guid; // 0x0c |
| 40 | + char* m_name; // 0x1c |
| 41 | + char* m_description; // 0x20 |
| 42 | + D3DDEVICEDESC m_deviceDesc; // 0x24 |
| 43 | + }; |
| 44 | + |
| 45 | + struct GolD3DDriverInfo { |
| 46 | + LegoBool32 m_unk0x00; // 0x00 |
| 47 | + LegoBool32 m_accelerated; // 0x04 |
| 48 | + LegoBool32 m_unk0x08; // 0x08 |
| 49 | + GUID m_guid; // 0x0c |
| 50 | + LegoChar* m_description; // 0x1c |
| 51 | + LegoChar* m_name; // 0x20 |
| 52 | + LegoU32 m_countDevices; // 0x24 |
| 53 | + GolD3DDeviceInfo* m_devices; // 0x28 |
| 54 | + }; |
| 55 | + |
| 56 | + GolDeviceList(); |
| 57 | + |
| 58 | + void Clear(); |
| 59 | + GolD3DDeviceInfo* SelectDevice( |
| 60 | + HWND p_hWnd, |
| 61 | + LegoU32 p_flags, |
| 62 | + const LegoChar* p_driverDescription, |
| 63 | + const LegoChar* p_deviceName |
| 64 | + ); |
| 65 | + void DetectDevices(); |
| 66 | + void UpdateDialog(HWND p_hWnd); |
| 67 | + GolD3DDeviceInfo* FindMatchingDevice( |
| 68 | + LegoU32 p_flags, |
| 69 | + const LegoChar* p_driverDescription, |
| 70 | + const LegoChar* p_deviceName |
| 71 | + ); |
| 72 | + |
| 73 | +private: |
| 74 | + static BOOL CALLBACK |
| 75 | + CountDirectDrawDriversCallback(GUID* p_guid, LPSTR p_name, LPSTR p_description, LPVOID Context); |
| 76 | + static BOOL CALLBACK |
| 77 | + EnumerateDirectDrawDriversCallback(GUID* p_guid, LPSTR p_name, LPSTR p_description, LPVOID Context); |
| 78 | + static HRESULT CALLBACK CountDirect3DDevicesCallback( |
| 79 | + GUID* p_guid, |
| 80 | + LPSTR p_description, |
| 81 | + LPSTR p_name, |
| 82 | + LPD3DDEVICEDESC p_halDesc, |
| 83 | + LPD3DDEVICEDESC p_helDesc, |
| 84 | + LPVOID p_context |
| 85 | + ); |
| 86 | + static HRESULT CALLBACK EnumerateDirect3DDevicesCallback( |
| 87 | + GUID* p_guid, |
| 88 | + LPSTR p_description, |
| 89 | + LPSTR p_name, |
| 90 | + LPD3DDEVICEDESC p_halDesc, |
| 91 | + LPD3DDEVICEDESC p_helDesc, |
| 92 | + LPVOID p_context |
| 93 | + ); |
| 94 | + static void StoreDialogWord(LegoU8** p_ptrStorage, LegoU16 p_word); |
| 95 | + static void StoreDialogItemText(LegoU8** p_ptrStorage, const char* p_text); |
| 96 | + static void StoreDialogItem( |
| 97 | + LegoU8** p_ptrStorage, |
| 98 | + LegoU32 p_style, |
| 99 | + LegoS16 p_x, |
| 100 | + LegoS16 p_y, |
| 101 | + LegoS16 p_cx, |
| 102 | + LegoS16 p_cy, |
| 103 | + LegoU16 p_id, |
| 104 | + const char* p_type, |
| 105 | + const char* p_text |
| 106 | + ); |
| 107 | + static int CALLBACK SelectDeviceDlgProc(HWND p_hWnd, UINT p_uMsg, WPARAM p_wParam, LPARAM p_lParam); |
| 108 | + |
| 109 | + // GolVector<GolD3DDriverInfo> m_drivers; |
| 110 | + LegoU32 m_countDrivers; |
| 111 | + GolD3DDriverInfo* m_drivers; |
| 112 | + LegoU32 m_driverIndex; |
| 113 | + LegoU32 m_deviceIndex; |
| 114 | + |
| 115 | + static GolDeviceList* s_DialogDeviceList; |
| 116 | +}; |
| 117 | + |
| 118 | +#endif // GOL_DEVICELIST_H |
0 commit comments