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

Added ForceD3D9On12 setting

This commit is contained in:
narzoul 2022-03-27 11:39:27 +02:00
parent ea369261df
commit fb9f28456e
6 changed files with 35 additions and 1 deletions

View File

@ -10,6 +10,7 @@ namespace Config
Settings::DisplayFilter displayFilter;
Settings::DisplayRefreshRate displayRefreshRate;
Settings::DisplayResolution displayResolution;
Settings::ForceD3D9On12 forceD3D9On12;
Settings::RenderColorDepth renderColorDepth;
Settings::ResolutionScale resolutionScale;
Settings::SpriteDetection spriteDetection;

View File

@ -8,6 +8,7 @@
#include <Config/Settings/DisplayFilter.h>
#include <Config/Settings/DisplayRefreshRate.h>
#include <Config/Settings/DisplayResolution.h>
#include <Config/Settings/ForceD3D9On12.h>
#include <Config/Settings/RenderColorDepth.h>
#include <Config/Settings/ResolutionScale.h>
#include <Config/Settings/SpriteDetection.h>
@ -30,6 +31,7 @@ namespace Config
extern Settings::DisplayFilter displayFilter;
extern Settings::DisplayRefreshRate displayRefreshRate;
extern Settings::DisplayResolution displayResolution;
extern Settings::ForceD3D9On12 forceD3D9On12;
extern Settings::RenderColorDepth renderColorDepth;
extern Settings::ResolutionScale resolutionScale;
extern Settings::SpriteDetection spriteDetection;

View File

@ -0,0 +1,18 @@
#pragma once
#include <Config/EnumSetting.h>
namespace Config
{
namespace Settings
{
class ForceD3D9On12 : public MappedSetting<bool>
{
public:
ForceD3D9On12()
: MappedSetting("ForceD3D9On12", "off", { {"off", false}, {"on", true} })
{
}
};
}
}

View File

@ -8,6 +8,7 @@
#include <Common/Hook.h>
#include <Common/ScopedSrwLock.h>
#include <Common/Time.h>
#include <Config/Config.h>
#include <D3dDdi/Device.h>
#include <D3dDdi/KernelModeThunks.h>
#include <D3dDdi/Log/KernelModeThunksLog.h>
@ -206,6 +207,14 @@ namespace
{
switch (pData->Type)
{
case KMTQAITYPE_UMDRIVERNAME:
if (Config::forceD3D9On12.get() &&
KMTUMDVERSION_DX9 == static_cast<D3DKMT_UMDFILENAMEINFO*>(pData->pPrivateDriverData)->Version)
{
return STATUS_INVALID_PARAMETER;
}
break;
case KMTQAITYPE_GETSEGMENTSIZE:
{
auto info = static_cast<D3DKMT_SEGMENTSIZEINFO*>(pData->pPrivateDriverData);
@ -222,8 +231,8 @@ namespace
info->DedicatedVideoMemorySize = min(info->DedicatedVideoMemorySize, maxMem);
info->SharedSystemMemorySize = min(info->SharedSystemMemorySize, maxMem);
break;
}
break;
}
}
return LOG_RESULT(result);

View File

@ -225,6 +225,7 @@
<ClInclude Include="Config\Settings\DisplayFilter.h" />
<ClInclude Include="Config\Settings\DisplayRefreshRate.h" />
<ClInclude Include="Config\Settings\DisplayResolution.h" />
<ClInclude Include="Config\Settings\ForceD3D9On12.h" />
<ClInclude Include="Config\Settings\RenderColorDepth.h" />
<ClInclude Include="Config\Settings\ResolutionScale.h" />
<ClInclude Include="Config\Settings\SpriteDetection.h" />

View File

@ -537,6 +537,9 @@
<ClInclude Include="Config\Settings\SpriteDetection.h">
<Filter>Header Files\Config\Settings</Filter>
</ClInclude>
<ClInclude Include="Config\Settings\ForceD3D9On12.h">
<Filter>Header Files\Config\Settings</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Gdi\Gdi.cpp">