diff --git a/console/rarch_console_libretro_mgmt.c b/console/rarch_console_libretro_mgmt.c index 253f6459ff..37268a480b 100644 --- a/console/rarch_console_libretro_mgmt.c +++ b/console/rarch_console_libretro_mgmt.c @@ -75,15 +75,15 @@ bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path, if (path_file_exists(tmp_pathnewfile)) { // if libretro core already exists, this means we are - // upgrading the libretro core - so delete pre-existing - // file first. + // upgrading the libretro core - so delete pre-existing + // file first. RARCH_LOG("Upgrading emulator core...\n"); - ret = remove(tmp_pathnewfile); + ret = remove(tmp_pathnewfile); - if (ret == 0) + if (ret == 0) RARCH_LOG("Succeeded in removing pre-existing libretro core: [%s].\n", tmp_pathnewfile); - else + else RARCH_ERR("Failed to remove pre-existing libretro core: [%s].\n", tmp_pathnewfile); } @@ -93,14 +93,14 @@ bool rarch_configure_libretro_core(const char *full_path, const char *tmp_path, if (ret == 0) { RARCH_LOG("libretro core [%s] renamed to: [%s].\n", full_path, tmp_pathnewfile); - strlcpy(libretro_core_installed, tmp_pathnewfile, sizeof_libretro_core); - ret = 1; + strlcpy(libretro_core_installed, tmp_pathnewfile, sizeof_libretro_core); + ret = 1; } else { RARCH_ERR("Failed to rename CORE executable.\n"); - RARCH_WARN("CORE executable was not found, or some other errors occurred. Will attempt to load libretro core path from config file.\n"); - ret = 0; + RARCH_WARN("CORE executable was not found, or some other errors occurred. Will attempt to load libretro core path from config file.\n"); + ret = 0; } } @@ -151,22 +151,28 @@ void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first if(first_exe) { -#ifdef _XBOX +#if defined(_XBOX) || defined(GEKKO) char fname_tmp[PATH_MAX]; fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); +#ifdef _XBOX if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0) +#elif defined(GEKKO) + if(strcmp(fname_tmp, "boot.dol") == 0) +#else +#error This case not handled +#endif { RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n"); - first_exe = dir_list->elems[1].data; - fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); + first_exe = dir_list->elems[1].data; + fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); - if(!first_exe) - { + if(!first_exe) + { RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n"); - first_exe = dir_list->elems[0].data; - fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); - } + first_exe = dir_list->elems[0].data; + fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); + } } strlcpy(first_file, fname_tmp, size_of_first_file); diff --git a/console/rgui/rgui.c b/console/rgui/rgui.c index 55470a42fb..9ae8a274d9 100644 --- a/console/rgui/rgui.c +++ b/console/rgui/rgui.c @@ -331,7 +331,7 @@ static void render_text(rgui_handle_t *rgui) { char rotate_msg[64]; rarch_settings_create_menu_item_label(rotate_msg, S_LBL_ROTATION, sizeof(rotate_msg)); - snprintf(type_str, sizeof(type_str), rotate_msg); + snprintf(type_str, sizeof(type_str), rotate_msg); } break; case RGUI_SETTINGS_AUDIO_MUTE: @@ -410,7 +410,7 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t #ifdef HW_RVL case RGUI_SETTINGS_VIDEO_SOFT_FILTER: g_console.soft_display_filter_enable = !g_console.soft_display_filter_enable; - gx->should_resize = true; + gx->should_resize = true; break; #endif case RGUI_SETTINGS_VIDEO_GAMMA: @@ -447,21 +447,21 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t { rarch_settings_default(S_DEF_AUDIO_CONTROL_RATE); #ifdef GEKKO - video_gx.set_rotation(NULL, g_console.screen_orientation); + video_gx.set_rotation(NULL, g_console.screen_orientation); #endif } else if (action == RGUI_ACTION_LEFT) { rarch_settings_change(S_ROTATION_DECREMENT); #ifdef GEKKO - video_gx.set_rotation(NULL, g_console.screen_orientation); + video_gx.set_rotation(NULL, g_console.screen_orientation); #endif } else if (action == RGUI_ACTION_RIGHT) { - rarch_settings_change(S_ROTATION_INCREMENT); + rarch_settings_change(S_ROTATION_INCREMENT); #ifdef GEKKO - video_gx.set_rotation(NULL, g_console.screen_orientation); + video_gx.set_rotation(NULL, g_console.screen_orientation); #endif } break; @@ -479,24 +479,17 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t else if (action == RGUI_ACTION_RIGHT) rarch_settings_change(S_AUDIO_CONTROL_RATE_INCREMENT); break; - - /*case RGUI_SETTINGS_CORE: - { - // !!JUST FOR TESTING!! - char boot_dol[PATH_MAX]; - char temp_dol[PATH_MAX]; - char temp2_dol[PATH_MAX]; - - snprintf(boot_dol, sizeof(boot_dol), "%s%s", app_dir, "boot.dol"); - snprintf(temp_dol, sizeof(temp_dol), "%s%s", app_dir, "temp.dol"); - snprintf(temp2_dol, sizeof(temp2_dol), "%s%s", app_dir, "temp2.dol"); - - rename(boot_dol, temp2_dol); - rename(temp_dol, boot_dol); - rename(temp2_dol, temp_dol); + case RGUI_SETTINGS_RESTART: + if (action == RGUI_ACTION_OK) + { +#ifdef GEKKO + snprintf(g_console.launch_app_on_exit, sizeof(g_console.launch_app_on_exit), "boot.dol"); +#endif + g_console.return_to_launcher = true; + g_console.mode_switch = MODE_EXIT; + g_console.menu_enable = false; + } break; - }*/ - // controllers case RGUI_SETTINGS_BIND_DEVICE: g_settings.input.device[port] += RARCH_DEVICE_LAST; @@ -565,6 +558,7 @@ static void rgui_settings_populate_entries(rgui_handle_t *rgui) RGUI_MENU_ITEM("Controller #2 Config", RGUI_SETTINGS_CONTROLLER_2); RGUI_MENU_ITEM("Controller #3 Config", RGUI_SETTINGS_CONTROLLER_3); RGUI_MENU_ITEM("Controller #4 Config", RGUI_SETTINGS_CONTROLLER_4); + RGUI_MENU_ITEM("Restart RetroArch", RGUI_SETTINGS_RESTART); } static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui) @@ -760,7 +754,7 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action) { if (menu_type == RGUI_SETTINGS_CORE) { - // CORE SWITCHING CODE GOES HERE + strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro)); rgui->directory_ptr = directory_ptr; rgui->need_refresh = true; rgui_list_pop(rgui->path_stack); diff --git a/console/rgui/rgui.h b/console/rgui/rgui.h index b629a18d37..b210cc6911 100644 --- a/console/rgui/rgui.h +++ b/console/rgui/rgui.h @@ -46,6 +46,7 @@ typedef enum RGUI_SETTINGS_CONTROLLER_2, RGUI_SETTINGS_CONTROLLER_3, RGUI_SETTINGS_CONTROLLER_4, + RGUI_SETTINGS_RESTART, RGUI_SETTINGS_BIND_DEVICE, RGUI_SETTINGS_BIND_UP, diff --git a/gx/frontend/main.c b/gx/frontend/main.c index 927cb710fb..62b02bb38b 100644 --- a/gx/frontend/main.c +++ b/gx/frontend/main.c @@ -159,13 +159,13 @@ static void menu_loop(void) } static const struct retro_keybind _quit_binds[] = { - { 0, 0, (enum retro_key)0, (GX_CLASSIC_HOME), 0 }, - { 0, 0, (enum retro_key)0, (GX_WIIMOTE_HOME), 0 }, - { 0, 0, (enum retro_key)0, (GX_QUIT_KEY), 0 }, + { 0, 0, (enum retro_key)0, (GX_CLASSIC_HOME), 0 }, + { 0, 0, (enum retro_key)0, (GX_WIIMOTE_HOME), 0 }, + { 0, 0, (enum retro_key)0, (GX_QUIT_KEY), 0 }, }; const struct retro_keybind *quit_binds[] = { - _quit_binds + _quit_binds }; input_state |= input_gx.input_state(NULL, quit_binds, false,