From fe7d184555775bdc5ae4d7107d08d68978dd674d Mon Sep 17 00:00:00 2001 From: retropieuser <73472027+retropieuser@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:22:20 +0000 Subject: [PATCH] Added hotkey start & select exit Added a start & select hotkey that stops the main loop and closes the game. The start & select exit is the standard function for users on RetroPie, Lakka and Batocera. It also allows the game to be played and closed without a keyboard. --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.c b/main.c index 1c1920a6..9e970748 100644 --- a/main.c +++ b/main.c @@ -414,6 +414,12 @@ int main(int argc, char** argv) { int b = RemapSdlButton(event.cbutton.button); if (b >= 0) HandleGamepadInput(b, event.type == SDL_CONTROLLERBUTTONDOWN); + + // Check for start and select buttons pressed and if so exit game + SDL_GameController* controller = SDL_GameControllerFromInstanceID(event.cbutton.which); + if (SDL_GameControllerGetButton(controller, SDL_CONTROLLER_BUTTON_START) && SDL_GameControllerGetButton(controller, SDL_CONTROLLER_BUTTON_BACK)) { + running = false; + } break; } case SDL_MOUSEWHEEL: