void AppConfig::FilenameOptions::LoadSave( IniInterface& ini ) { ScopedIniGroup path( ini, L"Filenames" ); static const wxFileName pc( L"Please Configure" ); //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) //note: this will break if converting from install to portable, and custom folders are used. We can live with that. bool needRelativeName = ini.IsSaving() && IsPortable(); for( int i=0; i<PluginId_Count; ++i ) { if ( needRelativeName ) { wxFileName plugin_filename = wxFileName( Plugins[i].GetFullName() ); ini.Entry( tbl_PluginInfo[i].GetShortname(), plugin_filename, pc ); } else ini.Entry( tbl_PluginInfo[i].GetShortname(), Plugins[i], pc ); } if( needRelativeName ) { wxFileName bios_filename = wxFileName( Bios.GetFullName() ); ini.Entry( L"BIOS", bios_filename, pc ); } else ini.Entry( L"BIOS", Bios, pc ); }
void AppConfig::LoadSaveRootItems( IniInterface& ini ) { IniEntry( MainGuiPosition ); IniEntry( SysSettingsTabName ); IniEntry( McdSettingsTabName ); IniEntry( ComponentsTabName ); IniEntry( AppSettingsTabName ); IniEntry( GameDatabaseTabName ); ini.EnumEntry( L"LanguageId", LanguageId, NULL, LanguageId ); IniEntry( LanguageCode ); IniEntry( RecentIsoCount ); IniEntry( GzipIsoIndexTemplate ); IniEntry( DeskTheme ); IniEntry( Listbook_ImageSize ); IniEntry( Toolbar_ImageSize ); IniEntry( Toolbar_ShowLabels ); wxFileName res(CurrentIso); ini.Entry( L"CurrentIso", res, res, ini.IsLoading() || IsPortable() ); CurrentIso = res.GetFullPath(); IniEntry( CurrentELF ); IniEntry( EnableSpeedHacks ); IniEntry( EnableGameFixes ); IniEntry( EnablePresets ); IniEntry( PresetIndex ); #ifdef __WXMSW__ IniEntry( McdCompressNTFS ); #endif ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, CdvdSource ); }
void RecentIsoManager::AppStatusEvent_OnUiSettingsLoadSave( const AppSettingsEventInfo& evt ) { IniInterface& ini( evt.GetIni() ); if( ini.IsSaving() ) { // Wipe existing recent iso list if we're saving, because our size might have changed // and that could leave some residual entries in the config. ini.GetConfig().SetRecordDefaults( false ); ini.GetConfig().DeleteGroup( L"RecentIso" ); ScopedIniGroup groupie( ini, L"RecentIso" ); int cnt = m_Items.size(); for( int i=0; i<cnt; ++i ) { wxFileName item_filename = wxFileName(m_Items[i].Filename); ini.Entry( pxsFmt( L"Filename%02d", i ), item_filename, wxFileName(L""), IsPortable()); } ini.GetConfig().SetRecordDefaults( true ); } else { LoadListFrom(ini); } }
void VolumePassword::Set (const byte *password, size_t size) { AllocateBuffer (); if (size > MaxSize) throw PasswordTooLong (SRC_POS); PasswordBuffer.CopyFrom (ConstBufferPtr (password, size)); PasswordSize = size; Unportable = !IsPortable(); }
void AppConfig::FolderOptions::LoadSave( IniInterface& ini ) { ScopedIniGroup path( ini, L"Folders" ); if( ini.IsSaving() ) { ApplyDefaults(); } IniBitBool( UseDefaultBios ); IniBitBool( UseDefaultSnapshots ); IniBitBool( UseDefaultSavestates ); IniBitBool( UseDefaultMemoryCards ); IniBitBool( UseDefaultLogs ); IniBitBool( UseDefaultLangs ); IniBitBool( UseDefaultPluginsFolder ); IniBitBool( UseDefaultCheats ); IniBitBool( UseDefaultCheatsWS ); //when saving in portable mode, we save relative paths if possible // --> on load, these relative paths will be expanded relative to the exe folder. bool rel = ( ini.IsLoading() || IsPortable() ); IniEntryDirFile( Bios, rel); IniEntryDirFile( Snapshots, rel ); IniEntryDirFile( Savestates, rel ); IniEntryDirFile( MemoryCards, rel ); IniEntryDirFile( Logs, rel ); IniEntryDirFile( Langs, rel ); IniEntryDirFile( Cheats, rel ); IniEntryDirFile( CheatsWS, rel ); ini.Entry( L"PluginsFolder", PluginsFolder, InstallFolder + PathDefs::Base::Plugins(), rel ); IniEntryDirFile( RunIso, rel ); IniEntryDirFile( RunELF, rel ); if( ini.IsLoading() ) { ApplyDefaults(); for( int i=0; i<FolderId_COUNT; ++i ) operator[]( (FoldersEnum_t)i ).Normalize(); } }
void VolumePassword::CheckPortability () const { if (Unportable || !IsPortable()) throw UnportablePassword (SRC_POS); }