reduce the number of tiny files in the top directory

This commit is contained in:
Glenn Maynard
2003-01-18 03:54:41 +00:00
parent 27580e0174
commit 14461051c4
2 changed files with 20 additions and 18 deletions
+9 -8
View File
@@ -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; i<MAX_GAME_CONTROLLERS; i++ )
@@ -124,7 +125,7 @@ void InputMapper::SaveMappingsToDisk()
sValueString = ssprintf( "%s,%s,%s",
m_GItoDI[i][j][0].toString().GetString(), m_GItoDI[i][j][1].toString().GetString(), m_GItoDI[i][j][2].toString().GetString() );
ini.SetValue( "Input", sNameString, sValueString );
ini.SetValue( GAMESTATE->GetCurrentGameDef()->m_szName, sNameString, sValueString );
}
}
+11 -10
View File
@@ -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();
}