Skip to content

Commit 5d44cb8

Browse files
committed
wait for KEY_UP during menu initialization
Signed-off-by: Vincent-FK <[email protected]>
1 parent 284930c commit 5d44cb8

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

platform/common/menu_pico.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "emu.h"
1717
#include "menu_pico.h"
1818
#include "input_pico.h"
19+
#include "../libpicofe/input.h"
1920
#include "version.h"
2021

2122
#include <pico/pico_int.h>
@@ -686,6 +687,21 @@ void run_menu_loop()
686687
memcpy(backup_hw_screen->pixels, (uint16_t*) virtual_hw_screen->pixels,
687688
RES_HW_SCREEN_HORIZONTAL * RES_HW_SCREEN_VERTICAL * sizeof(uint16_t));
688689

690+
/// ------ Wait for menu UP key event ------
691+
int actions[IN_BINDTYPE_COUNT] = { 0, };
692+
while(event.type != SDL_KEYUP || event.key.keysym.sym != SDLK_q){
693+
while (SDL_PollEvent(&event)){
694+
SDL_PushEvent(&event);
695+
in_update(actions);
696+
}
697+
698+
/* 500ms timeout */
699+
if(SDL_GetTicks() - cur_ms > 500){
700+
MENU_ERROR_PRINTF("Timeout waiting for SDLK_q UP\n");
701+
break;
702+
}
703+
}
704+
689705
/// -------- Main loop ---------
690706
while (!stop_menu_loop)
691707
{
@@ -2328,8 +2344,8 @@ void menu_loop_funkey(void)
23282344
if (engineState == PGS_Menu)
23292345
engineState = PGS_Running;
23302346
/* wait until menu, ok, back is released */
2331-
while (in_menu_wait_any(NULL, 50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK))
2332-
;
2347+
/*while (in_menu_wait_any(NULL, 50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK))
2348+
;*/
23332349
}
23342350

23352351
in_set_config_int(0, IN_CFG_BLOCKING, 0);

0 commit comments

Comments
 (0)