(Menu) Refactor menu_content_history_push_current

This commit is contained in:
twinaphex 2014-09-05 19:56:23 +02:00
parent 1111bd2f6d
commit 125f256c5e
5 changed files with 27 additions and 28 deletions

View File

@ -376,7 +376,7 @@ returntype main_entry(signature())
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
if (ret)
#endif
menu_content_history_push_current();
rarch_playlist_push(g_extern.history, g_extern.fullpath);
#else
frontend_loop = main_entry_iterate_content_nomenu;
#endif

View File

@ -55,31 +55,6 @@ void menu_update_system_info(menu_handle_t *menu, bool *load_no_content)
RARCH_LOG("Permissions = %s\n", info->permissions);
}
void menu_content_history_push_current(void)
{
char tmp[PATH_MAX];
if (!g_extern.history)
return;
if (!g_extern.libretro_dummy)
return;
/* g_extern.fullpath can be relative here.
* Ensure we're pushing absolute path. */
strlcpy(tmp, g_extern.fullpath, sizeof(tmp));
if (*tmp)
path_resolve_realpath(tmp, sizeof(tmp));
if (g_extern.system.no_content || *tmp)
content_playlist_push(g_extern.history,
*tmp ? tmp : NULL,
g_settings.libretro,
g_extern.system.info.library_name);
}
static void draw_frame(bool enable)
{
if (driver.video_data && driver.video_poke &&

View File

@ -133,8 +133,6 @@ bool load_menu_content(void);
void load_menu_content_history(unsigned game_index);
void menu_content_history_push_current(void);
bool menu_replace_config(const char *path);
bool menu_save_new_config(void);

View File

@ -814,6 +814,9 @@ void rarch_disk_control_append_image(const char *path);
bool rarch_set_rumble_state(unsigned port,
enum retro_rumble_effect effect, bool enable);
void rarch_playlist_push(content_playlist_t *playlist,
const char *path);
void rarch_playlist_load_content(content_playlist_t *playlist,
unsigned index);

View File

@ -3770,6 +3770,29 @@ void rarch_main_deinit(void)
g_extern.main_is_init = false;
}
void rarch_playlist_push(content_playlist_t *playlist,
const char *path)
{
char tmp[PATH_MAX];
if (!playlist || !g_extern.libretro_dummy)
return;
/* path can be relative here.
* Ensure we're pushing absolute path. */
strlcpy(tmp, path, sizeof(tmp));
if (*tmp)
path_resolve_realpath(tmp, sizeof(tmp));
if (g_extern.system.no_content || *tmp)
content_playlist_push(playlist,
*tmp ? tmp : NULL,
g_settings.libretro,
g_extern.system.info.library_name);
}
void rarch_playlist_load_content(content_playlist_t *playlist,
unsigned index)
{