From 61fcfc4bf2058d971af6882af2765ad34d935fcb Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 13 Nov 2014 00:56:32 -0800 Subject: [PATCH] ControllerInterface: Remove unused ClearInputState --- .../ControllerInterface/ControllerInterface.cpp | 3 --- .../ControllerInterface/DInput/DInputJoystick.cpp | 11 +++-------- .../ControllerInterface/DInput/DInputJoystick.h | 2 -- .../InputCommon/ControllerInterface/Device.cpp | 14 -------------- .../Core/InputCommon/ControllerInterface/Device.h | 2 -- .../ControllerInterface/XInput/XInput.cpp | 5 ----- .../ControllerInterface/XInput/XInput.h | 2 -- 7 files changed, 3 insertions(+), 36 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index ddfde30118..95ce7e5d96 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -148,9 +148,6 @@ bool ControllerInterface::UpdateInput() { if (d->UpdateInput()) ++ok_count; - //else - // disabled. it might be causing problems - //(*d)->ClearInputState(); } return (m_devices.size() == ok_count); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index ecd5db838c..0c1ed5aa18 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -149,7 +149,9 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI InitForceFeedback(m_device, (int)objects.size()); } - ClearInputState(); + ZeroMemory(&m_state_in, sizeof(m_state_in)); + // set hats to center + memset(m_state_in.rgdwPOV, 0xFF, sizeof(m_state_in.rgdwPOV)); } Joystick::~Joystick() @@ -158,13 +160,6 @@ Joystick::~Joystick() m_device->Release(); } -void Joystick::ClearInputState() -{ - ZeroMemory(&m_state_in, sizeof(m_state_in)); - // set hats to center - memset(m_state_in.rgdwPOV, 0xFF, sizeof(m_state_in.rgdwPOV)); -} - std::string Joystick::GetName() const { return GetDeviceName(m_device); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h index 0ac535cdfe..17770afe5a 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h @@ -54,8 +54,6 @@ private: public: bool UpdateInput(); - void ClearInputState(); - Joystick(const LPDIRECTINPUTDEVICE8 device, const unsigned int index); ~Joystick(); diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index 84af8649a8..f96c637426 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -66,20 +66,6 @@ Device::Output* Device::FindOutput(const std::string &name) const return nullptr; } -// -// Device :: ClearInputState -// -// Device classes should override this function -// ControllerInterface will call this when the device returns failure during UpdateInput -// used to try to set all buttons and axes to their default state when user unplugs a gamepad during play -// buttons/axes that were held down at the time of unplugging should be seen as not pressed after unplugging -// -void Device::ClearInputState() -{ - // this is going to be called for every UpdateInput call that fails - // kinda slow but, w/e, should only happen when user unplugs a device while playing -} - bool Device::Control::InputGateOn() { if (SConfig::GetInstance().m_BackgroundInput) diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h index 6b9c0d2994..abc7a68185 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.h +++ b/Source/Core/InputCommon/ControllerInterface/Device.h @@ -103,8 +103,6 @@ public: virtual bool UpdateInput() { return true; } virtual bool UpdateOutput() { return true; } - virtual void ClearInputState(); - const std::vector& Inputs() const { return m_inputs; } const std::vector& Outputs() const { return m_outputs; } diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp index 37949e03ac..961b92270b 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp @@ -165,11 +165,6 @@ Device::Device(const XINPUT_CAPABILITIES& caps, u8 index) AddOutput(new Motor(i, (&m_state_out.wLeftMotorSpeed)[i], 65535)); } - ClearInputState(); -} - -void Device::ClearInputState() -{ ZeroMemory(&m_state_in, sizeof(m_state_in)); } diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h index 3c9eadc395..0092870265 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h @@ -76,8 +76,6 @@ public: bool UpdateInput(); bool UpdateOutput(); - void ClearInputState(); - Device(const XINPUT_CAPABILITIES& capabilities, u8 index); std::string GetName() const;