Skip to content

Commit

Permalink
changed buttonLast type (fixes #1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
thrust26 committed Sep 9, 2024
1 parent cb624ae commit 03c5d7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/common/PJoystickHandler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)

if(j)
{
//int button = j->buttonLast[stick];
//int button = j->buttonLast;

switch(j->type)
{
Expand Down Expand Up @@ -945,7 +945,7 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
void PhysicalJoystickHandler::handleRegularAxisEvent(const PhysicalJoystickPtr& j,
int stick, int axis, int value)
{
const int button = j->buttonLast[stick];
const int button = j->buttonLast;

if(myHandler.state() == EventHandlerState::EMULATION)
{
Expand Down Expand Up @@ -1025,7 +1025,7 @@ void PhysicalJoystickHandler::handleBtnEvent(int stick, int button, bool pressed

if(j)
{
j->buttonLast[stick] = pressed ? button : JOY_CTRL_NONE;
j->buttonLast = pressed ? button : JOY_CTRL_NONE;

// Handle buttons which switch eventhandler state
if(!pressed && myHandler.changeStateByEvent(j->joyMap.get(EventMode::kEmulationMode, button)))
Expand All @@ -1052,7 +1052,7 @@ void PhysicalJoystickHandler::handleHatEvent(int stick, int hat, int value)

if(j)
{
const int button = j->buttonLast[stick];
const int button = j->buttonLast;

if(myHandler.state() == EventHandlerState::EMULATION)
{
Expand Down
1 change: 0 additions & 1 deletion src/common/PhysicalJoystick.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ void PhysicalJoystick::initialize(int index, string_view desc,
numButtons = buttons;
numHats = hats;
axisLastValue.resize(numAxes, 0);
buttonLast.resize(numButtons, JOY_CTRL_NONE);

// Erase the mappings
eraseMap(EventMode::kMenuMode);
Expand Down
2 changes: 1 addition & 1 deletion src/common/PhysicalJoystick.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PhysicalJoystick
Port port{Port::AUTO};
int numAxes{0}, numButtons{0}, numHats{0};
IntArray axisLastValue;
IntArray buttonLast;
int buttonLast{JOY_CTRL_NONE};

// Hashmaps of controller events
JoyMap joyMap;
Expand Down

0 comments on commit 03c5d7f

Please sign in to comment.