From 5d7885c764dc37d3804fb100d04d72184a943e94 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 27 Oct 2005 04:54:45 +0000 Subject: [PATCH] move game prefs into PrefsManager --- stepmania/src/CodeDetector.cpp | 2 +- stepmania/src/GameCommand.cpp | 4 +- stepmania/src/GameState.cpp | 8 ++-- stepmania/src/PrefsManager.cpp | 55 +++++++++++++++------- stepmania/src/PrefsManager.h | 30 +++++++++--- stepmania/src/ScreenDebugOverlay.cpp | 2 +- stepmania/src/ScreenJukebox.cpp | 4 +- stepmania/src/ScreenManager.cpp | 2 +- stepmania/src/ScreenOptionsMaster.cpp | 3 +- stepmania/src/ScreenOptionsMasterPrefs.cpp | 10 ++-- stepmania/src/ScreenPlayerOptions.cpp | 2 +- stepmania/src/ScreenSMOnlineLogin.cpp | 2 +- stepmania/src/SongOptions.cpp | 2 +- stepmania/src/StepMania.cpp | 54 +++++---------------- stepmania/src/StepMania.h | 1 - 15 files changed, 95 insertions(+), 86 deletions(-) diff --git a/stepmania/src/CodeDetector.cpp b/stepmania/src/CodeDetector.cpp index a2b320d901..4a5070fc61 100644 --- a/stepmania/src/CodeDetector.cpp +++ b/stepmania/src/CodeDetector.cpp @@ -253,7 +253,7 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller ) case CODE_MINES: TOGGLE( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES], true, false ); break; case CODE_DARK: FLOAT_TOGGLE( po.m_fDark ); break; case CODE_CANCEL_ALL: po.Init(); - po.FromString( PREFSMAN->m_sDefaultModifiers ); break; + po.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); break; case CODE_HIDDEN: TOGGLE_HIDDEN; break; case CODE_RANDOMVANISH: TOGGLE_RANDOMVANISH; break; diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index a2f86156cc..1a2b6d693a 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -1103,8 +1103,8 @@ void GameCommand::ApplySelf( const vector &vpns ) const if( m_bApplyDefaultOptions ) { FOREACH_PlayerNumber( p ) - GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers ); - GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers ); + GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); + GAMESTATE->m_SongOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); } // HACK: Set life type to BATTERY just once here so it happens once and // we don't override the user's changes if they back out. diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index fdb6cac5a4..e780172bd4 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -244,7 +244,7 @@ void GameState::Reset() // could be done in the title menu GameCommand, but then it wouldn't // affect demo, and other non-gameplay things ...) -glenn ApplyModifiers( p, DEFAULT_MODIFIERS ); - ApplyModifiers( p, PREFSMAN->m_sDefaultModifiers ); + ApplyModifiers( p, PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); } FOREACH_PlayerNumber(p) @@ -1036,10 +1036,10 @@ void GameState::ResetCurrentOptions() FOREACH_PlayerNumber( p ) { m_pPlayerState[p]->m_PlayerOptions.Init(); - m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers ); + m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); } m_SongOptions.Init(); - m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers ); + m_SongOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); } bool GameState::IsDisqualified( PlayerNumber pn ) @@ -1887,7 +1887,7 @@ bool GameState::IsSyncDataChanged() void GameState::SaveSyncChanges() { GAMESTATE->m_pCurSong->Save(); - PREFSMAN->SaveGlobalPrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); ResetOriginalSyncData(); } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 17abc5fead..85c200d3d9 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -12,9 +12,9 @@ #include "Preference.h" #include "RageLog.h" -#define DEFAULTS_INI_PATH "Data/Defaults.ini" // these can be overridden -#define STEPMANIA_INI_PATH "Data/" PRODUCT_NAME ".ini" // overlay on Defaults.ini, contains the user's choices -#define STATIC_INI_PATH "Data/Static.ini" // overlay on the 2 above, can't be overridden +const CString DEFAULTS_INI_PATH = "Data/Defaults.ini"; // these can be overridden +const CString STEPMANIA_INI_PATH = "Data/" PRODUCT_NAME ".ini"; // overlay on Defaults.ini, contains the user's choices +const CString STATIC_INI_PATH = "Data/Static.ini"; // overlay on the 2 above, can't be overridden PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program @@ -241,7 +241,8 @@ void MemoryCardUsbLevelInit( size_t /*PlayerNumber*/ i, CString &sNameOut, int & PrefsManager::PrefsManager() : - m_bWindowed ( "Windowed", TRUE_IF_DEBUG), + m_sCurrentGame ( "CurrentGame", "" ), + m_bWindowed ( "Windowed", TRUE_IF_DEBUG ), m_iDisplayWidth ( "DisplayWidth", 640 ), m_iDisplayHeight ( "DisplayHeight", 480 ), m_iDisplayColorDepth ( "DisplayColorDepth", 16 ), @@ -421,10 +422,7 @@ PrefsManager::PrefsManager() : m_bShowLogOutput ( "ShowLogOutput", false ), m_bLogSkips ( "LogSkips", false ), m_bLogCheckpoints ( "LogCheckpoints", false ), - m_bShowLoadingWindow ( "ShowLoadingWindow", true ), - - /* Game-specific prefs: */ - m_sDefaultModifiers ( "DefaultModifiers", "" ) + m_bShowLoadingWindow ( "ShowLoadingWindow", true ) #if defined(XBOX) , @@ -442,7 +440,7 @@ PrefsManager::PrefsManager() : { Init(); - ReadGlobalPrefsFromDisk(); + ReadPrefsFromDisk(); } #undef TRUE_IF_DEBUG @@ -456,7 +454,7 @@ PrefsManager::~PrefsManager() { } -void PrefsManager::ReadGlobalPrefsFromDisk() +void PrefsManager::ReadPrefsFromDisk() { ReadPrefsFromFile( DEFAULTS_INI_PATH ); ReadPrefsFromFile( STEPMANIA_INI_PATH ); @@ -470,7 +468,7 @@ void PrefsManager::ResetToFactoryDefaults() ReadPrefsFromFile( DEFAULTS_INI_PATH ); ReadPrefsFromFile( STATIC_INI_PATH ); - SaveGlobalPrefsToDisk(); + SavePrefsToDisk(); } void PrefsManager::ReadPrefsFromFile( CString sIni ) @@ -479,10 +477,12 @@ void PrefsManager::ReadPrefsFromFile( CString sIni ) if( !ini.ReadFile(sIni) ) return; - ReadGlobalPrefsFromIni( ini ); + ReadPrefsFromIni( ini ); } -void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini ) +static const CString GAME_SECTION_PREFIX = "Game-"; + +void PrefsManager::ReadPrefsFromIni( const IniFile &ini ) { FOREACHS_CONST( IPreference*, *SubscriptionManager::s_pSubscribers, p ) (*p)->ReadFrom( ini ); @@ -492,19 +492,42 @@ void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini ) FOREACH_PlayerNumber( pn ) m_sMemoryCardOsMountPoint[pn].Set( FixSlashes(m_sMemoryCardOsMountPoint[pn]) ); m_BackgroundMode.Set( (BackgroundMode)clamp((int)m_BackgroundMode.Get(),0,(int)NUM_BackgroundMode-1) ); + + + FOREACH_CONST_Child( &ini, section ) + { + if( !BeginsWith(section->m_sName, GAME_SECTION_PREFIX) ) + continue; + + CString sGame = section->m_sName.Right( section->m_sName.length() - GAME_SECTION_PREFIX.length() ); + GamePrefs &gp = m_mapGameNameToGamePrefs[ sGame ]; + + ini.GetValue( section->m_sName, "Announcer", gp.m_sAnnouncer ); + ini.GetValue( section->m_sName, "Theme", gp.m_sTheme ); + ini.GetValue( section->m_sName, "DefaultModifiers", gp.m_sDefaultModifiers ); + } } -void PrefsManager::SaveGlobalPrefsToDisk() const +void PrefsManager::SavePrefsToDisk() const { IniFile ini; - SaveGlobalPrefsToIni( ini ); + SavePrefsToIni( ini ); ini.WriteFile( STEPMANIA_INI_PATH ); } -void PrefsManager::SaveGlobalPrefsToIni( IniFile &ini ) const +void PrefsManager::SavePrefsToIni( IniFile &ini ) const { FOREACHS_CONST( IPreference*, *SubscriptionManager::s_pSubscribers, p ) (*p)->WriteTo( ini ); + + FOREACHM_CONST( CString, GamePrefs, m_mapGameNameToGamePrefs, iter ) + { + CString sSection = "Game-" + CString( iter->first ); + + ini.SetValue( sSection, "Announcer", iter->second.m_sAnnouncer ); + ini.SetValue( sSection, "Theme", iter->second.m_sTheme ); + ini.SetValue( sSection, "DefaultModifiers", iter->second.m_sDefaultModifiers ); + } } // wrappers diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 56c972dc7a..9914a8d4ce 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -21,6 +21,7 @@ public: void Init(); + Preference m_sCurrentGame; Preference m_bWindowed; Preference m_iDisplayWidth; Preference m_iDisplayHeight; @@ -249,9 +250,6 @@ public: Preference m_bLogCheckpoints; Preference m_bShowLoadingWindow; - /* Game-specific prefs: */ - Preference m_sDefaultModifiers; - #if defined(XBOX) // Virtual memory preferences Preference m_bEnableVirtualMemory; @@ -275,11 +273,11 @@ public: CString GetLightsDriver(); - void ReadGlobalPrefsFromIni( const IniFile &ini ); - void SaveGlobalPrefsToIni( IniFile &ini ) const; + void ReadPrefsFromIni( const IniFile &ini ); + void SavePrefsToIni( IniFile &ini ) const; - void ReadGlobalPrefsFromDisk(); - void SaveGlobalPrefsToDisk() const; + void ReadPrefsFromDisk(); + void SavePrefsToDisk() const; void ResetToFactoryDefaults(); @@ -289,6 +287,24 @@ public: static void Subscribe( IPreference *p ); static void Unsubscribe( IPreference *p ); + + // + // Non-self-registering prefs + // + struct GamePrefs + { + CString m_sAnnouncer; + CString m_sTheme; + CString m_sDefaultModifiers; + }; + map m_mapGameNameToGamePrefs; + + GamePrefs &GetCurrentGamePrefs() { return m_mapGameNameToGamePrefs[m_sCurrentGame]; } // inserts if not already present + + void SaveGamePrefsToDisk(); + void ReadGamePrefsFromDisk(); + + // Lua void PushSelf( lua_State *L ); diff --git a/stepmania/src/ScreenDebugOverlay.cpp b/stepmania/src/ScreenDebugOverlay.cpp index 19bd9e5b22..5ab68a2594 100644 --- a/stepmania/src/ScreenDebugOverlay.cpp +++ b/stepmania/src/ScreenDebugOverlay.cpp @@ -633,7 +633,7 @@ class DebugLineWritePreferences : public IDebugLine virtual bool IsEnabled() { return true; } virtual void Do( CString &sMessageOut ) { - PREFSMAN->SaveGlobalPrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); IDebugLine::Do( sMessageOut ); } }; diff --git a/stepmania/src/ScreenJukebox.cpp b/stepmania/src/ScreenJukebox.cpp index 207fccdaa0..aacbf1e063 100644 --- a/stepmania/src/ScreenJukebox.cpp +++ b/stepmania/src/ScreenJukebox.cpp @@ -214,13 +214,13 @@ void ScreenJukebox::Init() if( GAMESTATE->m_bJukeboxUsesModifiers ) { GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.Init(); - GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers ); + GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.ChooseRandomModifiers(); } } GAMESTATE->m_SongOptions.Init(); - GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers ); + GAMESTATE->m_SongOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF; diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index b239373f23..88d25aa73f 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -688,7 +688,7 @@ void ScreenManager::LoadDelayedScreen() // If we're exiting a system menu, persist settings in case we don't exit normally if( bWasOnSystemMenu && !bIsOnSystemMenu ) - PREFSMAN->SaveGlobalPrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); if( bTimeToDeleteScreens ) DeletePreparedScreens(); diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index 389429fd88..aee76f28f6 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -201,8 +201,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM ) { /* Save preferences. */ LOG->Trace("ROW_CONFIG used; saving ..."); - PREFSMAN->SaveGlobalPrefsToDisk(); - SaveGamePrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); } if( m_iChangeMask & OPT_RESET_GAME ) diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index bb0155d7e6..5b7190f1e1 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -18,8 +18,8 @@ static void GetDefaultModifiers( PlayerOptions &po, SongOptions &so ) { - po.FromString( PREFSMAN->m_sDefaultModifiers ); - so.FromString( PREFSMAN->m_sDefaultModifiers ); + po.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); + so.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); } static void SetDefaultModifiers( const PlayerOptions &po, const SongOptions &so ) @@ -30,7 +30,7 @@ static void SetDefaultModifiers( const PlayerOptions &po, const SongOptions &so if( so.GetString() != "" ) as.push_back( so.GetString() ); - PREFSMAN->m_sDefaultModifiers.Set( join(", ",as) ); + PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers = join( ", ",as ); } template @@ -238,7 +238,7 @@ static void DefaultNoteSkin( int &sel, bool ToSel, const ConfOption *pConfOption if( ToSel ) { PlayerOptions po; - po.FromString( PREFSMAN->m_sDefaultModifiers ); + po.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); sel = 0; for( unsigned i=0; i < choices.size(); i++ ) if( !stricmp(choices[i], po.m_sNoteSkin) ) @@ -397,7 +397,7 @@ static void DefaultFailType( int &sel, bool ToSel, const ConfOption *pConfOption if( ToSel ) { SongOptions so; - so.FromString( PREFSMAN->m_sDefaultModifiers ); + so.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); sel = so.m_FailType; } else diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 0040654e93..a5ee4a8fb2 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -99,7 +99,7 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input ) // apply the game default mods, but not the Profile saved mods GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Init(); - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers ); + GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); MESSAGEMAN->Broadcast( ssprintf("CancelAllP%i", pn+1) ); diff --git a/stepmania/src/ScreenSMOnlineLogin.cpp b/stepmania/src/ScreenSMOnlineLogin.cpp index f19fdb9e01..8f3073553d 100644 --- a/stepmania/src/ScreenSMOnlineLogin.cpp +++ b/stepmania/src/ScreenSMOnlineLogin.cpp @@ -131,7 +131,7 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) for( unsigned r=0; rSaveGlobalPrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); FOREACH_EnabledPlayer(pn) { PROFILEMAN->LoadLocalProfileFromMachine((PlayerNumber) pn); diff --git a/stepmania/src/SongOptions.cpp b/stepmania/src/SongOptions.cpp index 5087c1ffe8..18bd0c0813 100644 --- a/stepmania/src/SongOptions.cpp +++ b/stepmania/src/SongOptions.cpp @@ -125,7 +125,7 @@ void SongOptions::FromString( CString sOptions ) { SongOptions so; // TODO: Fix this so that SongOptions don't depend on PrefsManager - so.FromString( PREFSMAN->m_sDefaultModifiers ); + so.FromString( PREFSMAN->GetCurrentGamePrefs().m_sDefaultModifiers ); m_FailType = so.m_FailType; } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 11de7312e9..278311f332 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -286,8 +286,6 @@ void ResetGame() THEME->SwitchThemeAndLanguage( "default", THEME->GetCurLanguage() ); TEXTUREMAN->DoDelayedDelete(); } - SaveGamePrefsToDisk(); - // // update last seen joysticks @@ -310,6 +308,8 @@ void ResetGame() PREFSMAN->m_sLastSeenInputDevices.Set( sInputDevices ); } + + PREFSMAN->SavePrefsToDisk(); } @@ -382,7 +382,7 @@ static void CheckSettings() * systems. */ PREFSMAN->m_BannerCache.Set( LowMemory ? PrefsManager::BNCACHE_OFF:PrefsManager::BNCACHE_LOW_RES_PRELOAD ); - PREFSMAN->SaveGlobalPrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); #endif } @@ -739,24 +739,22 @@ RageDisplay *CreateDisplay() RageException::Throw( error ); } -#define GAMEPREFS_INI_PATH "Data/GamePrefs.ini" #define STATIC_INI_PATH "Data/Static.ini" void ChangeCurrentGame( const Game* g ) { ASSERT( g ); - SaveGamePrefsToDisk(); INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game GAMESTATE->m_pCurGame = g; /* Load this game's preferences. If we just set an unavailable game type, this * will change it back to the default. */ - ReadGamePrefsFromDisk( false ); + PREFSMAN->m_sCurrentGame.Set( g->m_szName ); /* Save the newly-selected game. */ - SaveGamePrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); /* Load keymaps for the new game. */ INPUTMAPPER->ReadMappingsFromDisk(); @@ -769,17 +767,13 @@ void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ) ASSERT( THEME ); ASSERT( GAMESTATE ); - IniFile ini; - ini.ReadFile( GAMEPREFS_INI_PATH ); // it's OK if this fails - ini.ReadFile( STATIC_INI_PATH ); // it's OK if this fails, too - if( bSwitchToLastPlayedGame ) { ASSERT( GAMEMAN != NULL ); CString sGame; GAMESTATE->m_pCurGame = NULL; - if( ini.GetValue("Options", "Game", sGame) ) - GAMESTATE->m_pCurGame = GAMEMAN->StringToGameType( sGame ); + if( !PREFSMAN->m_sCurrentGame.Get().empty() ) + GAMESTATE->m_pCurGame = GAMEMAN->StringToGameType( PREFSMAN->m_sCurrentGame ); } /* If the active game type isn't actually available, revert to the default. */ @@ -805,40 +799,19 @@ void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ) CString sGameName = GAMESTATE->GetCurrentGame()->m_szName; CString sAnnouncer = sGameName; CString sTheme = sGameName; - CString sNoteSkin = sGameName; - CString sDefaultModifiers; // if these calls fail, the three strings will keep the initial values set above. - ini.GetValue( sGameName, "Announcer", sAnnouncer ); - ini.GetValue( sGameName, "Theme", sTheme ); - ini.GetValue( sGameName, "DefaultModifiers", sDefaultModifiers ); - PREFSMAN->m_sDefaultModifiers.Set( sDefaultModifiers ); + if( !PREFSMAN->GetCurrentGamePrefs().m_sAnnouncer.empty() ) + sAnnouncer = PREFSMAN->GetCurrentGamePrefs().m_sAnnouncer; + if( !PREFSMAN->GetCurrentGamePrefs().m_sTheme.empty() ) + sTheme = PREFSMAN->GetCurrentGamePrefs().m_sTheme; // it's OK to call these functions with names that don't exist. ANNOUNCER->SwitchAnnouncer( sAnnouncer ); THEME->SwitchThemeAndLanguage( sTheme, PREFSMAN->m_sLanguage ); - -// NOTESKIN->SwitchNoteSkin( sNoteSkin ); } -void SaveGamePrefsToDisk() -{ - if( !GAMESTATE ) - return; - - CString sGameName = GAMESTATE->GetCurrentGame()->m_szName; - IniFile ini; - ini.ReadFile( GAMEPREFS_INI_PATH ); // it's OK if this fails - - ini.SetValue( sGameName, "Announcer", ANNOUNCER->GetCurAnnouncerName() ); - ini.SetValue( sGameName, "Theme", THEME->GetCurThemeName() ); - ini.SetValue( sGameName, "DefaultModifiers", PREFSMAN->m_sDefaultModifiers ); - ini.SetValue( "Options", "Game", (CString)GAMESTATE->GetCurrentGame()->m_szName ); - - ini.WriteFile( GAMEPREFS_INI_PATH ); -} - static void MountTreeOfZips( const CString &dir ) { vector dirs; @@ -1037,7 +1010,7 @@ int main(int argc, char* argv[]) /* One of the above filesystems might contain files that affect preferences, eg Data/Static.ini. * Re-read preferences. */ - PREFSMAN->ReadGlobalPrefsFromDisk(); + PREFSMAN->ReadPrefsFromDisk(); ApplyLogPreferences(); #if defined(HAVE_SDL) @@ -1174,8 +1147,7 @@ int main(int argc, char* argv[]) /* If we ended mid-game, finish up. */ GAMESTATE->EndGame(); - PREFSMAN->SaveGlobalPrefsToDisk(); - SaveGamePrefsToDisk(); + PREFSMAN->SavePrefsToDisk(); ShutdownGame(); diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 06a7ed8109..bf23dce310 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -13,7 +13,6 @@ void ApplyGraphicOptions(); void NORETURN HandleException( CString error ); void ExitGame(); void ResetGame(); -void SaveGamePrefsToDisk(); void ChangeCurrentGame( const Game* g ); void FocusChanged( bool bHasFocus ); bool AppHasFocus();