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 committed 2015-06-14 10:27:02 +02:00
1 parent c6220bf836
commit 1be8d07f85
9 files changed
+64 -31

No files matched your search

+21 -18
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