From 125f256c5e71f2a5150013be39328adad055f4d5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 5 Sep 2014 19:56:23 +0200 Subject: [PATCH] (Menu) Refactor menu_content_history_push_current --- frontend/frontend.c | 2 +- frontend/menu/menu_common.c | 25 ------------------------- frontend/menu/menu_common.h | 2 -- general.h | 3 +++ retroarch.c | 23 +++++++++++++++++++++++ 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/frontend/frontend.c b/frontend/frontend.c index 1b7b1813e2..5c960a8731 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -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 diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index c022eed019..560cc770be 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -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 && diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index 421d09178c..acc69decce 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -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); diff --git a/general.h b/general.h index a804b7476a..24a50fc0a6 100644 --- a/general.h +++ b/general.h @@ -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); diff --git a/retroarch.c b/retroarch.c index 2ad462029a..eedbc9ab7e 100644 --- a/retroarch.c +++ b/retroarch.c @@ -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) {