Permalink
Browse files

GSdx: Add option to Disable Safe Features.

Idea is to disable multiple features in 1 option to avoid gui clutter.

Unscale Point and Line:
This partially reverts PR #2710 restoring Unscale Point and Line but as a disable option.
It can help Xenosaga games.

GS Memory clearning:
This disables GS memory clearing to be done on the CPU, by default both gpu and cpu do memory clearing
which is more accurate.
It can help Kingdom Hearts games.
  • Loading branch information...
lightningterror committed Dec 31, 2018
1 parent c58acd1 commit f2f66c02d34b17857c9a8a87ae5413bbb792d854
@@ -432,9 +432,9 @@ void GSdxApp::Init()
m_default_configuration["UserHacks_AlphaStencil"] = "0";
m_default_configuration["UserHacks_AutoFlush"] = "0";
m_default_configuration["UserHacks_DisableDepthSupport"] = "0";
m_default_configuration["UserHacks_CPU_FB_Conversion"] = "0";
m_default_configuration["UserHacks_DisableGsMemClear"] = "0";
m_default_configuration["UserHacks_Disable_Safe_Features"] = "0";
m_default_configuration["UserHacks_DisablePartialInvalidation"] = "0";
m_default_configuration["UserHacks_CPU_FB_Conversion"] = "0";
m_default_configuration["UserHacks_HalfPixelOffset"] = "0";
m_default_configuration["UserHacks_merge_pp_sprite"] = "0";
m_default_configuration["UserHacks_MSAA"] = "0";
@@ -128,13 +128,14 @@ BEGIN
CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,45,57,8
CONTROL "Auto Flush",IDC_AUTO_FLUSH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,58,55,8
CONTROL "Disable Depth Emulation",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,92,8
CONTROL "Fast Texture Invalidation",IDC_FAST_TC_INV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,84,92,8
CONTROL "Disable Safe Features",IDC_SAFE_FEATURES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,84,85,8
// Column two - HW hacks
CONTROL "Frame Buffer Conversion",IDC_CPU_FB_CONVERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,19,92,8
CONTROL "Memory Wrapping",IDC_MEMORY_WRAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,32,75,8
CONTROL "Merge Sprite",IDC_MERGE_PP_SPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,45,90,8
CONTROL "Preload Frame Data",IDC_PRELOAD_GS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,58,80,8
CONTROL "Wild Arms Offset",IDC_WILDHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,71,70,8
CONTROL "Fast Texture Invalidation",IDC_FAST_TC_INV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,19,92,8
CONTROL "Frame Buffer Conversion",IDC_CPU_FB_CONVERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,32,92,8
CONTROL "Memory Wrapping",IDC_MEMORY_WRAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,45,75,8
CONTROL "Merge Sprite",IDC_MERGE_PP_SPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,58,90,8
CONTROL "Preload Frame Data",IDC_PRELOAD_GS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,71,80,8
CONTROL "Wild Arms Offset",IDC_WILDHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,84,70,8
// Columns end
//
RTEXT "MSAA:",IDC_MSAA_TEXT,54,99,22,8
@@ -335,7 +335,7 @@ void GSRendererDX11::SetupIA(const float& sx, const float& sy)

D3D11_PRIMITIVE_TOPOLOGY t;

bool unscale_pt_ln = (GetUpscaleMultiplier() != 1);
bool unscale_pt_ln = m_userHacks_enabled_unscale_ptln && (GetUpscaleMultiplier() != 1);

switch (m_vt.m_primclass)
{
@@ -41,18 +41,20 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc)
m_large_framebuffer = theApp.GetConfigB("large_framebuffer");
m_accurate_date = theApp.GetConfigI("accurate_date");
if (theApp.GetConfigB("UserHacks")) {
m_userhacks_enabled_gs_mem_clear = !theApp.GetConfigB("UserHacks_Disable_Safe_Features");
m_userHacks_enabled_unscale_ptln = !theApp.GetConfigB("UserHacks_Disable_Safe_Features");
m_userhacks_align_sprite_X = theApp.GetConfigB("UserHacks_align_sprite_X");
m_userhacks_round_sprite_offset = theApp.GetConfigI("UserHacks_round_sprite_offset");
m_userhacks_disable_gs_mem_clear = theApp.GetConfigB("UserHacks_DisableGsMemClear");
m_userHacks_HPO = theApp.GetConfigI("UserHacks_HalfPixelOffset");
m_userHacks_merge_sprite = theApp.GetConfigB("UserHacks_merge_pp_sprite");
m_userhacks_tcoffset_x = theApp.GetConfigI("UserHacks_TCOffsetX") / -1000.0f;
m_userhacks_tcoffset_y = theApp.GetConfigI("UserHacks_TCOffsetY") / -1000.0f;
m_userhacks_tcoffset = m_userhacks_tcoffset_x < 0.0f || m_userhacks_tcoffset_y < 0.0f;
} else {
m_userhacks_enabled_gs_mem_clear = true;
m_userHacks_enabled_unscale_ptln = true;
m_userhacks_align_sprite_X = false;
m_userhacks_round_sprite_offset = 0;
m_userhacks_disable_gs_mem_clear = false;
m_userHacks_HPO = 0;
m_userHacks_merge_sprite = false;
}
@@ -989,7 +991,7 @@ void GSRendererHW::Draw()
return;
}

