Refraction fixed the delay slot handling and the VU clip problem. This lets us remove 2 game specific hacks from the gamefixes dialog ;)

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@697 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
ramapcsx2 2009-02-05 00:55:02 +00:00 committed by Gregory Hainaut
parent 031f10b29a
commit 257953908f
6 changed files with 40 additions and 42 deletions

View File

@ -88,9 +88,7 @@ extern SessionOverrideFlags g_Session;
//------------ SPECIAL GAME FIXES!!! --------------- //------------ SPECIAL GAME FIXES!!! ---------------
#define CHECK_VUADDSUBHACK (Config.GameFixes & 0x1) // Special Fix for Tri-ace games, they use an encryption algorithm that requires VU addi opcode to be bit-accurate. #define CHECK_VUADDSUBHACK (Config.GameFixes & 0x1) // Special Fix for Tri-ace games, they use an encryption algorithm that requires VU addi opcode to be bit-accurate.
#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_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

@ -524,7 +524,6 @@ 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:
@ -535,7 +534,6 @@ 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

@ -7,12 +7,11 @@
// //
// Generated from the TEXTINCLUDE 2 resource. // Generated from the TEXTINCLUDE 2 resource.
// //
#include "afxresmw.h" #include "afxresmw.h" /////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Rumänisch resources // Romanian 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 +55,12 @@ BEGIN
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Rumänisch resources #endif // Romanian resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Deutsch (Deutschland) resources // German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32 #ifdef _WIN32
@ -74,25 +73,21 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
// Dialog // Dialog
// //
IDD_GAMEFIXES DIALOGEX 0, 0, 278, 154 IDD_GAMEFIXES DIALOGEX 0, 0, 278, 129
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,133,50,14 DEFPUSHBUTTON "OK",IDOK,85,108,50,14
PUSHBUTTON "Cancel",IDCANCEL,139,133,50,14 PUSHBUTTON "Cancel",IDCANCEL,139,108,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,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,74,252,10
GROUPBOX "PCSX2 Gamefixes",IDC_STATIC,7,30,264,92 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.",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,74,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
@ -110,17 +105,17 @@ BEGIN
RIGHTMARGIN, 271 RIGHTMARGIN, 271
VERTGUIDE, 12 VERTGUIDE, 12
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 147 BOTTOMMARGIN, 122
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Deutsch (Deutschland) resources #endif // German (Germany) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Englisch (USA) resources // English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32 #ifdef _WIN32
@ -1025,12 +1020,12 @@ END
// //
IDB_PS2SILVER BITMAP "ps2_silver.bmp" IDB_PS2SILVER BITMAP "ps2_silver.bmp"
#endif // Englisch (USA) resources #endif // English (U.S.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Englisch (GB) resources // English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32 #ifdef _WIN32
@ -1117,12 +1112,12 @@ END
// //
SPLASH_LOGO BITMAP "..\\pcsxAbout.bmp" SPLASH_LOGO BITMAP "..\\pcsxAbout.bmp"
#endif // Englisch (GB) resources #endif // English (U.K.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Spanisch resources // Spanish resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN)
#ifdef _WIN32 #ifdef _WIN32
@ -1363,12 +1358,12 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Spanisch resources #endif // Spanish resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Spanisch (Argentinien) resources // Spanish (Argentina) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESS) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESS)
#ifdef _WIN32 #ifdef _WIN32
@ -1521,12 +1516,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 // Spanisch (Argentinien) resources #endif // Spanish (Argentina) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Griechisch resources // Greek resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ELL) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ELL)
#ifdef _WIN32 #ifdef _WIN32
@ -1708,7 +1703,7 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Griechisch resources #endif // Greek resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -1718,7 +1713,6 @@ END
// //
// Generated from the TEXTINCLUDE 3 resource. // Generated from the TEXTINCLUDE 3 resource.
// //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED

View File

@ -573,7 +573,6 @@
#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

