gsdx: auto CRC management

Old way various check boxes to configure the plugin

New way an unified drop down list

* Level 0 (dev only) => disable (mostly) all hacks and auto skip depth.
* Level 1 (dev only ) => enable oi/oo/cu hacks, others remains disabled
* Level 2 (GL) => enable most hacks except a couple of one that were fixed on openGL (speed impact)
* Level 3 (DX) => enable all hacks
* Level 4 => enable also aggresive CRC

Note: windows gui must be updated, and it will be nice to create a global tooltip
This commit is contained in:
Gregory Hainaut 2015-06-04 18:52:58 +02:00
parent c6220bf836
commit 1be8d07f85
9 changed files with 64 additions and 31 deletions

View File

@ -288,6 +288,9 @@ void populate_hw_table(GtkWidget* hw_table)
GtkWidget* af_label = gtk_label_new("Anisotropic Filtering:");
GtkWidget* af_combo_box = CreateComboBoxFromVector(theApp.m_gs_max_anisotropy, "MaxAnisotropy", 1);
GtkWidget* crc_label = gtk_label_new("Automatic CRC level:");
GtkWidget* crc_combo_box = CreateComboBoxFromVector(theApp.m_gs_crc_level, "crc_hack_level", 3);
GtkWidget* paltex_check = CreateCheckBox("Allow 8 bits textures", "paltex");
GtkWidget* acc_blend_check = CreateCheckBox("Accurate Blend", "accurate_blend", true);
GtkWidget* acc_date_check = CreateCheckBox("Accurate Date", "accurate_date", false);
@ -301,13 +304,16 @@ void populate_hw_table(GtkWidget* hw_table)
gtk_widget_set_tooltip_text(acc_date_check, dialog_message(IDC_ACCURATE_DATE));
gtk_widget_set_tooltip_text(acc_cclip_check, dialog_message(IDC_ACCURATE_COLCLIP));
gtk_widget_set_tooltip_text(MT_nvidia_check, "Huge speedup on Nvidia binary driver! No effect otherwise.");
gtk_widget_set_tooltip_text(crc_label, dialog_message(IDC_CRC_LEVEL));
gtk_widget_set_tooltip_text(crc_combo_box, dialog_message(IDC_CRC_LEVEL));
s_table_line = 0;
InsertWidgetInTable(hw_table, filter_label, filter_combo_box);
InsertWidgetInTable(hw_table, af_label, af_combo_box);
InsertWidgetInTable(hw_table, paltex_check, MT_nvidia_check);
InsertWidgetInTable(hw_table, acc_blend_check, acc_date_check);
InsertWidgetInTable(hw_table, acc_cclip_check);
InsertWidgetInTable(hw_table, filter_label, filter_combo_box);
InsertWidgetInTable(hw_table, af_label, af_combo_box);
InsertWidgetInTable(hw_table, crc_label, crc_combo_box);
}
void populate_gl_table(GtkWidget* gl_table)

View File