if (!m_userhacks_disable_gs_mem_clear) {
if (m_userhacks_enabled_gs_mem_clear) {
// Constant Direct Write without texture/test/blending (aka a GS mem clear)
if ((m_vt.m_primclass == GS_SPRITE_CLASS) && !PRIM->TME // Direct write
&& (!PRIM->ABE || m_context->ALPHA.IsOpaque()) // No transparency
@@ -37,7 +37,7 @@ class GSRendererHW : public GSRenderer

bool m_large_framebuffer;
bool m_userhacks_align_sprite_X;
bool m_userhacks_disable_gs_mem_clear;
bool m_userhacks_enabled_gs_mem_clear;
bool m_userHacks_merge_sprite;

#pragma region hacks
@@ -145,6 +145,7 @@ class GSRendererHW : public GSRenderer

int m_userhacks_round_sprite_offset;
int m_userHacks_HPO;
bool m_userHacks_enabled_unscale_ptln;

bool m_userhacks_tcoffset;
float m_userhacks_tcoffset_x;
@@ -61,7 +61,7 @@ void GSRendererOGL::SetupIA(const float& sx, const float& sy)
}

GLenum t = 0;
bool unscale_pt_ln = (GetUpscaleMultiplier() != 1) && GLLoader::found_geometry_shader;
bool unscale_pt_ln = m_userHacks_enabled_unscale_ptln && (GetUpscaleMultiplier() != 1) && GLLoader::found_geometry_shader;

switch(m_vt.m_primclass)
{
@@ -445,6 +445,7 @@ void populate_hack_table(GtkWidget* hack_table)
GtkWidget* preload_gs_check = CreateCheckBox("Preload Frame Data", "preload_frame_with_gs_data");
GtkWidget* hack_fast_inv = CreateCheckBox("Fast Texture Invalidation", "UserHacks_DisablePartialInvalidation");
GtkWidget* hack_depth_check = CreateCheckBox("Disable Depth Emulation", "UserHacks_DisableDepthSupport");
GtkWidget* hack_safe_features = CreateCheckBox("Disable Safe Features", "UserHacks_Disable_Safe_Features");
GtkWidget* hack_cpu_fbcv = CreateCheckBox("Frame Buffer Conversion", "UserHacks_CPU_FB_Conversion");
GtkWidget* hack_auto_flush = CreateCheckBox("Auto Flush", "UserHacks_AutoFlush");
GtkWidget* hack_merge_sprite = CreateCheckBox("Merge Sprite", "UserHacks_merge_pp_sprite");
@@ -475,6 +476,7 @@ void populate_hack_table(GtkWidget* hack_table)
AddTooltip(hack_depth_check, IDC_TC_DEPTH);
AddTooltip(hack_cpu_fbcv, IDC_CPU_FB_CONVERSION);
AddTooltip(hack_auto_flush, IDC_AUTO_FLUSH);
AddTooltip(hack_safe_features, IDC_SAFE_FEATURES);
AddTooltip(hack_merge_sprite, IDC_MERGE_PP_SPRITE);
AddTooltip(hack_wrap_mem, IDC_MEMORY_WRAPPING);
AddTooltip(trilinear_box, IDC_TRI_FILTER);
@@ -484,11 +486,11 @@ void populate_hack_table(GtkWidget* hack_table)
s_table_line = 0;
//Hacks
// Column one and two HW Hacks
InsertWidgetInTable(hack_table , align_sprite_check , hack_wrap_mem);
InsertWidgetInTable(hack_table , hack_auto_flush , hack_merge_sprite);
InsertWidgetInTable(hack_table , hack_depth_check , preload_gs_check);
InsertWidgetInTable(hack_table , align_sprite_check , hack_cpu_fbcv);
InsertWidgetInTable(hack_table , hack_auto_flush , hack_wrap_mem);
InsertWidgetInTable(hack_table , hack_depth_check , hack_merge_sprite);
InsertWidgetInTable(hack_table , hack_safe_features , preload_gs_check);
InsertWidgetInTable(hack_table , hack_fast_inv , hack_wild_check);
InsertWidgetInTable(hack_table , hack_cpu_fbcv);
// Other upscaling hacks
InsertWidgetInTable(hack_table , trilinear_label , trilinear_box);
InsertWidgetInTable(hack_table , hack_offset_label , hack_offset_box);
@@ -154,6 +154,12 @@ const char* dialog_message(int ID, bool* updateText) {
"Fixes some processing effects such as the shadows in the Jak series and radiosity in GTA:SA.\n"
"Warning: it's very costly on the performance.\n\n"
"Note: OpenGL HW renderer is able to handle Jak shadows at full speed without this option.";
case IDC_SAFE_FEATURES:
return "This option disables multiple safe features.\n\n"
"Disables accurate Ucnscale Point and Line rendering.\n"
"It can help Xenosaga games.\n\n"
"Disables accurate GS Memory Clearing to be done on the CPU, and let only the GPU hangle it.\n"
"It can help Kingdom Hearts games.";
case IDC_MEMORY_WRAPPING:
return "Emulates GS memory wrapping accurately. This fixes issues where part of the image is cut-off by block shaped sections such as the FMVs in Wallace & Gromit: The Curse of the Were-Rabbit and Thrillville.\n\n"
"Note: This hack can have a small impact on performance.";
@@ -180,7 +186,7 @@ const char* dialog_message(int ID, bool* updateText) {
return "Uploads GS data when rendering a new frame to reproduce some effects accurately.\n"
"Fixes black screen issues in games like Armored Core: Last Raven.";
case IDC_MIPMAP_HW:
return "Control the accuracy level of the mipmapping emulation\n\n"
return "Control the accuracy level of the mipmapping emulation.\n\n"
"Automatic:\nAutomatically sets the mipmapping level based on the game.\n"
"This is the recommended setting.\n\n"
"Off:\nMipmapping emulation is disabled.\n\n"
@@ -80,6 +80,7 @@ enum {
IDC_LARGE_FB,
IDC_LINEAR_PRESENT,
IDC_AUTO_FLUSH,
IDC_SAFE_FEATURES,
IDC_MEMORY_WRAPPING,
IDC_MERGE_PP_SPRITE,
IDC_GEOMETRY_SHADER_OVERRIDE,
@@ -640,6 +640,7 @@ void GSHacksDlg::OnInit()
CheckDlgButton(m_hWnd, IDC_CPU_FB_CONVERSION, theApp.GetConfigB("UserHacks_CPU_FB_Conversion"));
CheckDlgButton(m_hWnd, IDC_FAST_TC_INV, theApp.GetConfigB("UserHacks_DisablePartialInvalidation"));
CheckDlgButton(m_hWnd, IDC_AUTO_FLUSH, theApp.GetConfigB("UserHacks_AutoFlush"));
CheckDlgButton(m_hWnd, IDC_SAFE_FEATURES, theApp.GetConfigB("UserHacks_Disable_Safe_Features"));
CheckDlgButton(m_hWnd, IDC_MEMORY_WRAPPING, theApp.GetConfigB("wrap_gs_mem"));
CheckDlgButton(m_hWnd, IDC_MERGE_PP_SPRITE, theApp.GetConfigB("UserHacks_merge_pp_sprite"));

@@ -709,6 +710,7 @@ void GSHacksDlg::OnInit()
AddTooltip(IDC_CPU_FB_CONVERSION);
AddTooltip(IDC_FAST_TC_INV);
AddTooltip(IDC_AUTO_FLUSH);
AddTooltip(IDC_SAFE_FEATURES);
AddTooltip(IDC_MEMORY_WRAPPING);
AddTooltip(IDC_TRI_FILTER);
AddTooltip(IDC_MERGE_PP_SPRITE);
@@ -808,6 +810,7 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
theApp.SetConfig("UserHacks_CPU_FB_Conversion", (int)IsDlgButtonChecked(m_hWnd, IDC_CPU_FB_CONVERSION));
theApp.SetConfig("UserHacks_DisablePartialInvalidation", (int)IsDlgButtonChecked(m_hWnd, IDC_FAST_TC_INV));
theApp.SetConfig("UserHacks_AutoFlush", (int)IsDlgButtonChecked(m_hWnd, IDC_AUTO_FLUSH));
theApp.SetConfig("UserHacks_Disable_Safe_Features", (int)IsDlgButtonChecked(m_hWnd, IDC_SAFE_FEATURES));
theApp.SetConfig("wrap_gs_mem", (int)IsDlgButtonChecked(m_hWnd, IDC_MEMORY_WRAPPING));
theApp.SetConfig("UserHacks_merge_pp_sprite", (int)IsDlgButtonChecked(m_hWnd, IDC_MERGE_PP_SPRITE));
theApp.SetConfig("UserHacks_TCOffsetX", SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0));
@@ -94,12 +94,13 @@
#define IDC_MEMORY_WRAPPING 2122
#define IDC_TRI_FILTER 2123
#define IDC_TRI_FILTER_TEXT 2124
#define IDC_MERGE_PP_SPRITE 2125
#define IDC_CPU_FB_CONVERSION 2126
#define IDC_SKIPDRAWHACK 2127
#define IDC_SKIPDRAWHACKEDIT 2128
#define IDC_SKIPDRAWOFFSET 2129
#define IDC_SKIPDRAWOFFSETEDIT 2130
#define IDC_SAFE_FEATURES 2125
#define IDC_MERGE_PP_SPRITE 2126
#define IDC_CPU_FB_CONVERSION 2127
#define IDC_SKIPDRAWHACK 2128
#define IDC_SKIPDRAWHACKEDIT 2129
#define IDC_SKIPDRAWOFFSET 2130
#define IDC_SKIPDRAWOFFSETEDIT 2131
// Shader:
#define IDC_SHADEBOOST 2140
#define IDC_FXAA 2141

0 comments on commit f2f66c0

Please sign in to comment.