mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added DesktopColorDepth setting
This commit is contained in:
parent
7dfb030ae2
commit
ee350c7f08
@ -3,6 +3,7 @@
|
||||
namespace Config
|
||||
{
|
||||
Settings::CpuAffinity cpuAffinity;
|
||||
Settings::DesktopColorDepth desktopColorDepth;
|
||||
Settings::DisplayResolution displayResolution;
|
||||
Settings::ThreadPriorityBoost threadPriorityBoost;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Config/Settings/CpuAffinity.h>
|
||||
#include <Config/Settings/DesktopColorDepth.h>
|
||||
#include <Config/Settings/DisplayResolution.h>
|
||||
#include <Config/Settings/ThreadPriorityBoost.h>
|
||||
|
||||
@ -11,6 +12,7 @@ namespace Config
|
||||
const unsigned maxPaletteUpdatesPerMs = 5;
|
||||
|
||||
extern Settings::CpuAffinity cpuAffinity;
|
||||
extern Settings::DesktopColorDepth desktopColorDepth;
|
||||
extern Settings::DisplayResolution displayResolution;
|
||||
extern Settings::ThreadPriorityBoost threadPriorityBoost;
|
||||
}
|
||||
|
20
DDrawCompat/Config/Settings/DesktopColorDepth.h
Normal file
20
DDrawCompat/Config/Settings/DesktopColorDepth.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <Config/MappedSetting.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
class DesktopColorDepth : public MappedSetting<UINT>
|
||||
{
|
||||
public:
|
||||
static const UINT INITIAL = 0;
|
||||
|
||||
DesktopColorDepth()
|
||||
: MappedSetting("DesktopColorDepth", INITIAL, { {"initial", INITIAL}, {"8", 8}, {"16", 16}, {"32", 32} })
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -214,6 +214,7 @@
|
||||
<ClInclude Include="Config\Parser.h" />
|
||||
<ClInclude Include="Config\Setting.h" />
|
||||
<ClInclude Include="Config\Settings\CpuAffinity.h" />
|
||||
<ClInclude Include="Config\Settings\DesktopColorDepth.h" />
|
||||
<ClInclude Include="Config\Settings\DisplayResolution.h" />
|
||||
<ClInclude Include="Config\Settings\ThreadPriorityBoost.h" />
|
||||
<ClInclude Include="D3dDdi\Adapter.h" />
|
||||
|
@ -438,6 +438,9 @@
|
||||
<ClInclude Include="Gdi\Cursor.h">
|
||||
<Filter>Header Files\Gdi</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Config\Settings\DesktopColorDepth.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Gdi\Gdi.cpp">
|
||||
|
@ -77,17 +77,24 @@ namespace
|
||||
Gdi::VirtualScreen::init();
|
||||
|
||||
CompatPtr<IDirectDraw> dd;
|
||||
CALL_ORIG_PROC(DirectDrawCreate)(nullptr, &dd.getRef(), nullptr);
|
||||
CompatPtr<IDirectDraw7> dd7;
|
||||
CALL_ORIG_PROC(DirectDrawCreateEx)(nullptr, reinterpret_cast<void**>(&dd7.getRef()), IID_IDirectDraw7, nullptr);
|
||||
if (!dd || !dd7)
|
||||
HRESULT result = CALL_ORIG_PROC(DirectDrawCreate)(nullptr, &dd.getRef(), nullptr);
|
||||
if (FAILED(result))
|
||||
{
|
||||
Compat::Log() << "ERROR: Failed to create a DirectDraw object for hooking";
|
||||
Compat::Log() << "ERROR: Failed to create a DirectDraw object for hooking: " << Compat::hex(result);
|
||||
return;
|
||||
}
|
||||
|
||||
CompatPtr<IDirectDraw7> dd7;
|
||||
result = CALL_ORIG_PROC(DirectDrawCreateEx)(
|
||||
nullptr, reinterpret_cast<void**>(&dd7.getRef()), IID_IDirectDraw7, nullptr);
|
||||
if (FAILED(result))
|
||||
{
|
||||
Compat::Log() << "ERROR: Failed to create a DirectDraw object for hooking: " << Compat::hex(result);
|
||||
return;
|
||||
}
|
||||
|
||||
CompatVtable<IDirectDrawVtbl>::s_origVtable = *dd.get()->lpVtbl;
|
||||
HRESULT result = dd->SetCooperativeLevel(dd, nullptr, DDSCL_NORMAL);
|
||||
result = dd->SetCooperativeLevel(dd, nullptr, DDSCL_NORMAL);
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
CompatVtable<IDirectDraw7Vtbl>::s_origVtable = *dd7.get()->lpVtbl;
|
||||
|
@ -624,8 +624,13 @@ namespace Win32
|
||||
DEVMODEA dm = {};
|
||||
dm.dmSize = sizeof(dm);
|
||||
EnumDisplaySettingsEx(nullptr, ENUM_CURRENT_SETTINGS, &dm, 0);
|
||||
g_desktopBpp = dm.dmBitsPerPel;
|
||||
g_emulatedDisplayMode.bpp = dm.dmBitsPerPel;
|
||||
|
||||
g_desktopBpp = Config::desktopColorDepth.get();
|
||||
if (Config::Settings::DesktopColorDepth::INITIAL == g_desktopBpp)
|
||||
{
|
||||
g_desktopBpp = dm.dmBitsPerPel;
|
||||
}
|
||||
g_emulatedDisplayMode.bpp = g_desktopBpp;
|
||||
|
||||
EnumDisplayMonitors(nullptr, nullptr, &initMonitor, 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user