From e1eceda03152777252561551454853e1c7e03cfe Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Sun, 6 Sep 2015 14:10:26 -0600 Subject: [PATCH] Moved AxisFix to GamePreferences so that the preference exists on all platforms and doesn't cause a crash on the Advanced Input Options screen on OS X. Preference does nothing on OS X for now. --- src/GamePreferences.cpp | 1 + src/GamePreferences.h | 1 + src/arch/InputHandler/InputHandler_DirectInput.cpp | 3 +-- src/arch/InputHandler/InputHandler_Linux_Event.cpp | 3 +-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GamePreferences.cpp b/src/GamePreferences.cpp index eefc636a3a..fe8b74cc1a 100644 --- a/src/GamePreferences.cpp +++ b/src/GamePreferences.cpp @@ -5,6 +5,7 @@ // use GameState::GetCoinMode(). Preference GamePreferences::m_CoinMode( "CoinMode", CoinMode_Home ); Preference GamePreferences::m_AutoPlay( "AutoPlay", PC_HUMAN ); +Preference GamePreferences::m_AxisFix("AxisFix", false); /* diff --git a/src/GamePreferences.h b/src/GamePreferences.h index ee1b1b4f4f..770a6d0ead 100644 --- a/src/GamePreferences.h +++ b/src/GamePreferences.h @@ -8,6 +8,7 @@ namespace GamePreferences { extern Preference m_CoinMode; extern Preference m_AutoPlay; + extern Preference m_AxisFix; }; #endif diff --git a/src/arch/InputHandler/InputHandler_DirectInput.cpp b/src/arch/InputHandler/InputHandler_DirectInput.cpp index a7c6deff20..81cb0fd317 100644 --- a/src/arch/InputHandler/InputHandler_DirectInput.cpp +++ b/src/arch/InputHandler/InputHandler_DirectInput.cpp @@ -16,7 +16,6 @@ #include "InputHandler_DirectInputHelper.h" REGISTER_INPUT_HANDLER_CLASS2( DirectInput, DInput ); -static Preference g_bAxisFix( "AxisFix", false ); static vector Devices; @@ -589,7 +588,7 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm device.m_sName.c_str(), in.ofs ); float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f ); - if(g_bAxisFix) + if(GamePreferences::m_AxisFix) { ButtonPressed( DeviceInput(dev, up, (l == 0) || (l == -1), tm) ); ButtonPressed( DeviceInput(dev, down,(l == 0) || (l == 1), tm) ); diff --git a/src/arch/InputHandler/InputHandler_Linux_Event.cpp b/src/arch/InputHandler/InputHandler_Linux_Event.cpp index be60412c29..6ea2baa374 100644 --- a/src/arch/InputHandler/InputHandler_Linux_Event.cpp +++ b/src/arch/InputHandler/InputHandler_Linux_Event.cpp @@ -19,7 +19,6 @@ #include REGISTER_INPUT_HANDLER_CLASS2( LinuxEvent, Linux_Event ); -static Preference g_bAxisFix( "AxisFix", false ); static RString BustypeToString( int iBus ) { @@ -416,7 +415,7 @@ void InputHandler_Linux_Event::InputThread() DeviceButton pos = g_apEventDevices[i]->aiAbsMappingHigh[event.code]; float l = SCALE( int(event.value), (float) g_apEventDevices[i]->aiAbsMin[event.code], (float) g_apEventDevices[i]->aiAbsMax[event.code], -1.0f, 1.0f ); - if (g_bAxisFix) + if (GamePreferences::m_AxisFix) { ButtonPressed( DeviceInput(g_apEventDevices[i]->m_Dev, neg, (l < -0.5)||((l > 0.0001)&&(l < 0.5)), now) ); //Up if between 0.0001 and 0.5 or if less than -0.5 ButtonPressed( DeviceInput(g_apEventDevices[i]->m_Dev, pos, (l > 0.5)||((l > 0.0001)&&(l < 0.5)) , now) ); //Down if between 0.0001 and 0.5 or if more than 0.5