From 14461051c4ae3b05626f67f12ba382e3312fcc8c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 18 Jan 2003 03:54:41 +0000 Subject: [PATCH] reduce the number of tiny files in the top directory --- stepmania/src/InputMapper.cpp | 17 +++++++++-------- stepmania/src/PrefsManager.cpp | 21 +++++++++++---------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index e53c4625ff..1916781166 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -69,13 +69,12 @@ void InputMapper::ReadMappingsFromDisk() ClearAllMappings(); - CString sPath = GAMESTATE->GetCurrentGameDef()->m_szName + CString("Map.ini"); IniFile ini; - ini.SetPath( sPath ); + ini.SetPath( "Keymaps.ini" ); if( !ini.ReadFile() ) - LOG->Warn( "could not input mapping file '%s'.", sPath.GetString() ); + LOG->Warn( "could not input mapping file \"Keymaps.ini"\"." ); - const IniFile::key *Key = ini.GetKey( "Input" ); + const IniFile::key *Key = ini.GetKey( GAMESTATE->GetCurrentGameDef()->m_szName ); if( Key ) { @@ -108,9 +107,11 @@ void InputMapper::ReadMappingsFromDisk() void InputMapper::SaveMappingsToDisk() { IniFile ini; - ini.SetPath( GAMESTATE->GetCurrentGameDef()->m_szName + CString("Map.ini") ); -// ini.ReadFile(); // don't read the file so that we overwrite everything there - + ini.SetPath( "Keymaps.ini" ); + ini.ReadFile(); + + // erase the key so that we overwrite everything for this game + ini.DeleteKey( GAMESTATE->GetCurrentGameDef()->m_szName ); // iterate over our input map and write all mappings to the ini file for( int i=0; iGetCurrentGameDef()->m_szName, sNameString, sValueString ); } } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 51d5bbeda9..9263800fb3 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -73,7 +73,7 @@ PrefsManager::PrefsManager() m_bChangeBannersWhenFast = false; m_bEasterEggs = true; m_bMarvelousTiming = true; - + /* I'd rather get occasional people asking for support for this even though it's * already here than lots of people asking why songs aren't being displayed. */ m_bHiddenSongs = false; @@ -195,7 +195,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValueB( "Options", "EasterEggs", m_bEasterEggs ); ini.SetValueB( "Options", "MarvelousTiming", m_bMarvelousTiming ); - /* Only write this if it's been changed. This ensures that we can change + /* Only write these if they aren't the default. This ensures that we can change * the default and have it take effect for everyone (except people who * tweaked this value). */ if(m_bSoundDrivers != DEFAULT_SOUND_DRIVER_LIST) @@ -218,15 +218,15 @@ void PrefsManager::ReadGamePrefsFromDisk() CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; IniFile ini; - ini.SetPath( sGameName+"Prefs.ini" ); + ini.SetPath( "GamePrefs.ini" ); ini.ReadFile(); // it's OK if this fails CString sAnnouncer = sGameName, sTheme = sGameName, sNoteSkin = sGameName; // if these calls fail, the three strings will keep the initial values set above. - ini.GetValue( "Options", "Announcer", sAnnouncer ); - ini.GetValue( "Options", "Theme", sTheme ); - ini.GetValue( "Options", "NoteSkin", sNoteSkin ); + ini.GetValue( sGameName, "Announcer", sAnnouncer ); + ini.GetValue( sGameName, "Theme", sTheme ); + ini.GetValue( sGameName, "NoteSkin", sNoteSkin ); // it's OK to call these functions with names that don't exist. ANNOUNCER->SwitchAnnouncer( sAnnouncer ); @@ -241,11 +241,12 @@ void PrefsManager::SaveGamePrefsToDisk() CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; IniFile ini; - ini.SetPath( sGameName+"Prefs.ini" ); + ini.SetPath( "GamePrefs.ini" ); + ini.ReadFile(); // it's OK if this fails - ini.SetValue( "Options", "Announcer", ANNOUNCER->GetCurAnnouncerName() ); - ini.SetValue( "Options", "Theme", THEME->GetCurThemeName() ); - ini.SetValue( "Options", "NoteSkin", GAMEMAN->GetCurNoteSkin() ); + ini.SetValue( sGameName, "Announcer", ANNOUNCER->GetCurAnnouncerName() ); + ini.SetValue( sGameName, "Theme", THEME->GetCurThemeName() ); + ini.SetValue( sGameName, "NoteSkin", GAMEMAN->GetCurNoteSkin() ); ini.WriteFile(); }