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
+8 -7
View File
@@ -69,13 +69,12 @@ void InputMapper::ReadMappingsFromDisk()
ClearAllMappings(); ClearAllMappings();
CString sPath = GAMESTATE->GetCurrentGameDef()->m_szName + CString("Map.ini");
IniFile ini; IniFile ini;
ini.SetPath( sPath ); ini.SetPath( "Keymaps.ini" );
if( !ini.ReadFile() ) 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 ) if( Key )
{ {
@@ -108,9 +107,11 @@ void InputMapper::ReadMappingsFromDisk()
void InputMapper::SaveMappingsToDisk() void InputMapper::SaveMappingsToDisk()
{ {
IniFile ini; IniFile ini;
ini.SetPath( GAMESTATE->GetCurrentGameDef()->m_szName + CString("Map.ini") ); ini.SetPath( "Keymaps.ini" );
// ini.ReadFile(); // don't read the file so that we overwrite everything there 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 // iterate over our input map and write all mappings to the ini file
for( int i=0; i<MAX_GAME_CONTROLLERS; i++ ) for( int i=0; i<MAX_GAME_CONTROLLERS; i++ )
@@ -124,7 +125,7 @@ void InputMapper::SaveMappingsToDisk()
sValueString = ssprintf( "%s,%s,%s", 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() ); 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 );
} }
} }
+10 -9
View File
@@ -195,7 +195,7 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValueB( "Options", "EasterEggs", m_bEasterEggs ); ini.SetValueB( "Options", "EasterEggs", m_bEasterEggs );
ini.SetValueB( "Options", "MarvelousTiming", m_bMarvelousTiming ); 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 * the default and have it take effect for everyone (except people who
* tweaked this value). */ * tweaked this value). */
if(m_bSoundDrivers != DEFAULT_SOUND_DRIVER_LIST) if(m_bSoundDrivers != DEFAULT_SOUND_DRIVER_LIST)
@@ -218,15 +218,15 @@ void PrefsManager::ReadGamePrefsFromDisk()
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
IniFile ini; IniFile ini;
ini.SetPath( sGameName+"Prefs.ini" ); ini.SetPath( "GamePrefs.ini" );
ini.ReadFile(); // it's OK if this fails ini.ReadFile(); // it's OK if this fails
CString sAnnouncer = sGameName, sTheme = sGameName, sNoteSkin = sGameName; CString sAnnouncer = sGameName, sTheme = sGameName, sNoteSkin = sGameName;
// if these calls fail, the three strings will keep the initial values set above. // if these calls fail, the three strings will keep the initial values set above.
ini.GetValue( "Options", "Announcer", sAnnouncer ); ini.GetValue( sGameName, "Announcer", sAnnouncer );
ini.GetValue( "Options", "Theme", sTheme ); ini.GetValue( sGameName, "Theme", sTheme );
ini.GetValue( "Options", "NoteSkin", sNoteSkin ); ini.GetValue( sGameName, "NoteSkin", sNoteSkin );
// it's OK to call these functions with names that don't exist. // it's OK to call these functions with names that don't exist.
ANNOUNCER->SwitchAnnouncer( sAnnouncer ); ANNOUNCER->SwitchAnnouncer( sAnnouncer );
@@ -241,11 +241,12 @@ void PrefsManager::SaveGamePrefsToDisk()
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
IniFile ini; 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( sGameName, "Announcer", ANNOUNCER->GetCurAnnouncerName() );
ini.SetValue( "Options", "Theme", THEME->GetCurThemeName() ); ini.SetValue( sGameName, "Theme", THEME->GetCurThemeName() );
ini.SetValue( "Options", "NoteSkin", GAMEMAN->GetCurNoteSkin() ); ini.SetValue( sGameName, "NoteSkin", GAMEMAN->GetCurNoteSkin() );
ini.WriteFile(); ini.WriteFile();
} }