@ -3014,12 +3014,18 @@ void recVUMI_CLIP(VURegs *VU, int info)
u32 clipaddr = VU_VI_ADDR(REG_CLIP_FLAG, 0); u32 clipaddr = VU_VI_ADDR(REG_CLIP_FLAG, 0);
u32 prevclipaddr = VU_VI_ADDR(REG_CLIP_FLAG, 2); u32 prevclipaddr = VU_VI_ADDR(REG_CLIP_FLAG, 2);
//SysPrintf ("recVUMI_CLIP \n");
if( clipaddr == 0 ) { // battle star has a clip right before fcset if( clipaddr == 0 ) { // battle star has a clip right before fcset
SysPrintf("skipping vu clip\n"); SysPrintf("skipping vu clip\n");
return; return;
} }
//Flush the clip flag before processing, incase of double clip commands (GoW)
if( prevclipaddr != (uptr)&VU->VI[REG_CLIP_FLAG] ) {
MOV32MtoR(EAX, prevclipaddr);
MOV32RtoM((uptr)&VU->VI[REG_CLIP_FLAG], EAX);
}
assert( clipaddr != 0 ); assert( clipaddr != 0 );
assert( t1reg != t2reg && t1reg != EEREC_TEMP && t2reg != EEREC_TEMP ); assert( t1reg != t2reg && t1reg != EEREC_TEMP && t2reg != EEREC_TEMP );
@ -3064,8 +3070,7 @@ void recVUMI_CLIP(VURegs *VU, int info)
MOV32RtoM(clipaddr, EAX); MOV32RtoM(clipaddr, EAX);
// God of War needs this additional move, but it breaks Rockstar games; ideally this hack shouldn't be needed, i think its a clipflag allocation bug in iVUzerorec.cpp if (( !(info & (PROCESS_VU_SUPER|PROCESS_VU_COP2)) ) ) //Instantly update the flag if its called from elsewhere (unlikely, but ok)
if ( ( CHECK_VUCLIPHACK ) || ( !(info & (PROCESS_VU_SUPER|PROCESS_VU_COP2)) ) )
MOV32RtoM((uptr)&VU->VI[REG_CLIP_FLAG], EAX); MOV32RtoM((uptr)&VU->VI[REG_CLIP_FLAG], EAX);
_freeX86reg(x86temp1); _freeX86reg(x86temp1);

View File

@ -932,7 +932,6 @@ 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];
@ -1135,8 +1134,6 @@ 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))) ) {
@ -1182,7 +1179,6 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
} }
} }
} }
else TwoCycle = false;
#endif #endif
if( prevbranch ) { if( prevbranch ) {
@ -1366,6 +1362,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
case 0x24: // jr case 0x24: // jr
pblock->type |= BLOCKTYPE_EOP; // jump out of procedure, since not returning, set EOP pblock->type |= BLOCKTYPE_EOP; // jump out of procedure, since not returning, set EOP
pblock->insts.push_back(SuperVUFlushInst()); pblock->insts.push_back(SuperVUFlushInst());
firstbranch = 0xff; //Non-Conditional Jump
break; break;
case 0x25: // jalr case 0x25: // jalr
@ -1380,6 +1377,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
assert( pblock != NULL ); assert( pblock != NULL );
pblock->blocks.push_back(pjumpblock); pblock->blocks.push_back(pjumpblock);
firstbranch = 0xff; //Non-Conditional Jump
break; break;
} }
case 0x20: // B case 0x20: // B
@ -1391,6 +1389,7 @@ static VuBaseBlock* SuperVUBuildBlocks(VuBaseBlock* parent, u32 startpc, const V
assert( pblock != NULL ); assert( pblock != NULL );
pblock->blocks.push_back(pbranchblock); pblock->blocks.push_back(pbranchblock);
firstbranch = 0xff; //Non-Conditional Jump
break; break;
} }
case 0x21: // BAL case 0x21: // BAL
@ -1401,6 +1400,7 @@ 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;
assert( pblock != NULL ); assert( pblock != NULL );
pblock->blocks.push_back(pbranchblock); pblock->blocks.push_back(pbranchblock);
firstbranch = 0xff; //Non-Conditional Jump
break; break;
} }
case 0x28: // IBEQ case 0x28: // IBEQ
@ -1436,7 +1436,11 @@ 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 #ifdef SUPERVU_VIBRANCHDELAY
if( hasSecondBranch && ( CHECK_DELAYSLOTHACK ? (!TwoCycle ? 1 : 0) : 1 ) ) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///// NOTE! This could still be a hack for KH2/GoW, but until we know how it properly works, this will do for now.///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if( hasSecondBranch && firstbranch != 0xff ) { //check the previous jump was conditional and there is a second branch
#else #else
if( hasSecondBranch) { if( hasSecondBranch) {
#endif #endif