Move MxDirectDraw and MxDirect3D to mxdirectx (#413)

This commit is contained in:
Christian Semmler 2024-01-07 12:07:22 -05:00 committed by GitHub
parent 8db36722d8
commit bb7e4df11b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 86 additions and 94 deletions

View file

@ -18,7 +18,7 @@ jobs:
ISLE/*.cpp ISLE/*.h \ ISLE/*.cpp ISLE/*.h \
LEGO1/*.cpp LEGO1/*.h \ LEGO1/*.cpp LEGO1/*.h \
LEGO1/3dmanager/*.cpp LEGO1/3dmanager/*.h \ LEGO1/3dmanager/*.cpp LEGO1/3dmanager/*.h \
LEGO1/mxdirectx/*.h \ LEGO1/mxdirectx/*.cpp LEGO1/mxdirectx/*.h \
LEGO1/mxstl/*.h \ LEGO1/mxstl/*.h \
LEGO1/realtime/*.cpp LEGO1/realtime/*.h \ LEGO1/realtime/*.cpp LEGO1/realtime/*.h \
LEGO1/tgl/*.h \ LEGO1/tgl/*.h \

View file

@ -116,8 +116,8 @@ add_library(lego1 SHARED
LEGO1/mxcontrolpresenter.cpp LEGO1/mxcontrolpresenter.cpp
LEGO1/mxcore.cpp LEGO1/mxcore.cpp
LEGO1/mxcriticalsection.cpp LEGO1/mxcriticalsection.cpp
LEGO1/mxdirect3d.cpp LEGO1/mxdirectx/mxdirect3d.cpp
LEGO1/mxdirectdraw.cpp LEGO1/mxdirectx/mxdirectdraw.cpp
LEGO1/mxdiskstreamcontroller.cpp LEGO1/mxdiskstreamcontroller.cpp
LEGO1/mxdiskstreamprovider.cpp LEGO1/mxdiskstreamprovider.cpp
LEGO1/mxdisplaysurface.cpp LEGO1/mxdisplaysurface.cpp

View file

@ -12,7 +12,6 @@
#include "legovideomanager.h" #include "legovideomanager.h"
#include "legoworldpresenter.h" #include "legoworldpresenter.h"
#include "mxbackgroundaudiomanager.h" #include "mxbackgroundaudiomanager.h"
#include "mxdirectdraw.h"
#include "mxdsaction.h" #include "mxdsaction.h"
#include "mxomnicreateflags.h" #include "mxomnicreateflags.h"
#include "mxomnicreateparam.h" #include "mxomnicreateparam.h"

View file

@ -3,7 +3,7 @@
#include "3dmanager/lego3dmanager.h" #include "3dmanager/lego3dmanager.h"
#include "decomp.h" #include "decomp.h"
#include "mxdirect3d.h" #include "mxdirectx/mxdirect3d.h"
#include "mxdirectx/mxstopwatch.h" #include "mxdirectx/mxstopwatch.h"
#include "mxunknown100d9d00.h" #include "mxunknown100d9d00.h"
#include "mxvideomanager.h" #include "mxvideomanager.h"

View file

@ -38,7 +38,6 @@ BOOL MxDirect3D::Create(
) )
{ {
BOOL success = FALSE; BOOL success = FALSE;
BOOL ret = MxDirectDraw::Create( BOOL ret = MxDirectDraw::Create(
hWnd, hWnd,
fullscreen_1, fullscreen_1,
@ -101,7 +100,7 @@ void MxDirect3D::DestroyButNotDirectDraw()
// FUNCTION: LEGO1 0x1009b2d0 // FUNCTION: LEGO1 0x1009b2d0
BOOL MxDirect3D::CreateIDirect3D() BOOL MxDirect3D::CreateIDirect3D()
{ {
MxResult ret = IDirect3D_QueryInterface(m_pDirectDraw, IID_IDirect3D2, (LPVOID*) &m_pDirect3d); HRESULT ret = IDirect3D_QueryInterface(m_pDirectDraw, IID_IDirect3D2, (LPVOID*) &m_pDirect3d);
if (ret) { if (ret) {
Error("Creation of IDirect3D failed", ret); Error("Creation of IDirect3D failed", ret);
@ -149,7 +148,7 @@ BOOL MxDirect3D::D3DSetMode()
MxDirectDraw::Mode mode = m_currentMode; MxDirectDraw::Mode mode = m_currentMode;
if (m_bFullScreen && !IsSupportedMode(mode.m_width, mode.m_height, mode.m_bitsPerPixel)) { if (m_bFullScreen && !IsSupportedMode(mode.width, mode.height, mode.bitsPerPixel)) {
Error("This device cannot support the current display mode", DDERR_GENERIC); Error("This device cannot support the current display mode", DDERR_GENERIC);
return FALSE; return FALSE;
} }
@ -162,10 +161,10 @@ BOOL MxDirect3D::D3DSetMode()
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
if (backBuffer->Lock(NULL, &desc, DDLOCK_WAIT, NULL) == DD_OK) { if (backBuffer->Lock(NULL, &desc, DDLOCK_WAIT, NULL) == DD_OK) {
MxU8* surface = (MxU8*) desc.lpSurface; unsigned char* surface = (unsigned char*) desc.lpSurface;
for (MxS32 i = mode.m_height; i > 0; i--) { for (int i = mode.height; i > 0; i--) {
memset(surface, 0, mode.m_width * desc.ddpfPixelFormat.dwRGBBitCount / 8); memset(surface, 0, mode.width * desc.ddpfPixelFormat.dwRGBBitCount / 8);
surface += desc.lPitch; surface += desc.lPitch;
} }
@ -180,10 +179,10 @@ BOOL MxDirect3D::D3DSetMode()
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
if (frontBuffer->Lock(NULL, &desc, DDLOCK_WAIT, NULL) == DD_OK) { if (frontBuffer->Lock(NULL, &desc, DDLOCK_WAIT, NULL) == DD_OK) {
MxU8* surface = (MxU8*) desc.lpSurface; unsigned char* surface = (unsigned char*) desc.lpSurface;
for (MxS32 i = mode.m_height; i > 0; i--) { for (int i = mode.height; i > 0; i--) {
memset(surface, 0, mode.m_width * desc.ddpfPixelFormat.dwRGBBitCount / 8); memset(surface, 0, mode.width * desc.ddpfPixelFormat.dwRGBBitCount / 8);
surface += desc.lPitch; surface += desc.lPitch;
} }
@ -229,7 +228,7 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_dri
} }
MxAssignedDevice* assignedDevice = new MxAssignedDevice; MxAssignedDevice* assignedDevice = new MxAssignedDevice;
MxS32 i = 0; int i = 0;
for (list<MxDriver>::iterator it = p_deviceEnumerate.m_list.begin(); it != p_deviceEnumerate.m_list.end(); it++) { for (list<MxDriver>::iterator it = p_deviceEnumerate.m_list.begin(); it != p_deviceEnumerate.m_list.end(); it++) {
MxDriver& driver = *it; MxDriver& driver = *it;
@ -248,13 +247,13 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_dri
assignedDevice->m_deviceInfo->m_modeArray = assignedDevice->m_deviceInfo->m_modeArray =
new MxDirectDraw::Mode[assignedDevice->m_deviceInfo->m_count]; new MxDirectDraw::Mode[assignedDevice->m_deviceInfo->m_count];
MxS32 j = 0; int 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++) {
assignedDevice->m_deviceInfo->m_modeArray[j].m_width = (*it2).m_width; assignedDevice->m_deviceInfo->m_modeArray[j].width = (*it2).m_width;
assignedDevice->m_deviceInfo->m_modeArray[j].m_height = (*it2).m_height; assignedDevice->m_deviceInfo->m_modeArray[j].height = (*it2).m_height;
assignedDevice->m_deviceInfo->m_modeArray[j].m_bitsPerPixel = (*it2).m_bitsPerPixel; assignedDevice->m_deviceInfo->m_modeArray[j].bitsPerPixel = (*it2).m_bitsPerPixel;
j++; j++;
} }
} }
@ -556,19 +555,19 @@ HRESULT MxDeviceEnumerate::EnumDevicesCallback(
} }
// FUNCTION: LEGO1 0x1009c6c0 // FUNCTION: LEGO1 0x1009c6c0
MxResult MxDeviceEnumerate::DoEnumerate() int MxDeviceEnumerate::DoEnumerate()
{ {
if (m_initialized) if (m_initialized)
return FAILURE; return -1;
HRESULT ret = DirectDrawEnumerate(DirectDrawEnumerateCallback, this); HRESULT ret = DirectDrawEnumerate(DirectDrawEnumerateCallback, this);
if (ret) { if (ret != DD_OK) {
BuildErrorString("DirectDrawEnumerate returned error %s\n", EnumerateErrorToString(ret)); BuildErrorString("DirectDrawEnumerate returned error %s\n", EnumerateErrorToString(ret));
return FAILURE; return -1;
} }
m_initialized = TRUE; m_initialized = TRUE;
return SUCCESS; return 0;
} }
// FUNCTION: LEGO1 0x1009c710 // FUNCTION: LEGO1 0x1009c710
@ -589,13 +588,13 @@ const char* MxDeviceEnumerate::EnumerateErrorToString(HRESULT p_error)
} }
// FUNCTION: LEGO1 0x1009ce60 // FUNCTION: LEGO1 0x1009ce60
MxS32 MxDeviceEnumerate::ParseDeviceName(const char* p_deviceId) int MxDeviceEnumerate::ParseDeviceName(const char* p_deviceId)
{ {
if (!m_initialized) if (!m_initialized)
return -1; return -1;
MxS32 num = -1; int num = -1;
MxS32 hex[4]; int hex[4];
if (sscanf(p_deviceId, "%d 0x%x 0x%x 0x%x 0x%x", &num, &hex[0], &hex[1], &hex[2], &hex[3]) != 5) if (sscanf(p_deviceId, "%d 0x%x 0x%x 0x%x 0x%x", &num, &hex[0], &hex[1], &hex[2], &hex[3]) != 5)
return -1; return -1;
@ -606,7 +605,7 @@ MxS32 MxDeviceEnumerate::ParseDeviceName(const char* p_deviceId)
GUID guid; GUID guid;
memcpy(&guid, hex, sizeof(guid)); memcpy(&guid, hex, sizeof(guid));
MxS32 result = ProcessDeviceBytes(num, guid); int result = ProcessDeviceBytes(num, guid);
if (result < 0) if (result < 0)
return ProcessDeviceBytes(-1, guid); return ProcessDeviceBytes(-1, guid);
@ -614,19 +613,19 @@ MxS32 MxDeviceEnumerate::ParseDeviceName(const char* p_deviceId)
} }
// FUNCTION: LEGO1 0x1009cf20 // FUNCTION: LEGO1 0x1009cf20
MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid) int MxDeviceEnumerate::ProcessDeviceBytes(int p_deviceNum, GUID& p_guid)
{ {
if (!m_initialized) if (!m_initialized)
return -1; return -1;
MxS32 i = 0; int i = 0;
MxS32 j = 0; int j = 0;
struct GUID4 { struct GUID4 {
MxS32 m_data1; int m_data1;
MxS32 m_data2; int m_data2;
MxS32 m_data3; int m_data3;
MxS32 m_data4; int m_data4;
}; };
static_assert(sizeof(GUID4) == sizeof(GUID), "Equal size"); static_assert(sizeof(GUID4) == sizeof(GUID), "Equal size");
@ -658,10 +657,10 @@ MxS32 MxDeviceEnumerate::ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid)
} }
// FUNCTION: LEGO1 0x1009d030 // FUNCTION: LEGO1 0x1009d030
MxResult MxDeviceEnumerate::GetDevice(MxS32 p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device) int MxDeviceEnumerate::GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device)
{ {
if (p_deviceNum >= 0 && m_initialized) { if (p_deviceNum >= 0 && m_initialized) {
MxS32 i = 0; int i = 0;
for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end(); it++) { for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end(); it++) {
p_driver = &*it; p_driver = &*it;
@ -669,20 +668,20 @@ MxResult MxDeviceEnumerate::GetDevice(MxS32 p_deviceNum, MxDriver*& p_driver, Mx
for (list<MxDevice>::iterator it2 = p_driver->m_devices.begin(); it2 != p_driver->m_devices.end(); it2++) { for (list<MxDevice>::iterator it2 = p_driver->m_devices.begin(); it2 != p_driver->m_devices.end(); it2++) {
if (i == p_deviceNum) { if (i == p_deviceNum) {
p_device = &*it2; p_device = &*it2;
return SUCCESS; return 0;
} }
i++; i++;
} }
} }
return FAILURE; return -1;
} }
return FAILURE; return -1;
} }
// FUNCTION: LEGO1 0x1009d0d0 // FUNCTION: LEGO1 0x1009d0d0
MxS32 MxDeviceEnumerate::FUN_1009d0d0() int MxDeviceEnumerate::FUN_1009d0d0()
{ {
if (!m_initialized) if (!m_initialized)
return -1; return -1;
@ -690,10 +689,10 @@ MxS32 MxDeviceEnumerate::FUN_1009d0d0()
if (m_list.empty()) if (m_list.empty())
return -1; return -1;
MxS32 i = 0; int i = 0;
MxS32 j = 0; int j = 0;
MxS32 k = -1; int k = -1;
MxU32 und = FUN_1009d1a0(); unsigned int und = FUN_1009d1a0();
for (list<MxDriver>::iterator it = m_list.begin();; it++) { for (list<MxDriver>::iterator it = m_list.begin();; it++) {
if (it == m_list.end()) if (it == m_list.end())
@ -729,10 +728,10 @@ undefined4 MxDeviceEnumerate::FUN_1009d1e0()
} }
// FUNCTION: LEGO1 0x1009d210 // FUNCTION: LEGO1 0x1009d210
MxResult MxDeviceEnumerate::FUN_1009d210() int MxDeviceEnumerate::FUN_1009d210()
{ {
if (!m_initialized) if (!m_initialized)
return FAILURE; return -1;
for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end();) { for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end();) {
MxDriver& driver = *it; MxDriver& driver = *it;
@ -756,11 +755,11 @@ MxResult MxDeviceEnumerate::FUN_1009d210()
} }
} }
return m_list.empty() ? FAILURE : SUCCESS; return m_list.empty() ? -1 : 0;
} }
// FUNCTION: LEGO1 0x1009d370 // FUNCTION: LEGO1 0x1009d370
MxBool MxDeviceEnumerate::FUN_1009d370(MxDriver& p_driver) unsigned char MxDeviceEnumerate::FUN_1009d370(MxDriver& p_driver)
{ {
for (list<MxDisplayMode>::iterator it = p_driver.m_displayModes.begin(); it != p_driver.m_displayModes.end(); for (list<MxDisplayMode>::iterator it = p_driver.m_displayModes.begin(); it != p_driver.m_displayModes.end();
it++) { it++) {
@ -774,7 +773,7 @@ MxBool MxDeviceEnumerate::FUN_1009d370(MxDriver& p_driver)
} }
// FUNCTION: LEGO1 0x1009d3d0 // FUNCTION: LEGO1 0x1009d3d0
MxBool MxDeviceEnumerate::FUN_1009d3d0(MxDevice& p_device) unsigned char MxDeviceEnumerate::FUN_1009d3d0(MxDevice& p_device)
{ {
if (m_list.size() <= 0) if (m_list.size() <= 0)
return FALSE; return FALSE;

View file

@ -1,10 +1,9 @@
#ifndef MXDIRECT3D_H #ifndef MXDIRECT3D_H
#define MXDIRECT3D_H #define MXDIRECT3D_H
#include "../mxstl/stlcompat.h"
#include "decomp.h" #include "decomp.h"
#include "mxdirectdraw.h" #include "mxdirectdraw.h"
#include "mxstl/stlcompat.h"
#include "mxtypes.h"
#include <d3d.h> #include <d3d.h>
@ -21,14 +20,14 @@ public:
MxAssignedDevice(); MxAssignedDevice();
~MxAssignedDevice(); ~MxAssignedDevice();
inline MxU32 GetFlags() { return m_flags; } inline unsigned int GetFlags() { return m_flags; }
inline D3DDEVICEDESC& GetDesc() { return m_desc; } inline D3DDEVICEDESC& GetDesc() { return m_desc; }
friend class MxDirect3D; friend class MxDirect3D;
private: private:
GUID m_guid; // 0x00 GUID m_guid; // 0x00
MxU32 m_flags; // 0x10 unsigned int m_flags; // 0x10
D3DDEVICEDESC m_desc; // 0x14 D3DDEVICEDESC m_desc; // 0x14
MxDirectDraw::DeviceModesInfo* m_deviceInfo; // 0xe0 MxDirectDraw::DeviceModesInfo* m_deviceInfo; // 0xe0
}; };
@ -101,8 +100,8 @@ struct MxDevice {
D3DDEVICEDESC m_HWDesc; // 0x0c D3DDEVICEDESC m_HWDesc; // 0x0c
D3DDEVICEDESC m_HELDesc; // 0xd8 D3DDEVICEDESC m_HELDesc; // 0xd8
MxBool operator==(MxDevice) const { return TRUE; } int operator==(MxDevice) const { return 0; }
MxBool operator<(MxDevice) const { return TRUE; } int operator<(MxDevice) const { return 0; }
}; };
// SIZE 0x0c // SIZE 0x0c
@ -111,8 +110,8 @@ struct MxDisplayMode {
DWORD m_height; // 0x04 DWORD m_height; // 0x04
DWORD m_bitsPerPixel; // 0x08 DWORD m_bitsPerPixel; // 0x08
MxBool operator==(MxDisplayMode) const { return TRUE; } int operator==(MxDisplayMode) const { return 0; }
MxBool operator<(MxDisplayMode) const { return TRUE; } int operator<(MxDisplayMode) const { return 0; }
}; };
// SIZE 0x190 // SIZE 0x190
@ -130,8 +129,8 @@ struct MxDriver {
list<MxDevice> m_devices; // 0x178 list<MxDevice> m_devices; // 0x178
list<MxDisplayMode> m_displayModes; // 0x184 list<MxDisplayMode> m_displayModes; // 0x184
MxBool operator==(MxDriver) const { return TRUE; } int operator==(MxDriver) const { return 0; }
MxBool operator<(MxDriver) const { return TRUE; } int operator<(MxDriver) const { return 0; }
}; };
// clang-format off // clang-format off
@ -178,7 +177,7 @@ public:
// FUNCTION: LEGO1 0x1009c010 // FUNCTION: LEGO1 0x1009c010
~MxDeviceEnumerate() {} ~MxDeviceEnumerate() {}
virtual MxResult DoEnumerate(); // vtable+0x00 virtual int DoEnumerate(); // vtable+0x00
BOOL EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName); BOOL EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName);
HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd); HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd);
@ -190,13 +189,13 @@ public:
LPD3DDEVICEDESC p_HELDesc LPD3DDEVICEDESC p_HELDesc
); );
const char* EnumerateErrorToString(HRESULT p_error); const char* EnumerateErrorToString(HRESULT p_error);
MxS32 ParseDeviceName(const char* p_deviceId); int ParseDeviceName(const char* p_deviceId);
MxS32 ProcessDeviceBytes(MxS32 p_deviceNum, GUID& p_guid); int ProcessDeviceBytes(int p_deviceNum, GUID& p_guid);
MxResult GetDevice(MxS32 p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device); int GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device);
MxS32 FUN_1009d0d0(); int FUN_1009d0d0();
MxResult FUN_1009d210(); int FUN_1009d210();
MxBool FUN_1009d370(MxDriver& p_driver); unsigned char FUN_1009d370(MxDriver& p_driver);
MxBool FUN_1009d3d0(MxDevice& p_device); unsigned char FUN_1009d3d0(MxDevice& p_device);
static void BuildErrorString(const char*, ...); static void BuildErrorString(const char*, ...);
static BOOL CALLBACK static BOOL CALLBACK
@ -217,7 +216,7 @@ public:
private: private:
list<MxDriver> m_list; // 0x04 list<MxDriver> m_list; // 0x04
MxBool m_initialized; // 0x10 unsigned char m_initialized; // 0x10
}; };
// VTABLE: LEGO1 0x100d9cc8 // VTABLE: LEGO1 0x100d9cc8

View file

@ -348,9 +348,9 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
} }
if (!IsSupportedMode(width, height, bpp)) { if (!IsSupportedMode(width, height, bpp)) {
width = m_pCurrentDeviceModesList->m_modeArray[0].m_width; width = m_pCurrentDeviceModesList->m_modeArray[0].width;
height = m_pCurrentDeviceModesList->m_modeArray[0].m_height; height = m_pCurrentDeviceModesList->m_modeArray[0].height;
bpp = m_pCurrentDeviceModesList->m_modeArray[0].m_bitsPerPixel; bpp = m_pCurrentDeviceModesList->m_modeArray[0].bitsPerPixel;
} }
m_bIgnoreWMSIZE = TRUE; m_bIgnoreWMSIZE = TRUE;
@ -396,9 +396,9 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
m_bIgnoreWMSIZE = FALSE; m_bIgnoreWMSIZE = FALSE;
} }
m_currentMode.m_width = width; m_currentMode.width = width;
m_currentMode.m_height = height; m_currentMode.height = height;
m_currentMode.m_bitsPerPixel = bpp; m_currentMode.bitsPerPixel = bpp;
if (!DDCreateSurfaces()) { if (!DDCreateSurfaces()) {
return FALSE; return FALSE;
@ -506,8 +506,8 @@ BOOL MxDirectDraw::DDCreateSurfaces()
Error("CreateSurface for window front buffer failed", result); Error("CreateSurface for window front buffer failed", result);
return FALSE; return FALSE;
} }
ddsd.dwHeight = m_currentMode.m_height; ddsd.dwHeight = m_currentMode.height;
ddsd.dwWidth = m_currentMode.m_width; ddsd.dwWidth = m_currentMode.width;
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
if (m_bOnlySystemMemory) if (m_bOnlySystemMemory)
@ -640,7 +640,7 @@ BOOL MxDirectDraw::CreateTextSurfaces()
} }
m_hFont = CreateFontA( m_hFont = CreateFontA(
m_currentMode.m_width <= 600 ? 12 : 24, m_currentMode.width <= 600 ? 12 : 24,
0, 0,
0, 0,
0, 0,
@ -774,8 +774,8 @@ BOOL MxDirectDraw::CreateZBuffer(DWORD memorytype, DWORD depth)
memset(&ddsd, 0, sizeof(ddsd)); memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwHeight = m_currentMode.m_height; ddsd.dwHeight = m_currentMode.height;
ddsd.dwWidth = m_currentMode.m_width; ddsd.dwWidth = m_currentMode.width;
ddsd.dwZBufferBitDepth = depth; ddsd.dwZBufferBitDepth = depth;
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_ZBUFFERBITDEPTH; ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_ZBUFFERBITDEPTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | memorytype; ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | memorytype;
@ -889,7 +889,7 @@ int MxDirectDraw::FlipToGDISurface()
} }
// FUNCTION: LEGO1 0x1009e830 // FUNCTION: LEGO1 0x1009e830
void MxDirectDraw::Error(const char* p_message, MxS32 p_error) void MxDirectDraw::Error(const char* p_message, int p_error)
{ {
// GLOBAL: LEGO1 0x10100c70 // GLOBAL: LEGO1 0x10100c70
static BOOL g_isInsideError = FALSE; static BOOL g_isInsideError = FALSE;

View file

@ -1,8 +1,6 @@
#ifndef MXDIRECTDRAW_H #ifndef MXDIRECTDRAW_H
#define MXDIRECTDRAW_H #define MXDIRECTDRAW_H
#include "mxtypes.h"
#include <ddraw.h> #include <ddraw.h>
#include <windows.h> #include <windows.h>
@ -14,17 +12,14 @@ public:
// SIZE 0x0c // SIZE 0x0c
struct Mode { struct Mode {
MxS32 operator==(const Mode& p_mode) const int operator==(const Mode& p_mode) const
{ {
return ( return ((width == p_mode.width) && (height == p_mode.height) && (bitsPerPixel == p_mode.bitsPerPixel));
(m_width == p_mode.m_width) && (m_height == p_mode.m_height) &&
(m_bitsPerPixel == p_mode.m_bitsPerPixel)
);
} }
MxS32 m_width; // 0x00 int width; // 0x00
MxS32 m_height; // 0x04 int height; // 0x04
MxS32 m_bitsPerPixel; // 0x08 int bitsPerPixel; // 0x08
}; };
// SIZE 0x17c // SIZE 0x17c
@ -34,7 +29,7 @@ public:
GUID* m_guid; // 0x00 GUID* m_guid; // 0x00
Mode* m_modeArray; // 0x04 Mode* m_modeArray; // 0x04
MxS32 m_count; // 0x08 int m_count; // 0x08
DDCAPS m_ddcaps; // 0x0c DDCAPS m_ddcaps; // 0x0c
void* m_unk0x178; // 0x178 void* m_unk0x178; // 0x178
}; };
@ -68,7 +63,7 @@ public:
BOOL DDCreateSurfaces(); BOOL DDCreateSurfaces();
BOOL DDInit(BOOL fullscreen); BOOL DDInit(BOOL fullscreen);
BOOL DDSetMode(int width, int height, int bpp); BOOL DDSetMode(int width, int height, int bpp);
void Error(const char* p_message, MxS32 p_error); void Error(const char* p_message, int p_error);
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf); BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf);
BOOL IsSupportedMode(int width, int height, int bpp); BOOL IsSupportedMode(int width, int height, int bpp);