Add support for changing FPU/VU roundmodes through database...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3042 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2010-05-18 23:52:29 +00:00
parent 951e1ec90e
commit 952c872f0e
5 changed files with 38 additions and 2 deletions

View File

@ -17,6 +17,8 @@
-- You can use c++ style 1-line comments (//) or (--) -- You can use c++ style 1-line comments (//) or (--)
-- All comments must be written in this header or they will not be -- All comments must be written in this header or they will not be
-- saved properly by pcsx2's database writer. -- saved properly by pcsx2's database writer.
-- For gamefixes/roundmodes/clampmodes, pcsx2 will use the current user
-- settings if the game database does not explicitly change the values.
--------------------------------------------- ---------------------------------------------
-- Compatibility Status (Compat = n) -- Compatibility Status (Compat = n)
@ -39,6 +41,17 @@
-- 2 = Positive Infinity -- 2 = Positive Infinity
-- 3 = Chop (Zero) -- 3 = Chop (Zero)
---------------------------------------------
-- Clamp Modes (eeClampMode = n and vuClampMode = n)
---------------------------------------------
-- The clamp modes are numerically based.
-- eeClampMode refers to the EE's FPU co-processor
-- vuClampMode refers to the VU's and COP2
-- 0 = Disables clamping completely
-- 1 = Clamp Normally (only clamp results)
-- 2 = Clamp Extra (clamp results as well as operands)
-- 3 = Full Clamping for FPU / Extra+Preserve Sign Clamping for VU
--------------------------------------------- ---------------------------------------------
-- Game Fixes (gameFixName = 1) -- Game Fixes (gameFixName = 1)
--------------------------------------------- ---------------------------------------------

View File

@ -541,6 +541,7 @@ struct Pcsx2Config
extern const Pcsx2Config EmuConfig; extern const Pcsx2Config EmuConfig;
Pcsx2Config::GSOptions& SetGSConfig(); Pcsx2Config::GSOptions& SetGSConfig();
Pcsx2Config::RecompilerOptions& SetRecompilerConfig();
Pcsx2Config::GamefixOptions& SetGameFixConfig(); Pcsx2Config::GamefixOptions& SetGameFixConfig();
ConsoleLogFilters& SetConsoleConfig(); ConsoleLogFilters& SetConsoleConfig();
TraceLogFilters& SetTraceConfig(); TraceLogFilters& SetTraceConfig();

View File

@ -393,9 +393,23 @@ static void loadGameSettings(DataBase_Loader* gameDB) {
if (gameDB->keyExists("eeRoundMode")) { eeRM = gameDB->getInt("eeRoundMode"); rm=1; } if (gameDB->keyExists("eeRoundMode")) { eeRM = gameDB->getInt("eeRoundMode"); rm=1; }
if (gameDB->keyExists("vuRoundMode")) { vuRM = gameDB->getInt("vuRoundMode"); rm=1; } if (gameDB->keyExists("vuRoundMode")) { vuRM = gameDB->getInt("vuRoundMode"); rm=1; }
if (rm && eeRM<4 && vuRM<4) { if (rm && eeRM<4 && vuRM<4) {
Console.WriteLn("Game DataBase: Changing roundmodes!"); Console.WriteLn("Game DataBase: Changing roundmodes! [ee=%d] [vu=%d]", eeRM, vuRM);
SetCPUState(eeMX.SetRoundMode((SSE_RoundMode)eeRM), vuMX.SetRoundMode((SSE_RoundMode)vuRM)); SetCPUState(eeMX.SetRoundMode((SSE_RoundMode)eeRM), vuMX.SetRoundMode((SSE_RoundMode)vuRM));
} }
if (gameDB->keyExists("eeClampMode")) {
int clampMode = gameDB->getInt("eeClampMode");
Console.WriteLn("Game DataBase: Changing EE/FPU clamp mode [mode=%d]", clampMode);
SetRecompilerConfig().fpuOverflow = clampMode >= 1;
SetRecompilerConfig().fpuExtraOverflow = clampMode >= 2;
SetRecompilerConfig().fpuFullMode = clampMode >= 3;
}
if (gameDB->keyExists("vuClampMode")) {
int clampMode = gameDB->getInt("vuClampMode");
Console.WriteLn("Game DataBase: Changing VU0/VU1 clamp mode [mode=%d]", clampMode);
SetRecompilerConfig().vuOverflow = clampMode >= 1;
SetRecompilerConfig().vuExtraOverflow = clampMode >= 2;
SetRecompilerConfig().vuSignOverflow = clampMode >= 3;
}
checkGamefix(VuAddSubHack); checkGamefix(VuAddSubHack);
checkGamefix(VuClipFlagHack); checkGamefix(VuClipFlagHack);
checkGamefix(FpuCompareHack); checkGamefix(FpuCompareHack);

View File

@ -68,6 +68,15 @@ Pcsx2Config::GSOptions& SetGSConfig()
return const_cast<Pcsx2Config::GSOptions&>(EmuConfig.GS); return const_cast<Pcsx2Config::GSOptions&>(EmuConfig.GS);
} }
// Provides an accessor for quick modification of Recompiler options.
// Used by loadGameSettings() to set clamp modes via database at game startup.
Pcsx2Config::RecompilerOptions& SetRecompilerConfig()
{
//DbgCon.WriteLn( "Direct modification of EmuConfig.Gamefixes detected" );
AffinityAssert_AllowFrom_MainUI();
return const_cast<Pcsx2Config::RecompilerOptions&>(EmuConfig.Cpu.Recompiler);
}
// Provides an accessor for quick modification of Gamefix options. // Provides an accessor for quick modification of Gamefix options.
// Used by loadGameSettings() to set gamefixes via database at game startup. // Used by loadGameSettings() to set gamefixes via database at game startup.
Pcsx2Config::GamefixOptions& SetGameFixConfig() Pcsx2Config::GamefixOptions& SetGameFixConfig()

View File

@ -26,7 +26,6 @@
// Note: If modXYZW is true, then it adjusts XYZW for Single Scalar operations // Note: If modXYZW is true, then it adjusts XYZW for Single Scalar operations
static void mVUupdateFlags(mV, int reg, int regT1 = -1, int regT2 = -1, bool modXYZW = 1) { static void mVUupdateFlags(mV, int reg, int regT1 = -1, int regT2 = -1, bool modXYZW = 1) {
int sReg, mReg = gprT1, regT1b = 0, regT2b = 0; int sReg, mReg = gprT1, regT1b = 0, regT2b = 0;
//int xyzw = _X_Y_Z_W; // unused local, still needed? -- air
static const u16 flipMask[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}; static const u16 flipMask[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};
//SysPrintf("Status = %d; Mac = %d\n", sFLAG.doFlag, mFLAG.doFlag); //SysPrintf("Status = %d; Mac = %d\n", sFLAG.doFlag, mFLAG.doFlag);