int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, const char *menu_label, uint32_t label_hash) { if (!cbs) return menu_cbs_exit(); BIND_ACTION_RIGHT(cbs, bind_right_generic); if (type == MENU_SETTING_NO_ITEM) { if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)) || string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS_TAB)) ) { BIND_ACTION_RIGHT(cbs, action_right_mainmenu); return 0; } } if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label ) == 0) return 0; if (menu_cbs_init_bind_right_compare_type(cbs, type, menu_label ) == 0) return 0; return menu_cbs_exit(); }
int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, const char *elem0, const char *elem1, const char *menu_label, uint32_t label_hash, uint32_t menu_label_hash) { if (!cbs) return menu_cbs_exit(); BIND_ACTION_RIGHT(cbs, bind_right_generic); if (type == MENU_SETTING_NO_ITEM) { switch (menu_label_hash) { case MENU_VALUE_HORIZONTAL_MENU: case MENU_VALUE_MAIN_MENU: case 153956705: /* TODO/FIXME - dehardcode */ BIND_ACTION_RIGHT(cbs, action_right_mainmenu); return 0; default: break; } } if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0) return 0; if (menu_cbs_init_bind_right_compare_type(cbs, type, label_hash, menu_label_hash) == 0) return 0; return menu_cbs_exit(); }
static int action_right_shader_scale_pass(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0; struct video_shader *shader = NULL; struct video_shader_pass *shader_pass = NULL; menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) return menu_cbs_exit(); shader_pass = &shader->pass[pass]; if (!shader_pass) return menu_cbs_exit(); { unsigned current_scale = shader_pass->fbo.scale_x; unsigned delta = 1; current_scale = (current_scale + delta) % 6; shader_pass->fbo.valid = current_scale; shader_pass->fbo.scale_x = shader_pass->fbo.scale_y = current_scale; } #endif return 0; }
static int deferred_push_dlist(menu_displaylist_info_t *info, enum menu_displaylist_ctl_state state) { if (!menu_displaylist_ctl(state, info)) return menu_cbs_exit(); menu_displaylist_ctl(DISPLAYLIST_PROCESS, info); return 0; }
static int action_left_scroll(unsigned type, const char *label, bool wraparound) { size_t selection; size_t scroll_accel = 0; unsigned scroll_speed = 0, fast_scroll_speed = 0; if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) return menu_cbs_exit(); if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel)) return false; scroll_speed = (MAX(scroll_accel, 2) - 2) / 4 + 1; fast_scroll_speed = 4 + 4 * scroll_speed; if (selection > fast_scroll_speed) { size_t idx = selection - fast_scroll_speed; bool scroll = true; menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll); } else { bool pending_push = false; menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push); } return 0; }
static int deferred_push_dlist(menu_displaylist_info_t *info, unsigned val) { if (menu_displaylist_push_list(info, val) != 0) return menu_cbs_exit(); menu_displaylist_push_list_process(info); return 0; }
static int action_left_mainmenu(unsigned type, const char *label, bool wraparound) { menu_ctx_list_t list_info; unsigned push_list = 0; menu_handle_t *menu = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return menu_cbs_exit(); menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info); list_info.type = MENU_LIST_PLAIN; menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_info); if (list_info.size == 1) { settings_t *settings = config_get_ptr(); if ((list_info.selection != 0) || settings->bools.menu_navigation_wraparound_enable) push_list = 1; } else push_list = 2; switch (push_list) { case 1: { menu_ctx_list_t list_info; file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); size_t selection = menu_navigation_get_selection(); menu_file_list_cbs_t *cbs = selection_buf ? (menu_file_list_cbs_t*)file_list_get_actiondata_at_offset(selection_buf, selection) : NULL; list_info.type = MENU_LIST_HORIZONTAL; list_info.action = MENU_ACTION_LEFT; menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info); if (cbs && cbs->action_content_list_switch) return cbs->action_content_list_switch( selection_buf, menu_stack, "", "", 0); } break; case 2: action_left_scroll(0, "", false); break; case 0: default: break; } return 0; }
static int playlist_association_right(unsigned type, const char *label, bool wraparound) { char core_path[PATH_MAX_LENGTH]; char new_playlist_cores[PATH_MAX_LENGTH]; size_t i, next, found, current = 0; core_info_t *info = NULL; struct string_list *stnames = NULL; struct string_list *stcores = NULL; core_info_list_t *list = NULL; settings_t *settings = config_get_ptr(); const char *path = path_basename(label); core_info_get_list(&list); if (!list) return menu_cbs_exit(); core_path[0] = new_playlist_cores[0] = '\0'; stnames = string_split(settings->arrays.playlist_names, ";"); stcores = string_split(settings->arrays.playlist_cores, ";"); if (!menu_content_playlist_find_associated_core(path, core_path, sizeof(core_path))) strlcpy(core_path, file_path_str(FILE_PATH_DETECT), sizeof(core_path)); for (i = 0; i < list->count; i++) { core_info_t *info = core_info_get(list, i); if (string_is_equal(info->path, core_path)) current = i; } next = current + 1; if (next >= list->count) { if (wraparound) next = 0; else next = list->count-1; } info = core_info_get(list, next); found = string_list_find_elem(stnames, path); if (found && info) string_list_set(stcores, (unsigned)(found-1), info->path); string_list_join_concat(new_playlist_cores, sizeof(new_playlist_cores), stcores, ";"); strlcpy(settings->arrays.playlist_cores, new_playlist_cores, sizeof(settings->arrays.playlist_cores)); string_list_free(stnames); string_list_free(stcores); return 0; }
static int action_right_shader_filter_default(unsigned type, const char *label, bool wraparound) { rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_VIDEO_SMOOTH); if (!setting) return menu_cbs_exit(); return menu_action_handle_setting(setting, setting_get_type(setting), MENU_ACTION_RIGHT, wraparound); }
static int action_right_shader_filter_pass(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER unsigned pass = type - MENU_SETTINGS_SHADER_PASS_FILTER_0; unsigned delta = 1; struct video_shader *shader = NULL; struct video_shader_pass *shader_pass = NULL; menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) return menu_cbs_exit(); shader_pass = &shader->pass[pass]; if (!shader_pass) return menu_cbs_exit(); shader_pass->filter = ((shader_pass->filter + delta) % 3); #endif return 0; }
static int playlist_association_left(unsigned type, const char *label, bool wraparound) { unsigned i; int next, found, current = 0; core_info_t *info = NULL; struct string_list *stnames = NULL; struct string_list *stcores = NULL; char core_path[PATH_MAX_LENGTH] = {0}; char new_playlist_cores[PATH_MAX_LENGTH] = {0}; settings_t *settings = config_get_ptr(); const char *path = path_basename(label); core_info_list_t *list = NULL; core_info_ctl(CORE_INFO_CTL_LIST_GET, &list); if (!list) return menu_cbs_exit(); stnames = string_split(settings->playlist_names, ";"); stcores = string_split(settings->playlist_cores, ";"); if (!menu_playlist_find_associated_core(path, core_path, sizeof(core_path))) strlcpy(core_path, "DETECT", sizeof(core_path)); for (i = 0; i < list->count; i++) { core_info_t *info = core_info_get(list, i); if (string_is_equal(info->path, core_path)) current = i; } next = current - 1; if (next < 0) { if (wraparound) next = list->count; else next = 0; } info = core_info_get(list, next); found = string_list_find_elem(stnames, path); if (found) string_list_set(stcores, found-1, info->path); string_list_join_concat(new_playlist_cores, sizeof(new_playlist_cores), stcores, ";"); strlcpy(settings->playlist_cores, new_playlist_cores, sizeof(settings->playlist_cores)); return 0; }
static int action_left_shader_filter_default(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER rarch_setting_t *setting = menu_setting_find(menu_hash_to_str(MENU_LABEL_VIDEO_SMOOTH)); if (!setting) return menu_cbs_exit(); return menu_action_handle_setting(setting, menu_setting_get_type(setting), MENU_ACTION_LEFT, wraparound); #else return 0; #endif }
static int generic_shader_action_parameter_right( struct video_shader *shader, struct video_shader_parameter *param, unsigned type, const char *label, bool wraparound) { if (!shader) return menu_cbs_exit(); param->current += param->step; param->current = MIN(MAX(param->minimum, param->current), param->maximum); if (ui_companion_is_on_foreground()) ui_companion_driver_notify_refresh(); return 0; }
static int action_right_shader_filter_pass(unsigned type, const char *label, bool wraparound) { unsigned pass = type - MENU_SETTINGS_SHADER_PASS_FILTER_0; unsigned delta = 1; struct video_shader *shader = menu_shader_get(); struct video_shader_pass *shader_pass = shader ? &shader->pass[pass] : NULL; if (!shader_pass) return menu_cbs_exit(); shader_pass->filter = ((shader_pass->filter + delta) % 3); return 0; }
static int action_left_shader_filter_pass(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER unsigned delta = 2; unsigned pass = type - MENU_SETTINGS_SHADER_PASS_FILTER_0; struct video_shader_pass *shader_pass = menu_shader_manager_get_pass(pass); if (!shader_pass) return menu_cbs_exit(); shader_pass->filter = ((shader_pass->filter + delta) % 3); #endif return 0; }
static int action_right_shader_num_passes(unsigned type, const char *label, bool wraparound) { bool refresh = false; struct video_shader *shader = menu_shader_get(); unsigned pass_count = shader ? shader->passes : 0; if (!shader) return menu_cbs_exit(); if (pass_count < GFX_MAX_SHADERS) menu_shader_manager_increment_amount_passes(); menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); video_shader_resolve_parameters(NULL, shader); return 0; }
static int action_left_shader_num_passes(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER bool refresh = false; struct video_shader *shader = menu_shader_get(); if (!shader) return menu_cbs_exit(); if (menu_shader_manager_get_amount_passes()) menu_shader_manager_decrement_amount_passes(); menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); video_shader_resolve_parameters(NULL, shader); #endif return 0; }
static int action_right_shader_scale_pass(unsigned type, const char *label, bool wraparound) { unsigned current_scale, delta; unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0; struct video_shader *shader = menu_shader_get(); struct video_shader_pass *shader_pass = shader ? &shader->pass[pass] : NULL; if (!shader_pass) return menu_cbs_exit(); current_scale = shader_pass->fbo.scale_x; delta = 1; current_scale = (current_scale + delta) % 6; shader_pass->fbo.valid = current_scale; shader_pass->fbo.scale_x = shader_pass->fbo.scale_y = current_scale; return 0; }
static int action_right_shader_num_passes(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER bool refresh = false; struct video_shader *shader = NULL; menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) return menu_cbs_exit(); if ((shader->passes < GFX_MAX_SHADERS)) shader->passes++; menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL); video_shader_resolve_parameters(NULL, shader); #endif return 0; }
static int action_left_shader_scale_pass(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER unsigned current_scale, delta; unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0; struct video_shader_pass *shader_pass = menu_shader_manager_get_pass(pass); if (!shader_pass) return menu_cbs_exit(); current_scale = shader_pass->fbo.scale_x; delta = 5; current_scale = (current_scale + delta) % 6; shader_pass->fbo.valid = current_scale; shader_pass->fbo.scale_x = current_scale; shader_pass->fbo.scale_y = current_scale; #endif return 0; }
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound) { video_shader_ctx_t shader_info; struct video_shader *shader = menu_shader_get(); struct video_shader_parameter *param_menu = NULL; struct video_shader_parameter *param_prev = NULL; int ret = 0; video_shader_driver_get_current_shader(&shader_info); param_prev = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; param_menu = shader ? &shader->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0] : NULL; if (!param_prev || !param_menu) return menu_cbs_exit(); ret = generic_shader_action_parameter_right(param_prev, type, label, wraparound); param_menu->current = param_prev->current; return ret; }
static int general_push(menu_displaylist_info_t *info, unsigned id, enum menu_displaylist_ctl_state state) { struct retro_system_info *system_menu = NULL; settings_t *settings = config_get_ptr(); rarch_system_info_t *system = NULL; core_info_list_t *list = NULL; menu_handle_t *menu = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return menu_cbs_exit(); core_info_ctl(CORE_INFO_CTL_LIST_GET, &list); menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system_menu); runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); switch (id) { case PUSH_DEFAULT: case PUSH_DETECT_CORE_LIST: break; default: fill_pathname_join(info->path, menu->scratch2_buf, menu->scratch_buf, sizeof(info->path)); fill_pathname_join(info->label, menu->scratch2_buf, menu->scratch_buf, sizeof(info->label)); break; } info->type_default = MENU_FILE_PLAIN; switch (id) { case PUSH_ARCHIVE_OPEN_DETECT_CORE: case PUSH_ARCHIVE_OPEN: case PUSH_DEFAULT: info->setting = menu_setting_find(info->label); break; default: break; } switch (id) { case PUSH_ARCHIVE_OPEN_DETECT_CORE: if (!string_is_empty(list->all_ext)) strlcpy(info->exts, list->all_ext, sizeof(info->exts)); else if (system_menu->valid_extensions) { if (*system_menu->valid_extensions) strlcpy(info->exts, system_menu->valid_extensions, sizeof(info->exts)); } else strlcpy(info->exts, system->valid_extensions, sizeof(info->exts)); break; case PUSH_ARCHIVE_OPEN: if (system_menu->valid_extensions) { if (*system_menu->valid_extensions) strlcpy(info->exts, system_menu->valid_extensions, sizeof(info->exts)); } else strlcpy(info->exts, system->valid_extensions, sizeof(info->exts)); break; case PUSH_DEFAULT: if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR) { } else if (system_menu->valid_extensions) { if (*system_menu->valid_extensions) strlcpy(info->exts, system_menu->valid_extensions, sizeof(info->exts)); } else strlcpy(info->exts, system->valid_extensions, sizeof(info->exts)); break; case PUSH_DETECT_CORE_LIST: if (!string_is_empty(list->all_ext)) strlcpy(info->exts, list->all_ext, sizeof(info->exts)); break; } (void)settings; if (settings->multimedia.builtin_mediaplayer_enable || settings->multimedia.builtin_imageviewer_enable) { struct retro_system_info sysinfo = {0}; (void)sysinfo; #ifdef HAVE_FFMPEG if (settings->multimedia.builtin_mediaplayer_enable) { libretro_ffmpeg_retro_get_system_info(&sysinfo); strlcat(info->exts, "|", sizeof(info->exts)); strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts)); } #endif #ifdef HAVE_IMAGEVIEWER if (settings->multimedia.builtin_imageviewer_enable) { libretro_imageviewer_retro_get_system_info(&sysinfo); strlcat(info->exts, "|", sizeof(info->exts)); strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts)); } #endif } return deferred_push_dlist(info, state); }