Added a game fix that handles delay slots differently in the VUrec. If enabled, it fixes Kingdom Hearts 2 (the gray screen bug, and the slowness) and also Tri-Ace games SPS.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@662 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
ramapcsx2 2009-01-30 21:24:35 +00:00 committed by Gregory Hainaut
parent 672bdb5a60
commit 1ace722861
5 changed files with 36 additions and 20 deletions

View File

@ -90,6 +90,7 @@ extern SessionOverrideFlags g_Session;
#define CHECK_FPUCLAMPHACK (Config.GameFixes & 0x4) // Special Fix for Tekken 5, different clamping for FPU (sets NaN to zero; doesn't clamp infinities) #define CHECK_FPUCLAMPHACK (Config.GameFixes & 0x4) // Special Fix for Tekken 5, different clamping for FPU (sets NaN to zero; doesn't clamp infinities)
#define CHECK_VUCLIPHACK (Config.GameFixes & 0x2) // Special Fix for GoW, updates the clipflag differently in recVUMI_CLIP() (note: turning this hack on, breaks Rockstar games) #define CHECK_VUCLIPHACK (Config.GameFixes & 0x2) // Special Fix for GoW, updates the clipflag differently in recVUMI_CLIP() (note: turning this hack on, breaks Rockstar games)
#define CHECK_VUBRANCHHACK (Config.GameFixes & 0x8) // Special Fix for Magna Carta (note: Breaks Crash Bandicoot) #define CHECK_VUBRANCHHACK (Config.GameFixes & 0x8) // Special Fix for Magna Carta (note: Breaks Crash Bandicoot)
#define CHECK_DELAYSLOTHACK (Config.GameFixes & 0x10)// Avoids supervu messing up the delayslot handling
//------------ Advanced Options!!! --------------- //------------ Advanced Options!!! ---------------
#define CHECK_VU_OVERFLOW (Config.vuOptions & 0x1) #define CHECK_VU_OVERFLOW (Config.vuOptions & 0x1)
#define CHECK_VU_EXTRA_OVERFLOW (Config.vuOptions & 0x2) // If enabled, Operands are clamped before being used in the VU recs #define CHECK_VU_EXTRA_OVERFLOW (Config.vuOptions & 0x2) // If enabled, Operands are clamped before being used in the VU recs

View File

