Core: Cleanup and some changes to console messages

* Always show number of cheats/widescreen hacks loaded in console title when respective options are enabled.
* Make the placement of braces consistent
This commit is contained in:
Akash 2016-04-01 04:59:46 +05:30
parent a99750ae87
commit 9ad33012ad
1 changed files with 24 additions and 34 deletions

View File

@ -350,10 +350,6 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
wxString gameCompat; wxString gameCompat;
wxString gameMemCardFilter; wxString gameMemCardFilter;
int numberLoadedCheats;
int numberLoadedWideScreenPatches;
int numberDbfCheatsLoaded;
if (ElfCRC) gameCRC.Printf( L"%8.8x", ElfCRC ); if (ElfCRC) gameCRC.Printf( L"%8.8x", ElfCRC );
if (!DiscSerial.IsEmpty()) gameSerial = L" [" + DiscSerial + L"]"; if (!DiscSerial.IsEmpty()) gameSerial = L" [" + DiscSerial + L"]";
@ -368,7 +364,8 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
if (IGameDatabase* GameDB = AppHost_GetGameDatabase() ) if (IGameDatabase* GameDB = AppHost_GetGameDatabase() )
{ {
Game_Data game; Game_Data game;
if (GameDB->findGame(game, curGameKey)) { if (GameDB->findGame(game, curGameKey))
{
int compat = game.getInt("Compat"); int compat = game.getInt("Compat");
gameName = game.getString("Name"); gameName = game.getString("Name");
gameName += L" (" + game.getString("Region") + L")"; gameName += L" (" + game.getString("Region") + L")";
@ -376,23 +373,23 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
gameMemCardFilter = game.getString("MemCardFilter"); gameMemCardFilter = game.getString("MemCardFilter");
} }
if (EmuConfig.EnablePatches) { if (EmuConfig.EnablePatches)
if (int patches = InitPatches(gameCRC, game)) { {
if (int patches = InitPatches(gameCRC, game))
{
gamePatch.Printf(L" [%d Patches]", patches); gamePatch.Printf(L" [%d Patches]", patches);
PatchesCon->WriteLn(Color_Green, "(GameDB) Patches Loaded: %d", patches); PatchesCon->WriteLn(Color_Green, "(GameDB) Patches Loaded: %d", patches);
} }
if (int fixes = loadGameSettings(fixup, game)) { if (int fixes = loadGameSettings(fixup, game))
gameFixes.Printf(L" [%d Fixes]", fixes); gameFixes.Printf(L" [%d Fixes]", fixes);
} }
} }
} }
}
if (!gameMemCardFilter.IsEmpty()) { if (!gameMemCardFilter.IsEmpty())
sioSetGameSerial(gameMemCardFilter); sioSetGameSerial(gameMemCardFilter);
} else { else
sioSetGameSerial(curGameKey); sioSetGameSerial(curGameKey);
}
if (gameName.IsEmpty() && gameSerial.IsEmpty() && gameCRC.IsEmpty()) if (gameName.IsEmpty() && gameSerial.IsEmpty() && gameCRC.IsEmpty())
{ {
@ -406,42 +403,35 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
ResetCheatsCount(); ResetCheatsCount();
//Till the end of this function, entry CRC will be 00000000 //Till the end of this function, entry CRC will be 00000000
if (!gameCRC.Length()) { if (!gameCRC.Length())
if (EmuConfig.EnableWideScreenPatches || EmuConfig.EnableCheats) { {
Console.WriteLn(Color_Gray, "Patches: No CRC, using 00000000 instead."); Console.WriteLn(Color_Gray, "Patches: No CRC found, using 00000000 instead.");
}
gameCRC = L"00000000"; gameCRC = L"00000000";
} }
// regular cheat patches // regular cheat patches
if (EmuConfig.EnableCheats) { if (EmuConfig.EnableCheats)
if (numberLoadedCheats = LoadCheats(gameCRC, GetCheatsFolder(), L"Cheats")) { gameCheats.Printf(L" [%d Cheats]", LoadCheats(gameCRC, GetCheatsFolder(), L"Cheats"));
gameCheats.Printf(L" [%d Cheats]", numberLoadedCheats);
}
}
// wide screen patches // wide screen patches
if (EmuConfig.EnableWideScreenPatches) { if (EmuConfig.EnableWideScreenPatches)
if (numberLoadedWideScreenPatches = LoadCheats(gameCRC, GetCheatsWsFolder(), L"Widescreen hacks")) { {
if (int numberLoadedWideScreenPatches = LoadCheats(gameCRC, GetCheatsWsFolder(), L"Widescreen hacks"))
{
gameWsHacks.Printf(L" [%d widescreen hacks]", numberLoadedWideScreenPatches); gameWsHacks.Printf(L" [%d widescreen hacks]", numberLoadedWideScreenPatches);
} }
else { else
{
// No ws cheat files found at the cheats_ws folder, try the ws cheats zip file. // No ws cheat files found at the cheats_ws folder, try the ws cheats zip file.
wxString cheats_ws_archive = Path::Combine(PathDefs::GetProgramDataDir(), wxFileName(L"cheats_ws.zip")); wxString cheats_ws_archive = Path::Combine(PathDefs::GetProgramDataDir(), wxFileName(L"cheats_ws.zip"));
int numberDbfCheatsLoaded = LoadCheatsFromZip(gameCRC, cheats_ws_archive);
if (numberDbfCheatsLoaded = LoadCheatsFromZip(gameCRC, cheats_ws_archive)) {
PatchesCon->WriteLn(Color_Green, "(Wide Screen Cheats DB) Patches Loaded: %d", numberDbfCheatsLoaded); PatchesCon->WriteLn(Color_Green, "(Wide Screen Cheats DB) Patches Loaded: %d", numberDbfCheatsLoaded);
gameWsHacks.Printf(L" [%d widescreen hacks]", numberDbfCheatsLoaded); gameWsHacks.Printf(L" [%d widescreen hacks]", numberDbfCheatsLoaded);
} }
} }
}
wxString consoleTitle = gameName + gameSerial; wxString consoleTitle = gameName + gameSerial;
if (!gameSerial.IsEmpty()) { consoleTitle += L" [" + gameCRC.MakeUpper() + L"]" + gameCompat + gameFixes + gamePatch + gameCheats + gameWsHacks;
consoleTitle += L" [" + gameCRC.MakeUpper() + L"]";
}
consoleTitle += gameCompat + gameFixes + gamePatch + gameCheats + gameWsHacks;
Console.SetTitle(consoleTitle); Console.SetTitle(consoleTitle);
// Re-entry guard protects against cases where code wants to manually set core settings // Re-entry guard protects against cases where code wants to manually set core settings