Implement RARCH_MENU_CTL_IS_PENDING_QUICK_MENU, RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU

This commit is contained in:
twinaphex 2016-02-12 04:28:09 +01:00
parent ce93da7cbf
commit 7d00f945b8
4 changed files with 47 additions and 28 deletions

View File

@ -107,7 +107,7 @@ finish:
}
#endif
static int generic_action_ok_displaylist_push(const char *path,
int generic_action_ok_displaylist_push(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
unsigned action_type)
{
@ -440,17 +440,6 @@ static int generic_action_ok_displaylist_push(const char *path,
return 0;
}
int action_ok_push_quick_menu(void)
{
bool msg_force = true;
menu_entries_flush_stack(NULL, MENU_SETTINGS);
menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
generic_action_ok_displaylist_push("",
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);
return 0;
}
static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx,
const char *path, const char *label,
uint32_t hash_label,
@ -509,7 +498,7 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx,
if (rarch_task_push_content_load_default(NULL, NULL,
false, CORE_TYPE_PLAIN, NULL, NULL))
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit();
case 0:
return generic_action_ok_displaylist_push(path, label, type,
@ -556,7 +545,7 @@ static int action_ok_file_load_detect_core(const char *path,
if (rarch_task_push_content_load_default(path, detect_content_path,
false, CORE_TYPE_PLAIN, NULL, NULL))
{
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit();
}
@ -1110,7 +1099,7 @@ static int action_ok_core_load_deferred(const char *path,
if (rarch_task_push_content_load_default(path, menu->deferred_path,
false, CORE_TYPE_PLAIN, NULL, NULL))
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit();
}
@ -1141,7 +1130,7 @@ static int generic_action_ok_file_load(const char *path,
case ACTION_OK_IMAGEVIEWER:
if (rarch_task_push_content_load_default(
NULL, new_path, true, action_type, NULL, NULL))
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
break;
default:
break;
@ -1209,7 +1198,7 @@ static int action_ok_file_load(const char *path,
if (rarch_task_push_content_load_default(NULL, full_path_new,
true, CORE_TYPE_PLAIN, NULL, NULL))
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit();
}
@ -1958,7 +1947,7 @@ static int action_ok_start_core(const char *path,
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
if (rarch_task_push_content_load_default(NULL, NULL,
false, CORE_TYPE_PLAIN, NULL, NULL))
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
}
return 0;
@ -2039,7 +2028,7 @@ static int action_ok_load_archive(const char *path,
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
if (rarch_task_push_content_load_default(
NULL, detect_content_path, false, CORE_TYPE_PLAIN, NULL, NULL))
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return 0;
}
@ -2084,7 +2073,7 @@ static int action_ok_load_archive_detect_core(const char *path,
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
if (rarch_task_push_content_load_default(NULL, NULL,
false, CORE_TYPE_PLAIN, NULL, NULL))
action_ok_push_quick_menu();
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit();
case 0:
return generic_action_ok_displaylist_push(path, label, type,

View File

@ -94,6 +94,10 @@ int shader_action_parameter_right(unsigned type, const char *label, bool wraparo
int shader_action_parameter_preset_right(unsigned type, const char *label,
bool wraparound);
int generic_action_ok_displaylist_push(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
unsigned action_type);
int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
bool wraparound);

View File

@ -258,6 +258,7 @@ static void menu_driver_toggle(bool latch)
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
{
static struct retro_system_info menu_driver_system;
static bool menu_driver_pending_quick_menu = false;
static bool menu_driver_prevent_populate = false;
static bool menu_driver_load_no_content = false;
static bool menu_driver_alive = false;
@ -281,6 +282,14 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
*driver_data = menu_driver_data;
}
break;
case RARCH_MENU_CTL_IS_PENDING_QUICK_MENU:
return menu_driver_pending_quick_menu;
case RARCH_MENU_CTL_SET_PENDING_QUICK_MENU:
menu_driver_pending_quick_menu = true;
break;
case RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU:
menu_driver_pending_quick_menu = false;
break;
case RARCH_MENU_CTL_IS_PENDING_QUIT:
return menu_driver_pending_quit;
case RARCH_MENU_CTL_SET_PENDING_QUIT:
@ -298,14 +307,15 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_driver_pending_shutdown = false;
break;
case RARCH_MENU_CTL_DESTROY:
menu_driver_pending_quit = false;
menu_driver_pending_shutdown = false;
menu_driver_prevent_populate = false;
menu_driver_load_no_content = false;
menu_driver_alive = false;
menu_driver_data_own = false;
menu_driver_ctx = NULL;
menu_userdata = NULL;
menu_driver_pending_quick_menu = false;
menu_driver_pending_quit = false;
menu_driver_pending_shutdown = false;
menu_driver_prevent_populate = false;
menu_driver_load_no_content = false;
menu_driver_alive = false;
menu_driver_data_own = false;
menu_driver_ctx = NULL;
menu_userdata = NULL;
break;
case RARCH_MENU_CTL_PLAYLIST_FREE:
if (menu_driver_playlist)
@ -787,6 +797,19 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
{
menu_ctx_iterate_t *iterate = (menu_ctx_iterate_t*)data;
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUICK_MENU, NULL))
{
bool msg_force = true;
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU, NULL);
menu_entries_flush_stack(NULL, MENU_SETTINGS);
menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
generic_action_ok_displaylist_push("",
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);
return true;
}
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL))
{
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUIT, NULL);

View File

@ -107,6 +107,9 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_NAVIGATION_SET_LAST,
RARCH_MENU_CTL_NAVIGATION_ASCEND_ALPHABET,
RARCH_MENU_CTL_NAVIGATION_DESCEND_ALPHABET,
RARCH_MENU_CTL_IS_PENDING_QUICK_MENU,
RARCH_MENU_CTL_SET_PENDING_QUICK_MENU,
RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU,
RARCH_MENU_CTL_IS_PENDING_QUIT,
RARCH_MENU_CTL_SET_PENDING_QUIT,
RARCH_MENU_CTL_UNSET_PENDING_QUIT,