only AutoMap joysticks if joysticks attached to system change. This way, we won't override users' custom mappings as often.

This commit is contained in:
Chris Danford
2003-10-03 03:20:50 +00:00
parent 1c6b80dc91
commit 63fc85a7c4
6 changed files with 49 additions and 23 deletions
+5 -3
View File
@@ -91,7 +91,7 @@ PrefsManager::PrefsManager()
m_ShowDancingCharacters = CO_OFF;
m_bUseUnlockSystem = false;
m_bFirstRun = true;
m_bAutoMapJoysticks = true;
m_bAutoMapOnJoyChange = true;
m_fGlobalOffsetSeconds = 0;
m_bForceLogFlush = false;
m_bLogging = true;
@@ -261,9 +261,10 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
ini.GetValue( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
ini.GetValue( "Options", "FirstRun", m_bFirstRun );
ini.GetValue( "Options", "AutoMapJoysticks", m_bAutoMapJoysticks );
ini.GetValue( "Options", "AutoMapJoysticks", m_bAutoMapOnJoyChange );
ini.GetValue( "Options", "VideoRenderers", m_sVideoRenderers );
ini.GetValue( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
ini.GetValue( "Options", "LastSeenInputDevices", m_sLastSeenInputDevices );
#if defined(WIN32)
ini.GetValue( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
@@ -366,9 +367,10 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValue( "Options", "ShowDancingCharacters", m_ShowDancingCharacters );
ini.SetValue( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
ini.SetValue( "Options", "FirstRun", m_bFirstRun );
ini.SetValue( "Options", "AutoMapJoysticks", m_bAutoMapJoysticks );
ini.SetValue( "Options", "AutoMapJoysticks", m_bAutoMapOnJoyChange );
ini.SetValue ( "Options", "VideoRenderers", m_sVideoRenderers );
ini.SetValue ( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
ini.SetValue ( "Options", "LastSeenInputDevices", m_sLastSeenInputDevices );
#if defined(WIN32)
ini.SetValue ( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
+2 -1
View File
@@ -85,7 +85,7 @@ public:
CharacterOption m_ShowDancingCharacters;
bool m_bUseUnlockSystem;
bool m_bFirstRun;
bool m_bAutoMapJoysticks;
bool m_bAutoMapOnJoyChange;
float m_fGlobalOffsetSeconds;
bool m_bForceLogFlush;
bool m_bLogging;
@@ -115,6 +115,7 @@ public:
CString m_DWIPath;
CString m_sLastSeenVideoDriver;
CString m_sLastSeenInputDevices;
#if defined(WIN32)
int m_iLastSeenMemory;
#endif
+8 -8
View File
@@ -35,12 +35,12 @@ enum {
/* Hmm. Ignore JoyAxes and Back Delayed probably belong in "key/joy config",
* preferably alongside button configuration. */
OptionRow g_InputOptionsLines[NUM_INPUT_OPTIONS_LINES] = {
OptionRow( "Auto Map\nJoysticks", true, "OFF","ON (recommended)" ),
OptionRow( "Menu\nButtons", true, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ),
OptionRow( "AutoPlay", true, "OFF","ON" ),
OptionRow( "Back\nDelayed", true, "INSTANT","HOLD" ),
OptionRow( "Options\nNavigation", true, "SM STYLE","ARCADE STYLE" ),
OptionRow( "Wheel\nSpeed", true, "SLOW","NORMAL","FAST","REALLY FAST" ),
OptionRow( "Auto Map\nOn Joy Change", true, "OFF","ON (recommended)" ),
OptionRow( "Menu\nButtons", true, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ),
OptionRow( "AutoPlay", true, "OFF","ON" ),
OptionRow( "Back\nDelayed", true, "INSTANT","HOLD" ),
OptionRow( "Options\nNavigation", true, "SM STYLE","ARCADE STYLE" ),
OptionRow( "Wheel\nSpeed", true, "SLOW","NORMAL","FAST","REALLY FAST" ),
};
ScreenInputOptions::ScreenInputOptions( CString sName ) :
@@ -60,7 +60,7 @@ ScreenInputOptions::ScreenInputOptions( CString sName ) :
void ScreenInputOptions::ImportOptions()
{
m_iSelectedOption[0][IO_AUTO_MAP_JOYSTICKS] = PREFSMAN->m_bAutoMapJoysticks ? 1:0;
m_iSelectedOption[0][IO_AUTO_MAP_JOYSTICKS] = PREFSMAN->m_bAutoMapOnJoyChange ? 1:0;
m_iSelectedOption[0][IO_DEDICATED_MENU_BUTTONS] = PREFSMAN->m_bOnlyDedicatedMenuButtons ? 1:0;
m_iSelectedOption[0][IO_AUTOPLAY] = PREFSMAN->m_bAutoPlay;
m_iSelectedOption[0][IO_DELAYED_ESCAPE] = PREFSMAN->m_bDelayedEscape ? 1:0;
@@ -73,7 +73,7 @@ void ScreenInputOptions::ImportOptions()
void ScreenInputOptions::ExportOptions()
{
PREFSMAN->m_bAutoMapJoysticks = m_iSelectedOption[0][IO_AUTO_MAP_JOYSTICKS] == 1;
PREFSMAN->m_bAutoMapOnJoyChange = m_iSelectedOption[0][IO_AUTO_MAP_JOYSTICKS] == 1;
PREFSMAN->m_bOnlyDedicatedMenuButtons= m_iSelectedOption[0][IO_DEDICATED_MENU_BUTTONS] == 1;
PREFSMAN->m_bDelayedEscape = m_iSelectedOption[0][IO_DELAYED_ESCAPE] == 1;
PREFSMAN->m_bAutoPlay = m_iSelectedOption[0][IO_AUTOPLAY] == 1;
+7 -7
View File
@@ -233,7 +233,7 @@ static void NumBackgrounds( int &sel, bool ToSel, const CStringArray &choices )
}
/* Input options */
MOVE( AutoMapJoysticks, PREFSMAN->m_bAutoMapJoysticks );
MOVE( AutoMapOnJoyChange, PREFSMAN->m_bAutoMapOnJoyChange );
MOVE( MenuButtons, PREFSMAN->m_bOnlyDedicatedMenuButtons );
MOVE( AutoPlay, PREFSMAN->m_bAutoPlay );
MOVE( BackDelayed, PREFSMAN->m_bDelayedEscape );
@@ -408,12 +408,12 @@ static const ConfOption g_ConfOptions[] =
ConfOption( "Random\nBackgrounds", NumBackgrounds, "5","10","15","20" ),
/* Input options */
ConfOption( "Auto Map\nJoysticks", AutoMapJoysticks, "OFF","ON (recommended)" ),
ConfOption( "MenuButtons", MenuButtons, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ),
ConfOption( "AutoPlay", AutoPlay, "OFF","ON" ),
ConfOption( "Back\nDelayed", BackDelayed, "INSTANT","HOLD" ),
ConfOption( "Options\nNavigation", OptionsNavigation, "SM STYLE","ARCADE STYLE" ),
ConfOption( "Wheel\nSpeed", WheelSpeed, "SLOW","NORMAL","FAST","REALLY FAST" ),
ConfOption( "Auto Map\nOn Joy Change", AutoMapOnJoyChange, "OFF","ON (recommended)" ),
ConfOption( "MenuButtons", MenuButtons, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ),
ConfOption( "AutoPlay", AutoPlay, "OFF","ON" ),
ConfOption( "Back\nDelayed", BackDelayed, "INSTANT","HOLD" ),
ConfOption( "Options\nNavigation", OptionsNavigation, "SM STYLE","ARCADE STYLE" ),
ConfOption( "Wheel\nSpeed", WheelSpeed, "SLOW","NORMAL","FAST","REALLY FAST" ),
/* Gameplay options */
ConfOption( "Solo\nSingles", SoloSingles, "OFF","ON" ),
+25 -2
View File
@@ -219,8 +219,31 @@ void ResetGame( bool ReturnToFirstScreen )
PREFSMAN->m_bFirstRun = false;
if( PREFSMAN->m_bAutoMapJoysticks )
INPUTMAPPER->AutoMapJoysticksForCurrentGame();
//
// update last seen joysticks
//
vector<InputDevice> vDevices;
vector<CString> vDescriptions;
INPUTMAN->GetDevicesAndDescriptions(vDevices,vDescriptions);
vector<CString> vOldDescriptions;
split( PREFSMAN->m_sLastSeenInputDevices, ",", vOldDescriptions );
CString sInputDevices = join( ",", vDescriptions );
if( PREFSMAN->m_sLastSeenInputDevices != sInputDevices )
{
LOG->Info( "Input devices changed from '%s' to '%s'.", PREFSMAN->m_sLastSeenInputDevices.c_str(), sInputDevices.c_str() );
if( PREFSMAN->m_bAutoMapOnJoyChange )
{
LOG->Info( "Remapping joysticks." );
INPUTMAPPER->AutoMapJoysticksForCurrentGame();
}
PREFSMAN->m_sLastSeenInputDevices = sInputDevices;
}
if( ReturnToFirstScreen )
SCREENMAN->SetNewScreen( THEME->GetMetric("Common","InitialScreen") );