diff --git a/DDrawCompat/Config/Config.cpp b/DDrawCompat/Config/Config.cpp index f3f7555..c373aa0 100644 --- a/DDrawCompat/Config/Config.cpp +++ b/DDrawCompat/Config/Config.cpp @@ -2,6 +2,7 @@ namespace Config { + Settings::AlternatePixelCenter alternatePixelCenter; Settings::CpuAffinity cpuAffinity; Settings::DesktopColorDepth desktopColorDepth; Settings::DisplayFilter displayFilter; diff --git a/DDrawCompat/Config/Config.h b/DDrawCompat/Config/Config.h index 0007484..5729ca5 100644 --- a/DDrawCompat/Config/Config.h +++ b/DDrawCompat/Config/Config.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -13,6 +14,7 @@ namespace Config const unsigned evictionTimeout = 200; const unsigned maxPaletteUpdatesPerMs = 5; + extern Settings::AlternatePixelCenter alternatePixelCenter; extern Settings::CpuAffinity cpuAffinity; extern Settings::DesktopColorDepth desktopColorDepth; extern Settings::DisplayFilter displayFilter; diff --git a/DDrawCompat/Config/Settings/AlternatePixelCenter.h b/DDrawCompat/Config/Settings/AlternatePixelCenter.h new file mode 100644 index 0000000..4e909e3 --- /dev/null +++ b/DDrawCompat/Config/Settings/AlternatePixelCenter.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace Config +{ + namespace Settings + { + class AlternatePixelCenter : public MappedSetting + { + public: + AlternatePixelCenter() + : MappedSetting("AlternatePixelCenter", "off", { {"off", 0.0f}, {"on", -0.5f} }) + { + } + }; + } +} diff --git a/DDrawCompat/D3dDdi/DrawPrimitive.cpp b/DDrawCompat/D3dDdi/DrawPrimitive.cpp index 1e553c4..6d59299 100644 --- a/DDrawCompat/D3dDdi/DrawPrimitive.cpp +++ b/DDrawCompat/D3dDdi/DrawPrimitive.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -618,6 +619,7 @@ namespace D3dDdi auto vertices = m_batched.vertices.data(); if (!m_isHwVertexProcessingUsed) { + const float pixelOffset = Config::alternatePixelCenter.get(); UINT offset = 0; for (UINT i = 0; i < count; ++i) { @@ -626,6 +628,8 @@ namespace D3dDdi { v->rhw = 1; } + v->sx += pixelOffset; + v->sy += pixelOffset; offset += m_streamSource.stride; } } diff --git a/DDrawCompat/DDrawCompat.vcxproj b/DDrawCompat/DDrawCompat.vcxproj index 07b02e7..750489e 100644 --- a/DDrawCompat/DDrawCompat.vcxproj +++ b/DDrawCompat/DDrawCompat.vcxproj @@ -213,6 +213,7 @@ + diff --git a/DDrawCompat/DDrawCompat.vcxproj.filters b/DDrawCompat/DDrawCompat.vcxproj.filters index 2971d8a..9ddb155 100644 --- a/DDrawCompat/DDrawCompat.vcxproj.filters +++ b/DDrawCompat/DDrawCompat.vcxproj.filters @@ -447,6 +447,9 @@ Header Files\Config\Settings + + Header Files\Config\Settings +