static void menu_action_setting_disp_set_label(file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { global_t *global = global_get_ptr(); uint32_t hash_label = menu_hash_calculate(label); *s = '\0'; *w = 19; switch (hash_label) { case MENU_LABEL_PERFORMANCE_COUNTERS: case MENU_LABEL_LOAD_CONTENT_HISTORY: *w = strlen(label); break; } if (type >= MENU_SETTINGS_CORE_OPTION_START) strlcpy( s, core_option_get_val(global->system.core_options, type - MENU_SETTINGS_CORE_OPTION_START), len); else setting_get_label(list, s, len, w, type, label, entry_label, i); strlcpy(s2, path, len2); }
void core_option_flush(core_option_manager_t *opt) { for (size_t i = 0; i < opt->size; i++) { struct core_option *option = &opt->opts[i]; config_set_string(opt->conf, option->key, core_option_get_val(opt, i)); } config_file_write(opt->conf, opt->conf_path); }
static bool parse_variable(core_option_manager_t *opt, size_t index, const struct retro_variable *var) { size_t i; struct core_option *option = &opt->opts[index]; option->key = strdup(var->key); char *value = strdup(var->value); char *desc_end = strstr(value, "; "); if (!desc_end) { free(value); return false; } *desc_end = '\0'; option->desc = strdup(value); const char *val_start = desc_end + 2; option->vals = string_split(val_start, "|"); if (!option->vals) { free(value); return false; } char *config_val = NULL; if (config_get_string(opt->conf, option->key, &config_val)) { for (i = 0; i < option->vals->size; i++) { if (strcmp(option->vals->elems[i].data, config_val) == 0) { option->index = i; break; } } free(config_val); } free(value); RARCH_LOG("Core option:\n"); RARCH_LOG("\tDescription: %s\n", option->desc); RARCH_LOG("\tKey: %s\n", option->key); RARCH_LOG("\tCurrent value: %s\n", core_option_get_val(opt, index)); RARCH_LOG("\tPossible values:\n"); for (i = 0; i < option->vals->size; i++) RARCH_LOG("\t\t%s\n", option->vals->elems[i].data); return true; }
HRESULT CRetroArchCoreOptions::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) { unsigned current_index = XuiListGetCurSel(m_menulist, NULL); unsigned input = pControlNavigateData->nControlNavigate; unsigned action = xui_input_to_rgui_action(input); if (g_extern.system.core_options) { bool update_item = false; switch (action) { case RGUI_ACTION_LEFT: core_option_prev(g_extern.system.core_options, current_index); update_item = true; break; case RGUI_ACTION_RIGHT: core_option_next(g_extern.system.core_options, current_index); update_item = true; break; } if (update_item) { char label[256]; strlcpy(label, core_option_get_desc(g_extern.system.core_options, current_index), sizeof(label)); snprintf(label, sizeof(label), "%s : %s", label, core_option_get_val(g_extern.system.core_options, current_index)); mbstowcs(strw_buffer, label, sizeof(strw_buffer) / sizeof(wchar_t)); XuiListSetText(m_menulist, current_index, strw_buffer); } } bHandled = TRUE; switch(action) { case RGUI_ACTION_LEFT: case RGUI_ACTION_RIGHT: case RGUI_ACTION_UP: case RGUI_ACTION_DOWN: pControlNavigateData->hObjDest = pControlNavigateData->hObjSource; break; default: break; } return 0; }
/** * core_option_flush: * @opt : options manager handle * * Writes core option key-pair values to file. * * Returns: true (1) if core option values could be * successfully saved to disk, otherwise false (0). **/ bool core_option_flush(core_option_manager_t *opt) { size_t i; for (i = 0; i < opt->size; i++) { struct core_option *option = (struct core_option*)&opt->opts[i]; if (option) config_set_string(opt->conf, option->key, core_option_get_val(opt, i)); } return config_file_write(opt->conf, opt->conf_path); }
void core_option_get(core_option_manager_t *opt, struct retro_variable *var) { opt->updated = false; for (size_t i = 0; i < opt->size; i++) { if (strcmp(opt->opts[i].key, var->key) == 0) { var->value = core_option_get_val(opt, i); return; } } var->value = NULL; }
static void menu_action_setting_disp_set_label(file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { rarch_system_info_t *system = rarch_system_info_get_ptr(); uint32_t hash_label = menu_hash_calculate(label); *s = '\0'; *w = 19; switch (hash_label) { case MENU_LABEL_LOAD_CONTENT_HISTORY: *w = strlen(label); break; case MENU_LABEL_SYSTEM_INFORMATION: *w = 2; break; case MENU_LABEL_DEBUG_INFORMATION: *w = 2; break; } if (type >= MENU_SETTINGS_CORE_OPTION_START) { const char *core_opt = NULL; if (!system) return; core_opt = core_option_get_val(system->core_options, type - MENU_SETTINGS_CORE_OPTION_START); strlcpy(s, core_opt ? core_opt : "", len); } else setting_get_label(list, s, len, w, type, label, entry_label, i); strlcpy(s2, path, len2); }
static void menu_action_setting_disp_set_label(file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { rarch_system_info_t *system = NULL; uint32_t hash_label = menu_hash_calculate(label); runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); *s = '\0'; *w = 19; switch (hash_label) { case MENU_LABEL_LOAD_CONTENT_HISTORY: *w = strlen(label); break; case MENU_LABEL_SYSTEM_INFORMATION: *w = 2; break; case MENU_LABEL_DEBUG_INFORMATION: *w = 2; break; case MENU_LABEL_ACHIEVEMENT_LIST: *w = 2; break; } if (type >= MENU_SETTINGS_PLAYLIST_ASSOCIATION_START) { char playlist_name_with_ext[PATH_MAX_LENGTH]; unsigned i; bool found_matching_core_association = false; settings_t *settings = config_get_ptr(); struct string_list *str_list = string_split(settings->playlist_names, ";"); struct string_list *str_list2 = string_split(settings->playlist_cores, ";"); strlcpy(playlist_name_with_ext, path, sizeof(playlist_name_with_ext)); strlcat(playlist_name_with_ext, ".lpl", sizeof(playlist_name_with_ext)); for (i = 0; i < str_list->size; i++) { if (!strcmp(str_list->elems[i].data, playlist_name_with_ext)) { if (str_list->size != str_list2->size) break; if (str_list2->elems[i].data == NULL) break; found_matching_core_association = true; strlcpy(s, str_list2->elems[i].data, len); } } string_list_free(str_list); string_list_free(str_list2); if (!strcmp(s, "DETECT") || !found_matching_core_association) strlcpy(s, "N/A", len); else { char buf[PATH_MAX_LENGTH]; core_info_list_t *list = NULL; runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list); if (core_info_list_get_display_name(list, s, buf, sizeof(buf))) strlcpy(s, buf, len); } } else if (type >= MENU_SETTINGS_CORE_OPTION_START) { const char *core_opt = NULL; if (!system) return; core_opt = core_option_get_val(system->core_options, type - MENU_SETTINGS_CORE_OPTION_START); strlcpy(s, "", len); if (core_opt) strlcpy(s, core_opt, len); } else menu_setting_get_label(list, s, len, w, type, label, entry_label, i); strlcpy(s2, path, len2); }
static void rmenu_xui_render(void) { size_t begin, end; char title[256]; const char *dir = NULL; unsigned menu_type = 0; unsigned menu_type_is = 0; if (!driver.menu || driver.menu->need_refresh && (g_extern.lifecycle_state & (1ULL << MODE_MENU)) && !driver.menu->msg_force) return; begin = driver.menu->selection_ptr; end = file_list_get_size(driver.menu->selection_buf); rmenu_xui_render_background(); file_list_get_last(driver.menu->menu_stack, &dir, &menu_type); if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->type_is) menu_type_is = driver.menu_ctx->backend->type_is(menu_type); if (menu_type == MENU_SETTINGS_CORE) snprintf(title, sizeof(title), "CORE SELECTION %s", dir); else if (menu_type == MENU_SETTINGS_DEFERRED_CORE) snprintf(title, sizeof(title), "DETECTED CORES %s", dir); else if (menu_type == MENU_SETTINGS_CONFIG) snprintf(title, sizeof(title), "CONFIG %s", dir); else if (menu_type == MENU_SETTINGS_DISK_APPEND) snprintf(title, sizeof(title), "DISK APPEND %s", dir); else if (menu_type == MENU_SETTINGS_VIDEO_OPTIONS) strlcpy(title, "VIDEO OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_INPUT_OPTIONS) strlcpy(title, "INPUT OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_OVERLAY_OPTIONS) strlcpy(title, "OVERLAY OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_NETPLAY_OPTIONS) strlcpy(title, "NETPLAY OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_PATH_OPTIONS) strlcpy(title, "PATH OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_OPTIONS) strlcpy(title, "SETTINGS", sizeof(title)); else if (menu_type == MENU_SETTINGS_DRIVERS) strlcpy(title, "DRIVER OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS) strlcpy(title, "PERFORMANCE COUNTERS", sizeof(title)); else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO) strlcpy(title, "CORE PERFORMANCE COUNTERS", sizeof(title)); else if (menu_type == MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND) strlcpy(title, "FRONTEND PERFORMANCE COUNTERS", sizeof(title)); #ifdef HAVE_SHADER_MANAGER else if (menu_type == MENU_SETTINGS_SHADER_OPTIONS) strlcpy(title, "SHADER OPTIONS", sizeof(title)); #endif else if (menu_type == MENU_SETTINGS_FONT_OPTIONS) strlcpy(title, "FONT OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_GENERAL_OPTIONS) strlcpy(title, "GENERAL OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_AUDIO_OPTIONS) strlcpy(title, "AUDIO OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_DISK_OPTIONS) strlcpy(title, "DISK OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_CORE_OPTIONS) strlcpy(title, "CORE OPTIONS", sizeof(title)); else if (menu_type == MENU_SETTINGS_CORE_INFO) strlcpy(title, "CORE INFO", sizeof(title)); else if (menu_type == MENU_SETTINGS_PRIVACY_OPTIONS) strlcpy(title, "PRIVACY OPTIONS", sizeof(title)); #ifdef HAVE_SHADER_MANAGER else if (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS) snprintf(title, sizeof(title), "SHADER %s", dir); #endif else if ((menu_type == MENU_SETTINGS_INPUT_OPTIONS) || (menu_type == MENU_SETTINGS_PATH_OPTIONS) || (menu_type == MENU_SETTINGS_OPTIONS) || (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT || menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT_2) || menu_type == MENU_SETTINGS_CUSTOM_BIND || menu_type == MENU_START_SCREEN || menu_type == MENU_SETTINGS) snprintf(title, sizeof(title), "MENU %s", dir); else if (menu_type == MENU_SETTINGS_OPEN_HISTORY) strlcpy(title, "LOAD HISTORY", sizeof(title)); else if (menu_type == MENU_INFO_SCREEN) strlcpy(title, "INFO", sizeof(title)); #ifdef HAVE_OVERLAY else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET) snprintf(title, sizeof(title), "OVERLAY %s", dir); #endif else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER) snprintf(title, sizeof(title), "FILTER %s", dir); else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER) snprintf(title, sizeof(title), "DSP FILTER %s", dir); else if (menu_type == MENU_BROWSER_DIR_PATH) snprintf(title, sizeof(title), "BROWSER DIR %s", dir); else if (menu_type == MENU_CONTENT_DIR_PATH) snprintf(title, sizeof(title), "CONTENT DIR %s", dir); else if (menu_type == MENU_SCREENSHOT_DIR_PATH) snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir); else if (menu_type == MENU_AUTOCONFIG_DIR_PATH) snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir); else if (menu_type == MENU_SHADER_DIR_PATH) snprintf(title, sizeof(title), "SHADER DIR %s", dir); else if (menu_type == MENU_FILTER_DIR_PATH) snprintf(title, sizeof(title), "FILTER DIR %s", dir); else if (menu_type == MENU_DSP_FILTER_DIR_PATH) snprintf(title, sizeof(title), "DSP_FILTER DIR %s", dir); else if (menu_type == MENU_SAVESTATE_DIR_PATH) snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir); #ifdef HAVE_DYNAMIC else if (menu_type == MENU_LIBRETRO_DIR_PATH) snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir); #endif else if (menu_type == MENU_CONFIG_DIR_PATH) snprintf(title, sizeof(title), "CONFIG DIR %s", dir); else if (menu_type == MENU_SAVEFILE_DIR_PATH) snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir); #ifdef HAVE_OVERLAY else if (menu_type == MENU_OVERLAY_DIR_PATH) snprintf(title, sizeof(title), "OVERLAY DIR %s", dir); #endif else if (menu_type == MENU_SYSTEM_DIR_PATH) snprintf(title, sizeof(title), "SYSTEM DIR %s", dir); else if (menu_type == MENU_ASSETS_DIR_PATH) snprintf(title, sizeof(title), "ASSETS DIR %s", dir); else { if (driver.menu->defer_core) snprintf(title, sizeof(title), "CONTENT %s", dir); else { const char *core_name = driver.menu->info.library_name; if (!core_name) core_name = g_extern.system.info.library_name; if (!core_name) core_name = "No Core"; snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir); } } mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t)); XuiTextElementSetText(m_menutitle, strw_buffer); char title_buf[256]; menu_ticker_line(title_buf, RXUI_TERM_WIDTH - 3, g_extern.frame_count / 15, title, true); blit_line(RXUI_TERM_START_X + 15, 15, title_buf, true); char title_msg[64]; const char *core_name = driver.menu->info.library_name; if (!core_name) core_name = g_extern.system.info.library_name; if (!core_name) core_name = "No Core"; const char *core_version = driver.menu->info.library_version; if (!core_version) core_version = g_extern.system.info.library_version; if (!core_version) core_version = ""; snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version); blit_line(RXUI_TERM_START_X + 15, (RXUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + RXUI_TERM_START_Y + 2, title_msg, true); unsigned x, y; size_t i; x = RXUI_TERM_START_X; y = RXUI_TERM_START_Y; for (i = begin; i < end; i++/*, y += FONT_HEIGHT_STRIDE */) { const char *path = 0; unsigned type = 0; file_list_get_at_offset(driver.menu->selection_buf, i, &path, &type); char message[256]; char type_str[256]; unsigned w = 19; if (menu_type == MENU_SETTINGS_INPUT_OPTIONS || menu_type == MENU_SETTINGS_CUSTOM_BIND) w = 21; else if (menu_type == MENU_SETTINGS_PATH_OPTIONS) w = 24; if (type >= MENU_SETTINGS_SHADER_FILTER && type <= MENU_SETTINGS_SHADER_LAST) { // HACK. Work around that we're using the menu_type as dir type to propagate state correctly. if ((menu_type_is == MENU_SETTINGS_SHADER_OPTIONS) && (menu_type_is == MENU_SETTINGS_SHADER_OPTIONS)) { type = MENU_FILE_DIRECTORY; strlcpy(type_str, "(DIR)", sizeof(type_str)); w = 5; } else if (type == MENU_SETTINGS_SHADER_OPTIONS || type == MENU_SETTINGS_SHADER_PRESET) strlcpy(type_str, "...", sizeof(type_str)); else if (type == MENU_SETTINGS_SHADER_FILTER) snprintf(type_str, sizeof(type_str), "%s", g_settings.video.smooth ? "Linear" : "Nearest"); else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str) driver.menu_ctx->backend->shader_manager_get_str(driver.menu->shader, type_str, sizeof(type_str), type); } else // Pretty-print libretro cores from menu. if (menu_type == MENU_SETTINGS_CORE || menu_type == MENU_SETTINGS_DEFERRED_CORE) { if (type == MENU_FILE_PLAIN) { strlcpy(type_str, "(CORE)", sizeof(type_str)); file_list_get_alt_at_offset(driver.menu->selection_buf, i, &path); w = 6; } else { strlcpy(type_str, "(DIR)", sizeof(type_str)); type = MENU_FILE_DIRECTORY; w = 5; } } else if (menu_type == MENU_SETTINGS_CONFIG || #ifdef HAVE_OVERLAY menu_type == MENU_SETTINGS_OVERLAY_PRESET || #endif menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER || menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER || menu_type == MENU_SETTINGS_DISK_APPEND || menu_type_is == MENU_FILE_DIRECTORY) { if (type == MENU_FILE_PLAIN) { strlcpy(type_str, "(FILE)", sizeof(type_str)); w = 6; } else if (type == MENU_FILE_USE_DIRECTORY) { *type_str = '\0'; w = 0; } else { strlcpy(type_str, "(DIR)", sizeof(type_str)); type = MENU_FILE_DIRECTORY; w = 5; } } else if (menu_type == MENU_SETTINGS_OPEN_HISTORY) { *type_str = '\0'; w = 0; } else if (type >= MENU_SETTINGS_CORE_OPTION_START) strlcpy(type_str, core_option_get_val(g_extern.system.core_options, type - MENU_SETTINGS_CORE_OPTION_START), sizeof(type_str)); else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label) driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type); char entry_title_buf[256]; char type_str_buf[64]; bool selected = i == driver.menu->selection_ptr; strlcpy(entry_title_buf, path, sizeof(entry_title_buf)); strlcpy(type_str_buf, type_str, sizeof(type_str_buf)); #if 0 if ((type == MENU_FILE_PLAIN || type == MENU_FILE_DIRECTORY)) menu_ticker_line(entry_title_buf, RXUI_TERM_WIDTH - (w + 1 + 2), g_extern.frame_count / 15, path, selected); else menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, type_str, selected); #endif snprintf(message, sizeof(message), "%s : %s", entry_title_buf, type_str_buf); wchar_t msg_w[256]; mbstowcs(msg_w, message, sizeof(msg_w) / sizeof(wchar_t)); XuiListSetText(m_menulist, i, msg_w); blit_line(x, y, message, i); } if (driver.menu->keyboard.display) { char msg[1024]; const char *str = *driver.menu->keyboard.buffer; if (!str) str = ""; snprintf(msg, sizeof(msg), "%s\n%s", driver.menu->keyboard.label, str); rmenu_xui_render_messagebox(msg); } }
static void rmenu_render(void *data) { if (!render_normal) { render_normal = true; return; } rgui_handle_t *rgui = (rgui_handle_t*)data; font_params_t font_parms; if (rgui->need_refresh && (g_extern.lifecycle_state & (1ULL << MODE_MENU)) && !rgui->msg_force) return; size_t begin = rgui->selection_ptr >= (ENTRIES_HEIGHT / 2) ? (rgui->selection_ptr - (ENTRIES_HEIGHT / 2)) : 0; size_t end = (rgui->selection_ptr + ENTRIES_HEIGHT) <= rgui->selection_buf->size ? rgui->selection_ptr + ENTRIES_HEIGHT : rgui->selection_buf->size; if (rgui->selection_buf->size <= ENTRIES_HEIGHT) begin = 0; if (end - begin > ENTRIES_HEIGHT) end = begin + ENTRIES_HEIGHT; rmenu_render_background(rgui); char title[256]; const char *dir = NULL; unsigned menu_type = 0; unsigned menu_type_is = 0; file_list_get_last(rgui->menu_stack, &dir, &menu_type); if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->type_is) menu_type_is = driver.menu_ctx->backend->type_is(menu_type); if (menu_type == RGUI_SETTINGS_CORE) snprintf(title, sizeof(title), "CORE SELECTION %s", dir); else if (menu_type == RGUI_SETTINGS_DEFERRED_CORE) snprintf(title, sizeof(title), "DETECTED CORES %s", dir); else if (menu_type == RGUI_SETTINGS_CONFIG) snprintf(title, sizeof(title), "CONFIG %s", dir); else if (menu_type == RGUI_SETTINGS_DISK_APPEND) snprintf(title, sizeof(title), "DISK APPEND %s", dir); else if (menu_type == RGUI_SETTINGS_VIDEO_OPTIONS) strlcpy(title, "VIDEO OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_DRIVERS) strlcpy(title, "DRIVER OPTIONS", sizeof(title)); #ifdef HAVE_SHADER_MANAGER else if (menu_type == RGUI_SETTINGS_SHADER_OPTIONS) strlcpy(title, "SHADER OPTIONS", sizeof(title)); #endif else if (menu_type == RGUI_SETTINGS_AUDIO_OPTIONS) strlcpy(title, "AUDIO OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_OVERLAY_OPTIONS) strlcpy(title, "OVERLAY OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_NETPLAY_OPTIONS) strlcpy(title, "NETPLAY OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_FONT_OPTIONS) strlcpy(title, "FONT OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_GENERAL_OPTIONS) strlcpy(title, "GENERAL OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS) strlcpy(title, "PATH OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_OPTIONS) strlcpy(title, "SETTINGS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_INPUT_OPTIONS) strlcpy(title, "INPUT OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_DISK_OPTIONS) strlcpy(title, "DISK OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_CORE_OPTIONS) strlcpy(title, "CORE OPTIONS", sizeof(title)); else if (menu_type == RGUI_SETTINGS_CORE_INFO) strlcpy(title, "CORE INFO", sizeof(title)); else if (menu_type == RGUI_SETTINGS_PRIVACY_OPTIONS) strlcpy(title, "PRIVACY OPTIONS", sizeof(title)); #ifdef HAVE_SHADER_MANAGER else if (menu_type_is == RGUI_SETTINGS_SHADER_OPTIONS) snprintf(title, sizeof(title), "SHADER %s", dir); #endif else if ((menu_type == RGUI_SETTINGS_INPUT_OPTIONS) || (menu_type == RGUI_SETTINGS_PATH_OPTIONS) || (menu_type == RGUI_SETTINGS_OPTIONS) || (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT || menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2) || menu_type == RGUI_SETTINGS_CUSTOM_BIND || menu_type == RGUI_START_SCREEN || menu_type == RGUI_SETTINGS) snprintf(title, sizeof(title), "MENU %s", dir); else if (menu_type == RGUI_SETTINGS_OPEN_HISTORY) strlcpy(title, "LOAD HISTORY", sizeof(title)); #ifdef HAVE_OVERLAY else if (menu_type == RGUI_SETTINGS_OVERLAY_PRESET) snprintf(title, sizeof(title), "OVERLAY %s", dir); #endif else if (menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER) snprintf(title, sizeof(title), "FILTER %s", dir); else if (menu_type == RGUI_SETTINGS_AUDIO_DSP_FILTER) snprintf(title, sizeof(title), "DSP FILTER %s", dir); else if (menu_type == RGUI_BROWSER_DIR_PATH) snprintf(title, sizeof(title), "BROWSER DIR %s", dir); else if (menu_type == RGUI_CONTENT_DIR_PATH) snprintf(title, sizeof(title), "CONTENT DIR %s", dir); #ifdef HAVE_SCREENSHOTS else if (menu_type == RGUI_SCREENSHOT_DIR_PATH) snprintf(title, sizeof(title), "SCREENSHOT DIR %s", dir); #endif else if (menu_type == RGUI_AUTOCONFIG_DIR_PATH) snprintf(title, sizeof(title), "AUTOCONFIG DIR %s", dir); else if (menu_type == RGUI_SHADER_DIR_PATH) snprintf(title, sizeof(title), "SHADER DIR %s", dir); else if (menu_type == RGUI_FILTER_DIR_PATH) snprintf(title, sizeof(title), "FILTER DIR %s", dir); else if (menu_type == RGUI_DSP_FILTER_DIR_PATH) snprintf(title, sizeof(title), "DSP FILTER DIR %s", dir); else if (menu_type == RGUI_SAVESTATE_DIR_PATH) snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir); #ifdef HAVE_DYNAMIC else if (menu_type == RGUI_LIBRETRO_DIR_PATH) snprintf(title, sizeof(title), "LIBRETRO DIR %s", dir); #endif else if (menu_type == RGUI_CONFIG_DIR_PATH) snprintf(title, sizeof(title), "CONFIG DIR %s", dir); else if (menu_type == RGUI_SAVEFILE_DIR_PATH) snprintf(title, sizeof(title), "SAVEFILE DIR %s", dir); #ifdef HAVE_OVERLAY else if (menu_type == RGUI_OVERLAY_DIR_PATH) snprintf(title, sizeof(title), "OVERLAY DIR %s", dir); #endif else if (menu_type == RGUI_SYSTEM_DIR_PATH) snprintf(title, sizeof(title), "SYSTEM DIR %s", dir); else if (menu_type == RGUI_ASSETS_DIR_PATH) snprintf(title, sizeof(title), "ASSETS DIR %s", dir); else { if (rgui->defer_core) snprintf(title, sizeof(title), "CONTENT %s", dir); else { const char *core_name = rgui->info.library_name; if (!core_name) core_name = g_extern.system.info.library_name; if (!core_name) core_name = "No Core"; snprintf(title, sizeof(title), "CONTENT (%s) %s", core_name, dir); } } char title_buf[256]; menu_ticker_line(title_buf, RMENU_TERM_WIDTH, g_extern.frame_count / 15, title, true); font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET; font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET - (POSITION_OFFSET*2); font_parms.scale = FONT_SIZE_NORMAL; font_parms.color = WHITE; if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) driver.video_poke->set_osd_msg(driver.video_data, title_buf, &font_parms); char title_msg[64]; const char *core_name = rgui->info.library_name; if (!core_name) core_name = g_extern.system.info.library_name; if (!core_name) core_name = "No Core"; const char *core_version = rgui->info.library_version; if (!core_version) core_version = g_extern.system.info.library_version; if (!core_version) core_version = ""; font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET; font_parms.y = POSITION_EDGE_MAX - (POSITION_OFFSET*2); font_parms.scale = FONT_SIZE_NORMAL; font_parms.color = WHITE; snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version); if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) driver.video_poke->set_osd_msg(driver.video_data, title_msg, &font_parms); size_t i, j; j = 0; for (i = begin; i < end; i++, j++) { const char *path = 0; unsigned type = 0; file_list_get_at_offset(rgui->selection_buf, i, &path, &type); char message[256]; char type_str[256]; unsigned w = 19; if (menu_type == RGUI_SETTINGS_INPUT_OPTIONS || menu_type == RGUI_SETTINGS_CUSTOM_BIND) w = 21; else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS) w = 24; #ifdef HAVE_SHADER_MANAGER if (type >= RGUI_SETTINGS_SHADER_FILTER && type <= RGUI_SETTINGS_SHADER_LAST) { // HACK. Work around that we're using the menu_type as dir type to propagate state correctly. if ((menu_type_is == RGUI_SETTINGS_SHADER_OPTIONS) && (menu_type_is == RGUI_SETTINGS_SHADER_OPTIONS)) { type = RGUI_FILE_DIRECTORY; strlcpy(type_str, "(DIR)", sizeof(type_str)); w = 5; } else if (type == RGUI_SETTINGS_SHADER_OPTIONS || type == RGUI_SETTINGS_SHADER_PRESET) strlcpy(type_str, "...", sizeof(type_str)); else if (type == RGUI_SETTINGS_SHADER_FILTER) snprintf(type_str, sizeof(type_str), "%s", g_settings.video.smooth ? "Linear" : "Nearest"); else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str) driver.menu_ctx->backend->shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type); } else #endif // Pretty-print libretro cores from menu. if (menu_type == RGUI_SETTINGS_CORE || menu_type == RGUI_SETTINGS_DEFERRED_CORE) { if (type == RGUI_FILE_PLAIN) { strlcpy(type_str, "(CORE)", sizeof(type_str)); file_list_get_alt_at_offset(rgui->selection_buf, i, &path); w = 6; } else { strlcpy(type_str, "(DIR)", sizeof(type_str)); type = RGUI_FILE_DIRECTORY; w = 5; } } else if (menu_type == RGUI_SETTINGS_CONFIG || #ifdef HAVE_OVERLAY menu_type == RGUI_SETTINGS_OVERLAY_PRESET || #endif menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER || menu_type == RGUI_SETTINGS_AUDIO_DSP_FILTER || menu_type == RGUI_SETTINGS_DISK_APPEND || menu_type_is == RGUI_FILE_DIRECTORY) { if (type == RGUI_FILE_PLAIN) { strlcpy(type_str, "(FILE)", sizeof(type_str)); w = 6; } else if (type == RGUI_FILE_USE_DIRECTORY) { *type_str = '\0'; w = 0; } else { strlcpy(type_str, "(DIR)", sizeof(type_str)); type = RGUI_FILE_DIRECTORY; w = 5; } } else if (menu_type == RGUI_SETTINGS_OPEN_HISTORY) { *type_str = '\0'; w = 0; } else if (type >= RGUI_SETTINGS_CORE_OPTION_START) strlcpy(type_str, core_option_get_val(g_extern.system.core_options, type - RGUI_SETTINGS_CORE_OPTION_START), sizeof(type_str)); else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->setting_set_label) driver.menu_ctx->backend->setting_set_label(type_str, sizeof(type_str), &w, type); char entry_title_buf[256]; char type_str_buf[64]; bool selected = i == rgui->selection_ptr; strlcpy(entry_title_buf, path, sizeof(entry_title_buf)); strlcpy(type_str_buf, type_str, sizeof(type_str_buf)); if ((type == RGUI_FILE_PLAIN || type == RGUI_FILE_DIRECTORY)) menu_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (w + 1 + 2), g_extern.frame_count / 15, path, selected); else menu_ticker_line(type_str_buf, w, g_extern.frame_count / 15, type_str, selected); snprintf(message, sizeof(message), "%c %s", selected ? '>' : ' ', entry_title_buf); //blit_line(rgui, x, y, message, selected); font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET; font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET + (POSITION_OFFSET * j); font_parms.scale = FONT_SIZE_NORMAL; font_parms.color = WHITE; if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) driver.video_poke->set_osd_msg(driver.video_data, message, &font_parms); font_parms.x = POSITION_EDGE_CENTER + POSITION_OFFSET; if (driver.video_data && driver.video_poke && driver.video_poke->set_osd_msg) driver.video_poke->set_osd_msg(driver.video_data, type_str_buf, &font_parms); } }
static void init_menulist(unsigned menu_id) { XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist)); switch (menu_id) { case INGAME_MENU_CORE_OPTIONS_MODE: if (g_extern.system.core_options) { size_t opts = core_option_size(g_extern.system.core_options); for (size_t i = 0; i < opts; i++) { char label[256]; strlcpy(label, core_option_get_desc(g_extern.system.core_options, i), sizeof(label)); snprintf(label, sizeof(label), "%s : %s", label, core_option_get_val(g_extern.system.core_options, i)); mbstowcs(strw_buffer, label, sizeof(strw_buffer) / sizeof(wchar_t)); XuiListInsertItems(m_menulist, i, 1); XuiListSetText(m_menulist, i, strw_buffer); } } else { XuiListInsertItems(m_menulist, 0, 1); XuiListSetText(m_menulist, 0, L"No options available."); } break; case INGAME_MENU_LOAD_GAME_HISTORY_MODE: { size_t history_size = rom_history_size(rgui->history); if (history_size) { size_t opts = history_size; for (size_t i = 0; i < opts; i++) { const char *path = NULL; const char *core_path = NULL; const char *core_name = NULL; rom_history_get_index(rgui->history, i, &path, &core_path, &core_name); char path_short[PATH_MAX]; fill_pathname(path_short, path_basename(path), "", sizeof(path_short)); char fill_buf[PATH_MAX]; snprintf(fill_buf, sizeof(fill_buf), "%s (%s)", path_short, core_name); mbstowcs(strw_buffer, fill_buf, sizeof(strw_buffer) / sizeof(wchar_t)); XuiListInsertItems(m_menulist, i, 1); XuiListSetText(m_menulist, i, strw_buffer); } } else { XuiListInsertItems(m_menulist, 0, 1); XuiListSetText(m_menulist, 0, L"No history available."); } } break; case INGAME_MENU_INPUT_OPTIONS_MODE: { unsigned i; char buttons[RARCH_FIRST_META_KEY][128]; unsigned keybind_end = RETRO_DEVICE_ID_JOYPAD_R3 + 1; for(i = 0; i < keybind_end; i++) { struct platform_bind key_label; strlcpy(key_label.desc, "Unknown", sizeof(key_label.desc)); key_label.joykey = g_settings.input.binds[rgui->current_pad][i].joykey; if (driver.input->set_keybinds) driver.input->set_keybinds(&key_label, 0, 0, 0, (1ULL << KEYBINDS_ACTION_GET_BIND_LABEL)); snprintf(buttons[i], sizeof(buttons[i]), "%s #%d: %s", g_settings.input.binds[rgui->current_pad][i].desc, rgui->current_pad, key_label.desc); mbstowcs(strw_buffer, buttons[i], sizeof(strw_buffer) / sizeof(wchar_t)); XuiListInsertItems(m_menulist, i, 1); XuiListSetText(m_menulist, i, strw_buffer); } //set_dpad_emulation_label(rgui->current_pad, buttons[0], sizeof(buttons[0])); //mbstowcs(strw_buffer, buttons[0], sizeof(strw_buffer) / sizeof(wchar_t)); XuiListInsertItems(m_menulist, keybind_end, 1); //XuiListSetText(m_menulist, SETTING_CONTROLS_DPAD_EMULATION, strw_buffer); XuiListSetText(m_menulist, SETTING_CONTROLS_DPAD_EMULATION, L"Stub"); XuiListInsertItems(m_menulist, keybind_end + 1, 1); XuiListSetText(m_menulist, SETTING_CONTROLS_DEFAULT_ALL, L"Reset all buttons to default"); } break; case INGAME_MENU_SETTINGS_MODE: XuiListInsertItems(m_menulist, INGAME_MENU_REWIND_ENABLED, 1); XuiListSetText(m_menulist, INGAME_MENU_REWIND_ENABLED, g_settings.rewind_enable ? L"Rewind: ON" : L"Rewind: OFF"); menu_settings_create_menu_item_label_w(strw_buffer, S_LBL_REWIND_GRANULARITY, sizeof(strw_buffer)); XuiListInsertItems(m_menulist, INGAME_MENU_REWIND_GRANULARITY, 1); XuiListSetText(m_menulist, INGAME_MENU_REWIND_GRANULARITY, strw_buffer); XuiListInsertItems(m_menulist, SETTING_EMU_SHOW_DEBUG_INFO_MSG, 1); XuiListSetText(m_menulist, SETTING_EMU_SHOW_DEBUG_INFO_MSG, (g_settings.fps_show) ? L"Show Framerate: ON" : L"Show Framerate: OFF"); break; case INGAME_MENU_MAIN_MODE: XuiListInsertItems(m_menulist, INGAME_MENU_CHANGE_LIBRETRO_CORE, 1); XuiListSetText(m_menulist, INGAME_MENU_CHANGE_LIBRETRO_CORE, L"Core ..."); XuiListInsertItems(m_menulist, INGAME_MENU_LOAD_GAME_HISTORY_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_LOAD_GAME_HISTORY_MODE, L"Load Game (History) ..."); XuiListInsertItems(m_menulist, INGAME_MENU_CHANGE_GAME, 1); XuiListSetText(m_menulist, INGAME_MENU_CHANGE_GAME, L"Load Game ..."); XuiListInsertItems(m_menulist, INGAME_MENU_CORE_OPTIONS_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_CORE_OPTIONS_MODE, L"Core Options ..."); XuiListInsertItems(m_menulist, INGAME_MENU_VIDEO_OPTIONS_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_VIDEO_OPTIONS_MODE, L"Video Options ..."); XuiListInsertItems(m_menulist, INGAME_MENU_AUDIO_OPTIONS_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_AUDIO_OPTIONS_MODE, L"Audio Options ..."); XuiListInsertItems(m_menulist, INGAME_MENU_INPUT_OPTIONS_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_INPUT_OPTIONS_MODE, L"Input Options ..."); XuiListInsertItems(m_menulist, INGAME_MENU_PATH_OPTIONS_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_PATH_OPTIONS_MODE, L"Path Options ..."); XuiListInsertItems(m_menulist, INGAME_MENU_SETTINGS_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_SETTINGS_MODE, L"Settings ..."); menu_settings_create_menu_item_label_w(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer)); XuiListInsertItems(m_menulist, INGAME_MENU_LOAD_STATE, 1); XuiListSetText(m_menulist, INGAME_MENU_LOAD_STATE, strw_buffer); menu_settings_create_menu_item_label_w(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer)); XuiListInsertItems(m_menulist, INGAME_MENU_SAVE_STATE, 1); XuiListSetText(m_menulist, INGAME_MENU_SAVE_STATE, strw_buffer); XuiListInsertItems(m_menulist, INGAME_MENU_SCREENSHOT_MODE, 1); XuiListSetText(m_menulist, INGAME_MENU_SCREENSHOT_MODE, L"Take Screenshot"); XuiListInsertItems(m_menulist, INGAME_MENU_RETURN_TO_GAME, 1); XuiListSetText(m_menulist, INGAME_MENU_RETURN_TO_GAME, L"Resume Game"); XuiListInsertItems(m_menulist, INGAME_MENU_RESET, 1); XuiListSetText(m_menulist, INGAME_MENU_RESET, L"Restart Game"); XuiListInsertItems(m_menulist, INGAME_MENU_QUIT_RETROARCH, 1); XuiListSetText(m_menulist, INGAME_MENU_QUIT_RETROARCH, L"Quit RetroArch"); break; } }