Create menu_content_ctl

This commit is contained in:
twinaphex 2016-02-04 14:51:01 +01:00
parent 8709657d4d
commit b646b548ff
3 changed files with 29 additions and 13 deletions

View File

@ -96,11 +96,11 @@ static void menu_content_environment_get(int *argc, char *argv[],
* Returns: true (1) if successful, otherwise false (0).
**/
bool menu_content_load(void)
static bool menu_content_load(void)
{
bool msg_force = true;
char name[PATH_MAX_LENGTH];
char msg[PATH_MAX_LENGTH];
bool msg_force = true;
char *fullpath = NULL;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
@ -134,6 +134,8 @@ bool menu_content_load(void)
event_cmd_ctl(EVENT_CMD_VIDEO_SET_ASPECT_RATIO, NULL);
event_cmd_ctl(EVENT_CMD_RESUME, NULL);
frontend_driver_content_loaded();
return true;
}
@ -269,3 +271,17 @@ int menu_content_defer_core(void *data, const char *dir,
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, new_core_path);
return -1;
}
bool menu_content_ctl(enum menu_content_ctl_state state, void *data)
{
switch (state)
{
case MENU_CONTENT_CTL_LOAD:
return menu_content_load();
case MENU_CONTENT_CTL_NONE:
default:
return false;
}
return true;
}

View File

@ -25,15 +25,16 @@
extern "C" {
#endif
/**
* menu_content_load:
*
* Loads content into currently selected core.
* Will also optionally push the content entry to the history playlist.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool menu_content_load(void);
enum menu_content_ctl_state
{
MENU_CONTENT_CTL_NONE = 0,
/* Loads content into currently selected core.
* Will also optionally push the content entry
* to the history playlist. */
MENU_CONTENT_CTL_LOAD
};
bool menu_content_ctl(enum menu_content_ctl_state state, void *data);
/**
* menu_content_playlist_load:

View File

@ -1477,10 +1477,9 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
case RARCH_CTL_LOAD_CONTENT_IMAGEVIEWER:
#ifdef HAVE_MENU
/* If content loading fails, we go back to menu. */
if (!menu_content_load())
if (!menu_content_ctl(MENU_CONTENT_CTL_LOAD, NULL))
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
#endif
frontend_driver_content_loaded();
break;
case RARCH_CTL_MENU_RUNNING_FINISHED:
#ifdef HAVE_MENU