// This routine loads patches from the game database // Returns number of patches loaded int InitPatches(const wxString& crc, const Game_Data& game) { bool patchFound = false; wxString patch; patchnumber = 0; if (game.IsOk()) { if (game.sectionExists(L"patches", crc)) { patch = game.getSection(L"patches", crc); patchFound = true; } else if (game.keyExists(L"[patches]")) { patch = game.getString(L"[patches]"); patchFound = true; } } if (patchFound) TrimPatches(patch); return patchnumber; }
// Load Game Settings found in database // (game fixes, round modes, clamp modes, etc...) // Returns number of gamefixes set static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game) { if( !game.IsOk() ) return 0; int gf = 0; if (game.keyExists("eeRoundMode")) { SSE_RoundMode eeRM = (SSE_RoundMode)game.getInt("eeRoundMode"); if (EnumIsValid(eeRM)) { PatchesCon->WriteLn("(GameDB) Changing EE/FPU roundmode to %d [%s]", eeRM, EnumToString(eeRM)); dest.Cpu.sseMXCSR.SetRoundMode(eeRM); ++gf; } } if (game.keyExists("vuRoundMode")) { SSE_RoundMode vuRM = (SSE_RoundMode)game.getInt("vuRoundMode"); if (EnumIsValid(vuRM)) { PatchesCon->WriteLn("(GameDB) Changing VU0/VU1 roundmode to %d [%s]", vuRM, EnumToString(vuRM)); dest.Cpu.sseVUMXCSR.SetRoundMode(vuRM); ++gf; } } if (game.keyExists("eeClampMode")) { int clampMode = game.getInt("eeClampMode"); PatchesCon->WriteLn("(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode); dest.Cpu.Recompiler.fpuOverflow = (clampMode >= 1); dest.Cpu.Recompiler.fpuExtraOverflow = (clampMode >= 2); dest.Cpu.Recompiler.fpuFullMode = (clampMode >= 3); gf++; } if (game.keyExists("vuClampMode")) { int clampMode = game.getInt("vuClampMode"); PatchesCon->WriteLn("(GameDB) Changing VU0/VU1 clamp mode [mode=%d]", clampMode); dest.Cpu.Recompiler.vuOverflow = (clampMode >= 1); dest.Cpu.Recompiler.vuExtraOverflow = (clampMode >= 2); dest.Cpu.Recompiler.vuSignOverflow = (clampMode >= 3); gf++; } if (game.keyExists("mvuFlagSpeedHack")) { bool vuFlagHack = game.getInt("mvuFlagSpeedHack") ? 1 : 0; PatchesCon->WriteLn("(GameDB) Changing mVU flag speed hack [mode=%d]", vuFlagHack); dest.Speedhacks.vuFlagHack = vuFlagHack; gf++; } for( GamefixId id=GamefixId_FIRST; id<pxEnumEnd; ++id ) { wxString key( EnumToString(id) ); key += L"Hack"; if (game.keyExists(key)) { bool enableIt = game.getBool(key); dest.Gamefixes.Set(id, enableIt); PatchesCon->WriteLn(L"(GameDB) %s Gamefix: " + key, enableIt ? L"Enabled" : L"Disabled"); gf++; // The LUT is only used for 1 game so we allocate it only when the gamefix is enabled (save 4MB) if (id == Fix_GoemonTlbMiss && enableIt) vtlb_Alloc_Ppmap(); } } return gf; }
// Load Game Settings found in database // (game fixes, round modes, clamp modes, etc...) // Returns number of gamefixes set static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game, bool verbose = true) { if( !game.IsOk() ) return 0; int gf = 0; if (game.keyExists("eeRoundMode")) { SSE_RoundMode eeRM = (SSE_RoundMode)game.getInt("eeRoundMode"); if (EnumIsValid(eeRM)) { if(verbose) Console.WriteLn("(GameDB) Changing EE/FPU roundmode to %d [%s]", eeRM, EnumToString(eeRM)); dest.Cpu.sseMXCSR.SetRoundMode(eeRM); ++gf; } } if (game.keyExists("vuRoundMode")) { SSE_RoundMode vuRM = (SSE_RoundMode)game.getInt("vuRoundMode"); if (EnumIsValid(vuRM)) { if(verbose) Console.WriteLn("(GameDB) Changing VU0/VU1 roundmode to %d [%s]", vuRM, EnumToString(vuRM)); dest.Cpu.sseVUMXCSR.SetRoundMode(vuRM); ++gf; } } if (game.keyExists("eeClampMode")) { int clampMode = game.getInt("eeClampMode"); if(verbose) Console.WriteLn("(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode); dest.Cpu.Recompiler.fpuOverflow = (clampMode >= 1); dest.Cpu.Recompiler.fpuExtraOverflow = (clampMode >= 2); dest.Cpu.Recompiler.fpuFullMode = (clampMode >= 3); gf++; } if (game.keyExists("vuClampMode")) { int clampMode = game.getInt("vuClampMode"); if(verbose) Console.WriteLn("(GameDB) Changing VU0/VU1 clamp mode [mode=%d]", clampMode); dest.Cpu.Recompiler.vuOverflow = (clampMode >= 1); dest.Cpu.Recompiler.vuExtraOverflow = (clampMode >= 2); dest.Cpu.Recompiler.vuSignOverflow = (clampMode >= 3); gf++; } if (game.keyExists("mvuFlagSpeedHack")) { bool vuFlagHack = game.getInt("mvuFlagSpeedHack") ? 1 : 0; if(verbose) Console.WriteLn("(GameDB) Changing mVU flag speed hack [mode=%d]", vuFlagHack); dest.Speedhacks.vuFlagHack = vuFlagHack; gf++; } for( GamefixId id=GamefixId_FIRST; id<pxEnumEnd; ++id ) { wxString key( EnumToString(id) ); key += L"Hack"; if (game.keyExists(key)) { bool enableIt = game.getBool(key); dest.Gamefixes.Set(id, enableIt); if(verbose) Console.WriteLn(L"(GameDB) %s Gamefix: " + key, enableIt ? L"Enabled" : L"Disabled" ); gf++; } } return gf; }