mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
WIP
This commit is contained in:
parent
21d096dcd2
commit
7e6435f795
@ -102,7 +102,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
deviceEnumerator.GetDevice(deviceNum, driver, device);
|
||||
}
|
||||
|
||||
m_direct3d->FUN_1009b5f0(deviceEnumerator, driver, device);
|
||||
m_direct3d->SetDevice(deviceEnumerator, driver, device);
|
||||
|
||||
if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2)
|
||||
p_videoParam.Flags().SetF2bit0(TRUE);
|
||||
|
||||
@ -125,9 +125,85 @@ BOOL MxDirect3D::D3DSetMode()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1009b5f0
|
||||
BOOL MxDirect3D::FUN_1009b5f0(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device)
|
||||
// FUNCTION: LEGO1 0x1009b5f0
|
||||
BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerator, MxDriver* p_driver, MxDevice* p_device)
|
||||
{
|
||||
if (m_pDeviceModeFinder) {
|
||||
delete m_pDeviceModeFinder;
|
||||
m_pDeviceModeFinder = NULL;
|
||||
m_pCurrentDeviceModesList = NULL;
|
||||
}
|
||||
|
||||
MxDeviceModeFinder* deviceModeFinder = new MxDeviceModeFinder;
|
||||
list<MxDriver>& deviceList = p_deviceEnumerator.GetDeviceList();
|
||||
MxS32 i = 0;
|
||||
|
||||
for (list<MxDriver>::iterator it = deviceList.begin(); it != deviceList.end(); it++) {
|
||||
MxDriver& driver = *it;
|
||||
|
||||
if (&driver == p_driver) {
|
||||
deviceModeFinder->m_deviceInfo = new MxDirectDraw::DeviceModesInfo;
|
||||
|
||||
if (driver.m_guid) {
|
||||
deviceModeFinder->m_deviceInfo->m_guid = new GUID;
|
||||
memcpy(deviceModeFinder->m_deviceInfo->m_guid, driver.m_guid, sizeof(GUID));
|
||||
}
|
||||
|
||||
deviceModeFinder->m_deviceInfo->m_count = driver.m_displayModes.size();
|
||||
|
||||
if (deviceModeFinder->m_deviceInfo->m_count > 0) {
|
||||
deviceModeFinder->m_deviceInfo->m_modeArray =
|
||||
new MxDirectDraw::Mode[deviceModeFinder->m_deviceInfo->m_count];
|
||||
|
||||
MxS32 j = 0;
|
||||
for (list<MxDisplayMode>::iterator it2 = driver.m_displayModes.begin();
|
||||
it2 != driver.m_displayModes.end();
|
||||
it2++) {
|
||||
deviceModeFinder->m_deviceInfo->m_modeArray[j].m_width = (*it2).m_width;
|
||||
deviceModeFinder->m_deviceInfo->m_modeArray[j].m_height = (*it2).m_height;
|
||||
deviceModeFinder->m_deviceInfo->m_modeArray[j].m_bitsPerPixel = (*it2).m_bitsPerPixel;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(
|
||||
&deviceModeFinder->m_deviceInfo->m_ddcaps,
|
||||
&driver.m_ddCaps,
|
||||
sizeof(deviceModeFinder->m_deviceInfo->m_ddcaps)
|
||||
);
|
||||
|
||||
if (i == 0)
|
||||
deviceModeFinder->m_flags |= MxDeviceModeFinder::Flag_Bit2;
|
||||
|
||||
for (list<MxDevice>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end(); it2++) {
|
||||
MxDevice& device = *it2;
|
||||
|
||||
if (&device == p_device) {
|
||||
memcpy(&deviceModeFinder->m_guid, device.m_guid, sizeof(deviceModeFinder->m_guid));
|
||||
|
||||
D3DDEVICEDESC* desc;
|
||||
if (device.m_HWDesc.dcmColorModel) {
|
||||
deviceModeFinder->m_flags |= MxDeviceModeFinder::Flag_HardwareMode;
|
||||
desc = &device.m_HWDesc;
|
||||
}
|
||||
else
|
||||
desc = &device.m_HELDesc;
|
||||
|
||||
memcpy(&deviceModeFinder->m_desc, desc, sizeof(deviceModeFinder->m_desc));
|
||||
m_pDeviceModeFinder = deviceModeFinder;
|
||||
m_pCurrentDeviceModesList = deviceModeFinder->m_deviceInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!m_pDeviceModeFinder) {
|
||||
delete deviceModeFinder;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -8,13 +8,25 @@
|
||||
|
||||
#include <d3d.h>
|
||||
|
||||
class MxDirect3D;
|
||||
|
||||
// SIZE 0xe4
|
||||
class MxDeviceModeFinder {
|
||||
public:
|
||||
enum {
|
||||
Flag_HardwareMode = 0x01,
|
||||
Flag_Bit2 = 0x02
|
||||
};
|
||||
|
||||
MxDeviceModeFinder();
|
||||
~MxDeviceModeFinder();
|
||||
|
||||
undefined m_pad[0xe0]; // 0x00
|
||||
friend class MxDirect3D;
|
||||
|
||||
private:
|
||||
GUID m_guid; // 0x00
|
||||
undefined4 m_flags; // 0x10
|
||||
D3DDEVICEDESC m_desc; // 0x14
|
||||
MxDirectDraw::DeviceModesInfo* m_deviceInfo; // 0xe0
|
||||
};
|
||||
|
||||
@ -45,7 +57,7 @@ class MxDirect3D : public MxDirectDraw {
|
||||
|
||||
BOOL CreateIDirect3D();
|
||||
BOOL D3DSetMode();
|
||||
BOOL FUN_1009b5f0(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 IDirect3D* GetDirect3D() { return this->m_pDirect3d; }
|
||||
@ -197,6 +209,8 @@ class MxDeviceEnumerate {
|
||||
static undefined4 FUN_1009d1a0();
|
||||
static undefined4 FUN_1009d1e0();
|
||||
|
||||
inline list<MxDriver>& GetDeviceList() { return m_list; }
|
||||
|
||||
private:
|
||||
list<MxDriver> m_list; // 0x04
|
||||
MxBool m_initialized; // 0x10
|
||||
|
||||
@ -12,12 +12,8 @@ class MxDirectDraw {
|
||||
public:
|
||||
typedef void (*ErrorHandler)(const char*, HRESULT, void*);
|
||||
|
||||
// size 0x0c
|
||||
// SIZE 0x0c
|
||||
struct Mode {
|
||||
MxS32 m_width;
|
||||
MxS32 m_height;
|
||||
MxS32 m_bitsPerPixel;
|
||||
|
||||
MxS32 operator==(const Mode& p_mode) const
|
||||
{
|
||||
return (
|
||||
@ -25,50 +21,54 @@ class MxDirectDraw {
|
||||
(m_bitsPerPixel == p_mode.m_bitsPerPixel)
|
||||
);
|
||||
}
|
||||
|
||||
MxS32 m_width; // 0x00
|
||||
MxS32 m_height; // 0x04
|
||||
MxS32 m_bitsPerPixel; // 0x08
|
||||
};
|
||||
|
||||
// SIZE 0x17c
|
||||
struct DeviceModesInfo {
|
||||
GUID* m_guid;
|
||||
Mode* m_modeArray;
|
||||
MxS32 m_count;
|
||||
DDCAPS m_ddcaps;
|
||||
void* m_unk0x178;
|
||||
|
||||
DeviceModesInfo();
|
||||
~DeviceModesInfo();
|
||||
|
||||
GUID* m_guid; // 0x00
|
||||
Mode* m_modeArray; // 0x04
|
||||
MxS32 m_count; // 0x08
|
||||
DDCAPS m_ddcaps; // 0x0c
|
||||
void* m_unk0x178; // 0x178
|
||||
};
|
||||
|
||||
protected:
|
||||
BOOL m_bOnlySoftRender;
|
||||
BOOL m_bFlipSurfaces;
|
||||
IDirectDraw* m_pDirectDraw;
|
||||
IDirectDrawSurface* m_pFrontBuffer;
|
||||
IDirectDrawSurface* m_pBackBuffer;
|
||||
IDirectDrawSurface* m_pZBuffer;
|
||||
IDirectDrawSurface* m_pText1Surface;
|
||||
IDirectDrawSurface* m_pText2Surface;
|
||||
IDirectDrawClipper* m_pClipper;
|
||||
IDirectDrawPalette* m_pPalette;
|
||||
PALETTEENTRY m_paletteEntries[256];
|
||||
PALETTEENTRY m_originalPaletteEntries[256];
|
||||
SIZE m_text1SizeOnSurface;
|
||||
SIZE m_text2SizeOnSurface;
|
||||
HWND m_hWndMain;
|
||||
HFONT m_hFont;
|
||||
BOOL m_bIgnoreWMSIZE;
|
||||
BOOL m_bPrimaryPalettized;
|
||||
BOOL m_bFullScreen;
|
||||
void* m_unk0x850;
|
||||
BOOL m_bOnlySystemMemory;
|
||||
BOOL m_bIsOnPrimaryDevice;
|
||||
ErrorHandler m_pErrorHandler;
|
||||
ErrorHandler m_pFatalErrorHandler;
|
||||
void* m_pErrorHandlerArg;
|
||||
void* m_pFatalErrorHandlerArg;
|
||||
int m_pauseCount;
|
||||
DeviceModesInfo* m_pCurrentDeviceModesList;
|
||||
Mode m_currentMode;
|
||||
BOOL m_bOnlySoftRender; // 0x04
|
||||
BOOL m_bFlipSurfaces; // 0x08
|
||||
IDirectDraw* m_pDirectDraw; // 0x0c
|
||||
IDirectDrawSurface* m_pFrontBuffer; // 0x10
|
||||
IDirectDrawSurface* m_pBackBuffer; // 0x14
|
||||
IDirectDrawSurface* m_pZBuffer; // 0x18
|
||||
IDirectDrawSurface* m_pText1Surface; // 0x1c
|
||||
IDirectDrawSurface* m_pText2Surface; // 0x20
|
||||
IDirectDrawClipper* m_pClipper; // 0x24
|
||||
IDirectDrawPalette* m_pPalette; // 0x28
|
||||
PALETTEENTRY m_paletteEntries[256]; // 0x2c
|
||||
PALETTEENTRY m_originalPaletteEntries[256]; // 0x42c
|
||||
SIZE m_text1SizeOnSurface; // 0x82c
|
||||
SIZE m_text2SizeOnSurface; // 0x834
|
||||
HWND m_hWndMain; // 0x83c
|
||||
HFONT m_hFont; // 0x840
|
||||
BOOL m_bIgnoreWMSIZE; // 0x844
|
||||
BOOL m_bPrimaryPalettized; // 0x848
|
||||
BOOL m_bFullScreen; // 0x84c
|
||||
void* m_unk0x850; // 0x850
|
||||
BOOL m_bOnlySystemMemory; // 0x854
|
||||
BOOL m_bIsOnPrimaryDevice; // 0x858
|
||||
ErrorHandler m_pErrorHandler; // 0x85c
|
||||
ErrorHandler m_pFatalErrorHandler; // 0x860
|
||||
void* m_pErrorHandlerArg; // 0x864
|
||||
void* m_pFatalErrorHandlerArg; // 0x868
|
||||
int m_pauseCount; // 0x86c
|
||||
DeviceModesInfo* m_pCurrentDeviceModesList; // 0x870
|
||||
Mode m_currentMode; // 0x87c
|
||||
|
||||
public:
|
||||
__declspec(dllexport) int FlipToGDISurface();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user