changed buttonLast type (fixes #1043)

This commit is contained in:
thrust26 2024-09-09 10:28:20 +02:00
parent cb624aece0
commit 03c5d7f1cf
3 changed files with 5 additions and 6 deletions

View File

@ -901,7 +901,7 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
if(j) if(j)
{ {
//int button = j->buttonLast[stick]; //int button = j->buttonLast;
switch(j->type) switch(j->type)
{ {
@ -945,7 +945,7 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
void PhysicalJoystickHandler::handleRegularAxisEvent(const PhysicalJoystickPtr& j, void PhysicalJoystickHandler::handleRegularAxisEvent(const PhysicalJoystickPtr& j,
int stick, int axis, int value) int stick, int axis, int value)
{ {
const int button = j->buttonLast[stick]; const int button = j->buttonLast;
if(myHandler.state() == EventHandlerState::EMULATION) if(myHandler.state() == EventHandlerState::EMULATION)
{ {
@ -1025,7 +1025,7 @@ void PhysicalJoystickHandler::handleBtnEvent(int stick, int button, bool pressed
if(j) if(j)
{ {
j->buttonLast[stick] = pressed ? button : JOY_CTRL_NONE; j->buttonLast = pressed ? button : JOY_CTRL_NONE;
// Handle buttons which switch eventhandler state // Handle buttons which switch eventhandler state
if(!pressed && myHandler.changeStateByEvent(j->joyMap.get(EventMode::kEmulationMode, button))) if(!pressed && myHandler.changeStateByEvent(j->joyMap.get(EventMode::kEmulationMode, button)))
@ -1052,7 +1052,7 @@ void PhysicalJoystickHandler::handleHatEvent(int stick, int hat, int value)
if(j) if(j)
{ {
const int button = j->buttonLast[stick]; const int button = j->buttonLast;
if(myHandler.state() == EventHandlerState::EMULATION) if(myHandler.state() == EventHandlerState::EMULATION)
{ {

View File

@ -47,7 +47,6 @@ void PhysicalJoystick::initialize(int index, string_view desc,
numButtons = buttons; numButtons = buttons;
numHats = hats; numHats = hats;
axisLastValue.resize(numAxes, 0); axisLastValue.resize(numAxes, 0);
buttonLast.resize(numButtons, JOY_CTRL_NONE);
// Erase the mappings // Erase the mappings
eraseMap(EventMode::kMenuMode); eraseMap(EventMode::kMenuMode);

View File

@ -81,7 +81,7 @@ class PhysicalJoystick
Port port{Port::AUTO}; Port port{Port::AUTO};
int numAxes{0}, numButtons{0}, numHats{0}; int numAxes{0}, numButtons{0}, numHats{0};
IntArray axisLastValue; IntArray axisLastValue;
IntArray buttonLast; int buttonLast{JOY_CTRL_NONE};
// Hashmaps of controller events // Hashmaps of controller events
JoyMap joyMap; JoyMap joyMap;