diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 95ce7e5d96..74aa6de3a3 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -135,22 +135,15 @@ void ControllerInterface::Shutdown() // // Update input for all devices, return true if all devices returned successful // -bool ControllerInterface::UpdateInput() +void ControllerInterface::UpdateInput() { std::unique_lock lk(update_lock, std::defer_lock); if (!lk.try_lock()) - return false; - - size_t ok_count = 0; + return; for (ciface::Core::Device* d : m_devices) - { - if (d->UpdateInput()) - ++ok_count; - } - - return (m_devices.size() == ok_count); + d->UpdateInput(); } // @@ -158,22 +151,15 @@ bool ControllerInterface::UpdateInput() // // Update output for all devices, return true if all devices returned successful // -bool ControllerInterface::UpdateOutput() +void ControllerInterface::UpdateOutput() { std::unique_lock lk(update_lock, std::defer_lock); if (!lk.try_lock()) - return false; - - size_t ok_count = 0; + return; for (ciface::Core::Device* d : m_devices) - { - if (d->UpdateOutput()) - ++ok_count; - } - - return (m_devices.size() == ok_count); + d->UpdateOutput(); } // diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 56723b123f..9600aded63 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -120,8 +120,8 @@ public: bool IsInit() const { return m_is_init; } void UpdateReference(ControlReference* control, const ciface::Core::DeviceQualifier& default_device) const; - bool UpdateInput(); - bool UpdateOutput(); + void UpdateInput(); + void UpdateOutput(); std::recursive_mutex update_lock; diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index 0c1ed5aa18..bc8638293e 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -177,7 +177,7 @@ std::string Joystick::GetSource() const // update IO -bool Joystick::UpdateInput() +void Joystick::UpdateInput() { HRESULT hr = 0; @@ -215,9 +215,7 @@ bool Joystick::UpdateInput() // try reacquire if input lost if (DIERR_INPUTLOST == hr || DIERR_NOTACQUIRED == hr) - hr = m_device->Acquire(); - - return SUCCEEDED(hr); + m_device->Acquire(); } // get name diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h index 17770afe5a..f1af8102cd 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.h @@ -52,7 +52,7 @@ private: }; public: - bool UpdateInput(); + void UpdateInput() override; Joystick(const LPDIRECTINPUTDEVICE8 device, const unsigned int index); ~Joystick(); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp index 692826aebb..c96e51a830 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp @@ -139,7 +139,7 @@ void GetMousePos(ControlState* const x, ControlState* const y) *y = (ControlState)point.y / (ControlState)win_height * 2 - 1; } -bool KeyboardMouse::UpdateInput() +void KeyboardMouse::UpdateInput() { DIMOUSESTATE2 tmp_mouse; @@ -175,11 +175,7 @@ bool KeyboardMouse::UpdateInput() // update mouse cursor GetMousePos(&m_state_in.cursor.x, &m_state_in.cursor.y); - - return true; } - - return false; } std::string KeyboardMouse::GetName() const diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h index 0f3dfece83..704635057e 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h @@ -77,7 +77,7 @@ private: }; public: - bool UpdateInput(); + void UpdateInput() override; KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIRECTINPUTDEVICE8 mo_device); ~KeyboardMouse(); diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h index abc7a68185..6f54f9adf5 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.h +++ b/Source/Core/InputCommon/ControllerInterface/Device.h @@ -100,8 +100,8 @@ public: virtual std::string GetName() const = 0; virtual int GetId() const = 0; virtual std::string GetSource() const = 0; - virtual bool UpdateInput() { return true; } - virtual bool UpdateOutput() { return true; } + virtual void UpdateInput() {} + virtual void UpdateOutput() {} const std::vector& Inputs() const { return m_inputs; } const std::vector& Outputs() const { return m_outputs; } diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp index 4350444492..f8efad343a 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp @@ -133,10 +133,8 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i return true; } -bool ForceFeedbackDevice::UpdateOutput() +void ForceFeedbackDevice::UpdateOutput() { - size_t ok_count = 0; - DIEFFECT eff; memset(&eff, 0, sizeof(eff)); eff.dwSize = sizeof(DIEFFECT); @@ -151,22 +149,16 @@ bool ForceFeedbackDevice::UpdateOutput() eff.cbTypeSpecificParams = state.size; eff.lpvTypeSpecificParams = state.params; // set params and start effect - ok_count += SUCCEEDED(state.iface->SetParameters(&eff, DIEP_TYPESPECIFICPARAMS | DIEP_START)); + state.iface->SetParameters(&eff, DIEP_TYPESPECIFICPARAMS | DIEP_START); } else { - ok_count += SUCCEEDED(state.iface->Stop()); + state.iface->Stop(); } state.params = nullptr; } - else - { - ++ok_count; - } } - - return (m_state_out.size() == ok_count); } template<> diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h index 31a1884aae..8b26ffeff2 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h @@ -52,7 +52,7 @@ private: public: bool InitForceFeedback(const LPDIRECTINPUTDEVICE8, int cAxes); - bool UpdateOutput(); + void UpdateOutput() override; virtual ~ForceFeedbackDevice(); private: diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h index c38235c2b8..06e686fc6a 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.h @@ -53,7 +53,7 @@ private: }; public: - bool UpdateInput() override; + void UpdateInput() override; Keyboard(IOHIDDeviceRef device, std::string name, int index, void *window); diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm index 5a97b27488..0e876f4173 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm @@ -54,7 +54,7 @@ Keyboard::Keyboard(IOHIDDeviceRef device, std::string name, int index, void *win AddInput(new Button(i, m_mousebuttons[i])); } -bool Keyboard::UpdateInput() +void Keyboard::UpdateInput() { CGRect bounds = CGRectZero; uint32_t windowid[1] = { m_windowid }; @@ -85,8 +85,6 @@ bool Keyboard::UpdateInput() m_mousebuttons[0] = CGEventSourceButtonState(kCGEventSourceStateHIDSystemState, kCGMouseButtonLeft); m_mousebuttons[1] = CGEventSourceButtonState(kCGEventSourceStateHIDSystemState, kCGMouseButtonRight); m_mousebuttons[2] = CGEventSourceButtonState(kCGEventSourceStateHIDSystemState, kCGMouseButtonCenter); - - return true; } std::string Keyboard::GetName() const diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index b745f7b2d4..5428778163 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -316,15 +316,13 @@ void Joystick::TriangleEffect::SetState(ControlState state) } #endif -bool Joystick::UpdateInput() +void Joystick::UpdateInput() { // each joystick is doin this, o well SDL_JoystickUpdate(); - - return true; } -bool Joystick::UpdateOutput() +void Joystick::UpdateOutput() { #ifdef USE_SDL_HAPTIC for (auto &i : m_state_out) @@ -359,7 +357,6 @@ bool Joystick::UpdateOutput() } } #endif - return true; } std::string Joystick::GetName() const diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h index 76fc028ec9..d1aeb38f4a 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h @@ -134,8 +134,8 @@ private: #endif public: - bool UpdateInput() override; - bool UpdateOutput() override; + void UpdateInput() override; + void UpdateOutput() override; Joystick(SDL_Joystick* const joystick, const int sdl_index, const unsigned int index); ~Joystick(); 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); } } diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h index 0092870265..17ee333e97 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h @@ -73,8 +73,8 @@ private: }; public: - bool UpdateInput(); - bool UpdateOutput(); + void UpdateInput() override; + void UpdateOutput() override; Device(const XINPUT_CAPABILITIES& capabilities, u8 index); diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index 4d7cc26b4d..1d7d080d7e 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -208,7 +208,7 @@ void KeyboardMouse::UpdateCursor() m_state.cursor.y = win_y / (float)win_attribs.height * 2 - 1; } -bool KeyboardMouse::UpdateInput() +void KeyboardMouse::UpdateInput() { XFlush(m_display); @@ -282,8 +282,6 @@ bool KeyboardMouse::UpdateInput() m_state.axis.y *= MOUSE_AXIS_SMOOTHING; m_state.axis.y += delta_y; m_state.axis.y /= MOUSE_AXIS_SMOOTHING+1.0f; - - return true; } std::string KeyboardMouse::GetName() const diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h index 064dd997f7..3f31aa50f2 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h @@ -98,7 +98,7 @@ private: void UpdateCursor(); public: - bool UpdateInput() override; + void UpdateInput() override; KeyboardMouse(Window window, int opcode, int pointer_deviceid, int keyboard_deviceid); ~KeyboardMouse(); diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp index e938cfc1bc..9a700a9c99 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp @@ -49,7 +49,7 @@ KeyboardMouse::~KeyboardMouse() XCloseDisplay(m_display); } -bool KeyboardMouse::UpdateInput() +void KeyboardMouse::UpdateInput() { XQueryKeymap(m_display, m_state.keyboard); @@ -64,8 +64,6 @@ bool KeyboardMouse::UpdateInput() // the mouse position as a range from -1 to 1 m_state.cursor.x = (float)win_x / (float)win_attribs.width * 2 - 1; m_state.cursor.y = (float)win_y / (float)win_attribs.height * 2 - 1; - - return true; } std::string KeyboardMouse::GetName() const diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h index 61d520d08c..0c2f79c8b3 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h @@ -70,7 +70,7 @@ private: }; public: - bool UpdateInput() override; + void UpdateInput() override; KeyboardMouse(Window window); ~KeyboardMouse();