diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index b64f0e41d0..e8120497ea 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -83,6 +83,8 @@ char **g_argv = NULL; static bool g_bHasFocus = true; static bool g_bQuitting = false; +void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ); + static RageDisplay::VideoModeParams GetCurVideoModeParams() { return RageDisplay::VideoModeParams( @@ -275,8 +277,6 @@ void ExitGame() void ResetGame( bool ReturnToFirstScreen ) { - ReadGamePrefsFromDisk(); - GAMESTATE->Reset(); if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) ) @@ -759,10 +759,15 @@ void ChangeCurrentGame( const Game* g ) 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 ); /* Save the newly-selected game. */ SaveGamePrefsToDisk(); + + /* Load keymaps for the new game. */ + INPUTMAPPER->ReadMappingsFromDisk(); } void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ) @@ -792,11 +797,12 @@ void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ) LOG->Warn( "Default note skin for \"%s\" missing, reverting to \"%s\"", GAMESTATE->m_pCurGame->m_szName, GAMEMAN->GetDefaultGame()->m_szName ); GAMESTATE->m_pCurGame = GAMEMAN->GetDefaultGame(); - - /* Load key maps for the new game. */ - INPUTMAPPER->ReadMappingsFromDisk(); } + /* Load keymaps for the new game. */ + if( INPUTMAPPER ) + INPUTMAPPER->ReadMappingsFromDisk(); + /* If the default isn't available, our default note skin is messed up. */ if( !GAMEMAN->IsGameEnabled( GAMESTATE->m_pCurGame ) ) RageException::Throw( "Default note skin for \"%s\" missing", GAMESTATE->m_pCurGame->m_szName ); @@ -1095,8 +1101,8 @@ int main(int argc, char* argv[]) ANNOUNCER = new AnnouncerManager; NOTESKIN = new NoteSkinManager; - /* Set up the theme and announcer. */ - ReadGamePrefsFromDisk(); + /* Set up the theme and announcer, and switch to the last game type. */ + ReadGamePrefsFromDisk( true ); { /* Now that THEME is loaded, load the icon for the current theme into the diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 915e32103f..61c0288772 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -12,7 +12,6 @@ void ApplyGraphicOptions(); void NORETURN HandleException( CString error ); void ExitGame(); void ResetGame( bool ReturnToFirstScreen=true ); -void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame=true ); void SaveGamePrefsToDisk(); void ChangeCurrentGame( const Game* g ); void FocusChanged( bool bHasFocus );