mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
parent
f1ae0c7147
commit
76dfc38645
@ -50,6 +50,7 @@
|
|||||||
#include <Config/Settings/ThreadPriorityBoost.h>
|
#include <Config/Settings/ThreadPriorityBoost.h>
|
||||||
#include <Config/Settings/VertexBufferMemoryType.h>
|
#include <Config/Settings/VertexBufferMemoryType.h>
|
||||||
#include <Config/Settings/VertexFixup.h>
|
#include <Config/Settings/VertexFixup.h>
|
||||||
|
#include <Config/Settings/ViewportEdgeFix.h>
|
||||||
#include <Config/Settings/VSync.h>
|
#include <Config/Settings/VSync.h>
|
||||||
#include <Config/Settings/WinVersionLie.h>
|
#include <Config/Settings/WinVersionLie.h>
|
||||||
|
|
||||||
@ -107,6 +108,7 @@ namespace Config
|
|||||||
Settings::ThreadPriorityBoost threadPriorityBoost;
|
Settings::ThreadPriorityBoost threadPriorityBoost;
|
||||||
Settings::VertexBufferMemoryType vertexBufferMemoryType;
|
Settings::VertexBufferMemoryType vertexBufferMemoryType;
|
||||||
Settings::VertexFixup vertexFixup;
|
Settings::VertexFixup vertexFixup;
|
||||||
|
Settings::ViewportEdgeFix viewportEdgeFix;
|
||||||
Settings::VSync vSync;
|
Settings::VSync vSync;
|
||||||
Settings::WinVersionLie winVersionLie;
|
Settings::WinVersionLie winVersionLie;
|
||||||
}
|
}
|
||||||
|
32
DDrawCompat/Config/Settings/ViewportEdgeFix.h
Normal file
32
DDrawCompat/Config/Settings/ViewportEdgeFix.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Config/EnumSetting.h>
|
||||||
|
|
||||||
|
namespace Config
|
||||||
|
{
|
||||||
|
namespace Settings
|
||||||
|
{
|
||||||
|
class ViewportEdgeFix : public EnumSetting
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Values { OFF, SCALE };
|
||||||
|
|
||||||
|
ViewportEdgeFix()
|
||||||
|
: EnumSetting("ViewportEdgeFix", "off", { "off", "scale" })
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ParamInfo getParamInfo() const override
|
||||||
|
{
|
||||||
|
switch (m_value)
|
||||||
|
{
|
||||||
|
case SCALE:
|
||||||
|
return { "Gap", 1, 100, 50 };
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
extern Settings::ViewportEdgeFix viewportEdgeFix;
|
||||||
|
}
|
@ -16,6 +16,7 @@
|
|||||||
#include <D3dDdi/ShaderAssembler.h>
|
#include <D3dDdi/ShaderAssembler.h>
|
||||||
#include <Overlay/Steam.h>
|
#include <Overlay/Steam.h>
|
||||||
#include <Shaders/VertexFixup.h>
|
#include <Shaders/VertexFixup.h>
|
||||||
|
#include <Config/Settings/ViewportEdgeFix.h>
|
||||||
|
|
||||||
#define LOG_DS LOG_DEBUG << "DeviceState::" << __func__ << ": "
|
#define LOG_DS LOG_DEBUG << "DeviceState::" << __func__ << ": "
|
||||||
|
|
||||||
@ -901,7 +902,7 @@ namespace D3dDdi
|
|||||||
if (spriteMode != m_spriteMode)
|
if (spriteMode != m_spriteMode)
|
||||||
{
|
{
|
||||||
m_spriteMode = spriteMode;
|
m_spriteMode = spriteMode;
|
||||||
m_changedStates |= CS_RENDER_STATE | CS_TEXTURE_STAGE;
|
m_changedStates |= CS_RENDER_STATE | CS_RENDER_TARGET | CS_TEXTURE_STAGE;
|
||||||
m_changedRenderStates.set(D3DDDIRS_MULTISAMPLEANTIALIAS);
|
m_changedRenderStates.set(D3DDDIRS_MULTISAMPLEANTIALIAS);
|
||||||
if (Config::Settings::SpriteTexCoord::ROUND == Config::spriteTexCoord.get())
|
if (Config::Settings::SpriteTexCoord::ROUND == Config::spriteTexCoord.get())
|
||||||
{
|
{
|
||||||
@ -1353,17 +1354,21 @@ namespace D3dDdi
|
|||||||
const float apc = Config::alternatePixelCenter.get();
|
const float apc = Config::alternatePixelCenter.get();
|
||||||
const auto& zr = m_current.zRange;
|
const auto& zr = m_current.zRange;
|
||||||
|
|
||||||
|
const float viewportEdgeGap = m_spriteMode ? 0 : (Config::viewportEdgeFix.getParam() / 100.0f);
|
||||||
|
const float w = width - viewportEdgeGap;
|
||||||
|
const float h = height - viewportEdgeGap;
|
||||||
|
|
||||||
m_vertexFixupData.texCoordAdj[2] = stc;
|
m_vertexFixupData.texCoordAdj[2] = stc;
|
||||||
m_vertexFixupData.texCoordAdj[3] = stc;
|
m_vertexFixupData.texCoordAdj[3] = stc;
|
||||||
|
|
||||||
if (Config::Settings::VertexFixup::GPU == m_vertexFixupConfig)
|
if (Config::Settings::VertexFixup::GPU == m_vertexFixupConfig)
|
||||||
{
|
{
|
||||||
m_vertexFixupData.offset[0] = 0.5f + apc - 0.5f / sx - width / 2;
|
m_vertexFixupData.offset[0] = 0.5f + apc - 0.5f / sx - w / 2;
|
||||||
m_vertexFixupData.offset[1] = 0.5f + apc - 0.5f / sy - height / 2;
|
m_vertexFixupData.offset[1] = 0.5f + apc - 0.5f / sy - h / 2;
|
||||||
m_vertexFixupData.offset[2] = -zr.MinZ;
|
m_vertexFixupData.offset[2] = -zr.MinZ;
|
||||||
|
|
||||||
m_vertexFixupData.multiplier[0] = 2.0f / width;
|
m_vertexFixupData.multiplier[0] = 2.0f / w;
|
||||||
m_vertexFixupData.multiplier[1] = -2.0f / height;
|
m_vertexFixupData.multiplier[1] = -2.0f / h;
|
||||||
m_vertexFixupData.multiplier[2] = 1.0f / (zr.MaxZ - zr.MinZ);
|
m_vertexFixupData.multiplier[2] = 1.0f / (zr.MaxZ - zr.MinZ);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1371,8 +1376,8 @@ namespace D3dDdi
|
|||||||
m_vertexFixupData.offset[0] = 0.5f + apc - 0.5f / sx;
|
m_vertexFixupData.offset[0] = 0.5f + apc - 0.5f / sx;
|
||||||
m_vertexFixupData.offset[1] = 0.5f + apc - 0.5f / sy;
|
m_vertexFixupData.offset[1] = 0.5f + apc - 0.5f / sy;
|
||||||
|
|
||||||
m_vertexFixupData.multiplier[0] = sx;
|
m_vertexFixupData.multiplier[0] = sx * width / w;
|
||||||
m_vertexFixupData.multiplier[1] = sy;
|
m_vertexFixupData.multiplier[1] = sy * height / h;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_changedStates |= CS_VERTEX_FIXUP;
|
m_changedStates |= CS_VERTEX_FIXUP;
|
||||||
|
@ -216,6 +216,7 @@
|
|||||||
<ClInclude Include="Config\Settings\ThreadPriorityBoost.h" />
|
<ClInclude Include="Config\Settings\ThreadPriorityBoost.h" />
|
||||||
<ClInclude Include="Config\Settings\VertexBufferMemoryType.h" />
|
<ClInclude Include="Config\Settings\VertexBufferMemoryType.h" />
|
||||||
<ClInclude Include="Config\Settings\VertexFixup.h" />
|
<ClInclude Include="Config\Settings\VertexFixup.h" />
|
||||||
|
<ClInclude Include="Config\Settings\ViewportEdgeFix.h" />
|
||||||
<ClInclude Include="Config\Settings\VSync.h" />
|
<ClInclude Include="Config\Settings\VSync.h" />
|
||||||
<ClInclude Include="Config\Settings\WinVersionLie.h" />
|
<ClInclude Include="Config\Settings\WinVersionLie.h" />
|
||||||
<ClInclude Include="D3dDdi\Adapter.h" />
|
<ClInclude Include="D3dDdi\Adapter.h" />
|
||||||
|
@ -723,6 +723,9 @@
|
|||||||
<ClInclude Include="Config\Settings\GdiStretchBltMode.h">
|
<ClInclude Include="Config\Settings\GdiStretchBltMode.h">
|
||||||
<Filter>Header Files\Config\Settings</Filter>
|
<Filter>Header Files\Config\Settings</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Config\Settings\ViewportEdgeFix.h">
|
||||||
|
<Filter>Header Files\Config\Settings</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Gdi\Gdi.cpp">
|
<ClCompile Include="Gdi\Gdi.cpp">
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <Config/Settings/StatsTransparency.h>
|
#include <Config/Settings/StatsTransparency.h>
|
||||||
#include <Config/Settings/TextureFilter.h>
|
#include <Config/Settings/TextureFilter.h>
|
||||||
#include <Config/Settings/VertexFixup.h>
|
#include <Config/Settings/VertexFixup.h>
|
||||||
|
#include <Config/Settings/ViewportEdgeFix.h>
|
||||||
#include <Config/Settings/VSync.h>
|
#include <Config/Settings/VSync.h>
|
||||||
#include <D3dDdi/Device.h>
|
#include <D3dDdi/Device.h>
|
||||||
#include <Gdi/Gdi.h>
|
#include <Gdi/Gdi.h>
|
||||||
@ -71,6 +72,7 @@ namespace
|
|||||||
{ &Config::statsTransparency, [&]() { Gdi::GuiThread::getStatsWindow()->setAlpha(Config::statsTransparency.get()); }},
|
{ &Config::statsTransparency, [&]() { Gdi::GuiThread::getStatsWindow()->setAlpha(Config::statsTransparency.get()); }},
|
||||||
{ &Config::textureFilter, &D3dDdi::Device::updateAllConfig },
|
{ &Config::textureFilter, &D3dDdi::Device::updateAllConfig },
|
||||||
{ &Config::vertexFixup, &D3dDdi::Device::updateAllConfig },
|
{ &Config::vertexFixup, &D3dDdi::Device::updateAllConfig },
|
||||||
|
{ &Config::viewportEdgeFix },
|
||||||
{ &Config::vSync }
|
{ &Config::vSync }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ namespace
|
|||||||
LSTATUS WINAPI regEnumValueW(HKEY hKey, DWORD dwIndex, LPWSTR lpValueName, LPDWORD lpcchValueName,
|
LSTATUS WINAPI regEnumValueW(HKEY hKey, DWORD dwIndex, LPWSTR lpValueName, LPDWORD lpcchValueName,
|
||||||
LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
|
LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
|
||||||
{
|
{
|
||||||
LOG_FUNC("RegEnumValueW", hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData);
|
LOG_FUNC("RegEnumValueW", hKey, dwIndex, Compat::out(lpValueName), lpcchValueName, lpReserved, lpType, lpData, lpcbData);
|
||||||
if (lpValueName && lpcchValueName && !lpReserved && !lpType && !lpData && !lpcbData)
|
if (lpValueName && lpcchValueName && !lpReserved && !lpType && !lpData && !lpcbData)
|
||||||
{
|
{
|
||||||
auto keyName(getKeyName(hKey));
|
auto keyName(getKeyName(hKey));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user