diff --git a/Makefile.common b/Makefile.common index f088a6b533..380f4586f0 100644 --- a/Makefile.common +++ b/Makefile.common @@ -392,6 +392,10 @@ ifeq ($(HAVE_XMB), 1) endif endif +ifeq ($(HAVE_LAKKA), 1) + DEFINES += -DHAVE_LAKKA +endif + ifeq ($(HAVE_MENU_COMMON), 1) ifeq ($(PSEUDOLOC), 1) PSEUDO_NS := pseudo diff --git a/command_event.c b/command_event.c index 71bbe3c3f0..de9449110b 100644 --- a/command_event.c +++ b/command_event.c @@ -1019,7 +1019,7 @@ bool event_command(enum event_command cmd) driver_t *driver = driver_get_ptr(); global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); - rarch_system_info_t *system = rarch_system_info_get_ptr(); + rarch_system_info_t *info = rarch_system_info_get_ptr(); (void)i; @@ -1411,6 +1411,11 @@ bool event_command(enum event_command cmd) case EVENT_CMD_QUIT_RETROARCH: rarch_ctl(RARCH_ACTION_STATE_FORCE_QUIT, NULL); break; + case EVENT_CMD_SHUTDOWN: + rarch_main_msg_queue_push("Shutting down...", 1, 180, true); + rarch_ctl(RARCH_ACTION_STATE_FORCE_QUIT, NULL); + system("shutdown -P now"); + break; case EVENT_CMD_RESUME: rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL); break; @@ -1638,11 +1643,11 @@ bool event_command(enum event_command cmd) global->log_file = NULL; break; case EVENT_CMD_DISK_EJECT_TOGGLE: - if (system && system->disk_control.get_num_images) + if (info && info->disk_control.get_num_images) { const struct retro_disk_control_callback *control = (const struct retro_disk_control_callback*) - &system->disk_control; + &info->disk_control; if (control) event_check_disk_eject(control); @@ -1653,11 +1658,11 @@ bool event_command(enum event_command cmd) 1, 120, true); break; case EVENT_CMD_DISK_NEXT: - if (system && system->disk_control.get_num_images) + if (info && info->disk_control.get_num_images) { const struct retro_disk_control_callback *control = (const struct retro_disk_control_callback*) - &system->disk_control; + &info->disk_control; if (!control) return false; @@ -1673,11 +1678,11 @@ bool event_command(enum event_command cmd) 1, 120, true); break; case EVENT_CMD_DISK_PREV: - if (system && system->disk_control.get_num_images) + if (info && info->disk_control.get_num_images) { const struct retro_disk_control_callback *control = (const struct retro_disk_control_callback*) - &system->disk_control; + &info->disk_control; if (!control) return false; diff --git a/command_event.h b/command_event.h index ded995fb66..79df12f7d3 100644 --- a/command_event.h +++ b/command_event.h @@ -117,6 +117,8 @@ enum event_command EVENT_CMD_RESTART_RETROARCH, /* Force-quit RetroArch. */ EVENT_CMD_QUIT_RETROARCH, + /* Shutdown the OS */ + EVENT_CMD_SHUTDOWN, /* Resume RetroArch when in menu. */ EVENT_CMD_RESUME, /* Toggles pause. */ diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 88ccdc6d67..080cfcf6ea 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2687,6 +2687,8 @@ static int xmb_list_push(menu_displaylist_info_t *info, unsigned type) menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_QUIT_RETROARCH), PARSE_ACTION); #endif + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_SHUTDOWN), PARSE_ACTION); info->need_push = true; ret = 0; break; diff --git a/menu/intl/menu_hash_fr.c b/menu/intl/menu_hash_fr.c index f87c3d858f..c32f7bdb25 100644 --- a/menu/intl/menu_hash_fr.c +++ b/menu/intl/menu_hash_fr.c @@ -484,6 +484,8 @@ const char *menu_hash_to_str_fr(uint32_t hash) return "Réglages"; case MENU_LABEL_VALUE_QUIT_RETROARCH: return "Quitter RetroArch"; + case MENU_LABEL_VALUE_SHUTDOWN: + return "Éteindre"; case MENU_LABEL_VALUE_HELP: return "Aide"; case MENU_LABEL_VALUE_SAVE_NEW_CONFIG: diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index 580e9cada2..14e13eedea 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -1176,6 +1176,8 @@ const char *menu_hash_to_str_us(uint32_t hash) return "Settings"; case MENU_LABEL_VALUE_QUIT_RETROARCH: return "Quit RetroArch"; + case MENU_LABEL_VALUE_SHUTDOWN: + return "Shutdown"; case MENU_LABEL_VALUE_HELP: return "help"; case MENU_LABEL_VALUE_SAVE_NEW_CONFIG: diff --git a/menu/menu_hash.h b/menu/menu_hash.h index adfdf3e8c3..2a84098d60 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -642,6 +642,8 @@ extern "C" { #define MENU_LABEL_VALUE_CLOSE_CONTENT 0x2b3d9556U #define MENU_LABEL_QUIT_RETROARCH 0x84b0bc71U #define MENU_LABEL_VALUE_QUIT_RETROARCH 0x8e7024f2U +#define MENU_LABEL_SHUTDOWN 0xfc460361U +#define MENU_LABEL_VALUE_SHUTDOWN 0x740b6741U #define MENU_LABEL_DEFERRED_VIDEO_FILTER 0x966ad201U #define MENU_LABEL_DEFERRED_CORE_LIST_SET 0xa6d5fdb4U #define MENU_LABEL_VALUE_STARTING_DOWNLOAD 0x42e10f03U diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a088e5db7c..c234062f2d 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3162,6 +3162,16 @@ static bool setting_append_list_main_menu_options( menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_QUIT_RETROARCH); #endif +#if defined(HAVE_LAKKA) + CONFIG_ACTION( + menu_hash_to_str(MENU_LABEL_SHUTDOWN), + menu_hash_to_str(MENU_LABEL_VALUE_SHUTDOWN), + group_info.name, + subgroup_info.name, + parent_group); + menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_SHUTDOWN); +#endif + for (user = 0; user < MAX_USERS; user++) setting_append_list_input_player_options(list, list_info, parent_group, user);