gsdx: Add an automatic CRC hack level

If a user switches renderer they also have to remember to change the CRC
hack level for the best user experience with the selected renderer.

This commit adds a new automatic CRC level that autoselects the
recommended CRC level for the selected renderer, so that a user doesn't
have to make the change manually.

coauthor: turtleli
This commit is contained in:
willkuer 2016-12-05 22:55:53 +01:00 committed by Gregory Hainaut
parent 439472d4f8
commit a18d624bcb
10 changed files with 38 additions and 32 deletions

View File

@ -216,11 +216,7 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
renderer = static_cast<GSRendererType>(theApp.GetConfigI("Renderer")); renderer = static_cast<GSRendererType>(theApp.GetConfigI("Renderer"));
#ifdef _WIN32 #ifdef _WIN32
if (renderer == GSRendererType::Default) if (renderer == GSRendererType::Default)
{
renderer = GSUtil::GetBestRenderer(); renderer = GSUtil::GetBestRenderer();
if (renderer == GSRendererType::OGL_HW)
theApp.SetConfig("crc_hack_level", static_cast<int>(CRCHackLevel::Partial));
}
#endif #endif
} }

View File

@ -1432,8 +1432,9 @@ enum class TriFiltering : uint8
Forced, Forced,
}; };
enum class CRCHackLevel : uint8 enum class CRCHackLevel : int8
{ {
Automatic = -1,
None, None,
Minimum, Minimum,
Partial, Partial,

View File

@ -23,11 +23,12 @@
#include "GSState.h" #include "GSState.h"
#include "GSdx.h" #include "GSdx.h"
CRCHackLevel s_crc_hack_level = CRCHackLevel::Full; static CRCHackLevel s_crc_hack_level = CRCHackLevel::Full;
// hacks // hacks
#define Aggresive (s_crc_hack_level >= CRCHackLevel::Aggressive) #define Aggresive (s_crc_hack_level >= CRCHackLevel::Aggressive)
#define Dx_only (s_crc_hack_level >= CRCHackLevel::Full) #define Dx_only (s_crc_hack_level >= CRCHackLevel::Full)
#define Dx_and_OGL (s_crc_hack_level >= CRCHackLevel::Partial)
CRC::Region g_crc_region = CRC::NoRegion; CRC::Region g_crc_region = CRC::NoRegion;
@ -2419,11 +2420,11 @@ void GSState::SetupCrcHack()
{ {
GetSkipCount lut[CRC::TitleCount]; GetSkipCount lut[CRC::TitleCount];
s_crc_hack_level = static_cast<CRCHackLevel>(theApp.GetConfigI("crc_hack_level")); s_crc_hack_level = m_crc_hack_level;
memset(lut, 0, sizeof(lut)); memset(lut, 0, sizeof(lut));
if (s_crc_hack_level > CRCHackLevel::Minimum) { if (Dx_and_OGL) {
lut[CRC::AceCombat4] = GSC_AceCombat4; lut[CRC::AceCombat4] = GSC_AceCombat4;
lut[CRC::BlackHawkDown] = GSC_BlackHawkDown; lut[CRC::BlackHawkDown] = GSC_BlackHawkDown;
lut[CRC::BleachBladeBattlers] = GSC_BleachBladeBattlers; lut[CRC::BleachBladeBattlers] = GSC_BleachBladeBattlers;

View File

@ -46,10 +46,14 @@ const char* dialog_message(int ID, bool* updateText) {
#endif #endif
case IDC_CRC_LEVEL: case IDC_CRC_LEVEL:
return "Control the number of Auto-CRC hacks applied to games.\n\n" return "Control the number of Auto-CRC hacks applied to games.\n\n"
"Automatic:\nAutomatically sets the recommended CRC hack level based on the selected renderer.\n"
"This is the recommended setting.\n"
"Partial will be selected for OpenGL.\nFull will be selected for Direct3D.\n\n"
"None:\nRemove nearly all CRC hacks (debug only).\n\n" "None:\nRemove nearly all CRC hacks (debug only).\n\n"
"Minimum:\nEnable a couple of CRC hacks (23).\n\n" "Minimum:\nEnable a couple of CRC hacks (23).\n\n"
"Partial:\nEnable most of the CRC hacks.\nRecommended OpenGL setting (Accurate/depth options may be required).\n\n" "Partial:\nEnable most of the CRC hacks.\n"
"Full:\nEnable all CRC hacks.\nRecommended Direct3D setting.\n\n" "For an optimal experience with OpenGL, Blending Unit Accuracy/Depth Emulation may need to be enabled.\n\n"
"Full:\nEnable all CRC hacks.\n\n"
"Aggressive:\nUse more aggressive CRC hacks. Only affects a few games, removing some effects which might make the image sharper/clearer.\n" "Aggressive:\nUse more aggressive CRC hacks. Only affects a few games, removing some effects which might make the image sharper/clearer.\n"
"Affected games: FFX, FFX2, FFXII, GOW2, ICO, SoTC, SSX3, SMT3, SMTDDS1, SMTDDS2.\n" "Affected games: FFX, FFX2, FFXII, GOW2, ICO, SoTC, SSX3, SMT3, SMTDDS1, SMTDDS2.\n"
"Works as a speedhack for: Steambot Chronicles."; "Works as a speedhack for: Steambot Chronicles.";

View File

@ -334,19 +334,9 @@ void GSSettingsDlg::UpdateRenderers()
} }
else else
{ {
GSRendererType ini_renderer = GSRendererType(theApp.GetConfigI("Renderer")); renderer_setting = GSRendererType(theApp.GetConfigI("Renderer"));
if (renderer_setting == GSRendererType::Undefined)
if (ini_renderer == GSRendererType::Undefined)
{
renderer_setting = GSUtil::GetBestRenderer(); renderer_setting = GSUtil::GetBestRenderer();
if(renderer_setting == GSRendererType::OGL_HW)
theApp.SetConfig("crc_hack_level", static_cast<int>(CRCHackLevel::Partial));
}
else
{
renderer_setting = ini_renderer;
}
} }
GSRendererType renderer_sel = GSRendererType::Default; GSRendererType renderer_sel = GSRendererType::Default;

View File

@ -22,7 +22,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "GSState.h" #include "GSState.h"
#include "GSdx.h" #include "GSdx.h"
#include "GSUtil.h"
//#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering //#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering
@ -78,7 +78,9 @@ GSState::GSState()
//s_savel = 0; //s_savel = 0;
UserHacks_WildHack = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_WildHack") : 0; UserHacks_WildHack = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_WildHack") : 0;
m_crc_hack_level = static_cast<CRCHackLevel>(theApp.GetConfigI("crc_hack_level")); m_crc_hack_level = theApp.GetConfigT<CRCHackLevel>("crc_hack_level");
if (m_crc_hack_level == CRCHackLevel::Automatic)
m_crc_hack_level = GSUtil::GetRecommendedCRCHackLevel(theApp.GetCurrentRendererType());
memset(&m_v, 0, sizeof(m_v)); memset(&m_v, 0, sizeof(m_v));
memset(&m_vertex, 0, sizeof(m_vertex)); memset(&m_vertex, 0, sizeof(m_vertex));

View File

@ -21,6 +21,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "GSTextureCache.h" #include "GSTextureCache.h"
#include "GSUtil.h"
bool s_IS_OPENGL = false; bool s_IS_OPENGL = false;
bool GSTextureCache::m_disable_partial_invalidation = false; bool GSTextureCache::m_disable_partial_invalidation = false;
@ -51,7 +52,9 @@ GSTextureCache::GSTextureCache(GSRenderer* r)
m_paltex = theApp.GetConfigB("paltex"); m_paltex = theApp.GetConfigB("paltex");
m_can_convert_depth &= s_IS_OPENGL; // only supported by openGL so far m_can_convert_depth &= s_IS_OPENGL; // only supported by openGL so far
m_crc_hack_level = static_cast<CRCHackLevel>(theApp.GetConfigI("crc_hack_level")); m_crc_hack_level = theApp.GetConfigT<CRCHackLevel>("crc_hack_level");
if (m_crc_hack_level == CRCHackLevel::Automatic)
m_crc_hack_level = GSUtil::GetRecommendedCRCHackLevel(theApp.GetCurrentRendererType());
// In theory 4MB is enough but 9MB is safer for overflow (8MB // In theory 4MB is enough but 9MB is safer for overflow (8MB
// isn't enough in custom resolution) // isn't enough in custom resolution)

View File

@ -241,6 +241,11 @@ bool GSUtil::CheckSSE()
return status; return status;
} }
CRCHackLevel GSUtil::GetRecommendedCRCHackLevel(GSRendererType type)
{
return type == GSRendererType::OGL_HW ? CRCHackLevel::Partial : CRCHackLevel::Full;
}
#define OCL_PROGRAM_VERSION 3 #define OCL_PROGRAM_VERSION 3
#ifdef ENABLE_OPENCL #ifdef ENABLE_OPENCL

View File

@ -50,6 +50,7 @@ public:
static bool HasCompatibleBits(uint32 spsm, uint32 dpsm); static bool HasCompatibleBits(uint32 spsm, uint32 dpsm);
static bool CheckSSE(); static bool CheckSSE();
static CRCHackLevel GetRecommendedCRCHackLevel(GSRendererType type);
#ifdef ENABLE_OPENCL #ifdef ENABLE_OPENCL
static void GetDeviceDescs(list<OCLDeviceDesc>& dl); static void GetDeviceDescs(list<OCLDeviceDesc>& dl);

View File

@ -229,11 +229,14 @@ void GSdxApp::Init()
m_gs_hw_mipmapping.push_back(GSSetting(1, "Basic", "Fast")); m_gs_hw_mipmapping.push_back(GSSetting(1, "Basic", "Fast"));
m_gs_hw_mipmapping.push_back(GSSetting(2, "Full", "Slow")); m_gs_hw_mipmapping.push_back(GSSetting(2, "Full", "Slow"));
m_gs_crc_level.push_back(GSSetting(0 , "None", "Debug")); m_gs_crc_level = {
m_gs_crc_level.push_back(GSSetting(1 , "Minimum", "Debug")); GSSetting(CRCHackLevel::Automatic, "Automatic", "Default"),
m_gs_crc_level.push_back(GSSetting(2 , "Partial", "OpenGL Recommended")); GSSetting(CRCHackLevel::None , "None", "Debug"),
m_gs_crc_level.push_back(GSSetting(3 , "Full", "Direct3D Recommended")); GSSetting(CRCHackLevel::Minimum, "Minimum", "Debug"),
m_gs_crc_level.push_back(GSSetting(4 , "Aggressive", "")); GSSetting(CRCHackLevel::Partial, "Partial", "OpenGL Recommended"),
GSSetting(CRCHackLevel::Full, "Full", "Direct3D Recommended"),
GSSetting(CRCHackLevel::Aggressive, "Aggressive", ""),
};
m_gs_acc_blend_level.push_back(GSSetting(0, "None", "Fastest")); m_gs_acc_blend_level.push_back(GSSetting(0, "None", "Fastest"));
m_gs_acc_blend_level.push_back(GSSetting(1, "Basic", "Recommended low-end PC")); m_gs_acc_blend_level.push_back(GSSetting(1, "Basic", "Recommended low-end PC"));
@ -303,7 +306,7 @@ void GSdxApp::Init()
m_default_configuration["CaptureHeight"] = "480"; m_default_configuration["CaptureHeight"] = "480";
m_default_configuration["CaptureWidth"] = "640"; m_default_configuration["CaptureWidth"] = "640";
m_default_configuration["clut_load_before_draw"] = "0"; m_default_configuration["clut_load_before_draw"] = "0";
m_default_configuration["crc_hack_level"] = to_string(static_cast<int8>(CRCHackLevel::Full)); m_default_configuration["crc_hack_level"] = std::to_string(static_cast<int8>(CRCHackLevel::Automatic));
m_default_configuration["CrcHacksExclusions"] = ""; m_default_configuration["CrcHacksExclusions"] = "";
m_default_configuration["debug_glsl_shader"] = "0"; m_default_configuration["debug_glsl_shader"] = "0";
m_default_configuration["debug_opengl"] = "0"; m_default_configuration["debug_opengl"] = "0";