From f7789a1e4a2cc64bdece9a16e68e6e6390582b25 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 30 Sep 2018 14:38:54 -0700 Subject: [PATCH] Add Select+Start+L1+R1 quit combo --- app/streaming/input.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/streaming/input.cpp b/app/streaming/input.cpp index 3521f08b..e4996c36 100644 --- a/app/streaming/input.cpp +++ b/app/streaming/input.cpp @@ -140,9 +140,8 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event) // further keyboard input SDL_SetRelativeMouseMode(SDL_FALSE); - SDL_Event event; - // Push a quit event to the main loop + SDL_Event event; event.type = SDL_QUIT; event.quit.timestamp = SDL_GetTicks(); SDL_PushEvent(&event); @@ -623,6 +622,23 @@ void SdlInputHandler::handleControllerButtonEvent(SDL_ControllerButtonEvent* eve state->buttons &= ~k_ButtonMap[event->button]; } + // Handle Start+Select+L1+R1 as a gamepad quit combo + if (state->buttons == (PLAY_FLAG | BACK_FLAG | LB_FLAG | RB_FLAG)) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Detected quit gamepad button combo"); + + // Push a quit event to the main loop + SDL_Event event; + event.type = SDL_QUIT; + event.quit.timestamp = SDL_GetTicks(); + SDL_PushEvent(&event); + + // Clear buttons down on this gameapd + LiSendMultiControllerEvent(state->index, m_GamepadMask, + 0, 0, 0, 0, 0, 0, 0); + return; + } + sendGamepadState(state); }