Skip to content

Commit a46a594

Browse files
committed
Merge branch 'FunKey' of fk:FunKey-Project/RetroFE into FunKey
2 parents 37ddfb4 + 9dad33d commit a46a594

File tree

2 files changed

+66
-10
lines changed

2 files changed

+66
-10
lines changed

RetroFE/Source/Menu/MenuMode.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,19 @@ void MenuMode::add_menu_zone(ENUM_MENU_TYPE menu_type){
334334
text_pos.y = surface->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 - padding_y_from_center_menu_zone*2;
335335
SDL_BlitSurface(text_surface, NULL, surface, &text_pos);
336336
break;
337+
case MENU_TYPE_LAUNCHER:
338+
MENU_DEBUG_PRINTF("Init MENU_TYPE_LAUNCHER\n");
339+
/// ------ Text ------
340+
text_surface = TTF_RenderText_Blended(menu_title_font, "SET LAUNCHER", text_color);
341+
text_pos.x = (surface->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
342+
text_pos.y = surface->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 - padding_y_from_center_menu_zone*2;
343+
SDL_BlitSurface(text_surface, NULL, surface, &text_pos);
344+
/// ------ Text ------
345+
text_surface = TTF_RenderText_Blended(menu_title_font, "GMENU2X", text_color);
346+
text_pos.x = (surface->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
347+
text_pos.y = surface->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2;
348+
SDL_BlitSurface(text_surface, NULL, surface, &text_pos);
349+
break;
337350
case MENU_TYPE_POWERDOWN:
338351
MENU_DEBUG_PRINTF("Init MENU_TYPE_POWERDOWN\n");
339352
/// ------ Text ------
@@ -368,6 +381,8 @@ void MenuMode::init_menu_zones(){
368381
add_menu_zone(MENU_TYPE_USB);
369382
/// Init Theme Menu
370383
add_menu_zone(MENU_TYPE_THEME);
384+
/// Init Launcher Menu
385+
add_menu_zone(MENU_TYPE_LAUNCHER);
371386
/// Init Powerdown Menu
372387
add_menu_zone(MENU_TYPE_POWERDOWN);
373388
}
@@ -622,6 +637,23 @@ void MenuMode::menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8
622637
}
623638
break;
624639

640+
case MENU_TYPE_LAUNCHER:
641+
if(menu_action){
642+
sprintf(text_tmp, "In progress...");
643+
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
644+
text_pos.x = (virtual_hw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
645+
text_pos.y = virtual_hw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
646+
SDL_BlitSurface(text_surface, NULL, virtual_hw_screen, &text_pos);
647+
}
648+
else if(menu_confirmation){
649+
sprintf(text_tmp, "Are you sure ?");
650+
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
651+
text_pos.x = (virtual_hw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
652+
text_pos.y = virtual_hw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
653+
SDL_BlitSurface(text_surface, NULL, virtual_hw_screen, &text_pos);
654+
}
655+
break;
656+
625657
case MENU_TYPE_EXIT:
626658
case MENU_TYPE_POWERDOWN:
627659
if(menu_action){
@@ -1009,6 +1041,27 @@ int MenuMode::launch( )
10091041
screen_refresh = 1;
10101042
}
10111043
}
1044+
else if(idx_menus[menuItem] == MENU_TYPE_LAUNCHER){
1045+
if(menu_confirmation){
1046+
MENU_DEBUG_PRINTF("Lancher change - confirmed\n");
1047+
1048+
/// ------ Refresh Screen -------
1049+
menu_screen_refresh(menuItem, prevItem, scroll, menu_confirmation, 1);
1050+
1051+
/// ----- Shell cmd ----
1052+
MENU_DEBUG_PRINTF("Running command: %s\n", SHELL_CMD_SET_LAUNCHER_GMENU2X);
1053+
Utils::executeRawPath(SHELL_CMD_SET_LAUNCHER_GMENU2X);
1054+
1055+
stop_menu_loop = 1;
1056+
returnCode = MENU_RETURN_EXIT;
1057+
}
1058+
else{
1059+
MENU_DEBUG_PRINTF("Launcher change - asking confirmation\n");
1060+
menu_confirmation = 1;
1061+
/// ------ Refresh screen ------
1062+
screen_refresh = 1;
1063+
}
1064+
}
10121065
else if(idx_menus[menuItem] == MENU_TYPE_EXIT){
10131066
MENU_DEBUG_PRINTF("Exit game\n");
10141067
if(menu_confirmation){

RetroFE/Source/Menu/MenuMode.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ typedef enum{
1313
MENU_TYPE_ASPECT_RATIO,
1414
MENU_TYPE_USB,
1515
MENU_TYPE_THEME,
16+
MENU_TYPE_LAUNCHER,
1617
MENU_TYPE_EXIT,
1718
MENU_TYPE_POWERDOWN,
1819
NB_MENU_TYPES,
@@ -43,16 +44,18 @@ typedef enum {ASPECT_RATIOS} ENUM_ASPECT_RATIOS_TYPES;
4344
#define STEP_CHANGE_BRIGHTNESS 10
4445

4546
////------ Menu commands -------
46-
#define SHELL_CMD_VOLUME_GET "volume_get"
47-
#define SHELL_CMD_VOLUME_SET "volume_set"
48-
#define SHELL_CMD_BRIGHTNESS_GET "brightness_get"
49-
#define SHELL_CMD_BRIGHTNESS_SET "brightness_set"
50-
#define SHELL_CMD_USB_DATA_CONNECTED "is_usb_data_connected"
51-
#define SHELL_CMD_USB_MOUNT "share start"
52-
#define SHELL_CMD_USB_UNMOUNT "share stop"
53-
#define SHELL_CMD_USB_CHECK_IS_SHARING "share is_sharing"
54-
#define SHELL_CMD_POWERDOWN "shutdown_funkey"
55-
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
47+
#define SHELL_CMD_VOLUME_GET "volume_get"
48+
#define SHELL_CMD_VOLUME_SET "volume_set"
49+
#define SHELL_CMD_BRIGHTNESS_GET "brightness_get"
50+
#define SHELL_CMD_BRIGHTNESS_SET "brightness_set"
51+
#define SHELL_CMD_USB_DATA_CONNECTED "is_usb_data_connected"
52+
#define SHELL_CMD_USB_MOUNT "share start"
53+
#define SHELL_CMD_USB_UNMOUNT "share stop"
54+
#define SHELL_CMD_USB_CHECK_IS_SHARING "share is_sharing"
55+
#define SHELL_CMD_POWERDOWN "shutdown_funkey"
56+
#define SHELL_CMD_SCHEDULE_POWERDOWN "sched_shutdown"
57+
#define SHELL_CMD_SET_LAUNCHER_GMENU2X "set_launcher gmenu2x"
58+
#define SHELL_CMD_SET_LAUNCHER_RETROFE "set_launcher retrofe"
5659

5760
class MenuMode
5861
{

0 commit comments

Comments
 (0)