1. Portable mode: Fixed (for real!).

2. Game database: now always loads from pcsx2 folder (was using cwd)

details:
Portable mode: folders and file names at the ini now always saved relative in portable mode -> pcsx2 folder can be moved around, renamed, etc, and everything keeps running as normal.

Note: last elf/iso folder paths are kept absolute at the ini, and so are the last/recent iso file names. This is to allow moving pcsx2 folder around without needing to select them again. The case of putting the ISO files inside the pcsx2 folder and expecting it to work when moving the folder around is still not solved for now (but the iso can always be selected manually). Maybe will get fixed soon.

Reminder: to run in portable mode, create an empty file named "portable.ini" at the pcsx2.exe folder.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4485 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-03-25 04:47:21 +00:00
parent 7d75a5a53b
commit 7f9f6590b7
3 changed files with 31 additions and 11 deletions

View File

@ -629,12 +629,16 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
IniBitBool( UseDefaultLangs );
IniBitBool( UseDefaultPluginsFolder );
IniEntry( Bios );
IniEntry( Snapshots );
IniEntry( Savestates );
IniEntry( MemoryCards );
IniEntry( Logs );
IniEntry( Langs );
if( !ini.IsSaving() || !(InstallationMode==InstallMode_Portable) )
{//when saving in portable mode, we skip these entries, as they cannot be modified anyway.
// --> on load they'll be initialized to default (relative) paths
IniEntry( Bios );
IniEntry( Snapshots );
IniEntry( Savestates );
IniEntry( MemoryCards );
IniEntry( Logs );
IniEntry( Langs );
}
IniEntry( RunIso );
IniEntry( RunELF );
@ -661,10 +665,22 @@ void AppConfig::FilenameOptions::LoadSave( IniInterface& ini )
static const wxFileName pc( L"Please Configure" );
for( int i=0; i<PluginId_Count; ++i )
ini.Entry( tbl_PluginInfo[i].GetShortname(), Plugins[i], pc );
//when saving in portable mode, we just save the non-full-path filename
// --> on load they'll be initialized with default (relative) paths (works both for plugins and bios)
bool needRelativeName = ini.IsSaving() && (InstallationMode==InstallMode_Portable);
ini.Entry( L"BIOS", Bios, pc );
for( int i=0; i<PluginId_Count; ++i )
{
if ( needRelativeName )
ini.Entry( tbl_PluginInfo[i].GetShortname(), wxFileName( Plugins[i].GetFullName() ), pc );
else
ini.Entry( tbl_PluginInfo[i].GetShortname(), Plugins[i], pc );
}
if( needRelativeName )
ini.Entry( L"BIOS", wxFileName( Bios.GetFullName() ), pc );
else
ini.Entry( L"BIOS", Bios, pc );
}
// ------------------------------------------------------------------------

View File

@ -149,8 +149,11 @@ void DBLoaderHelper::ReadGames()
// AppGameDatabase (implementations)
// --------------------------------------------------------------------------------------
AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& file, const wxString& key )
AppGameDatabase& AppGameDatabase::LoadFromFile(wxString file, const wxString& key )
{
if( wxFileName(file).IsRelative() )
file = (InstallFolder + file).GetFullPath();
if (!wxFileExists(file))
{
Console.Error(L"(GameDB) Database Not Found! [%s]", file.c_str());
@ -179,6 +182,7 @@ AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& file, const wxStr
}
// Saves changes to the database
void AppGameDatabase::SaveToFile(const wxString& file) {
wxFFileOutputStream writer( file );
pxWriteMultiline(writer, header);

View File

@ -51,7 +51,7 @@ public:
Console.WriteLn( "(GameDB) Unloading..." );
}
AppGameDatabase& LoadFromFile(const wxString& file = L"GameIndex.dbf", const wxString& key = L"Serial" );
AppGameDatabase& LoadFromFile(wxString file = L"GameIndex.dbf", const wxString& key = L"Serial" );
void SaveToFile(const wxString& file = L"GameIndex.dbf");
};