From 95dbb040b0ab3701f75cf9cbd1b3527a256402bd Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 5 May 2019 17:19:12 -0500 Subject: [PATCH] add restart menu option add sublabels Add .gitlab-ci.yml Update .gitlab-ci.yml --- .gitlab-ci.yml | 8 +++++ frontend/drivers/platform_win32.c | 55 +++++++++++++++++++++++++++++-- intl/msg_hash_us.h | 4 +++ menu/cbs/menu_cbs_sublabel.c | 4 +++ menu/drivers/ozone/ozone.c | 6 ++++ menu/drivers/xmb.c | 7 +++- menu/menu_displaylist.c | 7 ++++ menu/menu_setting.c | 8 +++++ msg_hash.h | 2 +- 9 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000..57f690c098 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +before_script: + - apt-get update -qq && apt-get install -y -qq git build-essential + - apt-get update -qq && apt-get build-dep -y retroarch + +build: + script: + - ./configure + - make -j2 diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 9a50c4a5b7..ff52a82d93 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include @@ -43,7 +45,7 @@ #include "../../retroarch.h" #include "../../verbosity.h" #include "../../ui/drivers/ui_win32.h" - +#include "../../paths.h" #ifndef SM_SERVERR2 #define SM_SERVERR2 89 #endif @@ -635,14 +637,61 @@ enum retro_language frontend_win32_get_user_language(void) return lang; } +enum frontend_fork win32_fork_mode; + +void frontend_win32_respawn(char *s, size_t len) +{ + if (win32_fork_mode != FRONTEND_FORK_RESTART) + return; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + + char executable_path[PATH_MAX_LENGTH] = {0}; + fill_pathname_application_path(executable_path, + sizeof(executable_path)); + path_set(RARCH_PATH_CORE, executable_path); + RARCH_LOG("Restarting RetroArch with commandline: %s and %s\n", + executable_path, get_retroarch_launch_arguments()); + + if(!CreateProcess( executable_path, get_retroarch_launch_arguments(), + NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + { + RARCH_LOG("Failed to restart RetroArch\n"); + } + return; +} + +bool frontend_win32_set_fork(enum frontend_fork fork_mode) +{ + switch (fork_mode) + { + case FRONTEND_FORK_CORE: + break; + case FRONTEND_FORK_CORE_WITH_ARGS: + break; + case FRONTEND_FORK_RESTART: + command_event(CMD_EVENT_QUIT, NULL); + break; + case FRONTEND_FORK_NONE: + default: + break; + } + win32_fork_mode = fork_mode; + return true; +} + frontend_ctx_driver_t frontend_ctx_win32 = { frontend_win32_environment_get, frontend_win32_init, NULL, /* deinit */ - NULL, /* exitspawn */ + frontend_win32_respawn, /* exitspawn */ NULL, /* process_args */ NULL, /* exec */ - NULL, /* set_fork */ + frontend_win32_set_fork, /* set_fork */ NULL, /* shutdown */ NULL, /* get_name */ frontend_win32_get_os, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 04472da7d6..872eddd3b2 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -5455,6 +5455,10 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUIT_RETROARCH, "Quit the program." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_RESTART_RETROARCH, + "Restart the program." + ) #endif MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index e338a8e604..d2ae08066a 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -241,6 +241,7 @@ default_sublabel_macro(action_bind_sublabel_content_special, MENU_ default_sublabel_macro(action_bind_sublabel_network_information, MENU_ENUM_SUBLABEL_NETWORK_INFORMATION) default_sublabel_macro(action_bind_sublabel_system_information, MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION) default_sublabel_macro(action_bind_sublabel_quit_retroarch, MENU_ENUM_SUBLABEL_QUIT_RETROARCH) +default_sublabel_macro(action_bind_sublabel_restart_retroarch, MENU_ENUM_SUBLABEL_RESTART_RETROARCH) default_sublabel_macro(action_bind_sublabel_video_window_width, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH) default_sublabel_macro(action_bind_sublabel_video_window_height, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT) default_sublabel_macro(action_bind_sublabel_video_fullscreen_x, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X) @@ -2035,6 +2036,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_QUIT_RETROARCH: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quit_retroarch); break; + case MENU_ENUM_LABEL_RESTART_RETROARCH: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_restart_retroarch); + break; case MENU_ENUM_LABEL_NETWORK_INFORMATION: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_network_information); break; diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index 1a1f58fc3a..918c0fc735 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -902,6 +902,12 @@ static int ozone_list_push(void *data, void *userdata, } #if !defined(IOS) + if (settings->bools.menu_show_quit_retroarch && frontend_driver_has_fork()) + { + entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH; + menu_displaylist_setting(&entry); + } + if (settings->bools.menu_show_quit_retroarch) { entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 3f7758fd4f..3574c460bd 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -5666,13 +5666,18 @@ static int xmb_list_push(void *data, void *userdata, } #if !defined(IOS) + if (settings->bools.menu_show_quit_retroarch && frontend_driver_has_fork()) + { + entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH; + menu_displaylist_setting(&entry); + } + if (settings->bools.menu_show_quit_retroarch) { entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH; menu_displaylist_setting(&entry); } #endif - if (settings->bools.menu_show_reboot) { entry.enum_idx = MENU_ENUM_LABEL_REBOOT; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 3ad1036590..c3f9a20572 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -6879,6 +6879,13 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, MENU_ENUM_LABEL_HELP_LIST, PARSE_ACTION, false) == 0) count++; + + if (settings->bools.menu_show_quit_retroarch && frontend_driver_has_fork()) + if (menu_displaylist_parse_settings_enum(info->list, + MENU_ENUM_LABEL_RESTART_RETROARCH, + PARSE_ACTION, false) == 0) + count++; + if (settings->bools.menu_show_quit_retroarch) if (menu_displaylist_parse_settings_enum(info->list, MENU_ENUM_LABEL_QUIT_RETROARCH, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index de7417c518..df0d58f113 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -6765,6 +6765,14 @@ static bool setting_append_list( &subgroup_info, parent_group); menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_QUIT); + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_RESTART_RETROARCH, + MENU_ENUM_LABEL_VALUE_RESTART_RETROARCH, + &group_info, + &subgroup_info, + parent_group); + menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_RESTART_RETROARCH); #endif #if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) diff --git a/msg_hash.h b/msg_hash.h index bcfc62065d..799ffdc22f 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1682,6 +1682,7 @@ enum msg_hash_enums MENU_LABEL(CLOSE_CONTENT), MENU_LABEL(SHOW_WIMP), MENU_LABEL(QUIT_RETROARCH), + MENU_LABEL(RESTART_RETROARCH), MENU_LABEL(SHUTDOWN), MENU_LABEL(REBOOT), MENU_LABEL(DISK_IMAGE_APPEND), @@ -1832,7 +1833,6 @@ enum msg_hash_enums MENU_LABEL(CHEAT_FILE_SAVE_AS), MENU_LABEL(DELETE_ENTRY), MENU_LABEL(RENAME_ENTRY), - MENU_LABEL(RESTART_RETROARCH), MENU_LABEL(TAKE_SCREENSHOT),