From 4c57d1bbbe1c8fd9cd3ef6191f5c9ca1c1cfdae9 Mon Sep 17 00:00:00 2001 From: avihal Date: Tue, 30 Aug 2011 12:48:54 +0000 Subject: [PATCH] GSdx: CRC hacks: allow exclusion of some/all hacks via "hidden" ini pref CrcHacksExclusions. The list is case insensitive and order insensitive. E.g. Disable all CRC hacks: CrcHacksExclusions=all E.g. Disable hacks for these CRCs: CrcHacksExclusions=0x0F0C4A9C, 0x0EE5646B, 0x7ACF7E03 git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4894 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSCrc.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/GSdx/GSCrc.cpp b/plugins/GSdx/GSCrc.cpp index 633cce0924..5130c166f0 100644 --- a/plugins/GSdx/GSCrc.cpp +++ b/plugins/GSdx/GSCrc.cpp @@ -20,6 +20,7 @@ */ #include "stdafx.h" +#include "GSdx.h" #include "GSCrc.h" CRC::Game CRC::m_games[] = @@ -320,13 +321,36 @@ CRC::Game CRC::m_games[] = hash_map CRC::m_map; +string ToLower( string str ) +{ + transform( str.begin(), str.end(), str.begin(), ::tolower); + return str; +} + +// The exclusions list is a comma separated list of: the word "all" and/or CRCs in standard hex notation (0x and 8 digits with leading 0's if required). +// The list is case insensitive and order insensitive. +// E.g. Disable all CRC hacks: CrcHacksExclusions=all +// E.g. Disable hacks for these CRCs: CrcHacksExclusions=0x0F0C4A9C, 0x0EE5646B, 0x7ACF7E03 +bool IsCrcExcluded(string exclusionList, uint32 crc) +{ + string target = format( "0x%08x", crc ); + exclusionList = ToLower( exclusionList ); + return ( exclusionList.find( target ) != string::npos || exclusionList.find( "all" ) != string::npos ); +} + CRC::Game CRC::Lookup(uint32 crc) { if(m_map.empty()) { + string exclusions = theApp.GetConfig( "CrcHacksExclusions", "" ); + printf( "GSdx: CrcHacksExclusions: %s\n", exclusions.c_str() ); + for(int i = 0; i < countof(m_games); i++) { - m_map[m_games[i].crc] = &m_games[i]; + if( !IsCrcExcluded( exclusions, m_games[i].crc ) ) + m_map[m_games[i].crc] = &m_games[i]; + //else + // printf( "GSdx: excluding CRC hack for 0x%08x\n", m_games[i].crc ); } } #ifndef NO_CRC_HACKS