mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added SpriteDetection setting
This commit is contained in:
parent
20912dce37
commit
ea369261df
@ -12,6 +12,7 @@ namespace Config
|
||||
Settings::DisplayResolution displayResolution;
|
||||
Settings::RenderColorDepth renderColorDepth;
|
||||
Settings::ResolutionScale resolutionScale;
|
||||
Settings::SpriteDetection spriteDetection;
|
||||
Settings::SpriteFilter spriteFilter;
|
||||
Settings::SpriteTexCoord spriteTexCoord;
|
||||
Settings::SupportedResolutions supportedResolutions;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <Config/Settings/DisplayResolution.h>
|
||||
#include <Config/Settings/RenderColorDepth.h>
|
||||
#include <Config/Settings/ResolutionScale.h>
|
||||
#include <Config/Settings/SpriteDetection.h>
|
||||
#include <Config/Settings/SpriteFilter.h>
|
||||
#include <Config/Settings/SpriteTexCoord.h>
|
||||
#include <Config/Settings/SupportedResolutions.h>
|
||||
@ -31,6 +32,7 @@ namespace Config
|
||||
extern Settings::DisplayResolution displayResolution;
|
||||
extern Settings::RenderColorDepth renderColorDepth;
|
||||
extern Settings::ResolutionScale resolutionScale;
|
||||
extern Settings::SpriteDetection spriteDetection;
|
||||
extern Settings::SpriteFilter spriteFilter;
|
||||
extern Settings::SpriteTexCoord spriteTexCoord;
|
||||
extern Settings::SupportedResolutions supportedResolutions;
|
||||
|
26
DDrawCompat/Config/Settings/SpriteDetection.cpp
Normal file
26
DDrawCompat/Config/Settings/SpriteDetection.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <Config/Settings/SpriteDetection.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
SpriteDetection::SpriteDetection()
|
||||
: MappedSetting("SpriteDetection", "off", {
|
||||
{"off", OFF},
|
||||
{"zconst", ZCONST},
|
||||
{"zmax", ZMAX},
|
||||
{"point", POINT}
|
||||
})
|
||||
{
|
||||
}
|
||||
|
||||
Setting::ParamInfo SpriteDetection::getParamInfo() const
|
||||
{
|
||||
if (ZMAX == m_value)
|
||||
{
|
||||
return { "ZMax", 0, 100, 0, m_param };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
22
DDrawCompat/Config/Settings/SpriteDetection.h
Normal file
22
DDrawCompat/Config/Settings/SpriteDetection.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <Config/MappedSetting.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
class SpriteDetection : public MappedSetting<UINT>
|
||||
{
|
||||
public:
|
||||
static const UINT OFF = 0;
|
||||
static const UINT ZCONST = 1;
|
||||
static const UINT ZMAX = 2;
|
||||
static const UINT POINT = 3;
|
||||
|
||||
SpriteDetection();
|
||||
|
||||
virtual ParamInfo getParamInfo() const override;
|
||||
};
|
||||
}
|
||||
}
|
@ -651,8 +651,23 @@ namespace D3dDdi
|
||||
|
||||
bool DrawPrimitive::isSprite(INT baseVertexIndex, UINT16 index0, UINT16 index1, UINT16 index2)
|
||||
{
|
||||
auto spriteDetection = Config::spriteDetection.get();
|
||||
if (Config::Settings::SpriteDetection::OFF == spriteDetection ||
|
||||
Config::Settings::SpriteDetection::POINT == spriteDetection && (
|
||||
D3DTEXF_POINT != m_device.getState().getAppState().textureStageState[0][D3DDDITSS_MAGFILTER] ||
|
||||
D3DTEXF_POINT != m_device.getState().getAppState().textureStageState[0][D3DDDITSS_MINFILTER]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto v = m_streamSource.vertices + baseVertexIndex * m_streamSource.stride;
|
||||
auto v0 = reinterpret_cast<const D3DTLVERTEX*>(v + index0 * m_streamSource.stride);
|
||||
if (Config::Settings::SpriteDetection::ZMAX == spriteDetection &&
|
||||
v0->sz > static_cast<float>(Config::spriteDetection.getParam()) / 100)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto v1 = reinterpret_cast<const D3DTLVERTEX*>(v + index1 * m_streamSource.stride);
|
||||
auto v2 = reinterpret_cast<const D3DTLVERTEX*>(v + index2 * m_streamSource.stride);
|
||||
return v0->sz == v1->sz && v0->sz == v2->sz;
|
||||
|
@ -227,6 +227,7 @@
|
||||
<ClInclude Include="Config\Settings\DisplayResolution.h" />
|
||||
<ClInclude Include="Config\Settings\RenderColorDepth.h" />
|
||||
<ClInclude Include="Config\Settings\ResolutionScale.h" />
|
||||
<ClInclude Include="Config\Settings\SpriteDetection.h" />
|
||||
<ClInclude Include="Config\Settings\SpriteFilter.h" />
|
||||
<ClInclude Include="Config\Settings\SpriteTexCoord.h" />
|
||||
<ClInclude Include="Config\Settings\SupportedResolutions.h" />
|
||||
@ -353,6 +354,7 @@
|
||||
<ClCompile Include="Config\Settings\DisplayRefreshRate.cpp" />
|
||||
<ClCompile Include="Config\Settings\DisplayResolution.cpp" />
|
||||
<ClCompile Include="Config\Settings\ResolutionScale.cpp" />
|
||||
<ClCompile Include="Config\Settings\SpriteDetection.cpp" />
|
||||
<ClCompile Include="Config\Settings\SpriteFilter.cpp" />
|
||||
<ClCompile Include="Config\Settings\SpriteTexCoord.cpp" />
|
||||
<ClCompile Include="Config\Settings\SupportedResolutions.cpp" />
|
||||
|
@ -534,6 +534,9 @@
|
||||
<ClInclude Include="Config\Settings\SpriteFilter.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Config\Settings\SpriteDetection.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Gdi\Gdi.cpp">
|
||||
@ -845,6 +848,9 @@
|
||||
<ClCompile Include="Config\Settings\SpriteFilter.cpp">
|
||||
<Filter>Source Files\Config\Settings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config\Settings\SpriteDetection.cpp">
|
||||
<Filter>Source Files\Config\Settings</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="DDrawCompat.rc">
|
||||
|
@ -16,6 +16,7 @@ namespace Overlay
|
||||
addControl(Config::displayFilter);
|
||||
addControl(Config::renderColorDepth);
|
||||
addControl(Config::resolutionScale);
|
||||
addControl(Config::spriteDetection);
|
||||
addControl(Config::spriteFilter);
|
||||
addControl(Config::spriteTexCoord);
|
||||
addControl(Config::textureFilter);
|
||||
|
Loading…
x
Reference in New Issue
Block a user