Refactor console_load_game

This commit is contained in:
twinaphex 2013-01-22 01:12:02 +01:00
parent 6da1a22978
commit 8a4efb6189
8 changed files with 21 additions and 20 deletions

View File

@ -102,12 +102,6 @@ int main(int argc, char *argv[])
#else
void console_load_game(const char *path)
{
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
}
static void verbose_log_init(void)
{
if (g_extern.verbose)

View File

@ -26,17 +26,12 @@ static void verbose_log_init(void);
static void find_first_libretro_core(char *first_file,
size_t size_of_first_file, const char *dir,
const char * ext);
#else
void console_load_game(const char *path);
#endif
#ifdef HAVE_LIBRETRO_MANAGEMENT
static void get_libretro_core_name(char *name, size_t size);
static bool install_libretro_core(const char *core_exe_path, const char *tmp_path,
const char *libretro_path, const char *config_path, const char *extension);
#endif
#endif

View File

@ -1219,7 +1219,10 @@ int rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
else
{
snprintf(rgui->path_buf, sizeof(rgui->path_buf), "%s/%s", dir, path);
console_load_game(rgui->path_buf);
strlcpy(g_extern.fullpath, rgui->path_buf, sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
rmenu_settings_msg(S_MSG_LOADING_ROM, S_DELAY_1);
rgui->need_refresh = true; // in case of zip extract
rgui->msg_force = true;

View File

@ -1808,7 +1808,10 @@ int select_rom(void *data, void *state)
rmenu_settings_msg(S_MSG_DIR_LOADING_ERROR, S_DELAY_180);
}
else
console_load_game(filebrowser_get_current_path(filebrowser));
{
strlcpy(g_extern.fullpath, filebrowser_get_current_path(filebrowser), sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
}
}
else if (input & (1ULL << RMENU_DEVICE_NAV_L1))
{

View File

@ -182,7 +182,8 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
if(path_file_exists(browser->current_dir.list->elems[index].data))
{
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(browser), str_buffer);
console_load_game(path);
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
}
else if(browser->current_dir.list->elems[index].attr.b)
{

View File

@ -377,7 +377,8 @@ static void system_process_args(int argc, char *argv[])
g_extern.lifecycle_mode_state |= (1ULL << MODE_UNZIP_TO_CURDIR_AND_LOAD_FIRST_FILE);
snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]);
console_load_game(rom);
strlcpy(g_extern.fullpath, rom, sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
rgui_iterate(rgui, RGUI_ACTION_MESSAGE);
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_DRAW);

View File

@ -200,7 +200,8 @@ void menu_init (void)
bool rmenu_iterate(void)
{
console_load_game("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes");
strlcpy(g_extern.fullpath, "/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes", sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
return false;
}

View File

@ -96,10 +96,13 @@ void menu_init (void) {}
bool rmenu_iterate(void)
{
char game_rom[256];
snprintf(game_rom, sizeof(game_rom), "%s%s", default_paths.port_dir, "dkc.sfc");
RARCH_LOG("game ROM: %s\n", game_rom);
console_load_game(game_rom);
char path[256];
snprintf(path, sizeof(path), "%s%s", default_paths.port_dir, "dkc.sfc");
RARCH_LOG("game ROM: %s\n", path);
strlcpy(g_extern.fullpath, path, sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU);
g_extern.lifecycle_mode_state |= (1ULL << MODE_INIT);