mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-31 08:33:40 +00:00
Add RARCH_MENU_CTL_DRIVER_DATA_GET
This commit is contained in:
parent
46750ff3e6
commit
84d64c4042
@ -328,7 +328,10 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
|
||||
|
||||
|
@ -134,10 +134,11 @@ static int action_left_mainmenu(unsigned type, const char *label,
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
unsigned action = MENU_ACTION_LEFT;
|
||||
size_t list_size = menu_driver_list_get_size(MENU_LIST_PLAIN);
|
||||
if (!menu)
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
if (list_size == 1)
|
||||
|
@ -121,11 +121,14 @@ static int generic_action_ok_displaylist_push(const char *path,
|
||||
const char *content_path = NULL;
|
||||
const char *info_label = NULL;
|
||||
const char *info_path = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
|
||||
@ -455,13 +458,13 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx,
|
||||
{
|
||||
menu_content_ctx_defer_info_t def_info;
|
||||
char menu_path_new[PATH_MAX_LENGTH];
|
||||
int ret = 0;
|
||||
const char *menu_path = NULL;
|
||||
const char *menu_label = NULL;
|
||||
int ret = 0;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
@ -566,18 +569,18 @@ static int action_ok_playlist_entry(const char *path,
|
||||
size_t selection;
|
||||
menu_content_ctx_playlist_info_t playlist_info;
|
||||
uint32_t core_name_hash, core_path_hash;
|
||||
size_t selection_ptr = 0;
|
||||
content_playlist_t *playlist = g_defaults.history;
|
||||
bool is_history = true;
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
size_t selection_ptr = 0;
|
||||
content_playlist_t *tmp_playlist = NULL;
|
||||
content_playlist_t *playlist = g_defaults.history;
|
||||
bool is_history = true;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
uint32_t hash_label = menu_hash_calculate(label);
|
||||
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
||||
return -1;
|
||||
@ -726,9 +729,9 @@ static int generic_action_ok(const char *path,
|
||||
const char *menu_path = NULL;
|
||||
const char *flush_char = NULL;
|
||||
struct video_shader *shader = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
goto error;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
|
||||
@ -926,9 +929,12 @@ static int generic_action_ok_help(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx,
|
||||
unsigned id, menu_help_type_t id2)
|
||||
{
|
||||
const char *lbl = menu_hash_to_str(id);
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
const char *lbl = menu_hash_to_str(id);
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
|
||||
menu->help_screen_type = id2;
|
||||
|
||||
return generic_action_ok_displaylist_push(path, lbl, type, idx,
|
||||
entry_idx, ACTION_OK_DL_HELP);
|
||||
}
|
||||
@ -936,9 +942,11 @@ static int generic_action_ok_help(const char *path,
|
||||
static int action_ok_cheevos(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
unsigned new_id = type - MENU_SETTINGS_CHEEVOS_START;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
|
||||
|
||||
menu->help_screen_id = new_id;
|
||||
return generic_action_ok_help(path, label, type, idx, entry_idx,
|
||||
MENU_LABEL_CHEEVOS_DESCRIPTION, MENU_HELP_CHEEVOS_DESCRIPTION);
|
||||
@ -1095,9 +1103,9 @@ static int action_ok_core_deferred_set(const char *path,
|
||||
static int action_ok_core_load_deferred(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
if (rarch_task_push_content_load_default(path, menu->deferred_path,
|
||||
@ -1166,9 +1174,12 @@ static int action_ok_file_load(const char *path,
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
rarch_setting_t *setting = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
menu_entries_get_last(menu_stack, &menu_path, &menu_label, NULL, NULL);
|
||||
|
||||
strlcpy(menu_path_new, menu_path, sizeof(menu_path_new));
|
||||
@ -2012,9 +2023,15 @@ static int action_ok_open_archive(const char *path,
|
||||
static int action_ok_load_archive(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
const char *menu_path = menu ? menu->scratch2_buf : NULL;
|
||||
const char *content_path = menu ? menu->scratch_buf : NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
const char *menu_path = NULL;
|
||||
const char *content_path = NULL;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
menu_path = menu->scratch2_buf;
|
||||
content_path = menu->scratch_buf;
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||
sizeof(detect_content_path));
|
||||
@ -2033,16 +2050,19 @@ static int action_ok_load_archive_detect_core(const char *path,
|
||||
menu_content_ctx_defer_info_t def_info;
|
||||
int ret = 0;
|
||||
core_info_list_t *list = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
const char *menu_path = menu ? menu->scratch2_buf : NULL;
|
||||
const char *content_path = menu ? menu->scratch_buf : NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
const char *menu_path = NULL;
|
||||
const char *content_path = NULL;
|
||||
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &idx))
|
||||
return false;
|
||||
|
||||
menu_path = menu->scratch2_buf;
|
||||
content_path = menu->scratch_buf;
|
||||
|
||||
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
|
||||
|
||||
def_info.data = list;
|
||||
|
@ -46,8 +46,9 @@ int action_scan_file(const char *path,
|
||||
char fullpath[PATH_MAX_LENGTH] = {0};
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
@ -65,8 +66,9 @@ int action_scan_directory(const char *path,
|
||||
char fullpath[PATH_MAX_LENGTH] = {0};
|
||||
const char *menu_label = NULL;
|
||||
const char *menu_path = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL);
|
||||
|
@ -1190,13 +1190,14 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
unsigned i, j, k;
|
||||
char path_playlist[PATH_MAX_LENGTH];
|
||||
content_playlist_t *playlist = NULL;
|
||||
database_info_list_t *db_info = NULL;
|
||||
char path_base[PATH_MAX_LENGTH] = {0};
|
||||
char query[PATH_MAX_LENGTH] = {0};
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
content_playlist_t *playlist = NULL;
|
||||
database_info_list_t *db_info = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!menu)
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
goto error;
|
||||
|
||||
database_info_build_query(query, sizeof(query), "displaylist_parse_database_entry", info->path_b);
|
||||
@ -1759,11 +1760,14 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info)
|
||||
bool is_historylist = false;
|
||||
content_playlist_t *playlist = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
struct item_file *item = (struct item_file*)
|
||||
menu_driver_list_get_entry(MENU_LIST_HORIZONTAL,
|
||||
menu_driver_list_get_selection() - (menu_driver_list_get_size(MENU_LIST_TABS)+1));
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
if (!item)
|
||||
return -1;
|
||||
|
||||
@ -1797,12 +1801,12 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info)
|
||||
|
||||
static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t *info)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
#ifdef HAVE_CHEEVOS
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
@ -1889,9 +1893,9 @@ static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t
|
||||
|
||||
static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_info_t *info)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned idx = rpl_entry_selection_ptr;
|
||||
settings_t *settings = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
const char *label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
@ -1899,9 +1903,11 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in
|
||||
char *fullpath = NULL;
|
||||
content_playlist_t *playlist = NULL;
|
||||
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
settings = config_get_ptr();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
|
||||
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)
|
||||
@ -2124,9 +2130,14 @@ static int menu_displaylist_parse_options_cheats(menu_displaylist_info_t *info)
|
||||
static int menu_displaylist_parse_options_remappings(menu_displaylist_info_t *info)
|
||||
{
|
||||
unsigned p, retro_id;
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = NULL;
|
||||
rarch_system_info_t *system = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
settings = config_get_ptr();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
@ -2539,8 +2550,13 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
#endif
|
||||
rarch_system_info_t *system = NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
settings_t *settings = NULL;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
settings = config_get_ptr();
|
||||
|
||||
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
@ -58,7 +58,6 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static menu_handle_t *menu_driver_data = NULL;
|
||||
static const menu_ctx_driver_t *menu_driver_ctx = NULL;
|
||||
static void *menu_userdata = NULL;
|
||||
|
||||
@ -106,13 +105,6 @@ const char *config_get_menu_driver_options(void)
|
||||
return char_list_new_special(STRING_LIST_MENU_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
menu_handle_t *menu_driver_get_ptr(void)
|
||||
{
|
||||
if (!menu_driver_data)
|
||||
return NULL;
|
||||
return menu_driver_data;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
static void bundle_decompressed(void *task_data,
|
||||
void *user_data, const char *err)
|
||||
@ -334,10 +326,19 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
static bool menu_driver_pending_shutdown = false;
|
||||
static content_playlist_t *menu_driver_playlist = NULL;
|
||||
static struct video_shader *menu_driver_shader = NULL;
|
||||
static menu_handle_t *menu_driver_data = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case RARCH_MENU_CTL_DRIVER_DATA_GET:
|
||||
{
|
||||
menu_handle_t **driver_data = (menu_handle_t**)data;
|
||||
if (!driver_data)
|
||||
return false;
|
||||
*driver_data = menu_driver_data;
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_IS_PENDING_QUIT:
|
||||
return menu_driver_pending_quit;
|
||||
case RARCH_MENU_CTL_SET_PENDING_QUIT:
|
||||
|
@ -158,7 +158,8 @@ enum rarch_menu_ctl_state
|
||||
RARCH_MENU_CTL_LIST_INSERT,
|
||||
RARCH_MENU_CTL_LIST_PUSH,
|
||||
RARCH_MENU_CTL_ITERATE,
|
||||
RARCH_MENU_CTL_ENVIRONMENT
|
||||
RARCH_MENU_CTL_ENVIRONMENT,
|
||||
RARCH_MENU_CTL_DRIVER_DATA_GET
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@ -397,8 +398,6 @@ const char *menu_driver_find_ident(int index);
|
||||
**/
|
||||
const char* config_get_menu_driver_options(void);
|
||||
|
||||
menu_handle_t *menu_driver_get_ptr(void);
|
||||
|
||||
void menu_driver_list_free(file_list_t *list, size_t i, size_t list_size);
|
||||
|
||||
size_t menu_driver_list_get_size(menu_list_type_t type);
|
||||
|
@ -200,7 +200,8 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
||||
memset(menu_input, 0, sizeof(menu_input_t));
|
||||
break;
|
||||
case MENU_INPUT_CTL_SEARCH_START:
|
||||
menu = menu_driver_get_ptr();
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return false;
|
||||
|
||||
menu_input->keyboard.display = true;
|
||||
menu_input->keyboard.label = menu_hash_to_str(MENU_VALUE_SEARCH);
|
||||
@ -308,9 +309,11 @@ void menu_input_key_start_line(const char *label,
|
||||
input_keyboard_line_complete_t cb)
|
||||
{
|
||||
bool keyboard_display = true;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
if (!menu || !menu_input)
|
||||
if (!menu_input)
|
||||
return;
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return;
|
||||
|
||||
menu_input_ctl(MENU_INPUT_CTL_SET_KEYBOARD_DISPLAY, &keyboard_display);
|
||||
@ -669,13 +672,15 @@ int menu_input_key_bind_set_mode(void *data,
|
||||
enum menu_input_bind_mode type)
|
||||
{
|
||||
unsigned index_offset;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
if (menu_input_key_bind_set_mode_common(setting, type) == -1)
|
||||
return -1;
|
||||
|
||||
|
@ -205,9 +205,9 @@ void menu_shader_manager_save_preset(
|
||||
struct video_shader *shader = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
{
|
||||
RARCH_ERR("Cannot save shader preset, menu handle"
|
||||
" is not initialized.\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user