diff --git a/pcsx2/Misc.h b/pcsx2/Misc.h index 1874c52201..fd5dec12c8 100644 --- a/pcsx2/Misc.h +++ b/pcsx2/Misc.h @@ -58,7 +58,8 @@ #define CHECK_EESYNC_HACK (Config.Hacks & 0x1) #define CHECK_IOPSYNC_HACK (Config.Hacks & 0x10) #define CHECK_EE_IOP_EXTRA (Config.Hacks & 0x20) -#define CHECK_DENORMALS ((Config.Hacks & 0x8) ? 0xffc0 : 0x7f80) //If enabled, Denormals are Zero for the recs and flush to zero is enabled as well +#define CHECK_UNDERFLOW (!(Config.Hacks & 0x8)) +#define CHECK_DENORMALS ((Config.Hacks & 0x400) ? 0xffc0 : 0x7f80) //If enabled, Denormals are Zero for the recs and flush to zero is enabled as well #define CHECK_FASTBRANCHES (Config.Hacks & 0x80) #define CHECK_VUCLIPHACK (Config.Hacks & 0x100) // Special Fix for GoW, updates the clipflag differently in recVUMI_CLIP() (note: turning this hack on, breaks Rockstar games) #define CHECK_FPUCLAMPHACK (Config.Hacks & 0x200) // Special Fix for GT4, different clamping for FPU (Note: sets negative infinity to positive fMax when clamping, which the real ps2 doesn't do) diff --git a/pcsx2/windows/WinMain.c b/pcsx2/windows/WinMain.c index 0c76106ea8..2839b36e34 100644 --- a/pcsx2/windows/WinMain.c +++ b/pcsx2/windows/WinMain.c @@ -47,6 +47,7 @@ #include "iCore.h" #include "iVUzerorec.h" +#include "patch.h" #include "cheats/cheats.h" #include "../Paths.h" @@ -57,6 +58,9 @@ static int efile; char filename[256]; extern int g_SaveGSStream; +extern u32 g_sseMXCSR; +extern u32 g_sseVUMXCSR; + static int AccBreak = 0; int needReset = 1; unsigned int langsMax; @@ -730,6 +734,7 @@ BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { if(Config.Hacks & 0x80) CheckDlgButton(hDlg, IDC_FASTBRANCHES, TRUE); if(Config.Hacks & 0x100) CheckDlgButton(hDlg, IDC_VUCLIPHACK, TRUE); if(Config.Hacks & 0x200) CheckDlgButton(hDlg, IDC_FPUCLAMPHACK, TRUE); + if(Config.Hacks & 0x400) CheckDlgButton(hDlg, IDC_DENORMALS, 2); return TRUE; @@ -739,13 +744,16 @@ BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK) ? 0x1 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_OVERFLOWHACK) ? 0x2 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SOUNDHACK) ? 0x4 : 0; - Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_DENORMALS) ? 0x8 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK2) ? 0x10 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_SYNCHACK3) ? 0x20 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_OVERFLOWHACK_EXTRA) ? 0x40 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_FASTBRANCHES) ? 0x80 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_VUCLIPHACK) ? 0x100 : 0; Config.Hacks |= IsDlgButtonChecked(hDlg, IDC_FPUCLAMPHACK) ? 0x200 : 0; + Config.Hacks |= ( IsDlgButtonChecked(hDlg, IDC_DENORMALS) == 2 ) ? 0x408 : (IsDlgButtonChecked(hDlg, IDC_DENORMALS) ? 0x8 : 0); // 0x408 == greyed checkbox (DaZ SSE flag; so the CPU sets denormals to zero) + + g_sseVUMXCSR = CHECK_DENORMALS; + SetCPUState(g_sseMXCSR, g_sseVUMXCSR); SaveConfig(); diff --git a/pcsx2/windows/pcsx2.rc b/pcsx2/windows/pcsx2.rc index d3c2570d01..eb1d23461b 100644 --- a/pcsx2/windows/pcsx2.rc +++ b/pcsx2/windows/pcsx2.rc @@ -950,7 +950,7 @@ BEGIN CONTROL "Disable All Overflow Checks - Doesn't check for overflow at all in the VU Recs.",IDC_OVERFLOWHACK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,63,373,10 CTEXT "These hacks will effect the speed of PCSX2 but possibly comprimise on compatability",IDC_HACKDESC,7,7,392,8 - CONTROL "Tighter SPU2 Sync ( FFXII vids) - Slower, not useful anymore.",IDC_SOUNDHACK, + CONTROL "Tighter SPU2 Sync ( FFXII vids) - Slower, not very useful anymore.",IDC_SOUNDHACK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,197,323,10 CONTROL "IOP Sync Hack (x2) - Doubles the cycle rate of the IOP.",IDC_SYNCHACK2, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,128,270,10 @@ -958,12 +958,12 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,142,359,10 CONTROL "Enable Extra Overflow Checks - Enable extra overflow checks used to help stop SPS. ( Slow! )",IDC_OVERFLOWHACK_EXTRA, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,50,377,10 - CONTROL "EE/IOP Fast Branches - Quick branching ( Very small speedup, use only when you need every fps! )",IDC_FASTBRANCHES, + CONTROL "EE/IOP Fast Branches - Quick branching ( Very small speedup; Not Recommended! )",IDC_FASTBRANCHES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,183,351,10 CTEXT "If you have problems, disable all these and try again",IDC_STATIC,7,22,392,8 GROUPBOX "Overflow and Underflow",IDC_STATIC,7,36,392,60 - CONTROL "Denormals are Zero - Makes very small numbers equal zero. ( Big speedup on Intel CPUs ) ( Needs Restart! )",IDC_DENORMALS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,76,377,10 + CONTROL "Disable Underflow Checks - ( Checked = Small Speedup. ) ( Grey = DaZ Flag; Big Speedup for Intel CPU's! )",IDC_DENORMALS, + "Button",BS_AUTO3STATE | WS_TABSTOP,14,76,377,10 GROUPBOX "Sync Hacks",IDC_STATIC,7,101,392,59 GROUPBOX "Miscellaneous / Special Game Fixes",IDC_STATIC,7,168,392,76 CONTROL "VU Clip Hack - Special fix for God of War; Breaks Rockstar games!",IDC_VUCLIPHACK, diff --git a/pcsx2/x86/iVUmicro.c b/pcsx2/x86/iVUmicro.c index c6b228e404..5ee3e2de5f 100644 --- a/pcsx2/x86/iVUmicro.c +++ b/pcsx2/x86/iVUmicro.c @@ -1432,7 +1432,7 @@ void recUpdateFlags(VURegs * VU, int reg, int info) SHL32ItoR(x86macflag, 4); // Shift the Overflow and Underflow flags left 4 //-------------------------Optional Code: Denormals Are Zero------------------------------ - if (!(Config.Hacks & 0x8)) { //only use if denormals hack is off + if (CHECK_UNDERFLOW) { // Sets underflow/denormals to zero SSE_ANDNPS_XMM_to_XMM(EEREC_TEMP, reg); // EEREC_TEMP = !EEREC_TEMP & reg // Now we have Denormals are Positive Zero in EEREC_TEMP; the next two lines take Signed Zero into account SSE_ANDPS_M128_to_XMM(reg, (uptr)&VU_Signed_Zero_Mask[ 0 ]); @@ -1546,7 +1546,7 @@ void recUpdateFlags(VURegs * VU, int reg, int info) SHL32ItoR(x86macflag, 4); // Shift the Overflow and Underflow flags left 4 //-------------------------Optional Code: Denormals Are Zero------------------------------ - if (!(Config.Hacks & 0x8)) { //only use if denormals hack is off + if (CHECK_UNDERFLOW) { // Sets underflow/denormals to zero SSE_ANDNPS_XMM_to_XMM(t1reg, reg); // t1reg = !t1reg & reg // Now we have Denormals are Positive Zero in t1reg; the next two lines take Signed Zero into account SSE_ANDPS_M128_to_XMM(reg, (uptr)&VU_Signed_Zero_Mask[ 0 ]); diff --git a/pcsx2/x86/ix86-32/iR5900-32.c b/pcsx2/x86/ix86-32/iR5900-32.c index d15aa6ca7d..714435cf9d 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.c +++ b/pcsx2/x86/ix86-32/iR5900-32.c @@ -1450,7 +1450,7 @@ void eeFPURecompileCode(R5900FNPTR_INFO xmmcode, R5900FNPTR_INFO fpucode, int xm extern u8 g_MACFlagTransform[256]; // for vus u32 g_sseMXCSR = 0x9fc0; //0x9fc0 disable all exception, round to 0, flush to 0 -u32 g_sseVUMXCSR = 0; +u32 g_sseVUMXCSR = 0x7f80; void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR) {