mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-22 11:31:57 -04:00
Remove screen mode restrictions and related code (#291)
This commit is contained in:
parent
b95ca4b2a3
commit
d3378026ba
@ -284,11 +284,6 @@ int LegoDeviceEnumerate::FUN_1009d210()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end();) {
|
for (list<MxDriver>::iterator it = m_list.begin(); it != m_list.end();) {
|
||||||
if (!DriverSupportsRequiredDisplayMode(*it)) {
|
|
||||||
m_list.erase(it++);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
MxDriver& driver = *it;
|
MxDriver& driver = *it;
|
||||||
|
|
||||||
for (list<Direct3DDeviceInfo>::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();) {
|
||||||
@ -315,23 +310,6 @@ int LegoDeviceEnumerate::FUN_1009d210()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00402b00
|
|
||||||
// FUNCTION: LEGO1 0x1009d370
|
|
||||||
// FUNCTION: BETA10 0x1011d176
|
|
||||||
unsigned char LegoDeviceEnumerate::DriverSupportsRequiredDisplayMode(MxDriver& p_driver)
|
|
||||||
{
|
|
||||||
for (list<MxDisplayMode>::iterator it = p_driver.m_displayModes.begin(); it != p_driver.m_displayModes.end();
|
|
||||||
it++) {
|
|
||||||
if ((*it).m_width == 640 && (*it).m_height == 480) {
|
|
||||||
if ((*it).m_bitsPerPixel == 8 || (*it).m_bitsPerPixel == 16) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00402b60
|
// FUNCTION: CONFIG 0x00402b60
|
||||||
// FUNCTION: LEGO1 0x1009d3d0
|
// FUNCTION: LEGO1 0x1009d3d0
|
||||||
// FUNCTION: BETA10 0x1011d235
|
// FUNCTION: BETA10 0x1011d235
|
||||||
|
@ -18,7 +18,6 @@ public:
|
|||||||
static bool SupportsSIMD();
|
static bool SupportsSIMD();
|
||||||
static bool SupportsCPUID();
|
static bool SupportsCPUID();
|
||||||
int FUN_1009d210();
|
int FUN_1009d210();
|
||||||
unsigned char DriverSupportsRequiredDisplayMode(MxDriver& p_driver);
|
|
||||||
unsigned char FUN_1009d3d0(Direct3DDeviceInfo& p_device);
|
unsigned char FUN_1009d3d0(Direct3DDeviceInfo& p_device);
|
||||||
|
|
||||||
// SYNTHETIC: BETA10 0x100d8d10
|
// SYNTHETIC: BETA10 0x100d8d10
|
||||||
|
@ -167,14 +167,6 @@ BOOL MxDirect3D::D3DSetMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeviceModesInfo::Mode mode = *CurrentMode();
|
DeviceModesInfo::Mode mode = *CurrentMode();
|
||||||
|
|
||||||
if (IsFullScreen()) {
|
|
||||||
if (!IsSupportedMode(mode.width, mode.height, mode.bitsPerPixel)) {
|
|
||||||
Error("This device cannot support the current display mode", DDERR_GENERIC);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LPDIRECTDRAWSURFACE frontBuffer = FrontBuffer();
|
LPDIRECTDRAWSURFACE frontBuffer = FrontBuffer();
|
||||||
LPDIRECTDRAWSURFACE backBuffer = BackBuffer();
|
LPDIRECTDRAWSURFACE backBuffer = BackBuffer();
|
||||||
|
|
||||||
@ -277,21 +269,6 @@ BOOL MxDirect3D::SetDevice(MxDeviceEnumerate& p_deviceEnumerate, MxDriver* p_dri
|
|||||||
*d->m_deviceInfo->m_guid = *driver.m_guid;
|
*d->m_deviceInfo->m_guid = *driver.m_guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->m_deviceInfo->m_count = driver.m_displayModes.size();
|
|
||||||
|
|
||||||
if (d->m_deviceInfo->m_count > 0) {
|
|
||||||
int j = 0;
|
|
||||||
d->m_deviceInfo->m_modeArray = new DeviceModesInfo::Mode[d->m_deviceInfo->m_count];
|
|
||||||
|
|
||||||
for (list<MxDisplayMode>::iterator it2 = driver.m_displayModes.begin();
|
|
||||||
it2 != driver.m_displayModes.end();
|
|
||||||
it2++, j++) {
|
|
||||||
d->m_deviceInfo->m_modeArray[j].width = (*it2).m_width;
|
|
||||||
d->m_deviceInfo->m_modeArray[j].height = (*it2).m_height;
|
|
||||||
d->m_deviceInfo->m_modeArray[j].bitsPerPixel = (*it2).m_bitsPerPixel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
d->m_deviceInfo->m_ddcaps = driver.m_ddCaps;
|
d->m_deviceInfo->m_ddcaps = driver.m_ddCaps;
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
@ -283,23 +283,6 @@ BOOL MxDirectDraw::DDInit(BOOL fullscreen)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009d9d0
|
|
||||||
// FUNCTION: BETA10 0x10120e45
|
|
||||||
BOOL MxDirectDraw::IsSupportedMode(int width, int height, int bpp)
|
|
||||||
{
|
|
||||||
DeviceModesInfo::Mode mode = {width, height, bpp};
|
|
||||||
|
|
||||||
assert(m_currentDevInfo);
|
|
||||||
|
|
||||||
for (int i = 0; i < m_currentDevInfo->m_count; i++) {
|
|
||||||
if (m_currentDevInfo->m_modeArray[i] == mode) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1009da20
|
// FUNCTION: LEGO1 0x1009da20
|
||||||
// FUNCTION: BETA10 0x10120efb
|
// FUNCTION: BETA10 0x10120efb
|
||||||
void EnableResizing(HWND p_hwnd, BOOL p_flag)
|
void EnableResizing(HWND p_hwnd, BOOL p_flag)
|
||||||
@ -339,12 +322,6 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!IsSupportedMode(width, height, bpp)) {
|
|
||||||
width = m_currentDevInfo->m_modeArray[0].width;
|
|
||||||
height = m_currentDevInfo->m_modeArray[0].height;
|
|
||||||
bpp = m_currentDevInfo->m_modeArray[0].bitsPerPixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_bIgnoreWMSIZE = TRUE;
|
m_bIgnoreWMSIZE = TRUE;
|
||||||
result = m_pDirectDraw->SetDisplayMode(width, height, bpp);
|
result = m_pDirectDraw->SetDisplayMode(width, height, bpp);
|
||||||
m_bIgnoreWMSIZE = FALSE;
|
m_bIgnoreWMSIZE = FALSE;
|
||||||
|
@ -55,8 +55,6 @@ public:
|
|||||||
// FUNCTION: BETA10 0x1011c170
|
// FUNCTION: BETA10 0x1011c170
|
||||||
BOOL IsFullScreen() { return m_bFullScreen; }
|
BOOL IsFullScreen() { return m_bFullScreen; }
|
||||||
|
|
||||||
BOOL IsSupportedMode(int width, int height, int bpp);
|
|
||||||
|
|
||||||
int Pause(BOOL);
|
int Pause(BOOL);
|
||||||
BOOL RestoreSurfaces();
|
BOOL RestoreSurfaces();
|
||||||
|
|
||||||
|
@ -216,7 +216,6 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
|
|||||||
BuildErrorString("DirectDraw Create failed: %s\n", EnumerateErrorToString(result));
|
BuildErrorString("DirectDraw Create failed: %s\n", EnumerateErrorToString(result));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lpDD->EnumDisplayModes(0, NULL, this, DisplayModesEnumerateCallback);
|
|
||||||
newDevice.m_ddCaps.dwSize = sizeof(newDevice.m_ddCaps);
|
newDevice.m_ddCaps.dwSize = sizeof(newDevice.m_ddCaps);
|
||||||
result = lpDD->GetCaps(&newDevice.m_ddCaps, NULL);
|
result = lpDD->GetCaps(&newDevice.m_ddCaps, NULL);
|
||||||
|
|
||||||
@ -267,18 +266,6 @@ void MxDeviceEnumerate::BuildErrorString(const char* p_format, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00401bf0
|
|
||||||
// FUNCTION: LEGO1 0x1009c4f0
|
|
||||||
// FUNCTION: BETA10 0x1011e1dd
|
|
||||||
HRESULT CALLBACK MxDeviceEnumerate::DisplayModesEnumerateCallback(LPDDSURFACEDESC p_ddsd, LPVOID p_context)
|
|
||||||
{
|
|
||||||
if (p_context == NULL) {
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((MxDeviceEnumerate*) p_context)->EnumDisplayModesCallback(p_ddsd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00401c10
|
// FUNCTION: CONFIG 0x00401c10
|
||||||
// FUNCTION: LEGO1 0x1009c510
|
// FUNCTION: LEGO1 0x1009c510
|
||||||
// FUNCTION: BETA10 0x1011e226
|
// FUNCTION: BETA10 0x1011e226
|
||||||
@ -299,20 +286,6 @@ HRESULT CALLBACK MxDeviceEnumerate::DevicesEnumerateCallback(
|
|||||||
->EnumDevicesCallback(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
->EnumDevicesCallback(p_guid, p_deviceDesc, p_deviceName, p_HWDesc, p_HELDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00401c40
|
|
||||||
// FUNCTION: LEGO1 0x1009c540
|
|
||||||
// FUNCTION: BETA10 0x1011e27f
|
|
||||||
HRESULT MxDeviceEnumerate::EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd)
|
|
||||||
{
|
|
||||||
assert(m_list.size() > 0);
|
|
||||||
assert(p_ddsd);
|
|
||||||
|
|
||||||
// TODO: compat_mode?
|
|
||||||
MxDisplayMode displayMode(p_ddsd->dwWidth, p_ddsd->dwHeight, p_ddsd->ddpfPixelFormat.dwRGBBitCount);
|
|
||||||
m_list.back().m_displayModes.push_back(displayMode);
|
|
||||||
return DDENUMRET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00401cd0
|
// FUNCTION: CONFIG 0x00401cd0
|
||||||
// FUNCTION: LEGO1 0x1009c5d0
|
// FUNCTION: LEGO1 0x1009c5d0
|
||||||
// FUNCTION: BETA10 0x1011e32f
|
// FUNCTION: BETA10 0x1011e32f
|
||||||
@ -582,8 +555,4 @@ DeviceModesInfo::~DeviceModesInfo()
|
|||||||
if (m_guid != NULL) {
|
if (m_guid != NULL) {
|
||||||
delete m_guid;
|
delete m_guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_modeArray != NULL) {
|
|
||||||
delete[] m_modeArray;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,10 @@ struct DeviceModesInfo {
|
|||||||
DeviceModesInfo();
|
DeviceModesInfo();
|
||||||
~DeviceModesInfo();
|
~DeviceModesInfo();
|
||||||
|
|
||||||
GUID* m_guid; // 0x00
|
GUID* m_guid; // 0x00
|
||||||
Mode* m_modeArray; // 0x04
|
int m_count; // 0x08
|
||||||
int m_count; // 0x08
|
DDCAPS m_ddcaps; // 0x0c
|
||||||
DDCAPS m_ddcaps; // 0x0c
|
void* m_unk0x178; // 0x178
|
||||||
void* m_unk0x178; // 0x178
|
|
||||||
|
|
||||||
// SYNTHETIC: BETA10 0x1011c650
|
// SYNTHETIC: BETA10 0x1011c650
|
||||||
// DeviceModesInfo::`scalar deleting destructor'
|
// DeviceModesInfo::`scalar deleting destructor'
|
||||||
@ -128,7 +127,6 @@ struct MxDriver {
|
|||||||
char* m_driverName; // 0x08
|
char* m_driverName; // 0x08
|
||||||
DDCAPS m_ddCaps; // 0x0c
|
DDCAPS m_ddCaps; // 0x0c
|
||||||
list<Direct3DDeviceInfo> m_devices; // 0x178
|
list<Direct3DDeviceInfo> m_devices; // 0x178
|
||||||
list<MxDisplayMode> m_displayModes; // 0x184
|
|
||||||
|
|
||||||
int operator==(MxDriver) const { return 0; }
|
int operator==(MxDriver) const { return 0; }
|
||||||
int operator<(MxDriver) const { return 0; }
|
int operator<(MxDriver) const { return 0; }
|
||||||
@ -199,7 +197,6 @@ public:
|
|||||||
virtual int 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 EnumDevicesCallback(
|
HRESULT EnumDevicesCallback(
|
||||||
LPGUID p_guid,
|
LPGUID p_guid,
|
||||||
LPCSTR p_deviceDesc,
|
LPCSTR p_deviceDesc,
|
||||||
@ -211,7 +208,6 @@ public:
|
|||||||
static void BuildErrorString(const char*, ...);
|
static void BuildErrorString(const char*, ...);
|
||||||
static BOOL CALLBACK
|
static BOOL CALLBACK
|
||||||
DirectDrawEnumerateCallback(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName, LPVOID p_context);
|
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(
|
static HRESULT CALLBACK DevicesEnumerateCallback(
|
||||||
LPGUID p_guid,
|
LPGUID p_guid,
|
||||||
LPSTR p_deviceDesc,
|
LPSTR p_deviceDesc,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user