zzogl-pg: Revamp the crc code to pull from a table, and add a few crc codes. Based off of code from GSdx.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2902 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-04-25 11:14:37 +00:00
parent 07a16bc76d
commit 2daee33eae
5 changed files with 191 additions and 62 deletions

View File

@ -330,9 +330,12 @@ void CALLBACK GSsetSettingsDir(const char* dir) {
extern int VALIDATE_THRESH;
extern u32 TEXDESTROY_THRESH;
int g_LastCRC = 0;
void CALLBACK GSsetGameCRC(int crc, int options)
{
// TEXDESTROY_THRESH starts out at 16.
VALIDATE_THRESH = 8;
conf.mrtdepth = ((conf.gamesettings & GAME_DISABLEMRTDEPTH) != 0);
@ -343,63 +346,24 @@ void CALLBACK GSsetGameCRC(int crc, int options)
g_GameSettings |= GAME_PATH3HACK;
bool RunningFirstTime = (g_LastCRC == crc);
bool CRCValueChanged = (g_LastCRC != crc);
g_LastCRC = crc;
if (RunningFirstTime) {
switch(crc) {
case 0x54A548B4: // crash n burn
// overbright
break;
ZZLog::Error_Log("CRC = %x", crc);
if (CRCValueChanged && (crc != 0))
{
for (int i = 0; i < GAME_INFO_INDEX; i++)
{
if (crc_game_list[i].crc == crc)
{
if (crc_game_list[i].v_thresh > 0) VALIDATE_THRESH = crc_game_list[i].v_thresh;
if (crc_game_list[i].t_thresh > 0) TEXDESTROY_THRESH = crc_game_list[i].t_thresh;
case 0xA3D63039: // xenosaga(j)
case 0x0E7807B2: // xenosaga(u)
g_GameSettings |= GAME_DOPARALLELCTX;
VALIDATE_THRESH = 64;
TEXDESTROY_THRESH = 32;
break;
case 0x7D2FE035: // espgaluda (j)
VALIDATE_THRESH = 24;
//g_GameSettings |= GAME_BIGVALIDATE;
break;
case 0x21068223: //Okami, US,
case 0x891f223f: //Okami, FR
case 0xC5DEFEA0: //Okami, JP,
case 0xe0426fc6: //Okage Shadow King
conf.gamesettings |= 0x01000000; // Specular highlight;
break;
case 0xD6385328: // GodOfWar
case 0xFB0E6D72: // GodOfWar, EU,
case 0xEB001875: // GodOfWar, EU,
case 0xA61A4C6D: // GodOfWar,
case 0xE23D532B: // GodOfWar,
conf.gamesettings |= 0x00010000; // full 16 bit
break;
case 0xF0A6D880: // HarvestMoon, US
conf.gamesettings |= 0x00002000; // Disable stencil buffer
break;
case 0xFB236A46: // SonicUnleashed, US
case 0xa5d29941: // Shadow the Hedgehog
conf.gamesettings |= 0x00040100; // Fast update + no Alpha fail
case 0x7acf7e03: // Atelier Iris 1
case 0x9AC65D6A: // Atelier Iris 2, US
case 0x4ccc9212: // Atelier Iris 3
case 0xF95F37EE: // Ar Tonelico 2, US
case 0x77b0236f: // Mana Khemia
case 0x433951e7: // Mana Khemia 2
conf.gamesettings |= 0x10000000; // GustFix
case 0xbaa8dd8: // Dark Cloud 1
conf.gamesettings |= 0x00000010; // No Target Resolves
case 0x95cc86ef: // Ghost in the Shell
conf.gamesettings |= 0x00000100; // no Alpha fail
conf.gamesettings |= crc_game_list[i].flags;
g_GameSettings = conf.gamesettings | options;
ZZLog::Error_Log("Found CRC[%x] in crc game list.", crc);
return;
}
}
}

View File

@ -223,6 +223,10 @@ static bool SPAM_PASS;
#define ZEROGS_DEVBUILD
#endif
#ifdef ZEROGS_DEVBUILD
//#define DEVBUILD
#endif
extern void __LogToConsole(const char *fmt, ...);
namespace ZZLog

View File

@ -187,8 +187,8 @@ ZeroGS::VB::CheckFrame32bitRes(int maxpos)
}
// This is the main code of frame resising.
// It's check several reasons for resize and resize if it needs.
// This is the main code for frame resizing.
// It checks for several reasons to resize and resizes if it needs to.
// 4Mb memory in 64 bit (4 bytes) words.
// |------------------------|---------------------|----------|----------|---------------------|
// 0 gsfb.fbp zbuff.zpb tbp frame.fbp 2^20/64
@ -213,8 +213,11 @@ ZeroGS::VB::CheckFrameAddConstraints(int tbp)
if( maxpos > 256 )
maxpos &= ~0x1f;
//int noscissorpos = maxpos;
//int ConstrainR1 = ConstraintReson;
#ifdef DEVBUILD
int noscissorpos = maxpos;
int ConstrainR1 = ConstraintReson;
#endif
maxpos = FindMinimalHeightConstrain(maxpos);
frame = gsfb;

View File

@ -49,7 +49,7 @@ extern u32 s_uFramebuffer;
#endif
#ifdef DEVBUILD
static int g_bSaveResolved = 0;
//static int g_bSaveResolved = 0;
#endif
extern int s_nResolved;

View File

@ -467,6 +467,164 @@ enum GAME_HACK_OPTIONS
#define USEALPHATESTING (!(g_GameSettings&GAME_NOALPHATEST))
// CRC Information
enum Title_Info
{
Unknown_Title,
MetalSlug6,
TomoyoAfter,
Clannad,
Lamune,
KyuuketsuKitanMoonties,
PiaCarroteYoukosoGPGakuenPrincess,
KazokuKeikakuKokoroNoKizuna,
DuelSaviorDestiny,
FFX,
FFX2,
FFXII,
ShadowHearts,
Okami,
MetalGearSolid3,
DBZBT2,
DBZBT3,
SFEX3,
Bully,
BullyCC,
SoTC,
OnePieceGrandAdventure,
OnePieceGrandBattle,
ICO,
GT4,
WildArms5,
Manhunt2,
CrashBandicootWoC,
ResidentEvil4,
Spartan,
AceCombat4,
Drakengard2,
Tekken5,
IkkiTousen,
GodOfWar,
GodOfWar2,
JackieChanAdv,
HarvestMoon,
NamcoXCapcom,
GiTS,
Onimusha3,
MajokkoALaMode2,
TalesOfAbyss,
SonicUnleashed,
SimpsonsGame,
Genji,
StarOcean3,
ValkyrieProfile2,
RadiataStories,
SMTNocturne,
SMTDDS1,
SMTDDS2,
RozenMaidenGebetGarden,
Xenosaga,
Espgaluda,
OkageShadowKing,
ShadowTheHedgehog,
AtelierIris1,
AtelierIris2,
AtelierIris3,
ArTonelico1,
ArTonelico2,
ManaKhemia1,
ManaKhemia2,
DarkCloud1,
DarkCloud2,
GhostInTheShell,
TitleCount,
};
enum Region_Info
{
Unknown_Region,
US,
EU,
JP,
JPUNDUB,
RU,
FR,
DE,
IT,
ES,
ASIA,
RegionCount,
};
struct Game_Info
{
u32 crc;
Title_Info title;
Region_Info region;
u32 flags;
s32 v_thresh, t_thresh;
};
// Note; all the options surrounded by /**/ are ones that were getting chosen previously because of missing break statements, and might not be appropriate.
// I'll have to check and see if they work better with or without them.
static const Game_Info crc_game_list[] =
{
{0xA3D63039, Xenosaga, JP, GAME_DOPARALLELCTX, 64, 32},
{0x0E7807B2, Xenosaga, US, GAME_DOPARALLELCTX, 64, 32},
{0x7D2FE035, Espgaluda, JP, 0/*GAME_BIGVALIDATE*/, 24, -1},
{0x21068223, Okami, US, GAME_XENOSPECHACK, -1, -1},
{0x891f223f, Okami, FR, GAME_XENOSPECHACK, -1, -1},
{0xC5DEFEA0, Okami, JP, GAME_XENOSPECHACK, -1, -1},
{0xe0426fc6, OkageShadowKing, Unknown_Region, GAME_XENOSPECHACK, -1, -1},
{0xD6385328, GodOfWar, US, GAME_FULL16BITRES, -1, -1},
{0xFB0E6D72, GodOfWar, EU, GAME_FULL16BITRES, -1, -1},
{0xEB001875, GodOfWar, EU, GAME_FULL16BITRES, -1, -1},
{0xA61A4C6D, GodOfWar, Unknown_Region, GAME_FULL16BITRES, -1, -1},
{0xE23D532B, GodOfWar, Unknown_Region, GAME_FULL16BITRES, -1, -1},
{0xDF1AF973, GodOfWar, Unknown_Region, GAME_FULL16BITRES, -1, -1},
{0xD6385328, GodOfWar, Unknown_Region, GAME_FULL16BITRES, -1, -1},
//{0x2F123FD8, GodOfWar2, Unknown_Region, GAME_FULL16BITRES, -1, -1},
//{0x44A8A22A, GodOfWar2, Unknown_Region, GAME_FULL16BITRES, -1, -1},
//{0x4340C7C6, GodOfWar2, Unknown_Region, GAME_FULL16BITRES, -1, -1},
//{0xF8CD3DF6, GodOfWar2, Unknown_Region, GAME_FULL16BITRES, -1, -1},
//{0x0B82BFF7, GodOfWar2, Unknown_Region, GAME_FULL16BITRES, -1, -1},
{0xF0A6D880, HarvestMoon, US, GAME_NOSTENCIL, -1, -1},
{0xFB236A46, SonicUnleashed, US, GAME_FASTUPDATE | GAME_NOALPHAFAIL /**/ | GAME_GUSTHACK | GAME_NOTARGETRESOLVE /**/, -1, -1},
{0xa5d29941, ShadowTheHedgehog, US, GAME_FASTUPDATE | GAME_NOALPHAFAIL /**/ | GAME_GUSTHACK | GAME_NOTARGETRESOLVE /**/, -1, -1},
{0x7acf7e03, AtelierIris1, Unknown_Region, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0xE3981DBB, AtelierIris1, US, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0x9AC65D6A, AtelierIris2, US, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0x4CCC9212, AtelierIris3, US, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
//{0x4437F4B1, ArTonelico1, US, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0xF95F37EE, ArTonelico2, US, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0xF46142D3, ArTonelico2, JPUNDUB, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0x77b0236f, ManaKhemia1, US, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0x433951e7, ManaKhemia2, Unknown_Region, GAME_GUSTHACK /**/| GAME_NOTARGETRESOLVE | GAME_NOALPHAFAIL/**/, -1, -1},
{0xbaa8dd8, DarkCloud1, US, GAME_NOTARGETRESOLVE /**/| GAME_NOALPHAFAIL/**/, -1, -1},
{0xA5C05C78, DarkCloud1, Unknown_Region, GAME_NOTARGETRESOLVE /**/| GAME_NOALPHAFAIL/**/, -1, -1},
//{0x1DF41F33, DarkCloud2, US, 0, -1, -1},
{0x95cc86ef, GhostInTheShell, Unknown_Region, GAME_NOALPHAFAIL, -1, -1}
//{0xC164550A, WildArms5, JPUNDUB, 0, -1, -1},
//{0xC1640D2C, WildArms5, US, 0, -1, -1},
//{0x0FCF8FE4, WildArms5, EU, 0, -1, -1},
//{0x2294D322, WildArms5, JP, 0, -1, -1},
//{0x565B6170, WildArms5, JP, 0, -1, -1},
//{0xD7273511, SMTDDS1, US, 0, -1, -1}, // SMT Digital Devil Saga
//{0x1683A6BE, SMTDDS1, EU, 0, -1, -1}, // SMT Digital Devil Saga
//{0x44865CE1, SMTDDS1, JP, 0, -1, -1}, // SMT Digital Devil Saga
//{0xD382C164, SMTDDS2, US, 0, -1, -1}, // SMT Digital Devil Saga 2
//{0xE47C1A9C, SMTDDS2, JP, 0, -1, -1}, // SMT Digital Devil Saga 2
};
#define GAME_INFO_INDEX (sizeof(crc_game_list)/sizeof(Game_Info))
extern int nBackbufferWidth, nBackbufferHeight;
extern u8* g_pbyGSMemory;
extern u8* g_pbyGSClut; // the temporary clut buffer