From 61fcfc4bf2058d971af6882af2765ad34d935fcb Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 13 Nov 2014 00:56:32 -0800 Subject: ControllerInterface: Remove unused ClearInputState --- Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp') 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)); } -- cgit v1.2.3 From f2787f620eebbbfb746f59cfbd0318210297061b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 13 Nov 2014 00:55:14 -0800 Subject: ControllerInterface: Make UpdateInput / UpdateOutput return void The return values here have never been checked, so it doesn't make sense to return a value to begin with. --- .../Core/InputCommon/ControllerInterface/XInput/XInput.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp index 961b92270b..68d7eeb479 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp @@ -203,23 +203,19 @@ std::string Device::GetSource() const // Update I/O -bool Device::UpdateInput() +void Device::UpdateInput() { - return (ERROR_SUCCESS == PXInputGetState(m_index, &m_state_in)); + PXInputGetState(m_index, &m_state_in); } -bool Device::UpdateOutput() +void Device::UpdateOutput() { // this if statement is to make rumble work better when multiple ControllerInterfaces are using the device // only calls XInputSetState if the state changed if (memcmp(&m_state_out, &m_current_state_out, sizeof(m_state_out))) { m_current_state_out = m_state_out; - return (ERROR_SUCCESS == PXInputSetState(m_index, &m_state_out)); - } - else - { - return true; + PXInputSetState(m_index, &m_state_out); } } -- cgit v1.2.3 From 1958a10b6f5ba8348268b077f6410dadb2a20c8f Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 13 Nov 2014 01:10:55 -0800 Subject: XInput: Apply immediately as well --- .../Core/InputCommon/ControllerInterface/XInput/XInput.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp index 68d7eeb479..2bf98bb0b3 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.cpp @@ -121,7 +121,6 @@ Device::Device(const XINPUT_CAPABILITIES& caps, u8 index) : m_index(index), m_subtype(caps.SubType) { ZeroMemory(&m_state_out, sizeof(m_state_out)); - ZeroMemory(&m_current_state_out, sizeof(m_current_state_out)); // XInputGetCaps seems to always claim all capabilities are supported // but I will leave all this stuff in, incase m$ fixes xinput up a bit @@ -162,7 +161,7 @@ Device::Device(const XINPUT_CAPABILITIES& caps, u8 index) { //WORD val = (&caps.Vibration.wLeftMotorSpeed)[i]; // should be max value / nope, more lies if ((&caps.Vibration.wLeftMotorSpeed)[i]) - AddOutput(new Motor(i, (&m_state_out.wLeftMotorSpeed)[i], 65535)); + AddOutput(new Motor(i, this, (&m_state_out.wLeftMotorSpeed)[i], 65535)); } ZeroMemory(&m_state_in, sizeof(m_state_in)); @@ -208,15 +207,9 @@ void Device::UpdateInput() PXInputGetState(m_index, &m_state_in); } -void Device::UpdateOutput() +void Device::UpdateMotors() { - // this if statement is to make rumble work better when multiple ControllerInterfaces are using the device - // only calls XInputSetState if the state changed - if (memcmp(&m_state_out, &m_current_state_out, sizeof(m_state_out))) - { - m_current_state_out = m_state_out; - PXInputSetState(m_index, &m_state_out); - } + PXInputSetState(m_index, &m_state_out); } // GET name/source/id @@ -261,6 +254,7 @@ ControlState Device::Axis::GetState() const void Device::Motor::SetState(ControlState state) { m_motor = (WORD)(state * m_range); + m_parent->UpdateMotors(); } } -- cgit v1.2.3