mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 15:48:09 -05:00
Match some names/values (#545)
* Match some names/values * Fix mingw warning as error
This commit is contained in:
parent
f1f4bd14c6
commit
84af3e2158
8 changed files with 233 additions and 238 deletions
|
@ -68,9 +68,10 @@ BOOL CMainDialog::OnInitDialog()
|
||||||
const list<MxDriver>& driver_list = enumerator->GetDriverList();
|
const list<MxDriver>& driver_list = enumerator->GetDriverList();
|
||||||
for (list<MxDriver>::const_iterator it_driver = driver_list.begin(); it_driver != driver_list.end(); it_driver++) {
|
for (list<MxDriver>::const_iterator it_driver = driver_list.begin(); it_driver != driver_list.end(); it_driver++) {
|
||||||
const MxDriver& driver = *it_driver;
|
const MxDriver& driver = *it_driver;
|
||||||
for (list<MxDevice>::const_iterator it_device = driver.m_devices.begin(); it_device != driver.m_devices.end();
|
for (list<Direct3DDeviceInfo>::const_iterator it_device = driver.m_devices.begin();
|
||||||
|
it_device != driver.m_devices.end();
|
||||||
it_device++) {
|
it_device++) {
|
||||||
const MxDevice& device = *it_device;
|
const Direct3DDeviceInfo& device = *it_device;
|
||||||
if (&device == currentConfigApp->m_device) {
|
if (&device == currentConfigApp->m_device) {
|
||||||
selected = device_i;
|
selected = device_i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <d3d.h>
|
#include <d3d.h>
|
||||||
|
|
||||||
class MxDeviceEnumerate;
|
class MxDeviceEnumerate;
|
||||||
struct MxDevice;
|
struct Direct3DDeviceInfo;
|
||||||
struct MxDriver;
|
struct MxDriver;
|
||||||
|
|
||||||
#define currentConfigApp ((CConfigApp*) afxCurrentWinApp)
|
#define currentConfigApp ((CConfigApp*) afxCurrentWinApp)
|
||||||
|
@ -56,7 +56,7 @@ class CConfigApp : public CWinApp {
|
||||||
public:
|
public:
|
||||||
MxDeviceEnumerate* m_device_enumerator; // 0x0c4
|
MxDeviceEnumerate* m_device_enumerator; // 0x0c4
|
||||||
MxDriver* m_driver; // 0x0c8
|
MxDriver* m_driver; // 0x0c8
|
||||||
MxDevice* m_device; // 0x0cc
|
Direct3DDeviceInfo* m_device; // 0x0cc
|
||||||
int m_display_bit_depth; // 0x0d0
|
int m_display_bit_depth; // 0x0d0
|
||||||
BOOL m_flip_surfaces; // 0x0d4
|
BOOL m_flip_surfaces; // 0x0d4
|
||||||
BOOL m_full_screen; // 0x0d8
|
BOOL m_full_screen; // 0x0d8
|
||||||
|
|
|
@ -445,7 +445,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
if (g_isle && VideoManager() && g_isle->GetFullScreen() && VideoManager()->GetDirect3D()) {
|
if (g_isle && VideoManager() && g_isle->GetFullScreen() && VideoManager()->GetDirect3D()) {
|
||||||
if (VideoManager()->GetDirect3D()->GetAssignedDevice()) {
|
if (VideoManager()->GetDirect3D()->AssignedDevice()) {
|
||||||
int targetDepth = wParam;
|
int targetDepth = wParam;
|
||||||
int targetWidth = LOWORD(lParam);
|
int targetWidth = LOWORD(lParam);
|
||||||
int targetHeight = HIWORD(lParam);
|
int targetHeight = HIWORD(lParam);
|
||||||
|
|
|
@ -62,7 +62,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||||
{
|
{
|
||||||
MxBool paletteCreated = FALSE;
|
MxBool paletteCreated = FALSE;
|
||||||
MxDriver* driver = NULL;
|
MxDriver* driver = NULL;
|
||||||
MxDevice* device = NULL;
|
Direct3DDeviceInfo* device = NULL;
|
||||||
MxResult result = FAILURE;
|
MxResult result = FAILURE;
|
||||||
|
|
||||||
MxDeviceEnumerate100d9cc8 deviceEnumerate;
|
MxDeviceEnumerate100d9cc8 deviceEnumerate;
|
||||||
|
@ -137,11 +137,11 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||||
|
|
||||||
if (MxVideoManager::VTable0x28(
|
if (MxVideoManager::VTable0x28(
|
||||||
p_videoParam,
|
p_videoParam,
|
||||||
m_direct3d->GetDirectDraw(),
|
m_direct3d->DirectDraw(),
|
||||||
m_direct3d->GetDirect3D(),
|
m_direct3d->Direct3D(),
|
||||||
m_direct3d->GetFrontBuffer(),
|
m_direct3d->FrontBuffer(),
|
||||||
m_direct3d->GetBackBuffer(),
|
m_direct3d->BackBuffer(),
|
||||||
m_direct3d->GetClipper(),
|
m_direct3d->Clipper(),
|
||||||
p_frequencyMS,
|
p_frequencyMS,
|
||||||
p_createThread
|
p_createThread
|
||||||
) != SUCCESS) {
|
) != SUCCESS) {
|
||||||
|
@ -169,8 +169,8 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||||
createStruct.m_pPalette = m_videoParam.GetPalette()->CreateNativePalette();
|
createStruct.m_pPalette = m_videoParam.GetPalette()->CreateNativePalette();
|
||||||
createStruct.m_isFullScreen = FALSE;
|
createStruct.m_isFullScreen = FALSE;
|
||||||
createStruct.m_isWideViewAngle = m_videoParam.Flags().GetWideViewAngle();
|
createStruct.m_isWideViewAngle = m_videoParam.Flags().GetWideViewAngle();
|
||||||
createStruct.m_direct3d = m_direct3d->GetDirect3D();
|
createStruct.m_direct3d = m_direct3d->Direct3D();
|
||||||
createStruct.m_d3dDevice = m_direct3d->GetDirect3DDevice();
|
createStruct.m_d3dDevice = m_direct3d->Direct3DDevice();
|
||||||
|
|
||||||
if (!m_3dManager->Create(createStruct)) {
|
if (!m_3dManager->Create(createStruct)) {
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -501,7 +501,7 @@ MxResult LegoVideoManager::ConfigureD3DRM()
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MxAssignedDevice* assignedDevice = m_direct3d->GetAssignedDevice();
|
MxAssignedDevice* assignedDevice = m_direct3d->AssignedDevice();
|
||||||
|
|
||||||
if (assignedDevice && assignedDevice->GetFlags() & MxAssignedDevice::c_hardwareMode) {
|
if (assignedDevice && assignedDevice->GetFlags() & MxAssignedDevice::c_hardwareMode) {
|
||||||
if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR) {
|
if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR) {
|
||||||
|
|
|
@ -6,18 +6,24 @@
|
||||||
DECOMP_SIZE_ASSERT(MxAssignedDevice, 0xe4);
|
DECOMP_SIZE_ASSERT(MxAssignedDevice, 0xe4);
|
||||||
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
|
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894);
|
||||||
#endif
|
#endif
|
||||||
DECOMP_SIZE_ASSERT(MxDevice, 0x1a4);
|
DECOMP_SIZE_ASSERT(Direct3DDeviceInfo, 0x1a4);
|
||||||
DECOMP_SIZE_ASSERT(MxDisplayMode, 0x0c);
|
DECOMP_SIZE_ASSERT(MxDisplayMode, 0x0c);
|
||||||
DECOMP_SIZE_ASSERT(MxDriver, 0x190);
|
DECOMP_SIZE_ASSERT(MxDriver, 0x190);
|
||||||
DECOMP_SIZE_ASSERT(MxDeviceEnumerate, 0x14);
|
DECOMP_SIZE_ASSERT(MxDeviceEnumerate, 0x14);
|
||||||
|
|
||||||
#if !defined(MXDIRECTX_FOR_CONFIG)
|
#if !defined(MXDIRECTX_FOR_CONFIG)
|
||||||
|
#define RELEASE(x) \
|
||||||
|
if (x != NULL) { \
|
||||||
|
x->Release(); \
|
||||||
|
x = NULL; \
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009b0a0
|
// FUNCTION: LEGO1 0x1009b0a0
|
||||||
MxDirect3D::MxDirect3D()
|
MxDirect3D::MxDirect3D()
|
||||||
{
|
{
|
||||||
this->m_pDirect3d = NULL;
|
this->m_pDirect3d = NULL;
|
||||||
this->m_pDirect3dDevice = NULL;
|
this->m_pDirect3dDevice = NULL;
|
||||||
this->m_unk0x88c = 0;
|
this->m_bTexturesDisabled = FALSE;
|
||||||
this->m_assignedDevice = NULL;
|
this->m_assignedDevice = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +59,7 @@ BOOL MxDirect3D::Create(
|
||||||
paletteEntryCount
|
paletteEntryCount
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret && CreateIDirect3D() && D3DSetMode()) {
|
if (ret && D3DCreate() && D3DSetMode()) {
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,15 +73,8 @@ BOOL MxDirect3D::Create(
|
||||||
// FUNCTION: LEGO1 0x1009b210
|
// FUNCTION: LEGO1 0x1009b210
|
||||||
void MxDirect3D::Destroy()
|
void MxDirect3D::Destroy()
|
||||||
{
|
{
|
||||||
if (this->m_pDirect3dDevice) {
|
RELEASE(m_pDirect3dDevice);
|
||||||
this->m_pDirect3dDevice->Release();
|
RELEASE(m_pDirect3d);
|
||||||
this->m_pDirect3dDevice = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->m_pDirect3d) {
|
|
||||||
this->m_pDirect3d->Release();
|
|
||||||
this->m_pDirect3d = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->m_assignedDevice) {
|
if (this->m_assignedDevice) {
|
||||||
delete m_assignedDevice;
|
delete m_assignedDevice;
|
||||||
|
@ -92,27 +91,21 @@ void MxDirect3D::Destroy()
|
||||||
// FUNCTION: LEGO1 0x1009b290
|
// FUNCTION: LEGO1 0x1009b290
|
||||||
void MxDirect3D::DestroyButNotDirectDraw()
|
void MxDirect3D::DestroyButNotDirectDraw()
|
||||||
{
|
{
|
||||||
if (this->m_pDirect3dDevice) {
|
RELEASE(m_pDirect3dDevice);
|
||||||
this->m_pDirect3dDevice->Release();
|
RELEASE(m_pDirect3d);
|
||||||
this->m_pDirect3dDevice = NULL;
|
|
||||||
}
|
|
||||||
if (this->m_pDirect3d) {
|
|
||||||
this->m_pDirect3d->Release();
|
|
||||||
this->m_pDirect3d = NULL;
|
|
||||||
}
|
|
||||||
MxDirectDraw::DestroyButNotDirectDraw();
|
MxDirectDraw::DestroyButNotDirectDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009b2d0
|
// FUNCTION: LEGO1 0x1009b2d0
|
||||||
BOOL MxDirect3D::CreateIDirect3D()
|
BOOL MxDirect3D::D3DCreate()
|
||||||
{
|
{
|
||||||
HRESULT ret = IDirect3D_QueryInterface(m_pDirectDraw, IID_IDirect3D2, (LPVOID*) &m_pDirect3d);
|
HRESULT result;
|
||||||
|
|
||||||
if (ret) {
|
result = DirectDraw()->QueryInterface(IID_IDirect3D2, (LPVOID*) &m_pDirect3d);
|
||||||
Error("Creation of IDirect3D failed", ret);
|
if (result != DD_OK) {
|
||||||
|
Error("Creation of IDirect3D failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,27 +119,25 @@ BOOL MxDirect3D::D3DSetMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) {
|
if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) {
|
||||||
m_unk0x88c = FALSE;
|
m_bTexturesDisabled = FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_unk0x88c = TRUE;
|
m_bTexturesDisabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD bitDepth = GetZBufferBitDepth(m_assignedDevice);
|
if (!CreateZBuffer(DDSCAPS_VIDEOMEMORY, ZBufferDepth(m_assignedDevice))) {
|
||||||
if (!CreateZBuffer(DDSCAPS_VIDEOMEMORY, bitDepth)) {
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) {
|
if (m_assignedDevice->m_desc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) {
|
||||||
m_unk0x88c = FALSE;
|
m_bTexturesDisabled = FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_unk0x88c = TRUE;
|
m_bTexturesDisabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD bitDepth = GetZBufferBitDepth(m_assignedDevice);
|
if (!CreateZBuffer(DDSCAPS_SYSTEMMEMORY, ZBufferDepth(m_assignedDevice))) {
|
||||||
if (!CreateZBuffer(DDSCAPS_SYSTEMMEMORY, bitDepth)) {
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,9 +151,11 @@ BOOL MxDirect3D::D3DSetMode()
|
||||||
|
|
||||||
MxDirectDraw::Mode mode = m_currentMode;
|
MxDirectDraw::Mode mode = m_currentMode;
|
||||||
|
|
||||||
if (m_bFullScreen && !IsSupportedMode(mode.width, mode.height, mode.bitsPerPixel)) {
|
if (IsFullScreen()) {
|
||||||
Error("This device cannot support the current display mode", DDERR_GENERIC);
|
if (!IsSupportedMode(mode.width, mode.height, mode.bitsPerPixel)) {
|
||||||
return FALSE;
|
Error("This device cannot support the current display mode", DDERR_GENERIC);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LPDIRECTDRAWSURFACE frontBuffer = m_pFrontBuffer;
|
LPDIRECTDRAWSURFACE frontBuffer = m_pFrontBuffer;
|
||||||
|
@ -209,35 +202,39 @@ BOOL MxDirect3D::D3DSetMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009b5a0
|
// FUNCTION: LEGO1 0x1009b5a0
|
||||||
DWORD MxDirect3D::GetZBufferBitDepth(MxAssignedDevice* p_assignedDevice)
|
int MxDirect3D::ZBufferDepth(MxAssignedDevice* p_assignedDevice)
|
||||||
{
|
{
|
||||||
DWORD bitDepth;
|
int depth;
|
||||||
|
DWORD deviceDepth;
|
||||||
|
|
||||||
if (p_assignedDevice->m_desc.dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) {
|
if (p_assignedDevice->m_desc.dwFlags & D3DDD_DEVICEZBUFFERBITDEPTH) {
|
||||||
bitDepth = p_assignedDevice->m_desc.dwDeviceZBufferBitDepth;
|
deviceDepth = p_assignedDevice->m_desc.dwDeviceZBufferBitDepth;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bitDepth = 0;
|
deviceDepth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitDepth & DDBD_32) {
|
if (deviceDepth & DDBD_32) {
|
||||||
return 32;
|
depth = 32;
|
||||||
}
|
}
|
||||||
if (bitDepth & DDBD_24) {
|
else if (deviceDepth & DDBD_24) {
|
||||||
return 24;
|
depth = 24;
|
||||||
}
|
}
|
||||||
if (bitDepth & DDBD_16) {
|
else if (deviceDepth & DDBD_16) {
|
||||||
return 16;
|
depth = 16;
|
||||||
}
|
}
|
||||||
if (bitDepth & DDBD_8) {
|
else if (deviceDepth & DDBD_8) {
|
||||||
return 8;
|
depth = 8;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
depth = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009b5f0
|
// FUNCTION: LEGO1 0x1009b5f0
|
||||||
BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, MxDevice* p_device)
|
BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, Direct3DDeviceInfo* p_device)
|
||||||
{
|
{
|
||||||
if (m_assignedDevice) {
|
if (m_assignedDevice) {
|
||||||
delete m_assignedDevice;
|
delete m_assignedDevice;
|
||||||
|
@ -286,8 +283,9 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_dri
|
||||||
assignedDevice->m_flags |= MxAssignedDevice::c_primaryDevice;
|
assignedDevice->m_flags |= MxAssignedDevice::c_primaryDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list<MxDevice>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end(); it2++) {
|
for (list<Direct3DDeviceInfo>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end();
|
||||||
MxDevice& device = *it2;
|
it2++) {
|
||||||
|
Direct3DDeviceInfo& device = *it2;
|
||||||
if (&device != p_device) {
|
if (&device != p_device) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +393,7 @@ void MxDriver::Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009bd20
|
// FUNCTION: LEGO1 0x1009bd20
|
||||||
MxDevice::MxDevice(
|
Direct3DDeviceInfo::Direct3DDeviceInfo(
|
||||||
LPGUID p_guid,
|
LPGUID p_guid,
|
||||||
LPSTR p_deviceDesc,
|
LPSTR p_deviceDesc,
|
||||||
LPSTR p_deviceName,
|
LPSTR p_deviceName,
|
||||||
|
@ -405,12 +403,12 @@ MxDevice::MxDevice(
|
||||||
{
|
{
|
||||||
memset(this, 0, sizeof(*this));
|
memset(this, 0, sizeof(*this));
|
||||||
|
|
||||||
Init(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
Initialize(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x401460
|
// FUNCTION: CONFIG 0x401460
|
||||||
// FUNCTION: LEGO1 0x1009bd60
|
// FUNCTION: LEGO1 0x1009bd60
|
||||||
MxDevice::~MxDevice()
|
Direct3DDeviceInfo::~Direct3DDeviceInfo()
|
||||||
{
|
{
|
||||||
if (m_guid) {
|
if (m_guid) {
|
||||||
delete m_guid;
|
delete m_guid;
|
||||||
|
@ -424,7 +422,7 @@ MxDevice::~MxDevice()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009bda0
|
// FUNCTION: LEGO1 0x1009bda0
|
||||||
void MxDevice::Init(
|
void Direct3DDeviceInfo::Initialize(
|
||||||
LPGUID p_guid,
|
LPGUID p_guid,
|
||||||
LPSTR p_deviceDesc,
|
LPSTR p_deviceDesc,
|
||||||
LPSTR p_deviceName,
|
LPSTR p_deviceName,
|
||||||
|
@ -601,7 +599,7 @@ HRESULT MxDeviceEnumerate::EnumDevicesCallback(
|
||||||
LPD3DDEVICEDESC p_HELDesc
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MxDevice device(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
Direct3DDeviceInfo device(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
||||||
m_list.back().m_devices.push_back(device);
|
m_list.back().m_devices.push_back(device);
|
||||||
memset(&device, 0, sizeof(device));
|
memset(&device, 0, sizeof(device));
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
|
@ -899,7 +897,7 @@ int MxDeviceEnumerate::ProcessDeviceBytes(int p_deviceNum, GUID& p_guid)
|
||||||
|
|
||||||
GUID4 compareGuid;
|
GUID4 compareGuid;
|
||||||
MxDriver& driver = *it;
|
MxDriver& driver = *it;
|
||||||
for (list<MxDevice>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end(); it2++) {
|
for (list<Direct3DDeviceInfo>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end(); it2++) {
|
||||||
memcpy(&compareGuid, (*it2).m_guid, sizeof(GUID4));
|
memcpy(&compareGuid, (*it2).m_guid, sizeof(GUID4));
|
||||||
|
|
||||||
if (compareGuid.m_data1 == deviceGuid.m_data1 && compareGuid.m_data2 == deviceGuid.m_data2 &&
|
if (compareGuid.m_data1 == deviceGuid.m_data1 && compareGuid.m_data2 == deviceGuid.m_data2 &&
|
||||||
|
@ -919,7 +917,7 @@ int MxDeviceEnumerate::ProcessDeviceBytes(int p_deviceNum, GUID& p_guid)
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00402730
|
// FUNCTION: CONFIG 0x00402730
|
||||||
// FUNCTION: LEGO1 0x1009d030
|
// FUNCTION: LEGO1 0x1009d030
|
||||||
int MxDeviceEnumerate::GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device)
|
int MxDeviceEnumerate::GetDevice(int p_deviceNum, MxDriver*& p_driver, Direct3DDeviceInfo*& p_device)
|
||||||
{
|
{
|
||||||
if (p_deviceNum >= 0 && m_initialized) {
|
if (p_deviceNum >= 0 && m_initialized) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -927,7 +925,8 @@ int MxDeviceEnumerate::GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice*
|
||||||
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;
|
||||||
|
|
||||||
for (list<MxDevice>::iterator it2 = p_driver->m_devices.begin(); it2 != p_driver->m_devices.end(); it2++) {
|
for (list<Direct3DDeviceInfo>::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 0;
|
return 0;
|
||||||
|
@ -944,7 +943,8 @@ int MxDeviceEnumerate::GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice*
|
||||||
|
|
||||||
#if defined(MXDIRECTX_FOR_CONFIG)
|
#if defined(MXDIRECTX_FOR_CONFIG)
|
||||||
// FUNCTION: CONFIG 0x004027d0
|
// FUNCTION: CONFIG 0x004027d0
|
||||||
int MxDeviceEnumerate::FormatDeviceName(char* p_buffer, const MxDriver* p_driver, const MxDevice* p_device) const
|
int MxDeviceEnumerate::FormatDeviceName(char* p_buffer, const MxDriver* p_driver, const Direct3DDeviceInfo* p_device)
|
||||||
|
const
|
||||||
{
|
{
|
||||||
int number = 0;
|
int number = 0;
|
||||||
for (list<MxDriver>::const_iterator it = m_list.begin(); it != m_list.end(); it++) {
|
for (list<MxDriver>::const_iterator it = m_list.begin(); it != m_list.end(); it++) {
|
||||||
|
@ -988,7 +988,7 @@ int MxDeviceEnumerate::FUN_1009d0d0()
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list<MxDevice>::iterator it2 = (*it).m_devices.begin(); it2 != (*it).m_devices.end(); it2++) {
|
for (list<Direct3DDeviceInfo>::iterator it2 = (*it).m_devices.begin(); it2 != (*it).m_devices.end(); it2++) {
|
||||||
if ((*it2).m_HWDesc.dcmColorModel) {
|
if ((*it2).m_HWDesc.dcmColorModel) {
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
@ -1095,8 +1095,8 @@ int MxDeviceEnumerate::FUN_1009d210()
|
||||||
m_list.erase(it++);
|
m_list.erase(it++);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (list<MxDevice>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end();) {
|
for (list<Direct3DDeviceInfo>::iterator it2 = driver.m_devices.begin(); it2 != driver.m_devices.end();) {
|
||||||
MxDevice& device = *it2;
|
Direct3DDeviceInfo& device = *it2;
|
||||||
|
|
||||||
if (!FUN_1009d3d0(device)) {
|
if (!FUN_1009d3d0(device)) {
|
||||||
driver.m_devices.erase(it2++);
|
driver.m_devices.erase(it2++);
|
||||||
|
@ -1136,7 +1136,7 @@ unsigned char MxDeviceEnumerate::DriverSupportsRequiredDisplayMode(MxDriver& p_d
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00402b60
|
// FUNCTION: CONFIG 0x00402b60
|
||||||
// FUNCTION: LEGO1 0x1009d3d0
|
// FUNCTION: LEGO1 0x1009d3d0
|
||||||
unsigned char MxDeviceEnumerate::FUN_1009d3d0(MxDevice& p_device)
|
unsigned char MxDeviceEnumerate::FUN_1009d3d0(Direct3DDeviceInfo& p_device)
|
||||||
{
|
{
|
||||||
if (m_list.size() <= 0) {
|
if (m_list.size() <= 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1147,7 +1147,8 @@ unsigned char MxDeviceEnumerate::FUN_1009d3d0(MxDevice& p_device)
|
||||||
p_device.m_HWDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE;
|
p_device.m_HWDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list<MxDevice>::iterator it = m_list.front().m_devices.begin(); it != m_list.front().m_devices.end(); it++) {
|
for (list<Direct3DDeviceInfo>::iterator it = m_list.front().m_devices.begin(); it != m_list.front().m_devices.end();
|
||||||
|
it++) {
|
||||||
if ((&*it) == &p_device) {
|
if ((&*it) == &p_device) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class MxAssignedDevice {
|
||||||
|
|
||||||
class MxDeviceEnumerate;
|
class MxDeviceEnumerate;
|
||||||
struct MxDriver;
|
struct MxDriver;
|
||||||
struct MxDevice;
|
struct Direct3DDeviceInfo;
|
||||||
|
|
||||||
// VTABLE: LEGO1 0x100db800
|
// VTABLE: LEGO1 0x100db800
|
||||||
// SIZE 0x894
|
// SIZE 0x894
|
||||||
|
@ -58,14 +58,17 @@ class MxDirect3D : public MxDirectDraw {
|
||||||
void Destroy() override; // vtable+0x08
|
void Destroy() override; // vtable+0x08
|
||||||
void DestroyButNotDirectDraw() override; // vtable+0x0c
|
void DestroyButNotDirectDraw() override; // vtable+0x0c
|
||||||
|
|
||||||
BOOL CreateIDirect3D();
|
inline MxAssignedDevice* AssignedDevice() { return this->m_assignedDevice; }
|
||||||
BOOL D3DSetMode();
|
inline IDirect3D2* Direct3D() { return this->m_pDirect3d; }
|
||||||
DWORD GetZBufferBitDepth(MxAssignedDevice* p_assignedDevice);
|
inline IDirect3DDevice2* Direct3DDevice() { return this->m_pDirect3dDevice; }
|
||||||
BOOL SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, MxDevice* p_device);
|
|
||||||
|
|
||||||
inline MxAssignedDevice* GetAssignedDevice() { return this->m_assignedDevice; }
|
BOOL SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_driver, Direct3DDeviceInfo* p_device);
|
||||||
inline IDirect3D2* GetDirect3D() { return this->m_pDirect3d; }
|
|
||||||
inline IDirect3DDevice2* GetDirect3DDevice() { return this->m_pDirect3dDevice; }
|
protected:
|
||||||
|
BOOL D3DCreate();
|
||||||
|
BOOL D3DSetMode();
|
||||||
|
|
||||||
|
int ZBufferDepth(MxAssignedDevice* p_assignedDevice);
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1009b120
|
// SYNTHETIC: LEGO1 0x1009b120
|
||||||
// MxDirect3D::`scalar deleting destructor'
|
// MxDirect3D::`scalar deleting destructor'
|
||||||
|
@ -74,16 +77,16 @@ class MxDirect3D : public MxDirectDraw {
|
||||||
MxAssignedDevice* m_assignedDevice; // 0x880
|
MxAssignedDevice* m_assignedDevice; // 0x880
|
||||||
IDirect3D2* m_pDirect3d; // 0x884
|
IDirect3D2* m_pDirect3d; // 0x884
|
||||||
IDirect3DDevice2* m_pDirect3dDevice; // 0x888
|
IDirect3DDevice2* m_pDirect3dDevice; // 0x888
|
||||||
BOOL m_unk0x88c; // 0x88c
|
BOOL m_bTexturesDisabled; // 0x88c
|
||||||
undefined4 m_unk0x890; // 0x890
|
undefined4 m_unk0x890; // 0x890
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SIZE 0x1a4
|
// SIZE 0x1a4
|
||||||
struct MxDevice {
|
struct Direct3DDeviceInfo {
|
||||||
MxDevice() {}
|
Direct3DDeviceInfo() {}
|
||||||
~MxDevice();
|
~Direct3DDeviceInfo();
|
||||||
MxDevice(
|
Direct3DDeviceInfo(
|
||||||
LPGUID p_guid,
|
LPGUID p_guid,
|
||||||
LPSTR p_deviceDesc,
|
LPSTR p_deviceDesc,
|
||||||
LPSTR p_deviceName,
|
LPSTR p_deviceName,
|
||||||
|
@ -91,7 +94,7 @@ struct MxDevice {
|
||||||
LPD3DDEVICEDESC p_HELDesc
|
LPD3DDEVICEDESC p_HELDesc
|
||||||
);
|
);
|
||||||
|
|
||||||
void Init(
|
void Initialize(
|
||||||
LPGUID p_guid,
|
LPGUID p_guid,
|
||||||
LPSTR p_deviceDesc,
|
LPSTR p_deviceDesc,
|
||||||
LPSTR p_deviceName,
|
LPSTR p_deviceName,
|
||||||
|
@ -105,8 +108,8 @@ struct MxDevice {
|
||||||
D3DDEVICEDESC m_HWDesc; // 0x0c
|
D3DDEVICEDESC m_HWDesc; // 0x0c
|
||||||
D3DDEVICEDESC m_HELDesc; // 0xd8
|
D3DDEVICEDESC m_HELDesc; // 0xd8
|
||||||
|
|
||||||
int operator==(MxDevice) const { return 0; }
|
int operator==(Direct3DDeviceInfo) const { return 0; }
|
||||||
int operator<(MxDevice) const { return 0; }
|
int operator<(Direct3DDeviceInfo) const { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// SIZE 0x0c
|
// SIZE 0x0c
|
||||||
|
@ -131,7 +134,7 @@ struct MxDriver {
|
||||||
char* m_driverDesc; // 0x04
|
char* m_driverDesc; // 0x04
|
||||||
char* m_driverName; // 0x08
|
char* m_driverName; // 0x08
|
||||||
DDCAPS m_ddCaps; // 0x0c
|
DDCAPS m_ddCaps; // 0x0c
|
||||||
list<MxDevice> m_devices; // 0x178
|
list<Direct3DDeviceInfo> m_devices; // 0x178
|
||||||
list<MxDisplayMode> m_displayModes; // 0x184
|
list<MxDisplayMode> m_displayModes; // 0x184
|
||||||
|
|
||||||
int operator==(MxDriver) const { return 0; }
|
int operator==(MxDriver) const { return 0; }
|
||||||
|
@ -141,7 +144,7 @@ struct MxDriver {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// TEMPLATE: CONFIG 0x401000
|
// TEMPLATE: CONFIG 0x401000
|
||||||
// TEMPLATE: LEGO1 0x1009b900
|
// TEMPLATE: LEGO1 0x1009b900
|
||||||
// list<MxDevice,allocator<MxDevice> >::~list<MxDevice,allocator<MxDevice> >
|
// list<Direct3DDeviceInfo,allocator<Direct3DDeviceInfo> >::~list<Direct3DDeviceInfo,allocator<Direct3DDeviceInfo> >
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
@ -152,7 +155,7 @@ struct MxDriver {
|
||||||
|
|
||||||
// TEMPLATE: CONFIG 0x4010e0
|
// TEMPLATE: CONFIG 0x4010e0
|
||||||
// TEMPLATE: LEGO1 0x1009b9e0
|
// TEMPLATE: LEGO1 0x1009b9e0
|
||||||
// List<MxDevice>::~List<MxDevice>
|
// List<Direct3DDeviceInfo>::~List<Direct3DDeviceInfo>
|
||||||
|
|
||||||
// TEMPLATE: CONFIG 0x401130
|
// TEMPLATE: CONFIG 0x401130
|
||||||
// TEMPLATE: LEGO1 0x1009ba30
|
// TEMPLATE: LEGO1 0x1009ba30
|
||||||
|
@ -175,7 +178,7 @@ struct MxDriver {
|
||||||
|
|
||||||
// SYNTHETIC: CONFIG 0x401b00
|
// SYNTHETIC: CONFIG 0x401b00
|
||||||
// SYNTHETIC: LEGO1 0x1009c400
|
// SYNTHETIC: LEGO1 0x1009c400
|
||||||
// list<MxDevice,allocator<MxDevice> >::insert
|
// list<Direct3DDeviceInfo,allocator<Direct3DDeviceInfo> >::insert
|
||||||
|
|
||||||
// SYNTHETIC: CONFIG 0x401b60
|
// SYNTHETIC: CONFIG 0x401b60
|
||||||
// SYNTHETIC: LEGO1 0x1009c460
|
// SYNTHETIC: LEGO1 0x1009c460
|
||||||
|
@ -185,7 +188,7 @@ struct MxDriver {
|
||||||
// MxDriver::`scalar deleting destructor'
|
// MxDriver::`scalar deleting destructor'
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1009d470
|
// SYNTHETIC: LEGO1 0x1009d470
|
||||||
// MxDevice::`scalar deleting destructor'
|
// Direct3DDeviceInfo::`scalar deleting destructor'
|
||||||
|
|
||||||
// VTABLE: CONFIG 0x00406000
|
// VTABLE: CONFIG 0x00406000
|
||||||
// VTABLE: LEGO1 0x100db814
|
// VTABLE: LEGO1 0x100db814
|
||||||
|
@ -209,16 +212,16 @@ class MxDeviceEnumerate {
|
||||||
const char* EnumerateErrorToString(HRESULT p_error);
|
const char* EnumerateErrorToString(HRESULT p_error);
|
||||||
int ParseDeviceName(const char* p_deviceId);
|
int ParseDeviceName(const char* p_deviceId);
|
||||||
int ProcessDeviceBytes(int p_deviceNum, GUID& p_guid);
|
int ProcessDeviceBytes(int p_deviceNum, GUID& p_guid);
|
||||||
int GetDevice(int p_deviceNum, MxDriver*& p_driver, MxDevice*& p_device);
|
int GetDevice(int p_deviceNum, MxDriver*& p_driver, Direct3DDeviceInfo*& p_device);
|
||||||
|
|
||||||
#if defined(MXDIRECTX_FOR_CONFIG)
|
#if defined(MXDIRECTX_FOR_CONFIG)
|
||||||
int FormatDeviceName(char* p_buffer, const MxDriver* p_driver, const MxDevice* p_device) const;
|
int FormatDeviceName(char* p_buffer, const MxDriver* p_driver, const Direct3DDeviceInfo* p_device) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int FUN_1009d0d0();
|
int FUN_1009d0d0();
|
||||||
int FUN_1009d210();
|
int FUN_1009d210();
|
||||||
unsigned char DriverSupportsRequiredDisplayMode(MxDriver& p_driver);
|
unsigned char DriverSupportsRequiredDisplayMode(MxDriver& p_driver);
|
||||||
unsigned char FUN_1009d3d0(MxDevice& p_device);
|
unsigned char FUN_1009d3d0(Direct3DDeviceInfo& p_device);
|
||||||
|
|
||||||
static void BuildErrorString(const char*, ...);
|
static void BuildErrorString(const char*, ...);
|
||||||
static BOOL CALLBACK
|
static BOOL CALLBACK
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
DECOMP_SIZE_ASSERT(MxDirectDraw, 0x880);
|
DECOMP_SIZE_ASSERT(MxDirectDraw, 0x880);
|
||||||
DECOMP_SIZE_ASSERT(MxDirectDraw::DeviceModesInfo, 0x17c);
|
DECOMP_SIZE_ASSERT(MxDirectDraw::DeviceModesInfo, 0x17c);
|
||||||
|
|
||||||
|
#define RELEASE(x) \
|
||||||
|
if (x != NULL) { \
|
||||||
|
x->Release(); \
|
||||||
|
x = NULL; \
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef DDSCAPS_3DDEVICE
|
#ifndef DDSCAPS_3DDEVICE
|
||||||
#define DDSCAPS_3DDEVICE 0x00002000l
|
#define DDSCAPS_3DDEVICE 0x00002000l
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,7 +81,7 @@ int MxDirectDraw::GetPrimaryBitDepth()
|
||||||
// FUNCTION: LEGO1 0x1009d5e0
|
// FUNCTION: LEGO1 0x1009d5e0
|
||||||
BOOL MxDirectDraw::Create(
|
BOOL MxDirectDraw::Create(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
BOOL fullscreen_1,
|
BOOL fullscreen,
|
||||||
BOOL surface_fullscreen,
|
BOOL surface_fullscreen,
|
||||||
BOOL onlySystemMemory,
|
BOOL onlySystemMemory,
|
||||||
int width,
|
int width,
|
||||||
|
@ -96,10 +102,9 @@ BOOL MxDirectDraw::Create(
|
||||||
m_bFlipSurfaces = surface_fullscreen;
|
m_bFlipSurfaces = surface_fullscreen;
|
||||||
m_bOnlySystemMemory = onlySystemMemory;
|
m_bOnlySystemMemory = onlySystemMemory;
|
||||||
m_bIsOnPrimaryDevice = !m_pCurrentDeviceModesList->m_guid;
|
m_bIsOnPrimaryDevice = !m_pCurrentDeviceModesList->m_guid;
|
||||||
BOOL fullscreen = 1;
|
|
||||||
|
|
||||||
if (m_bIsOnPrimaryDevice) {
|
if (!m_bIsOnPrimaryDevice) {
|
||||||
fullscreen = fullscreen_1;
|
fullscreen = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetPaletteEntries(pPaletteEntries, paletteEntryCount, fullscreen)) {
|
if (!SetPaletteEntries(pPaletteEntries, paletteEntryCount, fullscreen)) {
|
||||||
|
@ -120,23 +125,19 @@ BOOL MxDirectDraw::Create(
|
||||||
// FUNCTION: LEGO1 0x1009d690
|
// FUNCTION: LEGO1 0x1009d690
|
||||||
BOOL MxDirectDraw::RecreateDirectDraw(GUID** ppGUID)
|
BOOL MxDirectDraw::RecreateDirectDraw(GUID** ppGUID)
|
||||||
{
|
{
|
||||||
if (m_pDirectDraw) {
|
RELEASE(m_pDirectDraw);
|
||||||
m_pDirectDraw->Release();
|
|
||||||
m_pDirectDraw = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (DirectDrawCreate(*ppGUID, &m_pDirectDraw, 0) == DD_OK);
|
return (DirectDrawCreate(*ppGUID, &m_pDirectDraw, 0) == DD_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009d6c0
|
// FUNCTION: LEGO1 0x1009d6c0
|
||||||
BOOL MxDirectDraw::CacheOriginalPaletteEntries()
|
BOOL MxDirectDraw::CacheOriginalPaletteEntries()
|
||||||
{
|
{
|
||||||
HDC dc;
|
HDC hdc;
|
||||||
|
|
||||||
if (g_isPaletteIndexed8) {
|
if (g_isPaletteIndexed8) {
|
||||||
dc = GetDC(0);
|
hdc = GetDC(NULL);
|
||||||
GetSystemPaletteEntries(dc, 0, _countof(m_originalPaletteEntries), m_originalPaletteEntries);
|
GetSystemPaletteEntries(hdc, 0, (1 << 8), &m_originalPaletteEntries[0]);
|
||||||
ReleaseDC(0, dc);
|
ReleaseDC(NULL, hdc);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +153,7 @@ BOOL MxDirectDraw::SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int pa
|
||||||
|
|
||||||
if (g_isPaletteIndexed8) {
|
if (g_isPaletteIndexed8) {
|
||||||
hdc = GetDC(NULL);
|
hdc = GetDC(NULL);
|
||||||
GetSystemPaletteEntries(hdc, 0, arraySize, m_paletteEntries);
|
GetSystemPaletteEntries(hdc, 0, (1 << 8), m_paletteEntries);
|
||||||
ReleaseDC(NULL, hdc);
|
ReleaseDC(NULL, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,20 +169,21 @@ BOOL MxDirectDraw::SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int pa
|
||||||
m_paletteEntries[i].peFlags = 0x84;
|
m_paletteEntries[i].peFlags = 0x84;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = arraySize - reservedHighEntryCount; i < arraySize; i++) {
|
for (i = 256 - reservedHighEntryCount; i < 256; i++) {
|
||||||
m_paletteEntries[i].peFlags = 0x80;
|
m_paletteEntries[i].peFlags = 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paletteEntryCount != 0) {
|
if (paletteEntryCount != 0) {
|
||||||
for (i = reservedLowEntryCount; (i < paletteEntryCount) && (i < arraySize - reservedHighEntryCount); i++) {
|
for (i = reservedLowEntryCount; (i < paletteEntryCount) && (i < 256 - reservedHighEntryCount); i++) {
|
||||||
m_paletteEntries[i].peRed = pPaletteEntries[i].peRed;
|
m_paletteEntries[i].peRed = pPaletteEntries[i].peRed;
|
||||||
m_paletteEntries[i].peGreen = pPaletteEntries[i].peGreen;
|
m_paletteEntries[i].peGreen = pPaletteEntries[i].peGreen;
|
||||||
m_paletteEntries[i].peBlue = pPaletteEntries[i].peBlue;
|
m_paletteEntries[i].peBlue = pPaletteEntries[i].peBlue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pPalette != NULL) {
|
if (m_pPalette) {
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
result = m_pPalette->SetEntries(0, 0, _countof(m_paletteEntries), m_paletteEntries);
|
result = m_pPalette->SetEntries(0, 0, _countof(m_paletteEntries), m_paletteEntries);
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("SetEntries failed", result);
|
Error("SetEntries failed", result);
|
||||||
|
@ -199,10 +201,7 @@ void MxDirectDraw::Destroy()
|
||||||
|
|
||||||
FUN_1009d920();
|
FUN_1009d920();
|
||||||
|
|
||||||
if (m_pDirectDraw != NULL) {
|
RELEASE(m_pDirectDraw);
|
||||||
m_pDirectDraw->Release();
|
|
||||||
m_pDirectDraw = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_bIsOnPrimaryDevice = TRUE;
|
m_bIsOnPrimaryDevice = TRUE;
|
||||||
|
|
||||||
|
@ -217,47 +216,20 @@ void MxDirectDraw::DestroyButNotDirectDraw()
|
||||||
{
|
{
|
||||||
RestoreOriginalPaletteEntries();
|
RestoreOriginalPaletteEntries();
|
||||||
if (m_bFullScreen) {
|
if (m_bFullScreen) {
|
||||||
if (m_pDirectDraw != NULL) {
|
if (m_pDirectDraw) {
|
||||||
m_bIgnoreWMSIZE = TRUE;
|
m_bIgnoreWMSIZE = TRUE;
|
||||||
m_pDirectDraw->RestoreDisplayMode();
|
m_pDirectDraw->RestoreDisplayMode();
|
||||||
m_bIgnoreWMSIZE = FALSE;
|
m_bIgnoreWMSIZE = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pPalette) {
|
RELEASE(m_pPalette);
|
||||||
m_pPalette->Release();
|
RELEASE(m_pClipper);
|
||||||
m_pPalette = NULL;
|
RELEASE(m_pText1Surface);
|
||||||
}
|
RELEASE(m_pText2Surface);
|
||||||
|
RELEASE(m_pZBuffer);
|
||||||
if (m_pClipper) {
|
RELEASE(m_pBackBuffer);
|
||||||
m_pClipper->Release();
|
RELEASE(m_pFrontBuffer);
|
||||||
m_pClipper = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pText1Surface) {
|
|
||||||
m_pText1Surface->Release();
|
|
||||||
m_pText1Surface = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pText2Surface) {
|
|
||||||
m_pText2Surface->Release();
|
|
||||||
m_pText2Surface = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pZBuffer) {
|
|
||||||
m_pZBuffer->Release();
|
|
||||||
m_pZBuffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pBackBuffer) {
|
|
||||||
m_pBackBuffer->Release();
|
|
||||||
m_pBackBuffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pFrontBuffer) {
|
|
||||||
m_pFrontBuffer->Release();
|
|
||||||
m_pFrontBuffer = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009d920
|
// FUNCTION: LEGO1 0x1009d920
|
||||||
|
@ -366,16 +338,18 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
|
||||||
DWORD dwStyle;
|
DWORD dwStyle;
|
||||||
|
|
||||||
if (!m_bIsOnPrimaryDevice) {
|
if (!m_bIsOnPrimaryDevice) {
|
||||||
Error("Attempt made enter a windowed mode on a DirectDraw device that is not the primary display", E_FAIL);
|
Error(
|
||||||
|
"Attempt made enter a windowed mode on a DirectDraw device that is not the primary display",
|
||||||
|
DDERR_GENERIC
|
||||||
|
);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bIgnoreWMSIZE = TRUE;
|
m_bIgnoreWMSIZE = TRUE;
|
||||||
dwStyle = GetWindowLong(m_hWndMain, GWL_STYLE);
|
dwStyle = GetWindowLong(m_hWndMain, GWL_STYLE);
|
||||||
dwStyle &= ~WS_POPUP;
|
dwStyle &= ~WS_POPUP;
|
||||||
dwStyle |= WS_CAPTION | WS_THICKFRAME | WS_OVERLAPPED;
|
dwStyle |= WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME;
|
||||||
SetWindowLong(m_hWndMain, GWL_STYLE, dwStyle);
|
SetWindowLong(m_hWndMain, GWL_STYLE, dwStyle);
|
||||||
|
|
||||||
SetRect(&rc, 0, 0, width - 1, height - 1);
|
SetRect(&rc, 0, 0, width - 1, height - 1);
|
||||||
AdjustWindowRectEx(
|
AdjustWindowRectEx(
|
||||||
&rc,
|
&rc,
|
||||||
|
@ -443,9 +417,13 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009dd80
|
// FUNCTION: LEGO1 0x1009dd80
|
||||||
HRESULT MxDirectDraw::CreateDDSurface(LPDDSURFACEDESC a2, LPDIRECTDRAWSURFACE* a3, IUnknown* a4)
|
HRESULT MxDirectDraw::CreateDDSurface(
|
||||||
|
LPDDSURFACEDESC p_lpDDSurfDesc,
|
||||||
|
LPDIRECTDRAWSURFACE FAR* p_lpDDSurface,
|
||||||
|
IUnknown FAR* p_pUnkOuter
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return m_pDirectDraw->CreateSurface(a2, a3, a4);
|
return m_pDirectDraw->CreateSurface(p_lpDDSurfDesc, p_lpDDSurface, p_pUnkOuter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009dda0
|
// FUNCTION: LEGO1 0x1009dda0
|
||||||
|
@ -453,8 +431,8 @@ BOOL MxDirectDraw::GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSU
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
memset(lpDDSurfDesc, 0, sizeof(*lpDDSurfDesc));
|
memset(lpDDSurfDesc, 0, sizeof(DDSURFACEDESC));
|
||||||
lpDDSurfDesc->dwSize = sizeof(*lpDDSurfDesc);
|
lpDDSurfDesc->dwSize = sizeof(DDSURFACEDESC);
|
||||||
result = lpDDSurf->GetSurfaceDesc(lpDDSurfDesc);
|
result = lpDDSurf->GetSurfaceDesc(lpDDSurfDesc);
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("Error getting a surface description", result);
|
Error("Error getting a surface description", result);
|
||||||
|
@ -467,25 +445,23 @@ BOOL MxDirectDraw::GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSU
|
||||||
BOOL MxDirectDraw::DDCreateSurfaces()
|
BOOL MxDirectDraw::DDCreateSurfaces()
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
DDSCAPS ddscaps;
|
|
||||||
DDSURFACEDESC ddsd;
|
DDSURFACEDESC ddsd;
|
||||||
|
DDSCAPS ddscaps;
|
||||||
|
|
||||||
if (m_bFlipSurfaces) {
|
if (m_bFlipSurfaces) {
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_3DDEVICE | DDSCAPS_COMPLEX;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_3DDEVICE | DDSCAPS_COMPLEX;
|
||||||
if (m_bOnlySystemMemory) {
|
if (m_bOnlySystemMemory) {
|
||||||
ddsd.ddsCaps.dwCaps =
|
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||||
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_3DDEVICE | DDSCAPS_COMPLEX | DDSCAPS_SYSTEMMEMORY;
|
|
||||||
}
|
}
|
||||||
ddsd.dwBackBufferCount = 1;
|
ddsd.dwBackBufferCount = 1;
|
||||||
result = CreateDDSurface(&ddsd, &m_pFrontBuffer, 0);
|
result = CreateDDSurface(&ddsd, &m_pFrontBuffer, NULL);
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("CreateSurface for front/back fullScreen buffer failed", result);
|
Error("CreateSurface for front/back fullScreen buffer failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
|
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
|
||||||
result = m_pFrontBuffer->GetAttachedSurface(&ddscaps, &m_pBackBuffer);
|
result = m_pFrontBuffer->GetAttachedSurface(&ddscaps, &m_pBackBuffer);
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
|
@ -497,8 +473,8 @@ BOOL MxDirectDraw::DDCreateSurfaces()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
ddsd.dwSize = sizeof(DDSURFACEDESC);
|
||||||
ddsd.dwFlags = DDSD_CAPS;
|
ddsd.dwFlags = DDSD_CAPS;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
result = CreateDDSurface(&ddsd, &m_pFrontBuffer, NULL);
|
result = CreateDDSurface(&ddsd, &m_pFrontBuffer, NULL);
|
||||||
|
@ -506,19 +482,18 @@ BOOL MxDirectDraw::DDCreateSurfaces()
|
||||||
Error("CreateSurface for window front buffer failed", result);
|
Error("CreateSurface for window front buffer failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||||
ddsd.dwHeight = m_currentMode.height;
|
ddsd.dwHeight = m_currentMode.height;
|
||||||
ddsd.dwWidth = m_currentMode.width;
|
ddsd.dwWidth = m_currentMode.width;
|
||||||
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) {
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY;
|
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||||
}
|
}
|
||||||
result = CreateDDSurface(&ddsd, &m_pBackBuffer, NULL);
|
result = CreateDDSurface(&ddsd, &m_pBackBuffer, NULL);
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("CreateSurface for window back buffer failed", result);
|
Error("CreateSurface for window back buffer failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetDDSurfaceDesc(&ddsd, m_pBackBuffer)) {
|
if (!GetDDSurfaceDesc(&ddsd, m_pBackBuffer)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -590,7 +565,7 @@ BOOL MxDirectDraw::TextToTextSurface(const char* text, IDirectDrawSurface* pSurf
|
||||||
RECT rc;
|
RECT rc;
|
||||||
size_t textLength;
|
size_t textLength;
|
||||||
|
|
||||||
if (pSurface == NULL) {
|
if (!pSurface) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,15 +607,14 @@ BOOL MxDirectDraw::CreateTextSurfaces()
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
DDCOLORKEY ddck;
|
DDCOLORKEY ddck;
|
||||||
DDSURFACEDESC ddsd;
|
DDSURFACEDESC ddsd;
|
||||||
HDC dc;
|
HDC hdc;
|
||||||
char dummyinfo[] = "000x000x00 (RAMP) 0000";
|
char dummyinfo[] = "000x000x00 (RAMP) 0000";
|
||||||
char dummyfps[] = "000.00 fps (000.00 fps (000.00 fps) 00000 tps)";
|
char dummyfps[] = "000.00 fps (000.00 fps (000.00 fps) 00000 tps)";
|
||||||
|
|
||||||
if (m_hFont != NULL) {
|
if (m_hFont != NULL) {
|
||||||
DeleteObject(m_hFont);
|
DeleteObject(m_hFont);
|
||||||
}
|
}
|
||||||
|
m_hFont = CreateFont(
|
||||||
m_hFont = CreateFontA(
|
|
||||||
m_currentMode.width <= 600 ? 12 : 24,
|
m_currentMode.width <= 600 ? 12 : 24,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -657,28 +631,26 @@ BOOL MxDirectDraw::CreateTextSurfaces()
|
||||||
"Arial"
|
"Arial"
|
||||||
);
|
);
|
||||||
|
|
||||||
dc = GetDC(NULL);
|
hdc = GetDC(NULL);
|
||||||
SelectObject(dc, m_hFont);
|
SelectObject(hdc, m_hFont);
|
||||||
GetTextExtentPointA(dc, dummyfps, strlen(dummyfps), &m_text1SizeOnSurface);
|
GetTextExtentPoint(hdc, dummyfps, strlen(dummyfps), &m_text1SizeOnSurface);
|
||||||
GetTextExtentPointA(dc, dummyinfo, strlen(dummyinfo), &m_text2SizeOnSurface);
|
GetTextExtentPoint(hdc, dummyinfo, strlen(dummyinfo), &m_text2SizeOnSurface);
|
||||||
ReleaseDC(NULL, dc);
|
ReleaseDC(NULL, hdc);
|
||||||
|
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
memset(&ddsd, 0, sizeof(ddsd));
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||||
if (m_bOnlySystemMemory) {
|
if (m_bOnlySystemMemory) {
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
|
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||||
}
|
}
|
||||||
ddsd.dwHeight = m_text1SizeOnSurface.cy;
|
ddsd.dwHeight = m_text1SizeOnSurface.cy;
|
||||||
ddsd.dwWidth = m_text1SizeOnSurface.cx;
|
ddsd.dwWidth = m_text1SizeOnSurface.cx;
|
||||||
|
result = CreateDDSurface(&ddsd, &m_pText1Surface, NULL);
|
||||||
result = CreateDDSurface(&ddsd, &m_pText1Surface, 0);
|
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("CreateSurface for text surface 1 failed", result);
|
Error("CreateSurface for text surface 1 failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&ddck, 0, sizeof(ddck));
|
memset(&ddck, 0, sizeof(ddck));
|
||||||
m_pText1Surface->SetColorKey(DDCKEY_SRCBLT, &ddck);
|
m_pText1Surface->SetColorKey(DDCKEY_SRCBLT, &ddck);
|
||||||
if (!TextToTextSurface1(dummyfps)) {
|
if (!TextToTextSurface1(dummyfps)) {
|
||||||
|
@ -690,17 +662,15 @@ BOOL MxDirectDraw::CreateTextSurfaces()
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||||
if (m_bOnlySystemMemory) {
|
if (m_bOnlySystemMemory) {
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
|
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||||
}
|
}
|
||||||
ddsd.dwHeight = m_text2SizeOnSurface.cy;
|
ddsd.dwHeight = m_text2SizeOnSurface.cy;
|
||||||
ddsd.dwWidth = m_text2SizeOnSurface.cx;
|
ddsd.dwWidth = m_text2SizeOnSurface.cx;
|
||||||
|
result = CreateDDSurface(&ddsd, &m_pText2Surface, NULL);
|
||||||
result = CreateDDSurface(&ddsd, &m_pText2Surface, 0);
|
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("CreateSurface for text surface 2 failed", result);
|
Error("CreateSurface for text surface 2 failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&ddck, 0, sizeof(ddck));
|
memset(&ddck, 0, sizeof(ddck));
|
||||||
m_pText2Surface->SetColorKey(DDCKEY_SRCBLT, &ddck);
|
m_pText2Surface->SetColorKey(DDCKEY_SRCBLT, &ddck);
|
||||||
if (!TextToTextSurface2(dummyinfo)) {
|
if (!TextToTextSurface2(dummyinfo)) {
|
||||||
|
@ -777,13 +747,13 @@ 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.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_ZBUFFERBITDEPTH;
|
||||||
ddsd.dwHeight = m_currentMode.height;
|
ddsd.dwHeight = m_currentMode.height;
|
||||||
ddsd.dwWidth = m_currentMode.width;
|
ddsd.dwWidth = m_currentMode.width;
|
||||||
ddsd.dwZBufferBitDepth = depth;
|
ddsd.dwZBufferBitDepth = depth;
|
||||||
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_ZBUFFERBITDEPTH;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | memorytype;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | memorytype;
|
||||||
|
|
||||||
result = CreateDDSurface(&ddsd, &lpZBuffer, 0);
|
result = CreateDDSurface(&ddsd, &lpZBuffer, 0);
|
||||||
|
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("CreateSurface for fullScreen Z-buffer failed", result);
|
Error("CreateSurface for fullScreen Z-buffer failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -800,10 +770,10 @@ BOOL MxDirectDraw::CreateZBuffer(DWORD memorytype, DWORD depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009e6a0
|
// FUNCTION: LEGO1 0x1009e6a0
|
||||||
int MxDirectDraw::Pause(int p_increment)
|
int MxDirectDraw::Pause(BOOL p_pause)
|
||||||
{
|
{
|
||||||
if (p_increment) {
|
if (p_pause) {
|
||||||
m_pauseCount++;
|
++m_pauseCount;
|
||||||
|
|
||||||
if (m_pauseCount > 1) {
|
if (m_pauseCount > 1) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -823,11 +793,13 @@ int MxDirectDraw::Pause(int p_increment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_pauseCount--;
|
--m_pauseCount;
|
||||||
|
|
||||||
if (m_pauseCount > 0) {
|
if (m_pauseCount > 0) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (m_pauseCount < 0) {
|
|
||||||
|
if (m_pauseCount < 0) {
|
||||||
m_pauseCount = 0;
|
m_pauseCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,11 +814,13 @@ int MxDirectDraw::Pause(int p_increment)
|
||||||
// FUNCTION: LEGO1 0x1009e750
|
// FUNCTION: LEGO1 0x1009e750
|
||||||
BOOL MxDirectDraw::RestorePaletteEntries()
|
BOOL MxDirectDraw::RestorePaletteEntries()
|
||||||
{
|
{
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
if (m_bFullScreen && m_bPrimaryPalettized) {
|
if (m_bFullScreen && m_bPrimaryPalettized) {
|
||||||
if (m_pPalette) {
|
if (m_pPalette) {
|
||||||
result = m_pPalette->SetEntries(0, 0, _countof(m_paletteEntries), m_paletteEntries);
|
HRESULT result;
|
||||||
|
|
||||||
|
result =
|
||||||
|
m_pPalette->SetEntries(0, 0, sizeof(m_paletteEntries) / sizeof(m_paletteEntries[0]), m_paletteEntries);
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("SetEntries failed", result);
|
Error("SetEntries failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -860,11 +834,16 @@ BOOL MxDirectDraw::RestorePaletteEntries()
|
||||||
// FUNCTION: LEGO1 0x1009e7a0
|
// FUNCTION: LEGO1 0x1009e7a0
|
||||||
BOOL MxDirectDraw::RestoreOriginalPaletteEntries()
|
BOOL MxDirectDraw::RestoreOriginalPaletteEntries()
|
||||||
{
|
{
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
if (m_bPrimaryPalettized) {
|
if (m_bPrimaryPalettized) {
|
||||||
if (m_pPalette) {
|
if (m_pPalette) {
|
||||||
result = m_pPalette->SetEntries(0, 0, 256, m_originalPaletteEntries);
|
HRESULT result;
|
||||||
|
|
||||||
|
result = m_pPalette->SetEntries(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
sizeof(m_originalPaletteEntries) / sizeof(m_originalPaletteEntries[0]),
|
||||||
|
m_originalPaletteEntries
|
||||||
|
);
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
Error("SetEntries failed", result);
|
Error("SetEntries failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -878,17 +857,18 @@ BOOL MxDirectDraw::RestoreOriginalPaletteEntries()
|
||||||
// FUNCTION: LEGO1 0x1009e7f0
|
// FUNCTION: LEGO1 0x1009e7f0
|
||||||
int MxDirectDraw::FlipToGDISurface()
|
int MxDirectDraw::FlipToGDISurface()
|
||||||
{
|
{
|
||||||
HRESULT ret;
|
|
||||||
|
|
||||||
if (m_pDirectDraw) {
|
if (m_pDirectDraw) {
|
||||||
ret = m_pDirectDraw->FlipToGDISurface();
|
HRESULT result;
|
||||||
if (ret != DD_OK) {
|
|
||||||
Error("FlipToGDISurface failed", ret);
|
result = m_pDirectDraw->FlipToGDISurface();
|
||||||
|
if (result != DD_OK) {
|
||||||
|
Error("FlipToGDISurface failed", result);
|
||||||
}
|
}
|
||||||
return !ret;
|
return (result == DD_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009e830
|
// FUNCTION: LEGO1 0x1009e830
|
||||||
|
|
|
@ -34,9 +34,7 @@ class MxDirectDraw {
|
||||||
void* m_unk0x178; // 0x178
|
void* m_unk0x178; // 0x178
|
||||||
};
|
};
|
||||||
|
|
||||||
int FlipToGDISurface();
|
|
||||||
static int GetPrimaryBitDepth();
|
static int GetPrimaryBitDepth();
|
||||||
int Pause(int);
|
|
||||||
|
|
||||||
MxDirectDraw();
|
MxDirectDraw();
|
||||||
virtual ~MxDirectDraw();
|
virtual ~MxDirectDraw();
|
||||||
|
@ -51,38 +49,50 @@ class MxDirectDraw {
|
||||||
int bpp,
|
int bpp,
|
||||||
const PALETTEENTRY* pPaletteEntries,
|
const PALETTEENTRY* pPaletteEntries,
|
||||||
int paletteEntryCount
|
int paletteEntryCount
|
||||||
); // vtable+0x04
|
); // vtable+0x04
|
||||||
virtual void Destroy(); // vtable+0x08
|
virtual void Destroy(); // vtable+0x08
|
||||||
virtual void DestroyButNotDirectDraw(); // vtable+0x0c
|
virtual void DestroyButNotDirectDraw(); // vtable+0x0c
|
||||||
virtual const char* ErrorToString(HRESULT p_error); // vtable+0x10
|
|
||||||
|
|
||||||
BOOL CacheOriginalPaletteEntries();
|
inline IDirectDraw* DirectDraw() { return m_pDirectDraw; }
|
||||||
HRESULT CreateDDSurface(LPDDSURFACEDESC a2, LPDIRECTDRAWSURFACE* a3, IUnknown* a4);
|
inline IDirectDrawSurface* FrontBuffer() { return m_pFrontBuffer; }
|
||||||
BOOL CreateTextSurfaces();
|
inline IDirectDrawSurface* BackBuffer() { return m_pBackBuffer; }
|
||||||
BOOL CreateZBuffer(DWORD memorytype, DWORD depth);
|
inline IDirectDrawClipper* Clipper() { return m_pClipper; }
|
||||||
BOOL DDCreateSurfaces();
|
|
||||||
BOOL DDInit(BOOL fullscreen);
|
BOOL IsFullScreen() { return m_bFullScreen; }
|
||||||
BOOL DDSetMode(int width, int height, int bpp);
|
|
||||||
void Error(const char* p_message, int p_error);
|
|
||||||
|
|
||||||
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf);
|
|
||||||
BOOL IsSupportedMode(int width, int height, int bpp);
|
BOOL IsSupportedMode(int width, int height, int bpp);
|
||||||
BOOL RecreateDirectDraw(GUID** a2);
|
|
||||||
BOOL RestoreOriginalPaletteEntries();
|
int Pause(BOOL);
|
||||||
BOOL RestorePaletteEntries();
|
|
||||||
BOOL RestoreSurfaces();
|
BOOL RestoreSurfaces();
|
||||||
BOOL SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int paletteEntryCount, BOOL fullscreen);
|
|
||||||
BOOL TextToTextSurface(const char* text, IDirectDrawSurface* pSurface, SIZE& textSizeOnSurface);
|
|
||||||
BOOL TextToTextSurface1(const char* text);
|
BOOL TextToTextSurface1(const char* text);
|
||||||
BOOL TextToTextSurface2(const char* lpString);
|
BOOL TextToTextSurface2(const char* lpString);
|
||||||
|
|
||||||
|
virtual const char* ErrorToString(HRESULT p_error); // vtable+0x10
|
||||||
|
int FlipToGDISurface();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int paletteEntryCount, BOOL fullscreen);
|
||||||
|
BOOL CacheOriginalPaletteEntries();
|
||||||
|
BOOL RestoreOriginalPaletteEntries();
|
||||||
|
BOOL RestorePaletteEntries();
|
||||||
|
|
||||||
|
BOOL DDInit(BOOL fullscreen);
|
||||||
|
BOOL DDSetMode(int width, int height, int bpp);
|
||||||
|
BOOL DDCreateSurfaces();
|
||||||
|
HRESULT CreateDDSurface(LPDDSURFACEDESC a2, LPDIRECTDRAWSURFACE* a3, IUnknown* a4);
|
||||||
|
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf);
|
||||||
|
BOOL CreateZBuffer(DWORD memorytype, DWORD depth);
|
||||||
|
|
||||||
|
BOOL CreateTextSurfaces();
|
||||||
|
BOOL TextToTextSurface(const char* text, IDirectDrawSurface* pSurface, SIZE& textSizeOnSurface);
|
||||||
|
|
||||||
|
void Error(const char* p_message, int p_error);
|
||||||
|
|
||||||
|
BOOL RecreateDirectDraw(GUID** a2);
|
||||||
void FUN_1009e020();
|
void FUN_1009e020();
|
||||||
void FUN_1009d920();
|
void FUN_1009d920();
|
||||||
|
|
||||||
inline IDirectDraw* GetDirectDraw() { return m_pDirectDraw; }
|
|
||||||
inline IDirectDrawSurface* GetFrontBuffer() { return m_pFrontBuffer; }
|
|
||||||
inline IDirectDrawSurface* GetBackBuffer() { return m_pBackBuffer; }
|
|
||||||
inline IDirectDrawClipper* GetClipper() { return m_pClipper; }
|
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1009d510
|
// SYNTHETIC: LEGO1 0x1009d510
|
||||||
// MxDirectDraw::`scalar deleting destructor'
|
// MxDirectDraw::`scalar deleting destructor'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue