mirror of https://github.com/PCSX2/pcsx2.git
cheats[_ws]: don't ignore custom folders for cheat files
The code was searching only at the default paths for cheats and cheats_ws. Now it's possible to set UseDefaultCheats[WS] at PCSX2_ui.ini to 'disabled' and set a custom value to Cheats and/or CheatsWS and PCSX2 will respect it.
This commit is contained in:
parent
d4793cc6b6
commit
95e00e0edf
|
@ -203,7 +203,8 @@ static int LoadCheatsFiles(const wxDirName& folderName, wxString& fileSpec, cons
|
|||
inifile_process(f);
|
||||
f.Close();
|
||||
int loaded = cheatnumber - before;
|
||||
Console.WriteLn((loaded ? Color_Green : Color_Gray), L"Loaded %d %s from '%s'", loaded, WX_STR(friendlyName), WX_STR(buffer));
|
||||
Console.WriteLn((loaded ? Color_Green : Color_Gray), L"Loaded %d %s from '%s' at '%s'",
|
||||
loaded, WX_STR(friendlyName), WX_STR(buffer), WX_STR(folderName.ToString()));
|
||||
numberFoundCheatsFiles ++;
|
||||
}
|
||||
found = dir.GetNext(&buffer);
|
||||
|
@ -253,6 +254,9 @@ int LoadCheats(wxString name, const wxDirName& folderName, const wxString& frien
|
|||
wxString filespec = name + L"*.pnach";
|
||||
loaded += LoadCheatsFiles(folderName, filespec, friendlyName, numberFoundCheatsFiles);
|
||||
|
||||
// This message _might_ be buggy. This function (LoadCheats) loads from an explicit folder.
|
||||
// This folder can be cheats or cheats_ws at either the default location or a custom one.
|
||||
// This check only tests the default cheats folder, so the message it produces is possibly misleading.
|
||||
if (folderName.ToString().IsSameAs(PathDefs::GetCheats().ToString()) && numberFoundCheatsFiles == 0) {
|
||||
wxString pathName = Path::Combine(folderName, name.MakeUpper() + L".pnach");
|
||||
Console.WriteLn(Color_Gray, L"Not found %s file: %s", WX_STR(friendlyName), WX_STR(pathName));
|
||||
|
|
|
@ -453,9 +453,24 @@ bool AppConfig::FullpathMatchTest( PluginsEnum_t pluginId, const wxString& cmpto
|
|||
return wxFileName(cmpto).SameAs( FullpathTo(pluginId) );
|
||||
}
|
||||
|
||||
static wxDirName GetResolvedFolder(FoldersEnum_t id)
|
||||
{
|
||||
return g_Conf->Folders.IsDefault(id) ? PathDefs::Get(id) : g_Conf->Folders[id];
|
||||
}
|
||||
|
||||
wxDirName GetLogFolder()
|
||||
{
|
||||
return g_Conf->Folders.IsDefault( FolderId_Logs ) ? PathDefs::Get(FolderId_Logs) : g_Conf->Folders[FolderId_Logs];
|
||||
return GetResolvedFolder(FolderId_Logs);
|
||||
}
|
||||
|
||||
wxDirName GetCheatsFolder()
|
||||
{
|
||||
return GetResolvedFolder(FolderId_Cheats);
|
||||
}
|
||||
|
||||
wxDirName GetCheatsWsFolder()
|
||||
{
|
||||
return GetResolvedFolder(FolderId_CheatsWS);
|
||||
}
|
||||
|
||||
wxDirName GetSettingsFolder()
|
||||
|
|
|
@ -67,6 +67,8 @@ extern wxString GetUiSettingsFilename();
|
|||
extern wxString GetUiKeysFilename();
|
||||
|
||||
extern wxDirName GetLogFolder();
|
||||
extern wxDirName GetCheatsFolder();
|
||||
extern wxDirName GetCheatsWsFolder();
|
||||
|
||||
enum InstallationModeType
|
||||
{
|
||||
|
|
|
@ -382,14 +382,14 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
|
|||
|
||||
// regular cheat patches
|
||||
if (EmuConfig.EnableCheats) {
|
||||
if (numberLoadedCheats = LoadCheats(gameCRC, PathDefs::GetCheats(), L"Cheats")) {
|
||||
if (numberLoadedCheats = LoadCheats(gameCRC, GetCheatsFolder(), L"Cheats")) {
|
||||
gameCheats.Printf(L" [%d Cheats]", numberLoadedCheats);
|
||||
}
|
||||
}
|
||||
|
||||
// wide screen patches
|
||||
if (EmuConfig.EnableWideScreenPatches) {
|
||||
if (numberLoadedWideScreenPatches = LoadCheats(gameCRC, PathDefs::GetCheatsWS(), L"Widescreen hacks")) {
|
||||
if (numberLoadedWideScreenPatches = LoadCheats(gameCRC, GetCheatsWsFolder(), L"Widescreen hacks")) {
|
||||
gameWsHacks.Printf(L" [%d widescreen hacks]", numberLoadedWideScreenPatches);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue