1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Added color depth check to ChangeDisplaySettingsEx hook

See issue #303.
This commit is contained in:
narzoul 2024-05-01 14:20:49 +02:00
parent 474fdb1e45
commit 574f4cdd2b
2 changed files with 7 additions and 0 deletions

View File

@ -132,6 +132,12 @@ namespace
SIZE emulatedResolution = {}; SIZE emulatedResolution = {};
if (lpDevMode) if (lpDevMode)
{ {
if ((lpDevMode->dmFields & DM_BITSPERPEL) &&
8 != lpDevMode->dmBitsPerPel && 16 != lpDevMode->dmBitsPerPel && 32 != lpDevMode->dmBitsPerPel)
{
return DISP_CHANGE_BADMODE;
}
targetDevMode = *lpDevMode; targetDevMode = *lpDevMode;
targetDevMode.dmFields |= DM_BITSPERPEL; targetDevMode.dmFields |= DM_BITSPERPEL;
targetDevMode.dmBitsPerPel = 32; targetDevMode.dmBitsPerPel = 32;

View File

@ -51,6 +51,7 @@ namespace
std::ostream& logDevMode(std::ostream& os, const DevMode& dm) std::ostream& logDevMode(std::ostream& os, const DevMode& dm)
{ {
return Compat::LogStruct(os) return Compat::LogStruct(os)
<< Compat::hex(dm.dmFields)
<< dm.dmPelsWidth << dm.dmPelsWidth
<< dm.dmPelsHeight << dm.dmPelsHeight
<< dm.dmBitsPerPel << dm.dmBitsPerPel