mirror of https://github.com/PCSX2/pcsx2.git
pcsx2 gui:
* handle cheats and cheatsWS folder like others data folders. Note: I didn't add new gui entry but every configuration bits are here. Tell me if you want addional entry * replace folder name hardcoded in AppCoreThread with the new PathDefs::GetCheats* functions git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5640 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
e3d658b501
commit
b9bd672c89
|
@ -171,13 +171,13 @@ void ResetCheatsCount()
|
||||||
cheatnumber = 0;
|
cheatnumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int LoadCheatsFiles(const wxString& folderName, wxString& fileSpec, const wxString& friendlyName)
|
static int LoadCheatsFiles(const wxDirName& folderName, wxString& fileSpec, const wxString& friendlyName)
|
||||||
{
|
{
|
||||||
if (!wxDir::Exists(folderName)) {
|
if (!folderName.Exists()) {
|
||||||
Console.WriteLn(Color_Red, L"The %s folder ('%s') is inaccessible. Skipping...", friendlyName.c_str(), folderName.c_str());
|
Console.WriteLn(Color_Red, L"The %s folder ('%s') is inaccessible. Skipping...", friendlyName.c_str(), folderName.ToString().c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
wxDir dir(folderName);
|
wxDir dir(folderName.ToString());
|
||||||
|
|
||||||
int before = cheatnumber;
|
int before = cheatnumber;
|
||||||
wxString buffer;
|
wxString buffer;
|
||||||
|
@ -200,7 +200,7 @@ static int LoadCheatsFiles(const wxString& folderName, wxString& fileSpec, const
|
||||||
// This routine loads cheats from *.pnach files
|
// This routine loads cheats from *.pnach files
|
||||||
// Returns number of cheats loaded
|
// Returns number of cheats loaded
|
||||||
// Note: Should be called after InitPatches()
|
// Note: Should be called after InitPatches()
|
||||||
int LoadCheats(wxString name, const wxString& folderName, const wxString& friendlyName)
|
int LoadCheats(wxString name, const wxDirName& folderName, const wxString& friendlyName)
|
||||||
{
|
{
|
||||||
if (!name.Length()) {
|
if (!name.Length()) {
|
||||||
Console.WriteLn(Color_Gray, "Cheats: No CRC, using 00000000 instead.");
|
Console.WriteLn(Color_Gray, "Cheats: No CRC, using 00000000 instead.");
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace PatchFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void ResetCheatsCount();
|
extern void ResetCheatsCount();
|
||||||
extern int LoadCheats(wxString name, const wxString& folderName, const wxString& friendlyName);
|
extern int LoadCheats(wxString name, const wxDirName& folderName, const wxString& friendlyName);
|
||||||
extern void inifile_command(bool isCheat, const wxString& cmd);
|
extern void inifile_command(bool isCheat, const wxString& cmd);
|
||||||
extern void inifile_trim(wxString& buffer);
|
extern void inifile_trim(wxString& buffer);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,9 @@ enum FoldersEnum_t
|
||||||
|
|
||||||
FolderId_Documents,
|
FolderId_Documents,
|
||||||
|
|
||||||
|
FolderId_Cheats,
|
||||||
|
FolderId_CheatsWS,
|
||||||
|
|
||||||
FolderId_COUNT
|
FolderId_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,6 +61,8 @@ namespace PathDefs
|
||||||
extern wxDirName GetSettings();
|
extern wxDirName GetSettings();
|
||||||
extern wxDirName GetLogs();
|
extern wxDirName GetLogs();
|
||||||
extern wxDirName GetLangs();
|
extern wxDirName GetLangs();
|
||||||
|
extern wxDirName GetCheats();
|
||||||
|
extern wxDirName GetCheatsWS();
|
||||||
|
|
||||||
extern wxDirName Get( FoldersEnum_t folderidx );
|
extern wxDirName Get( FoldersEnum_t folderidx );
|
||||||
|
|
||||||
|
@ -74,6 +79,8 @@ namespace PathDefs
|
||||||
extern const wxDirName& Logs();
|
extern const wxDirName& Logs();
|
||||||
extern const wxDirName& Dumps();
|
extern const wxDirName& Dumps();
|
||||||
extern const wxDirName& Langs();
|
extern const wxDirName& Langs();
|
||||||
|
extern const wxDirName& Cheats();
|
||||||
|
extern const wxDirName& CheatsWS();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,16 @@ namespace PathDefs
|
||||||
return GetDocuments() + wxDirName( L"bios" );
|
return GetDocuments() + wxDirName( L"bios" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxDirName GetCheats()
|
||||||
|
{
|
||||||
|
return GetDocuments() + wxDirName( L"cheats" );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDirName GetCheatsWS()
|
||||||
|
{
|
||||||
|
return GetDocuments() + wxDirName( L"cheats_ws" );
|
||||||
|
}
|
||||||
|
|
||||||
wxDirName GetSavestates()
|
wxDirName GetSavestates()
|
||||||
{
|
{
|
||||||
return GetDocuments() + Base::Savestates();
|
return GetDocuments() + Base::Savestates();
|
||||||
|
@ -218,6 +228,8 @@ namespace PathDefs
|
||||||
case FolderId_MemoryCards: return GetMemoryCards();
|
case FolderId_MemoryCards: return GetMemoryCards();
|
||||||
case FolderId_Logs: return GetLogs();
|
case FolderId_Logs: return GetLogs();
|
||||||
case FolderId_Langs: return GetLangs();
|
case FolderId_Langs: return GetLangs();
|
||||||
|
case FolderId_Cheats: return GetCheats();
|
||||||
|
case FolderId_CheatsWS: return GetCheatsWS();
|
||||||
|
|
||||||
case FolderId_Documents: return CustomDocumentsFolder;
|
case FolderId_Documents: return CustomDocumentsFolder;
|
||||||
|
|
||||||
|
@ -240,6 +252,8 @@ wxDirName& AppConfig::FolderOptions::operator[]( FoldersEnum_t folderidx )
|
||||||
case FolderId_MemoryCards: return MemoryCards;
|
case FolderId_MemoryCards: return MemoryCards;
|
||||||
case FolderId_Logs: return Logs;
|
case FolderId_Logs: return Logs;
|
||||||
case FolderId_Langs: return Langs;
|
case FolderId_Langs: return Langs;
|
||||||
|
case FolderId_Cheats: return Cheats;
|
||||||
|
case FolderId_CheatsWS: return CheatsWS;
|
||||||
|
|
||||||
case FolderId_Documents: return CustomDocumentsFolder;
|
case FolderId_Documents: return CustomDocumentsFolder;
|
||||||
|
|
||||||
|
@ -266,6 +280,8 @@ bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const
|
||||||
case FolderId_MemoryCards: return UseDefaultMemoryCards;
|
case FolderId_MemoryCards: return UseDefaultMemoryCards;
|
||||||
case FolderId_Logs: return UseDefaultLogs;
|
case FolderId_Logs: return UseDefaultLogs;
|
||||||
case FolderId_Langs: return UseDefaultLangs;
|
case FolderId_Langs: return UseDefaultLangs;
|
||||||
|
case FolderId_Cheats: return UseDefaultCheats;
|
||||||
|
case FolderId_CheatsWS: return UseDefaultCheatsWS;
|
||||||
|
|
||||||
case FolderId_Documents: return false;
|
case FolderId_Documents: return false;
|
||||||
|
|
||||||
|
@ -327,6 +343,16 @@ void AppConfig::FolderOptions::Set( FoldersEnum_t folderidx, const wxString& src
|
||||||
CustomDocumentsFolder = src;
|
CustomDocumentsFolder = src;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FolderId_Cheats:
|
||||||
|
Cheats = src;
|
||||||
|
UseDefaultCheats = useDefault;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FolderId_CheatsWS:
|
||||||
|
CheatsWS = src;
|
||||||
|
UseDefaultCheatsWS = useDefault;
|
||||||
|
break;
|
||||||
|
|
||||||
jNO_DEFAULT
|
jNO_DEFAULT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -634,6 +660,8 @@ void AppConfig::FolderOptions::ApplyDefaults()
|
||||||
if( UseDefaultLogs ) Logs = PathDefs::GetLogs();
|
if( UseDefaultLogs ) Logs = PathDefs::GetLogs();
|
||||||
if( UseDefaultLangs ) Langs = PathDefs::GetLangs();
|
if( UseDefaultLangs ) Langs = PathDefs::GetLangs();
|
||||||
if( UseDefaultPluginsFolder)PluginsFolder = PathDefs::GetPlugins();
|
if( UseDefaultPluginsFolder)PluginsFolder = PathDefs::GetPlugins();
|
||||||
|
if( UseDefaultCheats ) Cheats = PathDefs::GetCheats();
|
||||||
|
if( UseDefaultCheatsWS ) CheatsWS = PathDefs::GetCheatsWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -667,6 +695,8 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
|
||||||
IniBitBool( UseDefaultLogs );
|
IniBitBool( UseDefaultLogs );
|
||||||
IniBitBool( UseDefaultLangs );
|
IniBitBool( UseDefaultLangs );
|
||||||
IniBitBool( UseDefaultPluginsFolder );
|
IniBitBool( UseDefaultPluginsFolder );
|
||||||
|
IniBitBool( UseDefaultCheats );
|
||||||
|
IniBitBool( UseDefaultCheatsWS );
|
||||||
|
|
||||||
//when saving in portable mode, we save relative paths if possible
|
//when saving in portable mode, we save relative paths if possible
|
||||||
// --> on load, these relative paths will be expanded relative to the exe folder.
|
// --> on load, these relative paths will be expanded relative to the exe folder.
|
||||||
|
@ -678,6 +708,8 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
|
||||||
IniEntryDirFile( MemoryCards, rel );
|
IniEntryDirFile( MemoryCards, rel );
|
||||||
IniEntryDirFile( Logs, rel );
|
IniEntryDirFile( Logs, rel );
|
||||||
IniEntryDirFile( Langs, rel );
|
IniEntryDirFile( Langs, rel );
|
||||||
|
IniEntryDirFile( Cheats, rel );
|
||||||
|
IniEntryDirFile( CheatsWS, rel );
|
||||||
ini.Entry( L"PluginsFolder", PluginsFolder, InstallFolder + PathDefs::Base::Plugins(), rel );
|
ini.Entry( L"PluginsFolder", PluginsFolder, InstallFolder + PathDefs::Base::Plugins(), rel );
|
||||||
|
|
||||||
IniEntryDirFile( RunIso, rel );
|
IniEntryDirFile( RunIso, rel );
|
||||||
|
|
|
@ -132,7 +132,9 @@ public:
|
||||||
UseDefaultSavestates:1,
|
UseDefaultSavestates:1,
|
||||||
UseDefaultMemoryCards:1,
|
UseDefaultMemoryCards:1,
|
||||||
UseDefaultLogs:1,
|
UseDefaultLogs:1,
|
||||||
UseDefaultLangs:1;
|
UseDefaultLangs:1,
|
||||||
|
UseDefaultCheats:1,
|
||||||
|
UseDefaultCheatsWS:1;
|
||||||
BITFIELD_END
|
BITFIELD_END
|
||||||
|
|
||||||
wxDirName
|
wxDirName
|
||||||
|
@ -141,7 +143,9 @@ public:
|
||||||
Savestates,
|
Savestates,
|
||||||
MemoryCards,
|
MemoryCards,
|
||||||
Langs,
|
Langs,
|
||||||
Logs;
|
Logs,
|
||||||
|
Cheats,
|
||||||
|
CheatsWS;
|
||||||
|
|
||||||
wxDirName RunIso; // last used location for Iso loading.
|
wxDirName RunIso; // last used location for Iso loading.
|
||||||
wxDirName RunELF; // last used location for ELF loading.
|
wxDirName RunELF; // last used location for ELF loading.
|
||||||
|
|
|
@ -352,14 +352,14 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
|
||||||
|
|
||||||
ResetCheatsCount();
|
ResetCheatsCount();
|
||||||
if (EmuConfig.EnableCheats) {
|
if (EmuConfig.EnableCheats) {
|
||||||
if (int cheats = LoadCheats(gameCRC, L"cheats", L"Cheats")) {
|
if (int cheats = LoadCheats(gameCRC, PathDefs::GetCheats(), L"Cheats")) {
|
||||||
gameCheats.Printf(L" [%d Cheats]", cheats);
|
gameCheats.Printf(L" [%d Cheats]", cheats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: we should have a widescreen hacks config
|
// FIXME: we should have a widescreen hacks config
|
||||||
if (EmuConfig.EnableCheats) {
|
if (EmuConfig.EnableCheats) {
|
||||||
if (int cheats = LoadCheats(gameCRC, L"cheats_ws", L"Widescreen hacks")) {
|
if (int cheats = LoadCheats(gameCRC, PathDefs::GetCheatsWS(), L"Widescreen hacks")) {
|
||||||
gameWsHacks.Printf(L" [%d WS hacks]", cheats);
|
gameWsHacks.Printf(L" [%d WS hacks]", cheats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue