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.
This commit is contained in:
Jeffrey Bosboom 2023-04-15 02:13:00 -07:00
parent 4efa10c170
commit a902480cb0
2 changed files with 5 additions and 5 deletions

View File

@ -441,8 +441,7 @@ ControlState KeyboardMouse::Key::GetState() const
return (m_keyboard[m_keycode / 8] & (1 << (m_keycode % 8))) != 0; return (m_keyboard[m_keycode / 8] & (1 << (m_keycode % 8))) != 0;
} }
KeyboardMouse::Button::Button(unsigned int index, unsigned int* buttons) KeyboardMouse::Button::Button(unsigned int index, u32* buttons) : m_buttons(buttons), m_index(index)
: m_buttons(buttons), m_index(index)
{ {
name = fmt::format("Click {}", m_index + 1); name = fmt::format("Click {}", m_index + 1);
} }

View File

@ -13,6 +13,7 @@ extern "C" {
#include <X11/keysym.h> #include <X11/keysym.h>
} }
#include "Common/CommonTypes.h"
#include "Common/Matrix.h" #include "Common/Matrix.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/ControllerInterface.h"
@ -26,7 +27,7 @@ private:
struct State struct State
{ {
std::array<char, 32> keyboard; std::array<char, 32> keyboard;
unsigned int buttons; u32 buttons;
Common::Vec2 cursor; Common::Vec2 cursor;
Common::Vec3 axis; Common::Vec3 axis;
Common::Vec3 relative_mouse; Common::Vec3 relative_mouse;
@ -52,11 +53,11 @@ private:
{ {
public: public:
std::string GetName() const override { return name; } std::string GetName() const override { return name; }
Button(unsigned int index, unsigned int* buttons); Button(unsigned int index, u32* buttons);
ControlState GetState() const override; ControlState GetState() const override;
private: private:
const unsigned int* m_buttons; const u32* m_buttons;
const unsigned int m_index; const unsigned int m_index;
std::string name; std::string name;
}; };