mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added VSync setting
This commit is contained in:
parent
80863f77a7
commit
9813e8b1b7
@ -20,4 +20,5 @@ namespace Config
|
||||
Settings::SupportedResolutions supportedResolutions;
|
||||
Settings::TextureFilter textureFilter;
|
||||
Settings::ThreadPriorityBoost threadPriorityBoost;
|
||||
Settings::VSync vSync;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <Config/Settings/SupportedResolutions.h>
|
||||
#include <Config/Settings/TextureFilter.h>
|
||||
#include <Config/Settings/ThreadPriorityBoost.h>
|
||||
#include <Config/Settings/VSync.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
@ -39,4 +40,5 @@ namespace Config
|
||||
extern Settings::SupportedResolutions supportedResolutions;
|
||||
extern Settings::TextureFilter textureFilter;
|
||||
extern Settings::ThreadPriorityBoost threadPriorityBoost;
|
||||
extern Settings::VSync vSync;
|
||||
}
|
||||
|
24
DDrawCompat/Config/Settings/VSync.cpp
Normal file
24
DDrawCompat/Config/Settings/VSync.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <d3dtypes.h>
|
||||
#include <d3dumddi.h>
|
||||
|
||||
#include <Config/Settings/VSync.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
VSync::VSync()
|
||||
: MappedSetting("VSync", "app", { {"app", APP}, {"off", OFF}, {"on", ON} })
|
||||
{
|
||||
}
|
||||
|
||||
Setting::ParamInfo VSync::getParamInfo() const
|
||||
{
|
||||
if (ON == m_value)
|
||||
{
|
||||
return { "Interval", 1, 16, 1, m_param };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
21
DDrawCompat/Config/Settings/VSync.h
Normal file
21
DDrawCompat/Config/Settings/VSync.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <Config/MappedSetting.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
class VSync : public MappedSetting<int>
|
||||
{
|
||||
public:
|
||||
static const int APP = -1;
|
||||
static const int OFF = 0;
|
||||
static const int ON = 1;
|
||||
|
||||
VSync();
|
||||
|
||||
virtual ParamInfo getParamInfo() const override;
|
||||
};
|
||||
}
|
||||
}
|
@ -103,6 +103,12 @@ namespace
|
||||
|
||||
UINT getFlipInterval(DWORD flags)
|
||||
{
|
||||
auto vSync = Config::vSync.get();
|
||||
if (Config::Settings::VSync::APP != vSync)
|
||||
{
|
||||
return Config::Settings::VSync::OFF == vSync ? 0 : Config::vSync.getParam();
|
||||
}
|
||||
|
||||
if (flags & DDFLIP_NOVSYNC)
|
||||
{
|
||||
return 0;
|
||||
|
@ -235,6 +235,7 @@
|
||||
<ClInclude Include="Config\Settings\SupportedResolutions.h" />
|
||||
<ClInclude Include="Config\Settings\TextureFilter.h" />
|
||||
<ClInclude Include="Config\Settings\ThreadPriorityBoost.h" />
|
||||
<ClInclude Include="Config\Settings\VSync.h" />
|
||||
<ClInclude Include="D3dDdi\Adapter.h" />
|
||||
<ClInclude Include="D3dDdi\AdapterCallbacks.h" />
|
||||
<ClInclude Include="D3dDdi\AdapterFuncs.h" />
|
||||
@ -361,6 +362,7 @@
|
||||
<ClCompile Include="Config\Settings\SpriteTexCoord.cpp" />
|
||||
<ClCompile Include="Config\Settings\SupportedResolutions.cpp" />
|
||||
<ClCompile Include="Config\Settings\TextureFilter.cpp" />
|
||||
<ClCompile Include="Config\Settings\VSync.cpp" />
|
||||
<ClCompile Include="D3dDdi\Adapter.cpp" />
|
||||
<ClCompile Include="D3dDdi\AdapterCallbacks.cpp" />
|
||||
<ClCompile Include="D3dDdi\AdapterFuncs.cpp" />
|
||||
|
@ -543,6 +543,9 @@
|
||||
<ClInclude Include="Config\Settings\FullscreenMode.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Config\Settings\VSync.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Gdi\Gdi.cpp">
|
||||
@ -857,6 +860,9 @@
|
||||
<ClCompile Include="Config\Settings\SpriteDetection.cpp">
|
||||
<Filter>Source Files\Config\Settings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config\Settings\VSync.cpp">
|
||||
<Filter>Source Files\Config\Settings</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="DDrawCompat.rc">
|
||||
|
@ -20,6 +20,7 @@ namespace Overlay
|
||||
addControl(Config::spriteFilter);
|
||||
addControl(Config::spriteTexCoord);
|
||||
addControl(Config::textureFilter);
|
||||
addControl(Config::vSync);
|
||||
}
|
||||
|
||||
void ConfigWindow::addControl(Config::Setting& setting)
|
||||
|
Loading…
x
Reference in New Issue
Block a user