Browse Source

Fix some possible controller issues.

merge-requests/28/head
Mr_Goldberg 1 year ago
parent
commit
c9d97abd5b
No known key found for this signature in database GPG Key ID: 8597D87419DEF278
  1. 2
      controller/gamepad.c
  2. 5
      dll/steam_controller.h

2
controller/gamepad.c

@ -444,7 +444,7 @@ static void GamepadUpdateDevice(GAMEPAD_DEVICE gamepad) {
if (events[i].value) {
STATE[gamepad].bCurrent |= BUTTON_TO_FLAG(button);
} else {
STATE[gamepad].bCurrent ^= BUTTON_TO_FLAG(button);
STATE[gamepad].bCurrent &= ~BUTTON_TO_FLAG(button);
}
break;
case EV_ABS:

5
dll/steam_controller.h

@ -133,6 +133,7 @@ public ISteamInput
std::map<EControllerActionOrigin, std::string> steamcontroller_glyphs;
bool disabled;
bool initialized;
void set_handles(std::map<std::string, std::map<std::string, std::pair<std::set<std::string>, std::string>>> action_sets) {
uint64 handle_num = 1;
@ -214,6 +215,7 @@ Steam_Controller(class Settings *settings, class SteamCallResults *callback_resu
set_handles(settings->controller_settings.action_sets);
disabled = !action_handles.size();
initialized = false;
}
~Steam_Controller()
@ -245,6 +247,7 @@ bool Init()
controllers.insert(std::pair<ControllerHandle_t, struct Controller_Action>(i, cont_action));
}
initialized = true;
return true;
}
@ -277,7 +280,7 @@ void SetOverrideMode( const char *pchMode )
void RunFrame()
{
PRINT_DEBUG("Steam_Controller::RunFrame()\n");
if (disabled) {
if (disabled || !initialized) {
return;
}

Loading…
Cancel
Save