(Wii) Working Load Game History

This commit is contained in:
twinaphex 2013-04-29 03:05:46 +02:00
parent 74faafff37
commit 4a772c3fa8
13 changed files with 63 additions and 53 deletions

View File

@ -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)

View File

@ -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

View File

@ -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
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;

View File

@ -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
}

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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
}

View File

@ -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);
}

View File

@ -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,