From b84221eb3cc4bd4214caba9a476f7f3678a82bff Mon Sep 17 00:00:00 2001 From: Derek Jamison Date: Tue, 11 Jul 2023 16:52:35 -0500 Subject: [PATCH] BACK at "play again" should broadcast quit. --- .../plugins/rock_paper_scissors/rock_paper_scissors.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/subghz/plugins/rock_paper_scissors/rock_paper_scissors.c b/subghz/plugins/rock_paper_scissors/rock_paper_scissors.c index 27f62c9..281884a 100644 --- a/subghz/plugins/rock_paper_scissors/rock_paper_scissors.c +++ b/subghz/plugins/rock_paper_scissors/rock_paper_scissors.c @@ -1910,7 +1910,9 @@ int32_t rock_paper_scissors_app(void* p) { if((event.input.type == InputTypeLong) && (event.input.key == InputKeyBack)) { // Long press back to exit. processing = false; - } else if((event.input.type == InputTypeShort) && (event.input.key == InputKeyBack)) { + } else if( + (event.input.type == InputTypeShort) && (event.input.key == InputKeyBack) && + game_context->data->screen_state != ScreenFinishedGame) { if(game_context->data->local_player == StateHostingLookingForPlayer) { rps_broadcast_not_beacon(game_context); } @@ -2316,6 +2318,13 @@ int32_t rock_paper_scissors_app(void* p) { case InputKeyRight: game_context->data->keyboard_col = 1; // NO - Back to main menu break; + case InputKeyBack: + game_context->data->keyboard_col = 1; // NO - Back to main menu + rps_broadcast_quit(game_context); + game_context->data->local_player = StateMainMenuHost; + game_context->data->remote_player = StateUnknown; + game_context->data->screen_state = ScreenMainMenu; + break; case InputKeyOk: if(game_context->data->keyboard_col == 1) { rps_broadcast_quit(game_context);