add InputDevice::DevicesChanged

This commit is contained in:
Chris Danford
2005-12-18 03:08:12 +00:00
parent 3b9479e271
commit c95a5dc8e5
8 changed files with 147 additions and 96 deletions
+17 -3
View File
@@ -289,6 +289,13 @@ void StepMania::ResetGame()
TEXTUREMAN->DoDelayedDelete();
}
PREFSMAN->SavePrefsToDisk();
CheckForChangedInputDevicesAndRemap();
}
void StepMania::CheckForChangedInputDevicesAndRemap()
{
//
// update last seen joysticks
//
@@ -299,22 +306,27 @@ void StepMania::ResetGame()
if( PREFSMAN->m_sLastSeenInputDevices.Get() != sInputDevices )
{
LOG->Info( "Input devices changed from '%s' to '%s'.", PREFSMAN->m_sLastSeenInputDevices.Get().c_str(), sInputDevices.c_str() );
CString sMessage = ssprintf(
"Input devices changed from '%s' to '%s'.",
PREFSMAN->m_sLastSeenInputDevices.Get().c_str(),
sInputDevices.c_str() );
if( PREFSMAN->m_bAutoMapOnJoyChange )
{
LOG->Info( "Remapping joysticks." );
sMessage += "\nRemapping joysticks.";
INPUTMAPPER->AutoMapJoysticksForCurrentGame();
INPUTMAPPER->SaveMappingsToDisk();
}
LOG->Info( sMessage );
SCREENMAN->SystemMessage( sMessage );
PREFSMAN->m_sLastSeenInputDevices.Set( sInputDevices );
}
PREFSMAN->SavePrefsToDisk();
}
static bool ChangeAppPri()
{
if( PREFSMAN->m_BoostAppPriority.Get() == PrefsManager::BOOST_NO )
@@ -1100,6 +1112,8 @@ int main(int argc, char* argv[])
* dependencies on the SDL video subsystem, so it must be initialized after DISPLAY. */
INPUTMAN = new RageInput( PREFSMAN->GetInputDrivers() );
StepMania::CheckForChangedInputDevicesAndRemap();
// These things depend on the TextureManager, so do them after!
FONT = new FontManager;
SCREENMAN = new ScreenManager;