From a902480cb053478af3f8df25aab8a36395685378 Mon Sep 17 00:00:00 2001 From: Jeffrey Bosboom Date: Sat, 15 Apr 2023 02:13:00 -0700 Subject: [PATCH] XInput2: Make button state a u32 Because we care how many bits it has, not its arithmetic range. No functional change on all supported platforms. --- .../Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp | 3 +-- Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index 07d8e4bfa5..db7052996c 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -441,8 +441,7 @@ ControlState KeyboardMouse::Key::GetState() const return (m_keyboard[m_keycode / 8] & (1 << (m_keycode % 8))) != 0; } -KeyboardMouse::Button::Button(unsigned int index, unsigned int* buttons) - : m_buttons(buttons), m_index(index) +KeyboardMouse::Button::Button(unsigned int index, u32* buttons) : m_buttons(buttons), m_index(index) { name = fmt::format("Click {}", m_index + 1); } diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h index ff2c787b1d..52c78ab752 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.h @@ -13,6 +13,7 @@ extern "C" { #include } +#include "Common/CommonTypes.h" #include "Common/Matrix.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" @@ -26,7 +27,7 @@ private: struct State { std::array keyboard; - unsigned int buttons; + u32 buttons; Common::Vec2 cursor; Common::Vec3 axis; Common::Vec3 relative_mouse; @@ -52,11 +53,11 @@ private: { public: std::string GetName() const override { return name; } - Button(unsigned int index, unsigned int* buttons); + Button(unsigned int index, u32* buttons); ControlState GetState() const override; private: - const unsigned int* m_buttons; + const u32* m_buttons; const unsigned int m_index; std::string name; };