1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

Fix some possible controller issues.

This commit is contained in:
Mr_Goldberg 2020-01-19 01:34:52 -05:00
parent 958ced0edd
commit c9d97abd5b
No known key found for this signature in database
GPG key ID: 8597D87419DEF278
2 changed files with 5 additions and 2 deletions

View file

@ -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:

View file

@ -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;
}