diff --git a/Makefile.wii b/Makefile.wii index 6d3d0781b1..90c2a36cd4 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -37,8 +37,6 @@ ifeq ($(CUSTOM_LIBOGC), 1) CFLAGS += -DHAVE_MINIOGC endif -LIBOGC_LIB := -logc - MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) ifeq ($(WHOLE_ARCHIVE_LINK), 1) diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index fed7709a21..d8370a39fa 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -394,6 +394,31 @@ void load_menu_game_prepare(void) MENU_TEXTURE_FULLSCREEN); } +void load_menu_game_history(void) +{ + const char *path = NULL; + const char *core_path = NULL; + const char *core_name = NULL; + + rom_history_get_index(rgui->history, + rgui->selection_ptr, &path, &core_path, &core_name); + + strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro)); + strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath)); + +#if !defined( HAVE_DYNAMIC) && defined(RARCH_CONSOLE) + g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME); + g_extern.lifecycle_mode_state |= (1ULL << MODE_EXIT); + g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN); + g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN_START_GAME); +#elif defined(HAVE_DYNAMIC) + libretro_free_system_info(&rgui->info); + libretro_get_system_info(g_settings.libretro, &rgui->info); + g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME); +#endif + +} + bool load_menu_game(void) { if (g_extern.main_is_init) @@ -444,8 +469,6 @@ void menu_init(void) libretro_get_system_info(g_settings.libretro, &rgui->info); } #else - // Don't use pretro_*, it can be dummy core. If we're statically linked, - // retro_* will always go to the "real" core. retro_get_system_info(&rgui->info); #endif diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index c837c67953..bc6823c2c1 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -270,6 +270,7 @@ void shader_manager_get_str(struct gfx_shader *shader, void load_menu_game_prepare(void); bool load_menu_game(void); +void load_menu_game_history(void); #ifdef __cplusplus } diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index 4c8f978918..498e01cf0a 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -2191,24 +2191,7 @@ int rgui_iterate(rgui_handle_t *rgui) } else if (menu_type == RGUI_SETTINGS_OPEN_HISTORY) { - const char *path = NULL; - const char *core_path = NULL; - const char *core_name = NULL; - - rom_history_get_index(rgui->history, - rgui->selection_ptr, &path, &core_path, &core_name); - - strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro)); - -#ifdef HAVE_DYNAMIC - libretro_free_system_info(&rgui->info); - libretro_get_system_info(g_settings.libretro, &rgui->info); -#endif - // Dunno what to do for Wii here ... - - strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath)); - g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME); - + load_menu_game_history(); rgui->need_refresh = true; ret = -1; } diff --git a/frontend/menu/rmenu.c b/frontend/menu/rmenu.c index 1512cf4570..d6b6a32825 100644 --- a/frontend/menu/rmenu.c +++ b/frontend/menu/rmenu.c @@ -52,9 +52,6 @@ #define EXT_IMAGES "png|PNG"JPEG_FORMATS #define EXT_INPUT_PRESETS "cfg|CFG" - -static bool set_libretro_core_as_launch; - struct texture_image *menu_texture; #ifdef HAVE_MENU_PANEL struct texture_image *menu_panel; @@ -643,20 +640,9 @@ static int select_file(void *data, uint64_t input) break; case LIBRETRO_CHOICE: strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro)); - - if (set_libretro_core_as_launch) - { - strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath)); - set_libretro_core_as_launch = false; - g_extern.lifecycle_mode_state |= (1ULL << MODE_EXIT); - g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN); - return -1; - } - else - { - if (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW)) - msg_queue_push(g_extern.msg_queue, "INFO - You need to restart RetroArch.", 1, 180); - } + g_extern.lifecycle_mode_state |= (1ULL << MODE_EXIT); + g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN); + return -1; break; } @@ -1611,7 +1597,6 @@ static int set_setting_action(uint8_t menu_type, unsigned switchvalue, uint64_t { menu_stack_push(LIBRETRO_CHOICE, true); filebrowser_set_root_and_ext(rgui->browser, EXT_EXECUTABLES, default_paths.core_dir); - set_libretro_core_as_launch = true; } break; #ifdef HAVE_MULTIMAN diff --git a/frontend/menu/rmenu_xui.cpp b/frontend/menu/rmenu_xui.cpp index a5b561379a..b37bebb8b4 100644 --- a/frontend/menu/rmenu_xui.cpp +++ b/frontend/menu/rmenu_xui.cpp @@ -1488,7 +1488,8 @@ HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle wcstombs(str_buffer, (const wchar_t *)XuiListGetText(m_list, index), sizeof(str_buffer)); if(path_file_exists(rgui->browser->list->elems[index].data)) { - snprintf(g_extern.fullpath, sizeof(g_extern.fullpath), "%s\\%s", rgui->browser->current_dir.directory_path, str_buffer); + snprintf(g_settings.libretro, sizeof(g_settings.libretro), "%s\\%s", + rgui->browser->current_dir.directory_path, str_buffer); g_extern.lifecycle_mode_state |= (1ULL << MODE_EXIT); g_extern.lifecycle_mode_state |= (1ULL << MODE_EXITSPAWN); process_input_ret = -1; diff --git a/frontend/platform/platform_gx.c b/frontend/platform/platform_gx.c index 65daae25c0..6649abffc7 100644 --- a/frontend/platform/platform_gx.c +++ b/frontend/platform/platform_gx.c @@ -324,11 +324,14 @@ static void system_init(void) static void system_exitspawn(void) { #if defined(IS_SALAMANDER) - rarch_console_exec(default_paths.libretro_path); + rarch_console_exec(default_paths.libretro_path, false); #elif defined(HW_RVL) - // try to launch the core directly first, then fallback to salamander - rarch_console_exec(g_settings.libretro); - rarch_console_exec(g_extern.fullpath); + bool should_load_game = false; + if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN_START_GAME)) + should_load_game = true; + + rarch_console_exec(g_settings.libretro, should_load_game); + rarch_console_exec(g_extern.fullpath, false); #endif } diff --git a/frontend/platform/platform_gx_exec.c b/frontend/platform/platform_gx_exec.c index b98ae2d7fd..027045b25b 100644 --- a/frontend/platform/platform_gx_exec.c +++ b/frontend/platform/platform_gx_exec.c @@ -47,6 +47,8 @@ static void dol_copy_argv_path(const char *fullpath) size_t len = strlen(__system_argv->argv[0]); memcpy(cmdline, __system_argv->argv[0], len); cmdline[len++] = 0; + +#ifndef IS_SALAMANDER // file must be split into two parts, the path and the actual filename // done to be compatible with loaders if (fullpath && strchr(fullpath, '/') != (char *)-1) @@ -67,6 +69,7 @@ static void dol_copy_argv_path(const char *fullpath) len += t_len; cmdline[len++] = 0; } +#endif cmdline[len++] = 0; argv->length = len; DCFlushRange(ARGS_ADDR, sizeof(struct __argv) + argv->length); @@ -74,7 +77,7 @@ static void dol_copy_argv_path(const char *fullpath) // WARNING: after we move any data into EXECUTE_ADDR, we can no longer use any // heap memory and are restricted to the stack only -static void rarch_console_exec(const char *path) +static void rarch_console_exec(const char *path, bool should_load_game) { RARCH_LOG("Attempt to load executable: [%s].\n", path); @@ -112,7 +115,7 @@ static void rarch_console_exec(const char *path) memmove(EXECUTE_ADDR, dol, size); DCFlushRange(EXECUTE_ADDR, size); - dol_copy_argv_path(NULL); + dol_copy_argv_path(should_load_game ? g_extern.fullpath : NULL); size_t booter_size = booter_end - booter_start; memcpy(BOOTER_ADDR, booter_start, booter_size); diff --git a/frontend/platform/platform_ps3.c b/frontend/platform/platform_ps3.c index e263510645..eee2336375 100644 --- a/frontend/platform/platform_ps3.c +++ b/frontend/platform/platform_ps3.c @@ -397,13 +397,17 @@ static void system_exitspawn(void) #endif #ifdef IS_SALAMANDER - rarch_console_exec(default_paths.libretro_path); + rarch_console_exec(default_paths.libretro_path, false); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); #else - rarch_console_exec(g_extern.fullpath); + bool should_load_game = false; + if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN_START_GAME)) + should_load_game = true; + + rarch_console_exec(g_extern.fullpath, should_load_game); #endif #endif diff --git a/frontend/platform/platform_ps3_exec.c b/frontend/platform/platform_ps3_exec.c index f0fe8a0feb..8939770f66 100644 --- a/frontend/platform/platform_ps3_exec.c +++ b/frontend/platform/platform_ps3_exec.c @@ -25,8 +25,10 @@ #include "../../retroarch_logger.h" -static void rarch_console_exec(const char *path) +static void rarch_console_exec(const char *path, bool should_load_game) { + (void)should_load_game; + RARCH_LOG("Attempt to load executable: [%s].\n", path); char spawn_data[256]; for(unsigned int i = 0; i < sizeof(spawn_data); ++i) diff --git a/frontend/platform/platform_xdk.c b/frontend/platform/platform_xdk.c index ef6d7f007f..c5cfd41d17 100644 --- a/frontend/platform/platform_xdk.c +++ b/frontend/platform/platform_xdk.c @@ -274,8 +274,12 @@ static void system_deinit(void) {} static void system_exitspawn(void) { #ifdef IS_SALAMANDER - rarch_console_exec(default_paths.libretro_path); + rarch_console_exec(default_paths.libretro_path, false); #else - rarch_console_exec(g_extern.fullpath); + bool should_load_game = false; + if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN_START_GAME)) + should_load_game = true; + + rarch_console_exec(g_settings.libretro, should_load_game); #endif } diff --git a/frontend/platform/platform_xdk_exec.c b/frontend/platform/platform_xdk_exec.c index 8b55a3e6f2..1b81ccfa07 100644 --- a/frontend/platform/platform_xdk_exec.c +++ b/frontend/platform/platform_xdk_exec.c @@ -20,8 +20,10 @@ #include "../../retroarch_logger.h" -static void rarch_console_exec(const char *path) +static void rarch_console_exec(const char *path, bool should_load_game) { + (void)should_load_game; RARCH_LOG("Attempt to load executable: [%s].\n", path); + XLaunchNewImage(path, NULL); } diff --git a/general.h b/general.h index 57a80f6342..6e9db7940a 100644 --- a/general.h +++ b/general.h @@ -115,6 +115,7 @@ enum menu_enums MODE_EXTLAUNCH_MULTIMAN, MODE_EXIT, MODE_EXITSPAWN, + MODE_EXITSPAWN_START_GAME, MODE_EXITSPAWN_MULTIMAN, MODE_INPUT_XPERIA_PLAY_HACK, MODE_VIDEO_TRIPLE_BUFFERING_ENABLE,