From caa67224a8d3bd94312dfdb5b64e221a589ba60c Mon Sep 17 00:00:00 2001 From: Garrett Brown Date: Thu, 18 Aug 2016 15:20:54 -0700 Subject: [PATCH] Remove deadzone setting --- peripheral.joystick/resources/settings.xml | 6 ------ src/api/Joystick.cpp | 17 +---------------- src/settings/Settings.cpp | 7 ------- src/settings/Settings.h | 15 --------------- 4 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 peripheral.joystick/resources/settings.xml diff --git a/peripheral.joystick/resources/settings.xml b/peripheral.joystick/resources/settings.xml deleted file mode 100644 index 7be0f61b..00000000 --- a/peripheral.joystick/resources/settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/api/Joystick.cpp b/src/api/Joystick.cpp index 140b0b59..2f32761b 100644 --- a/src/api/Joystick.cpp +++ b/src/api/Joystick.cpp @@ -220,7 +220,7 @@ void CJoystick::SetAxisValue(unsigned int axisIndex, JOYSTICK_STATE_AXIS axisVal axisValue = CONSTRAIN(-1.0f, axisValue, 1.0f); if (axisIndex < m_stateBuffer.axes.size()) - m_stateBuffer.axes[axisIndex] = ScaleDeadzone(m_axisFilters[axisIndex]->Filter(axisValue)); + m_stateBuffer.axes[axisIndex] = m_axisFilters[axisIndex]->Filter(axisValue); } void CJoystick::SetAxisValue(unsigned int axisIndex, long value, long maxAxisAmount) @@ -242,18 +242,3 @@ float CJoystick::NormalizeAxis(long value, long maxAxisAmount) { return 1.0f * CONSTRAIN(-maxAxisAmount, value, maxAxisAmount) / maxAxisAmount; } - -float CJoystick::ScaleDeadzone(float value) -{ - const float deadzone = CSettings::Get().Deadzone(); - - if (deadzone >= 1.0f) - return 0.0f; - - if (value > deadzone) - return (float)(value - deadzone) / (float)(1.0f - deadzone); - else if (value < -deadzone) - return (float)(value + deadzone) / (float)(1.0f - deadzone); - - return 0.0f; -} diff --git a/src/settings/Settings.cpp b/src/settings/Settings.cpp index 0c3b3802..2a67bda2 100644 --- a/src/settings/Settings.cpp +++ b/src/settings/Settings.cpp @@ -23,12 +23,10 @@ using namespace JOYSTICK; -#define SETTING_DEADZONE "deadzone" #define SETTING_RETROARCH_CONFIG "retroarchconfig" CSettings::CSettings(void) : m_bInitialized(false), - m_deadzone(0.0f), m_bGenerateRetroArchConfigs(false) { } @@ -41,11 +39,6 @@ CSettings& CSettings::Get(void) void CSettings::SetSetting(const std::string& strName, const void* value) { - if (strName == SETTING_DEADZONE) - { - m_deadzone = *static_cast(value); - dsyslog("Setting \"%s\" set to %f", SETTING_DEADZONE, m_deadzone); - } if (strName == SETTING_RETROARCH_CONFIG) { m_bGenerateRetroArchConfigs = *static_cast(value); diff --git a/src/settings/Settings.h b/src/settings/Settings.h index 0a248d8c..fdda7b83 100644 --- a/src/settings/Settings.h +++ b/src/settings/Settings.h @@ -35,21 +35,6 @@ namespace JOYSTICK bool IsInitialized(void) const { return m_bInitialized; } - /*! - * \brief The analog stick deadzone - * - * This is applied to each axis. Axis is scaled appropriately, so position - * is continuous from -1.0 to 1.0: - * - * | / 1.0 - * | / - * __|__/ - * / | - * / |--| Deadzone - * -1.0 / | - */ - float Deadzone(void) const { return m_deadzone; } - /*! * \brief Generate .cfg files compatible with RetroArch's joypad autoconfig */