@ -98,7 +98,7 @@ void GSRendererHW::SetGameCRC(uint32 crc, int options)
bool GSRendererHW::CanUpscale()
{
if(m_hacks.m_cu && !(this->*m_hacks.m_cu)())
if(m_crc_hack_level && m_hacks.m_cu && !(this->*m_hacks.m_cu)())
{
return false;
}
@ -447,7 +447,7 @@ void GSRendererHW::Draw()
#endif
}
if(m_hacks.m_oi && !(this->*m_hacks.m_oi)(rt->m_texture, ds->m_texture, tex))
if(m_crc_hack_level && m_hacks.m_oi && !(this->*m_hacks.m_oi)(rt->m_texture, ds->m_texture, tex))
{
s_n += 1; // keep counter sync
GL_POP();
@ -542,7 +542,7 @@ void GSRendererHW::Draw()
//
if(m_hacks.m_oo)
if(m_crc_hack_level && m_hacks.m_oo)
{
(this->*m_hacks.m_oo)();
}
@ -640,6 +640,8 @@ void GSRendererHW::Hacks::SetGameCRC(const CRC::Game& game)
}
}
// OI (others input?/implementation?) hacks replace current draw call
bool GSRendererHW::OI_FFXII(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t)
{
static uint32* video = NULL;
@ -1125,6 +1127,8 @@ bool GSRendererHW::OI_PointListPalette(GSTexture* rt, GSTexture* ds, GSTextureCa
return true;
}
// OO (others output?) hacks: invalidate extra local memory after the draw call
void GSRendererHW::OO_DBZBT2()
{
// palette readback (cannot detect yet, when fetching the texture later)
@ -1162,6 +1166,8 @@ void GSRendererHW::OO_MajokkoALaMode2()
}
}
// Can Upscale hacks: disable upscaling for some draw calls
bool GSRendererHW::CU_DBZBT2()
{
// palette should stay 64 x 64

View File

@ -30,6 +30,21 @@ const char* dialog_message(int ID, bool* updateText) {
*updateText = true;
switch (ID)
{
#ifdef __linux__
case IDC_CRC_LEVEL:
return "Control the number of Auto-CRC hacks applyed to the game.\n\n"
"None : Remove nearly all CRC hacks (debug only).\n\n"
"Minimum : Enable a couple of CRC hacks (23).\n\n"
"Partial : Enable most of the CRC hacks. It is the recommended setting for OpenGL users."
"Note, it might require accurate options.\n\n"
"Full : Enable all CRC hacks. It is recommended setting for Dx users.\n\n"
"Aggressive : Use more aggressive CRC hacks on some games.\n"
" Only affects 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"
" Works as a speedhack for: Steambot Chronicles.";
#endif
case IDC_SKIPDRAWHACK:
case IDC_SKIPDRAWHACKEDIT:
case IDC_STATIC_SKIPDRAW:

View File

@ -66,6 +66,7 @@ enum {
IDC_PALTEX,
IDC_ACCURATE_BLEND,
IDC_ACCURATE_DATE,
IDC_ACCURATE_COLCLIP
IDC_ACCURATE_COLCLIP,
IDC_CRC_LEVEL
};
#endif

View File

@ -607,9 +607,7 @@ void GSHacksDlg::OnInit()
CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 0));
CheckDlgButton(m_hWnd, IDC_SPRITEHACK, theApp.GetConfig("UserHacks_SpriteHack", 0));
CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfig("UserHacks_WildHack", 0));
CheckDlgButton(m_hWnd, IDC_AGGRESSIVECRC, theApp.GetConfig("UserHacks_AggressiveCRC", 0));
CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfig("UserHacks_AlphaStencil", 0));
CheckDlgButton(m_hWnd, IDC_CHECK_DISABLE_ALL_HACKS, theApp.GetConfig("UserHacks_DisableCrcHacks", 0));
CheckDlgButton(m_hWnd, IDC_ROUND_SPRITE, theApp.GetConfig("UserHacks_round_sprite_offset", 0));
CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfig("UserHacks_align_sprite_X", 0));
CheckDlgButton(m_hWnd, IDC_AUTO_SKIP, theApp.GetConfig("UserHacks_AutoSkipDrawDepth", 0));
@ -670,9 +668,7 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
theApp.SetConfig("UserHacks_SpriteHack", (int)IsDlgButtonChecked(m_hWnd, IDC_SPRITEHACK));
theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0));
theApp.SetConfig("UserHacks_WildHack", (int)IsDlgButtonChecked(m_hWnd, IDC_WILDHACK));
theApp.SetConfig("UserHacks_AggressiveCRC", (int)IsDlgButtonChecked(m_hWnd, IDC_AGGRESSIVECRC));
theApp.SetConfig("UserHacks_AlphaStencil", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHASTENCIL));
theApp.SetConfig("UserHacks_DisableCrcHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_CHECK_DISABLE_ALL_HACKS));
theApp.SetConfig("UserHacks_round_sprite_offset", (int)IsDlgButtonChecked(m_hWnd, IDC_ROUND_SPRITE));
theApp.SetConfig("Userhacks_align_sprite_X", (int)IsDlgButtonChecked(m_hWnd, IDC_ALIGN_SPRITE));
theApp.SetConfig("UserHacks_AutoSkipDrawDepth",(int)IsDlgButtonChecked(m_hWnd, IDC_AUTO_SKIP));

View File

@ -29,6 +29,8 @@
//#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering
static int s_crc_hack_level = 3;
GSState::GSState()
: m_version(6)
, m_mt(false)
@ -64,10 +66,10 @@ GSState::GSState()
//s_save = 1;
//s_savez = 1;
UserHacks_AggressiveCRC = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_AggressiveCRC", 0) : 0;
UserHacks_DisableCrcHacks = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig( "UserHacks_DisableCrcHacks", 0 ) : 0;
UserHacks_WildHack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_WildHack", 0) : 0;
UserHacks_AutoSkipDrawDepth = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_AutoSkipDrawDepth", 1) : false;
m_crc_hack_level = theApp.GetConfig("crc_hack_level", 3);
s_crc_hack_level = m_crc_hack_level;
memset(&m_v, 0, sizeof(m_v));
memset(&m_vertex, 0, sizeof(m_vertex));
@ -2304,7 +2306,7 @@ void GSState::SetGameCRC(uint32 crc, int options)
{
m_crc = crc;
m_options = options;
m_game = CRC::Lookup(UserHacks_DisableCrcHacks ? 0 : crc);
m_game = CRC::Lookup(m_crc_hack_level < 2 ? 0 : crc);
}
//
@ -2999,6 +3001,7 @@ bool GSState::GSTransferBuffer::Update(int tw, int th, int bpp, int& len)
}
// hacks
#define Aggresive (s_crc_hack_level > 3)
struct GSFrameInfo
{
@ -3013,7 +3016,6 @@ struct GSFrameInfo
typedef bool (*GetSkipCount)(const GSFrameInfo& fi, int& skip);
CRC::Region g_crc_region = CRC::NoRegion;
int g_aggressive = 0;
bool GSC_Okami(const GSFrameInfo& fi, int& skip)
{
@ -3182,12 +3184,13 @@ bool GSC_BullyCC(const GSFrameInfo& fi, int& skip)
return true;
}
bool GSC_SoTC(const GSFrameInfo& fi, int& skip)
{
// Not needed anymore? What did it fix anyway? (rama)
if(skip == 0)
{
if(g_aggressive && fi.TME /*&& fi.FBP == 0x03d80*/ && fi.FPSM == 0 && fi.TBP0 == 0x03fc0 && fi.TPSM == 1)
if(Aggresive && fi.TME /*&& fi.FBP == 0x03d80*/ && fi.FPSM == 0 && fi.TBP0 == 0x03fc0 && fi.TPSM == 1)
{
skip = 48; //removes sky bloom
}
@ -3251,7 +3254,7 @@ bool GSC_ICO(const GSFrameInfo& fi, int& skip)
{
skip = 1;
}
else if( g_aggressive && fi.TME && fi.FBP == 0x0800 && (fi.TBP0 == 0x2800 || fi.TBP0 ==0x2c00) && fi.TPSM ==0 && fi.FBMSK == 0)
else if( Aggresive && fi.TME && fi.FBP == 0x0800 && (fi.TBP0 == 0x2800 || fi.TBP0 ==0x2c00) && fi.TPSM ==0 && fi.FBMSK == 0)
{
skip = 1;
}
@ -3437,7 +3440,7 @@ bool GSC_SMTNocturneDDS(const GSFrameInfo& fi, int& skip)
// -0x5900($gp), ref at 0x100740
const int state = *(int*)(state_addr);
if(g_aggressive && g_crc_region == CRC::US && skip == 0 && fi.TBP0 == 0xE00 && fi.TME && (state == 23 || state == 24 || state == 25))
if(Aggresive && g_crc_region == CRC::US && skip == 0 && fi.TBP0 == 0xE00 && fi.TME && (state == 23 || state == 24 || state == 25))
{
skip = 1;
}
@ -3610,11 +3613,11 @@ bool GSC_GodOfWar2(const GSFrameInfo& fi, int& skip)
{
skip = 1; // wall of fog
}
else if(g_aggressive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x1300 ) && (fi.TBP0 ==0x0F00 || fi.TBP0 ==0x1300 || fi.TBP0==0x2b00)) // || fi.FBP == 0x0100
else if(Aggresive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x1300 ) && (fi.TBP0 ==0x0F00 || fi.TBP0 ==0x1300 || fi.TBP0==0x2b00)) // || fi.FBP == 0x0100
{
skip = 1; // global haze/halo
}
else if(g_aggressive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x0100 ) && (fi.TBP0==0x2b00 || fi.TBP0==0x2e80)) //480P 2e80
else if(Aggresive && fi.TPSM == PSM_PSMCT24 && fi.TME && (fi.FBP ==0x0100 ) && (fi.TBP0==0x2b00 || fi.TBP0==0x2e80)) //480P 2e80
{
skip = 1; // water effect and water vertical lines
}
@ -3976,7 +3979,6 @@ bool GSC_Naruto(const GSFrameInfo& fi, int& skip)
return true;
}
bool GSC_EternalPoison(const GSFrameInfo& fi, int& skip)
{
if(skip == 0)
@ -3991,7 +3993,7 @@ bool GSC_EternalPoison(const GSFrameInfo& fi, int& skip)
bool GSC_LegoBatman(const GSFrameInfo& fi, int& skip)
{
if(g_aggressive && skip == 0)
if(Aggresive && skip == 0)
{
if(fi.TME && fi.TPSM == PSM_PSMZ16 && fi.FPSM == PSM_PSMCT16 && fi.FBMSK == 0x00000)
{
@ -4113,7 +4115,7 @@ bool GSC_ShadowofRome(const GSFrameInfo& fi, int& skip)
bool GSC_FFXII(const GSFrameInfo& fi, int& skip)
{
if(g_aggressive && skip == 0)
if(Aggresive && skip == 0)
{
if(fi.TME)
{
@ -4131,7 +4133,7 @@ bool GSC_FFXII(const GSFrameInfo& fi, int& skip)
bool GSC_FFX2(const GSFrameInfo& fi, int& skip)
{
if(g_aggressive && skip == 0)
if(Aggresive && skip == 0)
{
if(fi.TME)
{
@ -4149,7 +4151,7 @@ bool GSC_FFX2(const GSFrameInfo& fi, int& skip)
bool GSC_FFX(const GSFrameInfo& fi, int& skip)
{
if(g_aggressive && skip == 0)
if(Aggresive && skip == 0)
{
if(fi.TME)
{
@ -4464,7 +4466,7 @@ bool GSC_TombRaiderUnderWorld(const GSFrameInfo& fi, int& skip)
bool GSC_SSX3(const GSFrameInfo& fi, int& skip)
{
if(g_aggressive && skip == 0)
if(Aggresive && skip == 0)
{
if(fi.TME)
{
@ -4520,7 +4522,6 @@ bool GSC_DevilMayCry3(const GSFrameInfo& fi, int& skip)
return true;
}
bool GSC_StarWarsForceUnleashed(const GSFrameInfo& fi, int& skip)
{
if(skip == 0)
@ -5222,6 +5223,7 @@ bool GSC_Simple2000Vol114(const GSFrameInfo& fi, int& skip)
}
return true;
}
bool GSC_UrbanReign(const GSFrameInfo& fi, int& skip)
{
if(skip == 0)
@ -5249,7 +5251,7 @@ bool GSC_SteambotChronicles(const GSFrameInfo& fi, int& skip)
{
skip=100;//deletes most others(too high deletes the buggy sea completely;c, too low causes glitches to be visible)
}
else if(g_aggressive && fi.FBP != 0)//Agressive CRC
else if(Aggresive && fi.FBP != 0)//Agressive CRC
{
skip=19;//"speedhack", makes the game very light, vaporized water can disappear when not looked at directly, possibly some interface still, other value to try: 6 breaks menu background, possibly nothing(?) during gameplay, but it's slower, hence not much of a speedhack anymore
}
@ -5258,6 +5260,8 @@ bool GSC_SteambotChronicles(const GSFrameInfo& fi, int& skip)
return true;
}
#undef Agressive
#ifdef ENABLE_DYNAMIC_CRC_HACK
#include <sys/stat.h>
@ -5540,7 +5544,6 @@ bool GSState::IsBadFrame(int& skip, int UserHacks_SkipDraw)
GetSkipCount gsc = map[m_game.title];
g_crc_region = m_game.region;
g_aggressive = UserHacks_AggressiveCRC;
#ifdef ENABLE_DYNAMIC_CRC_HACK
bool res=false; if(IsInvokedDynamicCrcHack(fi, skip, g_crc_region, res, m_crc)){ if( !res ) return false; } else

View File

@ -142,11 +142,10 @@ class GSState : public GSAlignedClass<32>
protected:
bool IsBadFrame(int& skip, int UserHacks_SkipDraw);
int UserHacks_AggressiveCRC;
int UserHacks_DisableCrcHacks;
int UserHacks_WildHack;
bool UserHacks_AutoSkipDrawDepth;
bool isPackedUV_HackFlag;
bool isPackedUV_HackFlag;
int m_crc_hack_level;
GSVertex m_v;
float m_q;

View File

@ -180,6 +180,12 @@ GSdxApp::GSdxApp()
m_gs_hack.push_back(GSSetting(1, "Halfly On", ""));
m_gs_hack.push_back(GSSetting(2, "Fully On", ""));
m_gs_crc_level.push_back(GSSetting(0 , "None", "Debug"));
m_gs_crc_level.push_back(GSSetting(1 , "Minimum", "Debug"));
m_gs_crc_level.push_back(GSSetting(2 , "Partial", "openGL recommended"));
m_gs_crc_level.push_back(GSSetting(3 , "Full", "Safest"));
m_gs_crc_level.push_back(GSSetting(4 , "Aggressive", ""));
m_gpu_renderers.push_back(GSSetting(0, "Direct3D9 (Software)", ""));
m_gpu_renderers.push_back(GSSetting(1, "Direct3D11 (Software)", ""));
m_gpu_renderers.push_back(GSSetting(2, "SDL 1.3 (Software)", ""));

View File

@ -66,6 +66,7 @@ public:
vector<GSSetting> m_gs_filter;
vector<GSSetting> m_gs_gl_ext;
vector<GSSetting> m_gs_hack;
vector<GSSetting> m_gs_crc_level;
vector<GSSetting> m_gpu_renderers;
vector<GSSetting> m_gpu_filter;