@ -545,6 +545,7 @@ BOOL APIENTRY GameFixes(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if(Config.GameFixes & 0x2) CheckDlgButton(hDlg, IDC_GAMEFIX2, TRUE); if(Config.GameFixes & 0x2) CheckDlgButton(hDlg, IDC_GAMEFIX2, TRUE);
if(Config.GameFixes & 0x4) CheckDlgButton(hDlg, IDC_GAMEFIX3, TRUE); if(Config.GameFixes & 0x4) CheckDlgButton(hDlg, IDC_GAMEFIX3, TRUE);
if(Config.GameFixes & 0x8) CheckDlgButton(hDlg, IDC_GAMEFIX4, TRUE); if(Config.GameFixes & 0x8) CheckDlgButton(hDlg, IDC_GAMEFIX4, TRUE);
if(Config.GameFixes & 0x10) CheckDlgButton(hDlg, IDC_GAMEFIX6, TRUE);
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:
@ -555,6 +556,7 @@ BOOL APIENTRY GameFixes(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
newfixes |= IsDlgButtonChecked(hDlg, IDC_GAMEFIX2) ? 0x2 : 0; newfixes |= IsDlgButtonChecked(hDlg, IDC_GAMEFIX2) ? 0x2 : 0;
newfixes |= IsDlgButtonChecked(hDlg, IDC_GAMEFIX3) ? 0x4 : 0; newfixes |= IsDlgButtonChecked(hDlg, IDC_GAMEFIX3) ? 0x4 : 0;
newfixes |= IsDlgButtonChecked(hDlg, IDC_GAMEFIX4) ? 0x8 : 0; newfixes |= IsDlgButtonChecked(hDlg, IDC_GAMEFIX4) ? 0x8 : 0;
newfixes |= IsDlgButtonChecked(hDlg, IDC_GAMEFIX6) ? 0x10 : 0;
EndDialog(hDlg, TRUE); EndDialog(hDlg, TRUE);

View File

@ -12,7 +12,7 @@
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Romanian resources // Rumänisch resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ROM) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ROM)
#ifdef _WIN32 #ifdef _WIN32
@ -56,12 +56,12 @@ BEGIN
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Romanian resources #endif // Rumänisch resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// German (Germany) resources // Deutsch (Deutschland) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32 #ifdef _WIN32
@ -74,23 +74,25 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
// Dialog // Dialog
// //
IDD_GAMEFIXES DIALOGEX 0, 0, 278, 139 IDD_GAMEFIXES DIALOGEX 0, 0, 278, 154
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Game Special Fixes" CAPTION "Game Special Fixes"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,85,118,50,14 DEFPUSHBUTTON "OK",IDOK,85,133,50,14
PUSHBUTTON "Cancel",IDCANCEL,139,118,50,14 PUSHBUTTON "Cancel",IDCANCEL,139,133,50,14
CTEXT "Some games need special settings.\nConfigure them here.",IDC_STATIC,7,7,264,17 CTEXT "Some games need special settings.\nConfigure them here.",IDC_STATIC,7,7,264,17
CONTROL "VU Clip Hack - Special fix for God of War; Breaks Rockstar games!",IDC_GAMEFIX2, CONTROL "VU Clip Hack - Special fix for God of War; Breaks Rockstar games!",IDC_GAMEFIX2,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,74,252,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,74,252,10
GROUPBOX "PCSX2 Gamefixes",IDC_STATIC,7,30,264,78 GROUPBOX "PCSX2 Gamefixes",IDC_STATIC,7,30,264,92
CONTROL "FPU Clamp Hack - Special fix for Tekken 5 and Rogue Galaxy.",IDC_GAMEFIX3, CONTROL "FPU Clamp Hack - Special fix for Tekken 5 and Rogue Galaxy.",IDC_GAMEFIX3,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,46,249,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,46,249,10
CONTROL "VU Branch Hack - Special fix for Magna Carta; Breaks Crash Bandicoot!",IDC_GAMEFIX4, CONTROL "VU Branch Hack - Special fix for Magna Carta; Breaks Crash Bandicoot!",IDC_GAMEFIX4,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,88,252,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,88,252,10
CONTROL "VU Add / Sub Hack - Special fix for Tri-Ace games!",IDC_GAMEFIX1, CONTROL "VU Add / Sub Hack - Special fix for Tri-Ace games!",IDC_GAMEFIX1,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,60,252,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,60,252,10
CONTROL "Avoid 2 cycle branch delay handling - Fixes KH2 and Tri-Ace games",IDC_GAMEFIX6,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,103,252,10
END END
@ -108,17 +110,17 @@ BEGIN
RIGHTMARGIN, 271 RIGHTMARGIN, 271
VERTGUIDE, 12 VERTGUIDE, 12
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 132 BOTTOMMARGIN, 147
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // German (Germany) resources #endif // Deutsch (Deutschland) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // Englisch (USA) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32 #ifdef _WIN32
@ -1023,12 +1025,12 @@ END
// //
IDB_PS2SILVER BITMAP "ps2_silver.bmp" IDB_PS2SILVER BITMAP "ps2_silver.bmp"
#endif // English (U.S.) resources #endif // Englisch (USA) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources // Englisch (GB) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32 #ifdef _WIN32
@ -1115,12 +1117,12 @@ END
// //
SPLASH_LOGO BITMAP "..\\pcsxAbout.bmp" SPLASH_LOGO BITMAP "..\\pcsxAbout.bmp"
#endif // English (U.K.) resources #endif // Englisch (GB) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Spanish resources // Spanisch resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN)
#ifdef _WIN32 #ifdef _WIN32
@ -1361,12 +1363,12 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Spanish resources #endif // Spanisch resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Spanish (Argentina) resources // Spanisch (Argentinien) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESS) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESS)
#ifdef _WIN32 #ifdef _WIN32
@ -1519,12 +1521,12 @@ END
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_ICON ICON "Cdrom02.ico" IDI_ICON ICON "Cdrom02.ico"
#endif // Spanish (Argentina) resources #endif // Spanisch (Argentinien) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Greek resources // Griechisch resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ELL) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ELL)
#ifdef _WIN32 #ifdef _WIN32
@ -1706,7 +1708,7 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Greek resources #endif // Griechisch resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -573,6 +573,7 @@
#define IDC_GAMEFIX5 1304 #define IDC_GAMEFIX5 1304
#define IDC_GAMEFIX1 1304 #define IDC_GAMEFIX1 1304
#define IDC_EE_ROUNDMODE0 1305 #define IDC_EE_ROUNDMODE0 1305
#define IDC_GAMEFIX6 1305
#define IDC_EE_ROUNDMODE1 1306 #define IDC_EE_ROUNDMODE1 1306
#define IDC_EE_ROUNDMODE2 1307 #define IDC_EE_ROUNDMODE2 1307
#define IDC_EE_ROUNDMODE3 1308 #define IDC_EE_ROUNDMODE3 1308

View File

@ -947,6 +947,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
{ {
// check if block already exists // check if block already exists
//SysPrintf("startpc %x\n", startpc); //SysPrintf("startpc %x\n", startpc);
bool TwoCycle = false;
startpc &= (s_vu ? 0x3fff : 0xfff); startpc &= (s_vu ? 0x3fff : 0xfff);
VuBlockHeader* pbh = &recVUBlocks[s_vu][startpc/8]; VuBlockHeader* pbh = &recVUBlocks[s_vu][startpc/8];
@ -1149,6 +1150,8 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
#ifdef SUPERVU_VIBRANCHDELAY #ifdef SUPERVU_VIBRANCHDELAY
if( pinst->regs[0].pipe == VUPIPE_BRANCH && pblock->insts.size() > 1 ) { if( pinst->regs[0].pipe == VUPIPE_BRANCH && pblock->insts.size() > 1 ) {
TwoCycle = true;
if( pprevinst != NULL && pprevinst->info.cycle+1==pinst->info.cycle && if( pprevinst != NULL && pprevinst->info.cycle+1==pinst->info.cycle &&
(pprevinst->regs[0].pipe == VUPIPE_IALU||pprevinst->regs[0].pipe == VUPIPE_FMAC) && ((pprevinst->regs[0].VIwrite & pinst->regs[0].VIread) & 0xffff) (pprevinst->regs[0].pipe == VUPIPE_IALU||pprevinst->regs[0].pipe == VUPIPE_FMAC) && ((pprevinst->regs[0].VIwrite & pinst->regs[0].VIread) & 0xffff)
&& !(pprevinst->regs[0].VIread&((1<<REG_STATUS_FLAG)|(1<<REG_MAC_FLAG)|(1<<REG_CLIP_FLAG))) ) { && !(pprevinst->regs[0].VIread&((1<<REG_STATUS_FLAG)|(1<<REG_MAC_FLAG)|(1<<REG_CLIP_FLAG))) ) {
@ -1170,6 +1173,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
pdelayinst = ppprevinst; pdelayinst = ppprevinst;
} }
//SysPrintf("vurec: %x\n", pc); //SysPrintf("vurec: %x\n", pc);
// ignore if prev instruction is ILW or ILWR (xenosaga 2) // ignore if prev instruction is ILW or ILWR (xenosaga 2)
if( (lowercode>>25) != 4 // ILW if( (lowercode>>25) != 4 // ILW
@ -1193,6 +1197,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
} }
} }
} }
else TwoCycle = false;
#endif #endif
if( prevbranch ) { if( prevbranch ) {
@ -1445,7 +1450,12 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
pblock = recVUBlocks[s_vu][lastpc/8-2].pblock; pblock = recVUBlocks[s_vu][lastpc/8-2].pblock;
#ifdef SUPERVU_VIBRANCHDELAY
if( hasSecondBranch && ( CHECK_DELAYSLOTHACK ? (!TwoCycle ? 1 : 0) : 1 ) ) {
#else
if( hasSecondBranch) { if( hasSecondBranch) {
#endif
u32 vucode = *(u32*)(VU->Micro+lastpc-8); u32 vucode = *(u32*)(VU->Micro+lastpc-8);
pc = lastpc; pc = lastpc;
int bpc = _recbranchAddr(vucode); int bpc = _recbranchAddr(vucode);