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.

This commit is contained in:
Kyzentun Keeslala
2015-09-06 14:10:26 -06:00
parent b3c8f28c9d
commit e1eceda031
4 changed files with 4 additions and 4 deletions
+1
View File
@@ -5,6 +5,7 @@
// use GameState::GetCoinMode(). // use GameState::GetCoinMode().
Preference<CoinMode> GamePreferences::m_CoinMode( "CoinMode", CoinMode_Home ); Preference<CoinMode> GamePreferences::m_CoinMode( "CoinMode", CoinMode_Home );
Preference<PlayerController> GamePreferences::m_AutoPlay( "AutoPlay", PC_HUMAN ); Preference<PlayerController> GamePreferences::m_AutoPlay( "AutoPlay", PC_HUMAN );
Preference<bool> GamePreferences::m_AxisFix("AxisFix", false);
/* /*
+1
View File
@@ -8,6 +8,7 @@ namespace GamePreferences
{ {
extern Preference<CoinMode> m_CoinMode; extern Preference<CoinMode> m_CoinMode;
extern Preference<PlayerController> m_AutoPlay; extern Preference<PlayerController> m_AutoPlay;
extern Preference<bool> m_AxisFix;
}; };
#endif #endif
@@ -16,7 +16,6 @@
#include "InputHandler_DirectInputHelper.h" #include "InputHandler_DirectInputHelper.h"
REGISTER_INPUT_HANDLER_CLASS2( DirectInput, DInput ); REGISTER_INPUT_HANDLER_CLASS2( DirectInput, DInput );
static Preference<bool> g_bAxisFix( "AxisFix", false );
static vector<DIDevice> Devices; static vector<DIDevice> Devices;
@@ -589,7 +588,7 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
device.m_sName.c_str(), in.ofs ); device.m_sName.c_str(), in.ofs );
float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f ); 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, up, (l == 0) || (l == -1), tm) );
ButtonPressed( DeviceInput(dev, down,(l == 0) || (l == 1), tm) ); ButtonPressed( DeviceInput(dev, down,(l == 0) || (l == 1), tm) );
@@ -19,7 +19,6 @@
#include <linux/input.h> #include <linux/input.h>
REGISTER_INPUT_HANDLER_CLASS2( LinuxEvent, Linux_Event ); REGISTER_INPUT_HANDLER_CLASS2( LinuxEvent, Linux_Event );
static Preference<bool> g_bAxisFix( "AxisFix", false );
static RString BustypeToString( int iBus ) static RString BustypeToString( int iBus )
{ {
@@ -416,7 +415,7 @@ void InputHandler_Linux_Event::InputThread()
DeviceButton pos = g_apEventDevices[i]->aiAbsMappingHigh[event.code]; 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 ); 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, 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 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