diff --git a/cheevos.c b/cheevos.c index 44815d2440..6edca70c24 100644 --- a/cheevos.c +++ b/cheevos.c @@ -649,7 +649,7 @@ void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value) { unsigned i; - for (i = 0; i < sizeof(cheevos_locals.meminfo) / sizeof(cheevos_locals.meminfo[0]); i++) + for (i = 0; i < ARRAY_SIZE(cheevos_locals.meminfo); i++) { if (var->value < cheevos_locals.meminfo[i].size) { @@ -1824,8 +1824,8 @@ static size_t cheevos_eval_md5( static void cheevos_fill_md5(size_t size, size_t total, MD5_CTX *ctx) { - char buffer[4096]; - ssize_t fill = total - size; + char buffer[4096] = {0}; + ssize_t fill = total - size; memset((void*)buffer, 0, sizeof(buffer)); @@ -1846,11 +1846,10 @@ static unsigned cheevos_find_game_id_generic( retro_time_t timeout) { MD5_CTX ctx; - uint8_t hash[16]; retro_time_t to; - size_t size; - - size = cheevos_eval_md5(info, &ctx); + uint8_t hash[16] = {0}; + size_t size = cheevos_eval_md5(info, &ctx); + MD5_Final(hash, &ctx); if (!size) @@ -1865,11 +1864,9 @@ static unsigned cheevos_find_game_id_snes( retro_time_t timeout) { MD5_CTX ctx; - uint8_t hash[16]; retro_time_t to; - size_t size; - - size = cheevos_eval_md5(info, &ctx); + uint8_t hash[16] = {0}; + size_t size = cheevos_eval_md5(info, &ctx); if (!size) { @@ -1935,8 +1932,8 @@ static unsigned cheevos_find_game_id_nes( } else { - RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0); ssize_t num_read; + RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0); if (!file) return 0; @@ -1978,8 +1975,8 @@ static unsigned cheevos_find_game_id_nes( { 53, 198, 228 }; - bool round = true; - RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0); + bool round = true; + RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0); uint8_t * data = (uint8_t *) malloc(rom_size << 14); if (!file || !data) @@ -1997,7 +1994,7 @@ static unsigned cheevos_find_game_id_nes( mapper_no |= (header.rom_type2 & 0xF0); - for (i = 0; i != sizeof(not_power2) / sizeof(not_power2[0]); ++i) + for (i = 0; i != ARRAY_SIZE(not_power2); ++i) { /* for games not to the power of 2, so we just read enough * PRG rom from it, but we have to keep ROM_size to the power of 2 @@ -2100,14 +2097,16 @@ bool cheevos_load(const void *data) cheevos_locals.meminfo[3].id = RETRO_MEMORY_RTC; core_get_memory(&cheevos_locals.meminfo[3]); - /* Bail out if cheevos are disabled. But set the above anyways, command_read_ram needs it. */ + /* Bail out if cheevos are disabled. + * But set the above anyways, command_read_ram needs it. */ if (!settings->cheevos.enable) return true; - /* Use the supported extensions as a hint to what method we should use. */ + /* Use the supported extensions as a hint + * to what method we should use. */ core_get_system_info(&sysinfo); - for (i = 0; i < sizeof(finders) / sizeof(finders[0]); i++) + for (i = 0; i < ARRAY_SIZE(finders); i++) { if (finders[i].ext_hashes) { @@ -2149,7 +2148,7 @@ bool cheevos_load(const void *data) } } - for (i = 0; i < sizeof(finders) / sizeof(finders[0]); i++) + for (i = 0; i < ARRAY_SIZE(finders); i++) { if (finders[i].ext_hashes) continue; @@ -2175,7 +2174,8 @@ found: cheevos_locals.loaded = 1; cheevos_make_playing_url(game_id, url, sizeof(url)); - task_push_http_transfer(url, true, NULL, cheevos_playing, (void*)(uintptr_t)game_id); + task_push_http_transfer(url, true, NULL, + cheevos_playing, (void*)(uintptr_t)game_id); return true; } @@ -2191,28 +2191,24 @@ void cheevos_populate_menu(void *data) { #ifdef HAVE_MENU unsigned i; + unsigned items_found = 0; const cheevo_t *end = NULL; cheevo_t *cheevo = NULL; settings_t *settings = config_get_ptr(); menu_displaylist_info_t *info = (menu_displaylist_info_t*)data; - menu_entries_add_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS), - msg_hash_to_str(MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ACHIEVEMENTS), - MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ACHIEVEMENTS, - MENU_SETTINGS_CHEEVOS_NONE, 0, 0); - menu_entries_add_enum(info->list, "", "", MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ACHIEVEMENTS, - MENU_SETTINGS_CHEEVOS_NONE, 0, 0); - cheevo = cheevos_locals.core.cheevos; end = cheevos_locals.core.cheevos + cheevos_locals.core.count; for (i = 0; cheevo < end; i++, cheevo++) { if (!cheevo->active) + { menu_entries_add_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_ENTRY, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } } if (settings->cheevos.test_unofficial) @@ -2225,30 +2221,23 @@ void cheevos_populate_menu(void *data) { if (!cheevo->active) menu_entries_add_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_ENTRY, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, MENU_SETTINGS_CHEEVOS_START + i, 0, 0); } } - menu_entries_add_enum(info->list, "", "", MSG_UNKNOWN, - MENU_SETTINGS_CHEEVOS_NONE, 0, 0); - menu_entries_add_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ACHIEVEMENTS), - msg_hash_to_str(MENU_ENUM_LABEL_CHEEVOS_LOCKED_ACHIEVEMENTS), - MENU_ENUM_LABEL_CHEEVOS_LOCKED_ACHIEVEMENTS, - MENU_SETTINGS_CHEEVOS_NONE, 0, 0); - menu_entries_add_enum(info->list, "", "", MENU_ENUM_LABEL_CHEEVOS_LOCKED_ACHIEVEMENTS, - MENU_SETTINGS_CHEEVOS_NONE, 0, 0); - cheevo = cheevos_locals.core.cheevos; end = cheevos_locals.core.cheevos + cheevos_locals.core.count; for (i = 0; cheevo < end; i++, cheevo++) { if (cheevo->active) + { menu_entries_add_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_ENTRY, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } } if (settings->cheevos.test_unofficial) @@ -2260,11 +2249,23 @@ void cheevos_populate_menu(void *data) for (i = cheevos_locals.core.count; cheevo < end; i++, cheevo++) { if (cheevo->active) + { menu_entries_add_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_ENTRY, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } } } + + if (items_found == 0) + { + menu_entries_add_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ACHIEVEMENTS_TO_DISPLAY), + MENU_ENUM_LABEL_NO_ACHIEVEMENTS_TO_DISPLAY, + FILE_TYPE_NONE, 0, 0); + } #endif } @@ -2317,7 +2318,8 @@ bool cheevos_toggle_hardcore_mode(void) command_event(CMD_EVENT_REWIND_DEINIT, NULL); RARCH_LOG("%s\n", msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE)); - runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE), 0, 3 * 60, true); + runloop_msg_queue_push( + msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE), 0, 3 * 60, true); } else { diff --git a/config.def.h b/config.def.h index c22477185c..b4fe3224a5 100644 --- a/config.def.h +++ b/config.def.h @@ -524,13 +524,17 @@ static bool xmb_shadows_enable = false; static bool xmb_shadows_enable = true; #endif +static float menu_wallpaper_opacity = 0.300; + static unsigned menu_background_gradient = 4; +#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) || defined(HAVE_VULKAN) #if defined(HAVE_OPENGLES2) || defined(OSX_PPC) static unsigned menu_shader_pipeline = 1; #else static unsigned menu_shader_pipeline = 2; #endif +#endif static bool show_advanced_settings = true; static const uint32_t menu_entry_normal_color = 0xffffffff; diff --git a/configuration.c b/configuration.c index b07fd4d4a3..35d093a77e 100644 --- a/configuration.c +++ b/configuration.c @@ -465,15 +465,19 @@ static void config_set_defaults(void) if (def_menu) strlcpy(settings->menu.driver, def_menu, sizeof(settings->menu.driver)); - settings->menu.xmb_scale_factor = xmb_scale_factor; - settings->menu.xmb_alpha_factor = xmb_alpha_factor; - settings->menu.xmb_theme = xmb_theme; - settings->menu.background_gradient= menu_background_gradient; - settings->menu.xmb_shadows_enable = xmb_shadows_enable; - settings->menu.shader_pipeline = menu_shader_pipeline; - settings->menu.xmb_font[0] = '\0'; - settings->menu.throttle_framerate = true; - settings->menu.linear_filter = true; +#ifdef HAVE_XMB + settings->menu.xmb.scale_factor = xmb_scale_factor; + settings->menu.xmb.alpha_factor = xmb_alpha_factor; + settings->menu.xmb.theme = xmb_theme; + settings->menu.xmb.menu_color_theme = menu_background_gradient; + settings->menu.xmb.shadows_enable = xmb_shadows_enable; + settings->menu.xmb.shader_pipeline = menu_shader_pipeline; + settings->menu.xmb.font[0] = '\0'; +#endif + settings->menu.materialui.menu_color_theme = 0; + + settings->menu.throttle_framerate = true; + settings->menu.linear_filter = true; #endif settings->history_list_enable = def_history_list_enable; @@ -605,6 +609,7 @@ static void config_set_defaults(void) settings->menu.timedate_enable = true; settings->menu.core_enable = true; settings->menu.dynamic_wallpaper_enable = false; + settings->menu.wallpaper.opacity = menu_wallpaper_opacity; settings->menu.thumbnails = menu_thumbnails_default; settings->menu.show_advanced_settings = show_advanced_settings; settings->menu.entry_normal_color = menu_entry_normal_color; @@ -1324,6 +1329,7 @@ static bool config_load_file(const char *path, bool set_defaults) "menu_core_enable"); CONFIG_GET_BOOL_BASE(conf, settings, menu.dynamic_wallpaper_enable, "menu_dynamic_wallpaper_enable"); + CONFIG_GET_FLOAT_BASE(conf, settings, menu.wallpaper.opacity, "menu_wallpaper_opacity"); CONFIG_GET_INT_BASE(conf, settings, menu.thumbnails, "menu_thumbnails"); CONFIG_GET_BOOL_BASE(conf, settings, menu.navigation.wraparound.enable, @@ -1523,14 +1529,17 @@ static bool config_load_file(const char *path, bool set_defaults) config_get_array(conf, "location_driver", settings->location.driver, sizeof(settings->location.driver)); #ifdef HAVE_MENU config_get_array(conf, "menu_driver", settings->menu.driver, sizeof(settings->menu.driver)); - CONFIG_GET_INT_BASE(conf, settings, menu.xmb_scale_factor, "xmb_scale_factor"); - CONFIG_GET_INT_BASE(conf, settings, menu.xmb_alpha_factor, "xmb_alpha_factor"); - CONFIG_GET_INT_BASE(conf, settings, menu.xmb_theme, "xmb_theme"); - CONFIG_GET_INT_BASE(conf, settings, menu.background_gradient, "menu_background_gradient"); - CONFIG_GET_BOOL_BASE(conf, settings, menu.xmb_shadows_enable, "xmb_shadows_enable"); - CONFIG_GET_INT_BASE(conf, settings, menu.shader_pipeline, "menu_shader_pipeline"); + CONFIG_GET_INT_BASE(conf, settings, menu.xmb.scale_factor, "xmb_scale_factor"); + CONFIG_GET_INT_BASE(conf, settings, menu.xmb.alpha_factor, "xmb_alpha_factor"); + CONFIG_GET_INT_BASE(conf, settings, menu.xmb.theme, "xmb_theme"); +#ifdef HAVE_XMB + CONFIG_GET_INT_BASE(conf, settings, menu.xmb.menu_color_theme, "xmb_menu_color_theme"); +#endif + CONFIG_GET_INT_BASE(conf, settings, menu.materialui.menu_color_theme, "materialui_menu_color_theme"); + CONFIG_GET_BOOL_BASE(conf, settings, menu.xmb.shadows_enable, "xmb_shadows_enable"); + CONFIG_GET_INT_BASE(conf, settings, menu.xmb.shader_pipeline, "menu_shader_pipeline"); if (config_get_path(conf, "xmb_font", tmp_str, sizeof(tmp_str))) - strlcpy(settings->menu.xmb_font, tmp_str, sizeof(settings->menu.xmb_font)); + strlcpy(settings->menu.xmb.font, tmp_str, sizeof(settings->menu.xmb.font)); #endif config_get_array(conf, "video_context_driver", settings->video.context_driver, @@ -2700,6 +2709,8 @@ bool config_save_file(const char *path) #ifdef HAVE_MENU config_set_path(conf, "menu_wallpaper", settings->path.menu_wallpaper); + config_set_float(conf, "menu_wallpaper_opacity", + settings->menu.wallpaper.opacity); #endif config_set_string(conf, "video_filter", settings->path.softfilter_plugin); @@ -2935,14 +2946,17 @@ bool config_save_file(const char *path) *global->dir.savestate ? global->dir.savestate : "default"); #ifdef HAVE_MENU - config_set_int(conf, "xmb_scale_factor", settings->menu.xmb_scale_factor); - config_set_int(conf, "xmb_alpha_factor", settings->menu.xmb_alpha_factor); - config_set_int(conf, "xmb_theme", settings->menu.xmb_theme); - config_set_int(conf, "menu_background_gradient", settings->menu.background_gradient); - config_set_bool(conf, "xmb_shadows_enable", settings->menu.xmb_shadows_enable); - config_set_int(conf, "menu_shader_pipeline", settings->menu.shader_pipeline); + config_set_int(conf, "xmb_scale_factor", settings->menu.xmb.scale_factor); + config_set_int(conf, "xmb_alpha_factor", settings->menu.xmb.alpha_factor); + config_set_int(conf, "xmb_theme", settings->menu.xmb.theme); +#ifdef HAVE_XMB + config_set_int(conf, "xmb_menu_color_theme", settings->menu.xmb.menu_color_theme); +#endif + config_set_int(conf, "materialui_menu_color_theme", settings->menu.materialui.menu_color_theme); + config_set_bool(conf, "xmb_shadows_enable", settings->menu.xmb.shadows_enable); + config_set_int(conf, "menu_shader_pipeline", settings->menu.xmb.shader_pipeline); config_set_path(conf, "xmb_font", - !string_is_empty(settings->menu.xmb_font) ? settings->menu.xmb_font : ""); + !string_is_empty(settings->menu.xmb.font) ? settings->menu.xmb.font : ""); config_set_bool(conf, "rgui_show_start_screen", settings->menu_show_start_screen); config_set_bool(conf, "menu_navigation_wraparound_enable", diff --git a/configuration.h b/configuration.h index 6c41ffc2c4..602c1ca400 100644 --- a/configuration.h +++ b/configuration.h @@ -121,6 +121,11 @@ typedef struct settings unsigned thumbnails; bool throttle; + struct + { + float opacity; + } wallpaper; + struct { bool enable; @@ -158,15 +163,24 @@ typedef struct settings unsigned entry_normal_color; unsigned entry_hover_color; unsigned title_color; - unsigned xmb_scale_factor; - unsigned xmb_alpha_factor; - unsigned xmb_theme; - unsigned background_gradient; - bool xmb_shadows_enable; - unsigned shader_pipeline; - char xmb_font[PATH_MAX_LENGTH]; bool throttle_framerate; bool linear_filter; + + struct + { + unsigned shader_pipeline; + char font[PATH_MAX_LENGTH]; + unsigned scale_factor; + unsigned alpha_factor; + unsigned theme; + unsigned menu_color_theme; + bool shadows_enable; + } xmb; + + struct + { + unsigned menu_color_theme; + } materialui; } menu; #endif diff --git a/core_info.c b/core_info.c index 9b4f0df5c7..6adc8fd655 100644 --- a/core_info.c +++ b/core_info.c @@ -540,11 +540,11 @@ bool core_info_load(core_info_ctx_find_t *info) return true; } -bool core_info_find(core_info_ctx_find_t *info) +bool core_info_find(core_info_ctx_find_t *info, const char *core_path) { if (!info || !core_info_curr_list) return false; - info->inf = core_info_find_internal(core_info_curr_list, info->path); + info->inf = core_info_find_internal(core_info_curr_list, core_path); if (!info->inf) return false; return true; diff --git a/core_info.h b/core_info.h index 5ce4bc593a..a32301cea1 100644 --- a/core_info.h +++ b/core_info.h @@ -115,7 +115,7 @@ bool core_info_get_list(core_info_list_t **core); bool core_info_list_update_missing_firmware(core_info_ctx_firmware_t *info); -bool core_info_find(core_info_ctx_find_t *info); +bool core_info_find(core_info_ctx_find_t *info, const char *name); bool core_info_load(core_info_ctx_find_t *info); diff --git a/file_path_special.c b/file_path_special.c index 3b0118840a..657d73bfd6 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -410,8 +410,8 @@ void fill_pathname_application_special(char *s, size_t len, enum application_spe { settings_t *settings = config_get_ptr(); - if (!string_is_empty(settings->menu.xmb_font)) - strlcpy(s, settings->menu.xmb_font, len); + if (!string_is_empty(settings->menu.xmb.font)) + strlcpy(s, settings->menu.xmb.font, len); else { char s1[PATH_MAX_LENGTH] = {0}; diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index b3c4f72e55..3d189891ab 100644 --- a/gfx/common/x11_common.c +++ b/gfx/common/x11_common.c @@ -419,12 +419,12 @@ bool x11_alive(void *data) case ClientMessage: if (event.xclient.window == g_x11_win && (Atom)event.xclient.data.l[0] == g_x11_quit_atom) - frontend_driver_destroy_signal_handler_state(); + frontend_driver_set_signal_handler_state(1); break; case DestroyNotify: if (event.xdestroywindow.window == g_x11_win) - frontend_driver_destroy_signal_handler_state(); + frontend_driver_set_signal_handler_state(1); break; case MapNotify: diff --git a/intl/msg_hash_fr.c b/intl/msg_hash_fr.c index 96047fa20d..98cd09ec1e 100644 --- a/intl/msg_hash_fr.c +++ b/intl/msg_hash_fr.c @@ -1070,7 +1070,9 @@ const char *msg_hash_to_str_fr(enum msg_hash_enums msg) return "XMB : Police"; case MENU_ENUM_LABEL_VALUE_XMB_THEME: return "XMB : Theme"; - case MENU_ENUM_LABEL_VALUE_XMB_GRADIENT: + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME: + return "Dégradé de font d'écran"; + case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME: return "Dégradé de font d'écran"; case MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE: return "Ombres pour les icones"; diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 958be6aaa4..44990a3f71 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -1110,6 +1110,15 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len) static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) { + if (msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END && + msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN) + { + static char hotkey_lbl[PATH_MAX_LENGTH] = {0}; + unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN; + snprintf(hotkey_lbl, sizeof(hotkey_lbl), "input_hotkey_binds_%d", idx); + return hotkey_lbl; + } + switch (msg) { case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES: @@ -1184,8 +1193,12 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "input_libretro_device_p%u"; case MENU_ENUM_LABEL_RUN: return "collection"; - case MENU_ENUM_LABEL_CHEEVOS_ENTRY: - return "cheevos_entry"; + case MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY: + return "playlist_collection_entry"; + case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY: + return "cheevos_locked_entry"; + case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY: + return "cheevos_unlocked_entry"; case MENU_ENUM_LABEL_FILEBROWSER_ENTRY: return "filebrowser_entry"; case MENU_ENUM_LABEL_CORE_INFO_ENTRY: @@ -1252,6 +1265,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "no_performance_counters"; case MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY: return "no_entries_to_display"; + case MENU_ENUM_LABEL_NO_ACHIEVEMENTS_TO_DISPLAY: + return "no_achievements_to_display"; case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ACHIEVEMENTS: return "cheevos_unlocked_achievements"; case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ACHIEVEMENTS: @@ -1624,8 +1639,10 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "xmb_font"; case MENU_ENUM_LABEL_XMB_THEME: return "xmb_theme"; - case MENU_ENUM_LABEL_XMB_GRADIENT: - return "xmb_gradient"; + case MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME: + return "xmb_menu_color_theme"; + case MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME: + return "materialui_menu_color_theme"; case MENU_ENUM_LABEL_XMB_SHADOWS_ENABLE: return "xmb_shadows_enable"; case MENU_ENUM_LABEL_XMB_RIBBON_ENABLE: @@ -2080,6 +2097,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "use_builtin_image_viewer"; case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR: return "input_poll_type_behavior"; + case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY: + return "menu_wallpaper_opacity"; default: break; } @@ -2098,6 +2117,48 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg) switch (msg) { + case MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED: + return "Ribbon (simplified)"; + case MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON: + return "Ribbon"; + case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE: + return "Blue"; + case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED: + return "Red"; + case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW: + return "Yellow"; + case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_GREEN: + return "Green"; + case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_DARK_BLUE: + return "Dark Blue"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED: + return "Legacy Red"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE: + return "Dark Purple"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE: + return "Midnight Blue"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN: + return "Golden"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE: + return "Electric Blue"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN: + return "Apple Green"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA: + return "Undersea"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED: + return "Volcanic Red"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK: + return "Dark"; + case MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY: + return "Unlocked"; + case MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY: + return "Unlocked"; + case MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE: + return "Late"; + case MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL: + return "Normal"; + case MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY: + return "Early"; case MSG_INTERNAL_MEMORY: return "Internal Memory"; case MSG_EXTERNAL_APPLICATION_DIR: @@ -2498,6 +2559,8 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg) return "Custom Viewport Height"; case MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY: return "No entries to display."; + case MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY: + return "No achievements to display."; case MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ACHIEVEMENTS: return "Unlocked Achievements:"; case MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ACHIEVEMENTS: @@ -2830,8 +2893,10 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg) return "XMB Font"; case MENU_ENUM_LABEL_VALUE_XMB_THEME: return "XMB Theme"; - case MENU_ENUM_LABEL_VALUE_XMB_GRADIENT: - return "Background Gradient"; + case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME: + return "Menu Color Theme"; + case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME: + return "Menu Color Theme"; case MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE: return "Icon Shadows Enable"; case MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE: @@ -3526,6 +3591,8 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg) return "Title Screens"; case MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS: return "Boxarts"; + case MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY: + return "Wallpaper opacity"; default: #if 0 RARCH_LOG("Unimplemented: [%d]\n", msg); diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 2a2142657f..f20906d180 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -21,6 +21,7 @@ #include "../menu_animation.h" #include "../menu_cbs.h" #include "../menu_shader.h" +#include "../menu_display.h" #include "../../input/input_autodetect.h" #include "../../input/input_config.h" @@ -61,7 +62,7 @@ static void menu_action_setting_disp_set_label_cheat_num_passes( snprintf(s, len, "%u", cheat_manager_get_buf_size()); } -static void menu_action_setting_disp_set_label_cheevos_entry( +static void menu_action_setting_disp_set_label_cheevos_locked_entry( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, @@ -72,7 +73,23 @@ static void menu_action_setting_disp_set_label_cheevos_entry( { *w = 19; strlcpy(s2, path, len2); - strlcpy(s, "", len); + strlcpy(s, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY), len); +} + +static void menu_action_setting_disp_set_label_cheevos_unlocked_entry( + 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) +{ + *w = 19; + strlcpy(s2, path, len2); + strlcpy(s, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY), len); } static void menu_action_setting_disp_set_label_remap_file_load( @@ -194,16 +211,20 @@ static void menu_action_setting_disp_set_label_pipeline( *s = '\0'; *w = 19; - switch (settings->menu.shader_pipeline) + switch (settings->menu.xmb.shader_pipeline) { case 0: strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len); break; case 1: - strlcpy(s, "Ribbon (simplified)", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED), len); break; case 2: - strlcpy(s, "Ribbon", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON), len); break; } @@ -315,7 +336,8 @@ static void menu_action_setting_disp_set_label_shader_parameter( if (!shader_info.data) return; - param = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; + param = &shader_info.data->parameters[type - + MENU_SETTINGS_SHADER_PARAMETER_0]; if (!param) return; @@ -454,7 +476,7 @@ static void menu_action_setting_disp_set_label_input_desc( if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND) { - if(strstr(descriptor,"Auto") && !strstr(descriptor, + if(strstr(descriptor, "Auto") && !strstr(descriptor, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))) strlcpy(s, descriptor, @@ -621,13 +643,19 @@ static void menu_action_setting_disp_set_label_poll_type_behavior( switch (settings->input.poll_type_behavior) { case 0: - strlcpy(s, "Early", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY), len); break; case 1: - strlcpy(s, "Normal", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL), len); break; case 2: - strlcpy(s, "Late", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE), len); break; } } @@ -648,7 +676,7 @@ static void menu_action_setting_disp_set_label_xmb_theme( strlcpy(s2, path, len2); *w = 19; - switch (settings->menu.xmb_theme) + switch (settings->menu.xmb.theme) { case 0: strlcpy(s, "Monochrome", len); @@ -668,7 +696,7 @@ static void menu_action_setting_disp_set_label_xmb_theme( } } -static void menu_action_setting_disp_set_label_xmb_gradient( +static void menu_action_setting_disp_set_label_xmb_menu_color_theme( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, @@ -685,34 +713,110 @@ static void menu_action_setting_disp_set_label_xmb_gradient( if (!settings) return; - switch (settings->menu.background_gradient) + switch (settings->menu.xmb.menu_color_theme) { case 0: - strlcpy(s, "Legacy Red", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED), + len); break; case 1: - strlcpy(s, "Dark Purple", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE), + len); break; case 2: - strlcpy(s, "Midnight Blue", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE), + len); break; case 3: - strlcpy(s, "Golden", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN), + len); break; case 4: - strlcpy(s, "Electric Blue", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE), + len); break; case 5: - strlcpy(s, "Apple Green", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN), + len); break; case 6: - strlcpy(s, "Undersea", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA), + len); break; case 7: - strlcpy(s, "Volcanic Red", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED), + len); break; case 8: - strlcpy(s, "Dark", len); + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK), + len); + break; + } +} + +static void menu_action_setting_disp_set_label_materialui_menu_color_theme( + 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) +{ + settings_t *settings = config_get_ptr(); + + strlcpy(s2, path, len2); + *w = 19; + + if (!settings) + return; + + switch (settings->menu.materialui.menu_color_theme) + { + case MATERIALUI_THEME_BLUE: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE), len); + break; + case MATERIALUI_THEME_GREEN: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_GREEN), len); + break; + case MATERIALUI_THEME_RED: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED), len); + break; + case MATERIALUI_THEME_YELLOW: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW), len); + break; + case MATERIALUI_THEME_DARK_BLUE: + strlcpy(s, + msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_DARK_BLUE), len); + break; + default: break; } } @@ -1381,7 +1485,7 @@ static void menu_action_setting_disp_set_label(file_list_t* list, } static int menu_cbs_init_bind_get_string_representation_compare_label( - menu_file_list_cbs_t *cbs, uint32_t label_hash) + menu_file_list_cbs_t *cbs) { if (cbs->enum_idx != MSG_UNKNOWN) { @@ -1399,9 +1503,13 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_xmb_theme); break; - case MENU_ENUM_LABEL_XMB_GRADIENT: + case MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME: BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_xmb_gradient); + menu_action_setting_disp_set_label_xmb_menu_color_theme); + break; + case MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_materialui_menu_color_theme); break; case MENU_ENUM_LABEL_THUMBNAILS: BIND_ACTION_GET_VALUE(cbs, @@ -1495,94 +1603,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( } else { - switch (label_hash) - { - case MENU_LABEL_XMB_THEME: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_xmb_theme); - break; - case MENU_LABEL_XMB_GRADIENT: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_xmb_gradient); - break; - case MENU_LABEL_THUMBNAILS: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_thumbnails); - break; - case MENU_LABEL_REMAP_FILE_LOAD: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_remap_file_load); - break; - case MENU_LABEL_VIDEO_SHADER_FILTER_PASS: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_shader_filter_pass); - break; - case MENU_LABEL_VIDEO_SHADER_SCALE_PASS: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_shader_scale_pass); - break; - case MENU_LABEL_VIDEO_SHADER_NUM_PASSES: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_shader_num_passes); - break; - case MENU_LABEL_XMB_RIBBON_ENABLE: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_pipeline); - break; - case MENU_LABEL_VIDEO_SHADER_PASS: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_shader_pass); - break; - case MENU_LABEL_VIDEO_SHADER_DEFAULT_FILTER: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_shader_default_filter); - break; - case MENU_LABEL_VIDEO_FILTER: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_filter); - break; - case MENU_LABEL_CONFIGURATIONS: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_configurations); - break; - case MENU_LABEL_SCREEN_RESOLUTION: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_menu_video_resolution); - break; - case MENU_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_menu_input_keyboard_gamepad_mapping_type); - break; - case MENU_LABEL_CONTENT_COLLECTION_LIST: - case MENU_LABEL_LOAD_CONTENT_HISTORY: - case MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST: - case MENU_LABEL_DETECT_CORE_LIST: - case MENU_LABEL_LOAD_CONTENT: - case MENU_LABEL_CORE_OPTIONS: - case MENU_LABEL_CORE_CHEAT_OPTIONS: - case MENU_LABEL_SHADER_OPTIONS: - case MENU_LABEL_VIDEO_SHADER_PARAMETERS: - case MENU_LABEL_VIDEO_SHADER_PRESET_PARAMETERS: - case MENU_LABEL_VIDEO_SHADER_PRESET_SAVE_AS: - case MENU_LABEL_CHEAT_FILE_SAVE_AS: - case MENU_LABEL_FRONTEND_COUNTERS: - case MENU_LABEL_CORE_COUNTERS: - case MENU_LABEL_DATABASE_MANAGER_LIST: - case MENU_LABEL_CURSOR_MANAGER_LIST: - case MENU_LABEL_CLOSE_CONTENT: - case MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS: - case MENU_LABEL_CORE_INFORMATION: - case MENU_LABEL_SYSTEM_INFORMATION: - case MENU_LABEL_DEBUG_INFORMATION: - case MENU_LABEL_ACHIEVEMENT_LIST: - case MENU_LABEL_SAVE_STATE: - case MENU_LABEL_LOAD_STATE: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_menu_more); - break; - default: - return - 1; - } + return -1; } return 0; @@ -1728,8 +1749,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_type( } int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, - const char *path, const char *label, unsigned type, size_t idx, - uint32_t label_hash, uint32_t menu_label_hash) + const char *path, const char *label, unsigned type, size_t idx) { if (!cbs) return -1; @@ -1738,9 +1758,13 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, { switch (cbs->enum_idx) { - case MENU_ENUM_LABEL_CHEEVOS_ENTRY: + case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY: BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_cheevos_entry); + menu_action_setting_disp_set_label_cheevos_unlocked_entry); + return 0; + case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_cheevos_locked_entry); return 0; case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY: BIND_ACTION_GET_VALUE(cbs, @@ -1762,30 +1786,6 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, break; } } - else - { - switch (menu_label_hash) - { - case MENU_LABEL_LOAD_CONTENT_HISTORY: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_content_history); - return 0; - case MENU_LABEL_SYSTEM_INFORMATION: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_system_information); - return 0; - case MENU_LABEL_DEBUG_INFORMATION: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_debug_information); - return 0; - case MENU_LABEL_ACHIEVEMENT_LIST: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_achievement_information); - return 0; - default: - break; - } - } if (type >= MENU_SETTINGS_PLAYLIST_ASSOCIATION_START) { @@ -1815,7 +1815,7 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, return 0; } - if (menu_cbs_init_bind_get_string_representation_compare_label(cbs, label_hash) == 0) + if (menu_cbs_init_bind_get_string_representation_compare_label(cbs) == 0) return 0; if (menu_cbs_init_bind_get_string_representation_compare_type(cbs, type) == 0) diff --git a/menu/cbs/menu_cbs_label.c b/menu/cbs/menu_cbs_label.c index ee37ec07c0..09386a4347 100644 --- a/menu/cbs/menu_cbs_label.c +++ b/menu/cbs/menu_cbs_label.c @@ -14,10 +14,12 @@ */ #include +#include #include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_navigation.h" +#include "../../file_path_special.h" #ifndef BIND_ACTION_LABEL #define BIND_ACTION_LABEL(cbs, name) \ @@ -25,35 +27,72 @@ cbs->action_label_ident = #name; #endif -static int action_bind_label_generic(char *s, size_t len) +static int action_bind_label_generic( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { return 0; } -static int action_bind_label_information(char *s, size_t len) +static int action_bind_label_information( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INFORMATION), len); return 0; } -static int action_bind_label_internal_memory(char *s, size_t len) +static int action_bind_label_internal_memory( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MSG_INTERNAL_MEMORY), len); return 0; } -static int action_bind_label_external_application_dir(char *s, size_t len) +static int action_bind_label_external_application_dir( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MSG_EXTERNAL_APPLICATION_DIR), len); return 0; } -static int action_bind_label_application_dir(char *s, size_t len) +static int action_bind_label_application_dir( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MSG_APPLICATION_DIR), len); return 0; } +static int action_bind_label_playlist_collection_entry( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) +{ + if (strstr(path, file_path_str(FILE_PATH_LPL_EXTENSION))) + { + char path_base[PATH_MAX_LENGTH] = {0}; + fill_short_pathname_representation_noext(path_base, path, + sizeof(path_base)); + + strlcpy(s, path_base, len); + } + return 0; +} + int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx) { @@ -66,6 +105,9 @@ int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs, { switch (cbs->enum_idx) { + case MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY: + BIND_ACTION_LABEL(cbs, action_bind_label_playlist_collection_entry); + break; case MSG_INTERNAL_MEMORY: BIND_ACTION_LABEL(cbs, action_bind_label_internal_memory); break; diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 34e13b33ec..f650e072e6 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -429,6 +429,12 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, return 0; } + if (string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB))) + { + BIND_ACTION_LEFT(cbs, action_left_mainmenu); + return 0; + } + if (strstr(label, "rdb_entry")) { BIND_ACTION_LEFT(cbs, action_left_scroll); @@ -474,20 +480,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, } else { - switch (label_hash) - { - case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE: - if ( 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_PLAYLISTS_TAB)) || - string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)) - ) - { - BIND_ACTION_LEFT(cbs, action_left_mainmenu); - break; - } - default: - return -1; - } + return -1; } } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 00870886fc..451aceed95 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -107,10 +107,11 @@ finish: #endif int generic_action_ok_displaylist_push(const char *path, + const char *new_path, const char *label, unsigned type, size_t idx, size_t entry_idx, unsigned action_type) { - enum menu_displaylist_ctl_state dl_type = DISPLAYLIST_GENERIC; + enum menu_displaylist_ctl_state dl_type = DISPLAYLIST_NONE; char tmp[PATH_MAX_LENGTH] = {0}; char parent_dir[PATH_MAX_LENGTH] = {0}; char action_path[PATH_MAX_LENGTH] = {0}; @@ -122,9 +123,7 @@ int generic_action_ok_displaylist_push(const char *path, const char *info_path = NULL; menu_handle_t *menu = NULL; enum msg_hash_enums enum_idx = MSG_UNKNOWN; - 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); if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) @@ -146,6 +145,7 @@ int generic_action_ok_displaylist_push(const char *path, info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_USER_BINDS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_USER_BINDS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE: if (menu) @@ -163,6 +163,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info.type = type; info.directory_ptr = idx; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_OPEN_ARCHIVE: if (menu) @@ -180,6 +181,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info.type = type; info.directory_ptr = idx; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_HELP: info_label = label; @@ -192,23 +194,27 @@ int generic_action_ok_displaylist_push(const char *path, info.enum_idx = MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS; info.directory_ptr = idx; rpl_entry_selection_ptr = idx; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_AUDIO_DSP_PLUGIN: info.directory_ptr = idx; info_path = settings->directory.audio_filter; info_label = msg_hash_to_str(MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN); info.enum_idx = MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_SHADER_PASS: info.type = type; info.directory_ptr = idx; info_path = settings->directory.video_shader; info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_SHADER_PARAMETERS: info.type = MENU_SETTING_ACTION; info.directory_ptr = idx; info_label = label; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_GENERIC: if (path) @@ -218,72 +224,97 @@ int generic_action_ok_displaylist_push(const char *path, info.type = type; info.directory_ptr = idx; info_label = label; + dl_type = DISPLAYLIST_GENERIC; + break; + case ACTION_OK_DL_FILE_BROWSER_SELECT_DIR: + if (path) + strlcpy(menu->deferred_path, path, + sizeof(menu->deferred_path)); + + info.type = type; + info.directory_ptr = idx; + info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_DIR; break; case ACTION_OK_DL_PUSH_DEFAULT: info.type = type; info.directory_ptr = idx; info_path = label; info_label = label; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_SHADER_PRESET: info.type = type; info.directory_ptr = idx; info_path = settings->directory.video_shader; info_label = label; - break; - case ACTION_OK_DL_DOWNLOADS_DIR: - info.type = FILE_TYPE_DIRECTORY; - info.directory_ptr = idx; - info_path = settings->directory.core_assets; - info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_CONTENT_LIST: info.type = FILE_TYPE_DIRECTORY; info.directory_ptr = idx; - info_path = settings->directory.menu_content; + info_path = new_path; info_label = label; + dl_type = DISPLAYLIST_GENERIC; + break; + case ACTION_OK_DL_SCAN_DIR_LIST: + info.type = FILE_TYPE_DIRECTORY; + info.directory_ptr = idx; + info_path = new_path; + info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SCAN_DIR; break; case ACTION_OK_DL_REMAP_FILE: info.type = type; info.directory_ptr = idx; info_path = settings->directory.input_remapping; info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_RECORD_CONFIGFILE: - info.type = type; - info.directory_ptr = idx; - info_path = global->record.config_dir; - info_label = label; + { + global_t *global = global_get_ptr(); + info.type = type; + info.directory_ptr = idx; + info_path = global->record.config_dir; + info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + } break; case ACTION_OK_DL_DISK_IMAGE_APPEND_LIST: info.type = type; info.directory_ptr = idx; info_path = settings->directory.menu_content; info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_PLAYLIST_COLLECTION: info.type = type; info.directory_ptr = idx; info_path = path; info_label = label; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_CHEAT_FILE: info.type = type; info.directory_ptr = idx; info_path = settings->path.cheat_database; info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_CORE_LIST: info.type = type; info.directory_ptr = idx; info_path = settings->directory.libretro; info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_CORE; break; case ACTION_OK_DL_CONTENT_COLLECTION_LIST: info.type = type; info.directory_ptr = idx; info_path = settings->directory.playlist; info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_COLLECTION; break; case ACTION_OK_DL_RDB_ENTRY: fill_pathname_join_delim(tmp, @@ -293,11 +324,13 @@ int generic_action_ok_displaylist_push(const char *path, info.directory_ptr = idx; info_path = label; info_label = tmp; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_RDB_ENTRY_SUBMENU: info.directory_ptr = idx; info_label = label; info_path = path; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_CONFIGURATIONS_LIST: info.type = type; @@ -307,6 +340,7 @@ int generic_action_ok_displaylist_push(const char *path, else info_path = settings->directory.menu_config; info_label = label; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH_DETECT_CORE: info.type = type; @@ -320,6 +354,7 @@ int generic_action_ok_displaylist_push(const char *path, strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf)); if (!string_is_empty(menu_path)) strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf)); + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH: info.type = type; @@ -333,6 +368,7 @@ int generic_action_ok_displaylist_push(const char *path, strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf)); if (!string_is_empty(menu_path)) strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf)); + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_PARENT_DIRECTORY_PUSH: fill_pathname_parent_dir(parent_dir, @@ -344,12 +380,14 @@ int generic_action_ok_displaylist_push(const char *path, info.directory_ptr = idx; info_path = parent_dir; info_label = menu_label; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_DIRECTORY_PUSH: info.type = type; info.directory_ptr = idx; info_path = action_path; info_label = menu_label; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_DATABASE_MANAGER_LIST: fill_pathname_join(tmp, @@ -361,6 +399,7 @@ int generic_action_ok_displaylist_push(const char *path, info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_CURSOR_MANAGER_LIST: fill_pathname_join(tmp, settings->directory.cursor, @@ -371,56 +410,58 @@ int generic_action_ok_displaylist_push(const char *path, info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_CORE_UPDATER_LIST: - dl_type = DISPLAYLIST_PENDING_CLEAR; info.type = type; info.directory_ptr = idx; info_path = path; info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST; + dl_type = DISPLAYLIST_PENDING_CLEAR; break; case ACTION_OK_DL_THUMBNAILS_UPDATER_LIST: - dl_type = DISPLAYLIST_PENDING_CLEAR; info.type = type; info.directory_ptr = idx; info_path = path; info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST; + dl_type = DISPLAYLIST_PENDING_CLEAR; break; case ACTION_OK_DL_CORE_CONTENT_DIRS_LIST: - dl_type = DISPLAYLIST_PENDING_CLEAR; info.type = type; info.directory_ptr = idx; info_path = path; info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_DIRS_LIST; + dl_type = DISPLAYLIST_PENDING_CLEAR; break; case ACTION_OK_DL_CORE_CONTENT_LIST: - dl_type = DISPLAYLIST_PENDING_CLEAR; info.type = type; info.directory_ptr = idx; info_path = path; info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_CONTENT_LIST; + dl_type = DISPLAYLIST_PENDING_CLEAR; break; case ACTION_OK_DL_LAKKA_LIST: - dl_type = DISPLAYLIST_PENDING_CLEAR; info.type = type; info.directory_ptr = idx; info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_LAKKA_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_LAKKA_LIST; + dl_type = DISPLAYLIST_PENDING_CLEAR; break; case ACTION_OK_DL_DEFERRED_CORE_LIST: info.directory_ptr = idx; info_path = settings->directory.libretro; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_DEFERRED_CORE_LIST_SET: info.directory_ptr = idx; @@ -429,6 +470,7 @@ int generic_action_ok_displaylist_push(const char *path, info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_CORE_LIST_SET); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_LIST_SET; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_ACCOUNTS_LIST: info.directory_ptr = idx; @@ -436,6 +478,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_INPUT_SETTINGS_LIST: info.directory_ptr = idx; @@ -443,6 +486,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_INPUT_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_INPUT_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_DRIVER_SETTINGS_LIST: info.directory_ptr = idx; @@ -450,6 +494,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DRIVER_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DRIVER_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_CORE_SETTINGS_LIST: info.directory_ptr = idx; @@ -457,6 +502,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_VIDEO_SETTINGS_LIST: info.directory_ptr = idx; @@ -464,6 +510,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_VIDEO_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_CONFIGURATION_SETTINGS_LIST: info.directory_ptr = idx; @@ -471,6 +518,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CONFIGURATION_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_CONFIGURATION_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_SAVING_SETTINGS_LIST: info.directory_ptr = idx; @@ -478,6 +526,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_SAVING_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_SAVING_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_LOGGING_SETTINGS_LIST: info.directory_ptr = idx; @@ -485,6 +534,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_LOGGING_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_LOGGING_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_FRAME_THROTTLE_SETTINGS_LIST: info.directory_ptr = idx; @@ -492,6 +542,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FRAME_THROTTLE_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_FRAME_THROTTLE_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_REWIND_SETTINGS_LIST: info.directory_ptr = idx; @@ -499,6 +550,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_REWIND_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_REWIND_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST: info.directory_ptr = idx; @@ -506,6 +558,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST: info.directory_ptr = idx; @@ -513,6 +566,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_MENU_SETTINGS_LIST: info.directory_ptr = idx; @@ -520,6 +574,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_USER_INTERFACE_SETTINGS_LIST: info.directory_ptr = idx; @@ -527,6 +582,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_USER_INTERFACE_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_USER_INTERFACE_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_MENU_FILE_BROWSER_SETTINGS_LIST: info.directory_ptr = idx; @@ -534,6 +590,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MENU_FILE_BROWSER_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_MENU_FILE_BROWSER_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_RETRO_ACHIEVEMENTS_SETTINGS_LIST: info.directory_ptr = idx; @@ -541,6 +598,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_RETRO_ACHIEVEMENTS_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_UPDATER_SETTINGS_LIST: info.directory_ptr = idx; @@ -548,6 +606,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_UPDATER_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_NETWORK_SETTINGS_LIST: info.directory_ptr = idx; @@ -555,6 +614,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_NETWORK_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_USER_SETTINGS_LIST: info.directory_ptr = idx; @@ -562,6 +622,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_USER_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_USER_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_DIRECTORY_SETTINGS_LIST: info.directory_ptr = idx; @@ -569,6 +630,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_PRIVACY_SETTINGS_LIST: info.directory_ptr = idx; @@ -576,6 +638,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PRIVACY_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_PRIVACY_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_AUDIO_SETTINGS_LIST: info.directory_ptr = idx; @@ -583,6 +646,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_INPUT_HOTKEY_BINDS_LIST: info.directory_ptr = idx; @@ -590,6 +654,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_INPUT_HOTKEY_BINDS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_INPUT_HOTKEY_BINDS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_PLAYLIST_SETTINGS_LIST: info.directory_ptr = idx; @@ -597,6 +662,7 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_SETTINGS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_PLAYLIST_SETTINGS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST: info.directory_ptr = idx; @@ -604,16 +670,17 @@ int generic_action_ok_displaylist_push(const char *path, info_path = path; info_label = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST); info.enum_idx = MENU_ENUM_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST; + dl_type = DISPLAYLIST_GENERIC; break; case ACTION_OK_DL_CONTENT_SETTINGS: - dl_type = DISPLAYLIST_CONTENT_SETTINGS; - info.list = selection_buf; + info.list = menu_entries_get_selection_buf_ptr(0); info_path = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS); info_label = msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_SETTINGS); info.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS; menu_entries_add_enum(menu_stack, info_path, info_label, MENU_ENUM_LABEL_CONTENT_SETTINGS, 0, 0, 0); + dl_type = DISPLAYLIST_CONTENT_SETTINGS; break; } @@ -697,7 +764,7 @@ static int file_load_with_detect_core_wrapper( sizeof(detect_content_path)); if (enum_label_idx == MENU_ENUM_LABEL_COLLECTION) - return generic_action_ok_displaylist_push(path, + return generic_action_ok_displaylist_push(path, NULL, NULL, 0, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST_SET); switch (ret) @@ -706,7 +773,7 @@ static int file_load_with_detect_core_wrapper( return generic_action_ok_file_load(new_core_path, def_info.s, CORE_TYPE_PLAIN, CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU); case 0: - return generic_action_ok_displaylist_push(path, label, type, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST); default: break; @@ -754,13 +821,12 @@ static int action_ok_file_load_with_detect_core_collection(const char *path, path, label, type, false); } - - static int action_ok_playlist_entry_collection(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { size_t selection; menu_content_ctx_playlist_info_t playlist_info; + char new_core_path[PATH_MAX_LENGTH] = {0}; size_t selection_ptr = 0; playlist_t *playlist = NULL; bool playlist_initialized = false; @@ -794,12 +860,11 @@ static int action_ok_playlist_entry_collection(const char *path, playlist_get_index(playlist, selection_ptr, &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); - + if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) && string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) { core_info_ctx_find_t core_info; - char new_core_path[PATH_MAX_LENGTH] = {0}; char new_display_name[PATH_MAX_LENGTH] = {0}; const char *entry_path = NULL; const char *entry_crc32 = NULL; @@ -813,7 +878,7 @@ static int action_ok_playlist_entry_collection(const char *path, core_info.inf = NULL; core_info.path = new_core_path; - if (!core_info_find(&core_info)) + if (!core_info_find(&core_info, new_core_path)) found_associated_core = false; if (!found_associated_core) @@ -842,6 +907,8 @@ static int action_ok_playlist_entry_collection(const char *path, db_name); playlist_write_file(tmp_playlist); } + else + strlcpy(new_core_path, core_path, sizeof(new_core_path)); playlist_info.data = playlist; playlist_info.idx = selection_ptr; @@ -852,7 +919,7 @@ static int action_ok_playlist_entry_collection(const char *path, playlist_get_index(playlist, playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL); - return generic_action_ok_file_load(core_path, path, + return generic_action_ok_file_load(new_core_path, path, CORE_TYPE_PLAIN, CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU); } @@ -899,7 +966,7 @@ static int action_ok_playlist_entry(const char *path, core_info.inf = NULL; core_info.path = new_core_path; - if (!core_info_find(&core_info)) + if (!core_info_find(&core_info, new_core_path)) found_associated_core = false; if (!found_associated_core) @@ -998,7 +1065,7 @@ static int action_ok_playlist_entry_start_content(const char *path, core_info.inf = NULL; core_info.path = new_core_path; - if (!core_info_find(&core_info)) + if (!core_info_find(&core_info, new_core_path)) found_associated_core = false; if (!found_associated_core) @@ -1291,7 +1358,7 @@ static int generic_action_ok_help(const char *path, 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, + return generic_action_ok_displaylist_push(path, NULL, lbl, type, idx, entry_idx, ACTION_OK_DL_HELP); } @@ -1419,7 +1486,6 @@ static int generic_action_ok_remap_file_save(const char *path, { char directory[PATH_MAX_LENGTH] = {0}; char file[PATH_MAX_LENGTH] = {0}; - global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); rarch_system_info_t *info = NULL; const char *core_name = NULL; @@ -1442,8 +1508,8 @@ static int generic_action_ok_remap_file_save(const char *path, fill_pathname_join(file, core_name, core_name, sizeof(file)); break; case ACTION_OK_REMAP_FILE_SAVE_GAME: - if (global) { + global_t *global = global_get_ptr(); const char *game_name = path_basename(global->name.base); fill_pathname_join(file, core_name, game_name, sizeof(file)); } @@ -1539,15 +1605,12 @@ static int action_ok_core_deferred_set(const char *path, return menu_cbs_exit(); } - static int action_ok_deferred_list_stub(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { return 0; } - - static int action_ok_load_core_deferred(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -1804,7 +1867,7 @@ static int generic_action_ok_network(const char *path, task_push_http_transfer(url_path, false, url_label, callback, NULL); - return generic_action_ok_displaylist_push(path, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, type_id2); } @@ -2283,6 +2346,7 @@ static int action_ok_shader_apply_changes(const char *path, static int action_ok_lookup_setting(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { + menu_displaylist_reset_filebrowser(); return menu_setting_set(type, label, MENU_ACTION_OK, false); } @@ -2336,7 +2400,7 @@ static int action_ok_rdb_entry_submenu(const char *path, str_list->elems[0].data, '_', sizeof(new_label)); - ret = generic_action_ok_displaylist_push(new_path, + ret = generic_action_ok_displaylist_push(new_path, NULL, new_label, type, idx, entry_idx, ACTION_OK_DL_RDB_ENTRY_SUBMENU); @@ -2359,273 +2423,300 @@ static int action_ok_shader_pass(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0; - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_SHADER_PASS); } static int action_ok_shader_parameters(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_SHADER_PARAMETERS); } int action_ok_parent_directory_push(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_PARENT_DIRECTORY_PUSH); } int action_ok_directory_push(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_DIRECTORY_PUSH); } static int action_ok_database_manager_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_DATABASE_MANAGER_LIST); } static int action_ok_cursor_manager_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_CURSOR_MANAGER_LIST); } static int action_ok_compressed_archive_push(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH); } static int action_ok_compressed_archive_push_detect_core(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH_DETECT_CORE); } static int action_ok_configurations_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_CONFIGURATIONS_LIST); } static int action_ok_saving_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_SAVING_SETTINGS_LIST); } static int action_ok_logging_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_LOGGING_SETTINGS_LIST); } static int action_ok_frame_throttle_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_FRAME_THROTTLE_SETTINGS_LIST); } static int action_ok_rewind_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_REWIND_SETTINGS_LIST); } static int action_ok_onscreen_display_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST); } static int action_ok_onscreen_overlay_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST); } static int action_ok_menu_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_MENU_SETTINGS_LIST); } static int action_ok_user_interface_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_USER_INTERFACE_SETTINGS_LIST); } static int action_ok_menu_file_browser_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_MENU_FILE_BROWSER_SETTINGS_LIST); } static int action_ok_retro_achievements_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_RETRO_ACHIEVEMENTS_SETTINGS_LIST); } static int action_ok_updater_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_UPDATER_SETTINGS_LIST); } static int action_ok_network_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_NETWORK_SETTINGS_LIST); } static int action_ok_user_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_USER_SETTINGS_LIST); } static int action_ok_directory_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_DIRECTORY_SETTINGS_LIST); } static int action_ok_privacy_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_PRIVACY_SETTINGS_LIST); } static int action_ok_rdb_entry(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_RDB_ENTRY); } static int action_ok_content_collection_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_CONTENT_COLLECTION_LIST); } static int action_ok_core_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_CORE_LIST); } static int action_ok_cheat_file(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_CHEAT_FILE); } static int action_ok_playlist_collection(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_PLAYLIST_COLLECTION); } static int action_ok_disk_image_append_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_DISK_IMAGE_APPEND_LIST); } static int action_ok_record_configfile(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_RECORD_CONFIGFILE); } static int action_ok_remap_file(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_REMAP_FILE); } static int action_ok_push_content_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + settings_t *settings = config_get_ptr(); + return generic_action_ok_displaylist_push(path, + settings->directory.menu_content, label, type, idx, entry_idx, ACTION_OK_DL_CONTENT_LIST); } +static int action_ok_scan_directory_list(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + settings_t *settings = config_get_ptr(); + return generic_action_ok_displaylist_push(path, + settings->directory.menu_content, label, type, idx, + entry_idx, ACTION_OK_DL_SCAN_DIR_LIST); +} + static int action_ok_push_downloads_dir(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, - entry_idx, ACTION_OK_DL_DOWNLOADS_DIR); + settings_t *settings = config_get_ptr(); + menu_displaylist_reset_filebrowser(); + return generic_action_ok_displaylist_push(path, settings->directory.core_assets, + msg_hash_to_str(MENU_ENUM_LABEL_DETECT_CORE_LIST), + type, idx, + entry_idx, ACTION_OK_DL_CONTENT_LIST); } static int action_ok_shader_preset(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_SHADER_PRESET); } int action_ok_push_generic_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_GENERIC); } +int action_ok_push_filebrowser_list_dir_select(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, + entry_idx, ACTION_OK_DL_FILE_BROWSER_SELECT_DIR); +} + static int action_ok_push_default(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_PUSH_DEFAULT); } static int action_ok_audio_dsp_plugin(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_AUDIO_DSP_PLUGIN); } static int action_ok_rpl_entry(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_RPL_ENTRY); } @@ -2641,91 +2732,103 @@ static int action_ok_start_core(const char *path, static int action_ok_open_archive_detect_core(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE); } static int action_ok_push_accounts_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_ACCOUNTS_LIST); } static int action_ok_push_driver_settings_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_DRIVER_SETTINGS_LIST); } static int action_ok_push_video_settings_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_VIDEO_SETTINGS_LIST); } static int action_ok_push_configuration_settings_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_CONFIGURATION_SETTINGS_LIST); } static int action_ok_push_core_settings_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_CORE_SETTINGS_LIST); } static int action_ok_push_audio_settings_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_AUDIO_SETTINGS_LIST); } static int action_ok_push_input_settings_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_INPUT_SETTINGS_LIST); } static int action_ok_push_playlist_settings_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_PLAYLIST_SETTINGS_LIST); } static int action_ok_push_input_hotkey_binds_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_INPUT_HOTKEY_BINDS_LIST); } static int action_ok_push_user_binds_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_USER_BINDS_LIST); } static int action_ok_push_accounts_cheevos_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, label, type, idx, entry_idx, ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST); } static int action_ok_open_archive(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_OPEN_ARCHIVE); } @@ -2795,7 +2898,8 @@ static int action_ok_load_archive_detect_core(const char *path, CORE_TYPE_PLAIN, CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU); case 0: - return generic_action_ok_displaylist_push(path, label, type, + return generic_action_ok_displaylist_push(path, NULL, + label, type, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST); default: break; @@ -2942,7 +3046,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, if (menu_setting_get_browser_selection_type(cbs->setting) == ST_DIR) { - BIND_ACTION_OK(cbs, action_ok_push_generic_list); + BIND_ACTION_OK(cbs, action_ok_push_filebrowser_list_dir_select); return 0; } @@ -3113,8 +3217,10 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CONTENT_SETTINGS: BIND_ACTION_OK(cbs, action_ok_push_default); break; - case MENU_ENUM_LABEL_SCAN_FILE: case MENU_ENUM_LABEL_SCAN_DIRECTORY: + BIND_ACTION_OK(cbs, action_ok_scan_directory_list); + break; + case MENU_ENUM_LABEL_SCAN_FILE: case MENU_ENUM_LABEL_LOAD_CONTENT: case MENU_ENUM_LABEL_DETECT_CORE_LIST: BIND_ACTION_OK(cbs, action_ok_push_content_list); @@ -3399,34 +3505,16 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, BIND_ACTION_OK(cbs, action_ok_remap_file_load); break; case FILE_TYPE_SHADER_PRESET: - switch (menu_label_hash) - { - case MENU_LABEL_SCAN_FILE: - break; - default: - BIND_ACTION_OK(cbs, action_ok_shader_preset_load); - break; - } + /* TODO/FIXME - handle scan case */ + BIND_ACTION_OK(cbs, action_ok_shader_preset_load); break; case FILE_TYPE_SHADER: - switch (menu_label_hash) - { - case MENU_LABEL_SCAN_FILE: - break; - default: - BIND_ACTION_OK(cbs, action_ok_shader_pass_load); - break; - } + /* TODO/FIXME - handle scan case */ + BIND_ACTION_OK(cbs, action_ok_shader_pass_load); break; case FILE_TYPE_IMAGE: - switch (menu_label_hash) - { - case MENU_LABEL_SCAN_FILE: - break; - default: - BIND_ACTION_OK(cbs, action_ok_menu_wallpaper_load); - break; - } + /* TODO/FIXME - handle scan case */ + BIND_ACTION_OK(cbs, action_ok_menu_wallpaper_load); break; case FILE_TYPE_USE_DIRECTORY: BIND_ACTION_OK(cbs, action_ok_path_use_directory); @@ -3609,25 +3697,13 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case FILE_TYPE_MOVIE: case FILE_TYPE_MUSIC: #ifdef HAVE_FFMPEG - switch (menu_label_hash) - { - case MENU_LABEL_SCAN_FILE: - break; - default: - BIND_ACTION_OK(cbs, action_ok_file_load_ffmpeg); - break; - } + /* TODO/FIXME - handle scan case */ + BIND_ACTION_OK(cbs, action_ok_file_load_ffmpeg); #endif break; case FILE_TYPE_IMAGEVIEWER: - switch (menu_label_hash) - { - case MENU_LABEL_SCAN_FILE: - break; - default: - BIND_ACTION_OK(cbs, action_ok_file_load_imageviewer); - break; - } + /* TODO/FIXME - handle scan case */ + BIND_ACTION_OK(cbs, action_ok_file_load_imageviewer); break; case MENU_SETTINGS: case MENU_SETTING_GROUP: diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 88c8a5a257..dc5f52a116 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -535,6 +535,12 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, return 0; } + if (string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB))) + { + BIND_ACTION_RIGHT(cbs, action_right_mainmenu); + return 0; + } + if (strstr(label, "rdb_entry")) { BIND_ACTION_RIGHT(cbs, action_right_scroll); @@ -579,20 +585,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, } else { - switch (label_hash) - { - case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE: - if ( 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_PLAYLISTS_TAB)) || - string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)) - ) - { - BIND_ACTION_RIGHT(cbs, action_right_mainmenu); - break; - } - default: - return -1; - } + return -1; } } diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index c442d1e871..b97a775f95 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -114,6 +114,14 @@ typedef struct mui_handle float scroll_y; } mui_handle_t; +static void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha) +{ + rgba[0] = rgba[4] = rgba[8] = rgba[12] = ((hex >> 16) & 0xFF) * (1.0f / 255.0f); /* r */ + rgba[1] = rgba[5] = rgba[9] = rgba[13] = ((hex >> 8 ) & 0xFF) * (1.0f / 255.0f); /* g */ + rgba[2] = rgba[6] = rgba[10] = rgba[14] = ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f); /* b */ + rgba[3] = rgba[7] = rgba[11] = rgba[15] = alpha; +} + static const char *mui_texture_path(unsigned id) { switch (id) @@ -217,7 +225,7 @@ static void mui_draw_icon( static void mui_draw_tab(mui_handle_t *mui, unsigned i, unsigned width, unsigned height, - float *pure_white) + float *tab_color) { unsigned tab_icon = 0; @@ -249,7 +257,7 @@ static void mui_draw_tab(mui_handle_t *mui, height, 0, 1, - &pure_white[0]); + &tab_color[0]); /* default color is pure_white */ } static void mui_draw_text(float x, float y, unsigned width, unsigned height, @@ -305,7 +313,7 @@ static void mui_render_quad(mui_handle_t *mui, static void mui_draw_tab_begin(mui_handle_t *mui, unsigned width, unsigned height, - float *white_bg, float *grey_bg) + float *tabs_bg_color, float *tabs_separator_color) { float scale_factor = menu_display_get_dpi(); @@ -315,19 +323,19 @@ static void mui_draw_tab_begin(mui_handle_t *mui, mui_render_quad(mui, 0, height - mui->tabs_height, width, mui->tabs_height, width, height, - white_bg); + tabs_bg_color); /* white_bg */ /* tabs separator */ mui_render_quad(mui, 0, height - mui->tabs_height, width, 1, width, height, - grey_bg); + tabs_separator_color); /* grey_bg */ } static void mui_draw_tab_end(mui_handle_t *mui, unsigned width, unsigned height, unsigned header_height, - float *blue_bg) + float *active_tab_marker_color) { /* active tab marker */ unsigned tab_width = width / (MUI_SYSTEM_TAB_END+1); @@ -337,7 +345,7 @@ static void mui_draw_tab_end(mui_handle_t *mui, tab_width, header_height/16, width, height, - &blue_bg[0]); + &active_tab_marker_color[0]); /* blue_500 */ } static void mui_draw_scrollbar(mui_handle_t *mui, @@ -391,7 +399,7 @@ static void mui_get_message(void *data, const char *message) static void mui_render_messagebox(const char *message) { unsigned i, width, height; - uint32_t normal_color; + uint32_t font_normal_color; int x, y, font_size; settings_t *settings = config_get_ptr(); struct string_list *list = (struct string_list*) @@ -409,7 +417,7 @@ static void mui_render_messagebox(const char *message) x = width / 2; y = height / 2 - list->size * font_size / 2; - normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color); + font_normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color); for (i = 0; i < list->size; i++) { @@ -417,7 +425,7 @@ static void mui_render_messagebox(const char *message) if (msg) mui_draw_text(x, y + i * font_size, width, height, - msg, normal_color, TEXT_ALIGN_CENTER); + msg, font_normal_color, TEXT_ALIGN_CENTER); } end: @@ -595,14 +603,14 @@ static void mui_render_label_value(mui_handle_t *mui, height, 0, 1, - &pure_white[0]); + &pure_white[0]); /* pure_white */ } static void mui_render_menu_list(mui_handle_t *mui, unsigned width, unsigned height, - uint32_t normal_color, - uint32_t hover_color, - float *pure_white) + uint32_t font_normal_color, + uint32_t font_hover_color, + float *menu_list_color) { unsigned header_height; uint64_t *frame_count; @@ -641,9 +649,18 @@ static void mui_render_menu_list(mui_handle_t *mui, entry_selected = selection == i; - mui_render_label_value(mui, y, width, height, *frame_count / 20, - entry_selected ? hover_color : normal_color, entry_selected, - rich_label, entry.value, pure_white); + mui_render_label_value( + mui, + y, + width, + height, + *frame_count / 20, + entry_selected ? font_hover_color : font_normal_color, + entry_selected, + rich_label, + entry.value, + menu_list_color /* pure_white */ + ); } } @@ -716,37 +733,23 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw) static void mui_frame(void *data) { - unsigned header_height; - bool display_kb; float black_bg[16] = { 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, }; - float blue_bg[16] = { - 0.13, 0.59, 0.95, 1, - 0.13, 0.59, 0.95, 1, - 0.13, 0.59, 0.95, 1, - 0.13, 0.59, 0.95, 1, - }; - float lightblue_bg[16] = { - 0.89, 0.95, 0.99, 1.00, - 0.89, 0.95, 0.99, 1.00, - 0.89, 0.95, 0.99, 1.00, - 0.89, 0.95, 0.99, 1.00, - }; float pure_white[16]= { - 1, 1, 1, 1, - 1, 1, 1, 1, - 1, 1, 1, 1, - 1, 1, 1, 1, + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, }; float white_bg[16]= { - 0.98, 0.98, 0.98, 1, - 0.98, 0.98, 0.98, 1, - 0.98, 0.98, 0.98, 1, - 0.98, 0.98, 0.98, 1, + 0.98, 0.98, 0.98, 1.00, + 0.98, 0.98, 0.98, 1.00, + 0.98, 0.98, 0.98, 1.00, + 0.98, 0.98, 0.98, 1.00, }; float white_transp_bg[16]= { 0.98, 0.98, 0.98, 0.90, @@ -755,42 +758,155 @@ static void mui_frame(void *data) 0.98, 0.98, 0.98, 0.90, }; float grey_bg[16]= { - 0.78, 0.78, 0.78, 1, - 0.78, 0.78, 0.78, 1, - 0.78, 0.78, 0.78, 1, - 0.78, 0.78, 0.78, 1, + 0.78, 0.78, 0.78, 0.90, + 0.78, 0.78, 0.78, 0.90, + 0.78, 0.78, 0.78, 0.90, + 0.78, 0.78, 0.78, 0.90, }; float shadow_bg[16]= { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0.2, - 0, 0, 0, 0.2, + 0.00, 0.00, 0.00, 0.00, + 0.00, 0.00, 0.00, 0.00, + 0.00, 0.00, 0.00, 0.2, + 0.00, 0.00, 0.00, 0.2, }; + float greyish_blue[16] = { + 0.22, 0.28, 0.31, 1.00, + 0.22, 0.28, 0.31, 1.00, + 0.22, 0.28, 0.31, 1.00, + 0.22, 0.28, 0.31, 1.00, + }; + float almost_black[16] = { + 0.13, 0.13, 0.13, 0.90, + 0.13, 0.13, 0.13, 0.90, + 0.13, 0.13, 0.13, 0.90, + 0.13, 0.13, 0.13, 0.90, + }; + + /* This controls the main background color */ + menu_display_ctx_clearcolor_t clearcolor; menu_animation_ctx_ticker_t ticker; - unsigned width, height, ticker_limit, i; - size_t selection; - size_t title_margin; menu_display_ctx_draw_t draw; + + /* https://material.google.com/style/color.html#color-color-palette */ + /* Hex values converted to RGB normalized decimals, alpha set to 1 */ + float blue_500[16] = {0}; + float blue_50[16] = {0}; + float green_500[16] = {0}; + float green_50[16] = {0}; + float red_500[16] = {0}; + float red_50[16] = {0}; + float yellow_500[16] = {0}; + float yellow_200[16] = {0}; + unsigned width = 0; + unsigned height = 0; + unsigned ticker_limit = 0; + unsigned i = 0; + unsigned header_height = 0; + size_t selection = 0; + size_t title_margin = 0; + bool display_kb = false; mui_handle_t *mui = (mui_handle_t*)data; uint64_t *frame_count = video_driver_get_frame_count_ptr(); char msg[256] = {0}; char title[256] = {0}; char title_buf[256] = {0}; char title_msg[256] = {0}; - const uint32_t normal_color = 0x212121ff; - const uint32_t hover_color = 0x212121ff; - const uint32_t title_color = 0xffffffff; - const uint32_t activetab_color = 0x0096f2ff; - const uint32_t passivetab_color = 0x9e9e9eff; bool background_rendered = false; bool libretro_running = menu_display_libretro_running(); - (void)passivetab_color; - (void)activetab_color; + /* Default is blue theme */ + float *header_bg_color = blue_500; + float *highlighted_entry_color = blue_50; + float *footer_bg_color = white_bg; + float *body_bg_color = white_transp_bg; + settings_t *settings = config_get_ptr(); + float *active_tab_marker_color = blue_500; + + uint32_t font_normal_color = 0x212121ff; + uint32_t font_hover_color = 0x212121ff; + uint32_t font_header_color = 0xffffffff; + +#if 0 + uint32_t activetab_color = 0x0096f2ff; + uint32_t passivetab_color = 0x9e9e9eff; +#endif if (!mui) return; + hex32_to_rgba_normalized(0xFFEB3B, yellow_500, 1.00); + hex32_to_rgba_normalized(0xFFF59D, yellow_200, 0.90); + hex32_to_rgba_normalized(0xF44336, red_500, 1.00); + hex32_to_rgba_normalized(0xFFEBEE, red_50, 0.90); + hex32_to_rgba_normalized(0x2196F3, blue_500, 1.00); + hex32_to_rgba_normalized(0xE3F2FD, blue_50, 0.90); + hex32_to_rgba_normalized(0x4CAF50, green_500, 1.00); + hex32_to_rgba_normalized(0xE8F5E9, green_50, 0.90); + + clearcolor.r = 1.0f; + clearcolor.g = 1.0f; + clearcolor.b = 1.0f; + clearcolor.a = 0.75f; + + switch (settings->menu.materialui.menu_color_theme) + { + case MATERIALUI_THEME_BLUE: + break; + case MATERIALUI_THEME_GREEN: + header_bg_color = green_500; + body_bg_color = white_transp_bg; + highlighted_entry_color = green_50; + footer_bg_color = white_bg; + active_tab_marker_color = green_500; + + font_normal_color = 0x212121ff; + font_hover_color = 0x212121ff; + font_header_color = 0xffffffff; + break; + case MATERIALUI_THEME_RED: + header_bg_color = red_500; + body_bg_color = white_transp_bg; + highlighted_entry_color = red_50; + footer_bg_color = white_bg; + body_bg_color = white_transp_bg; + active_tab_marker_color = red_500; + + font_normal_color = 0x212121ff; + font_hover_color = 0x212121ff; + font_header_color = 0xffffffff; + break; + case MATERIALUI_THEME_YELLOW: + header_bg_color = yellow_500; + body_bg_color = white_transp_bg; + body_bg_color = white_transp_bg; + highlighted_entry_color = yellow_200; + footer_bg_color = white_bg; + active_tab_marker_color = yellow_500; + + font_normal_color = 0x212121ff; + font_hover_color = 0x212121ff; + font_header_color = 0x00000000; + break; + case MATERIALUI_THEME_DARK_BLUE: + header_bg_color = greyish_blue; + body_bg_color = almost_black; + highlighted_entry_color = grey_bg; + footer_bg_color = almost_black; + active_tab_marker_color = greyish_blue; + + font_normal_color = 0xffffffff; + font_hover_color = 0x00000000; + + /* + TODO/FIXME - Maybe make this track the footer's bg color or vice-versa + e.g. clearcolor.r = &footer_bg_color[0]; clearcolor.g = &footer_bg_color[4]; + */ + clearcolor.r = 0.13f; + clearcolor.g = 0.13f; + clearcolor.b = 0.13f; + break; + } + video_driver_get_size(&width, &height); menu_display_set_viewport(); @@ -803,7 +919,7 @@ static void mui_frame(void *data) draw.width = width; draw.height = height; draw.texture = menu_display_white_texture; - draw.color = &white_transp_bg[0]; + draw.color = &body_bg_color[0]; draw.vertex = NULL; draw.tex_coord = NULL; draw.vertex_count = 4; @@ -816,13 +932,6 @@ static void mui_frame(void *data) } else { - menu_display_ctx_clearcolor_t clearcolor; - - clearcolor.r = 1.0f; - clearcolor.g = 1.0f; - clearcolor.b = 1.0f; - clearcolor.a = 0.75f; - menu_display_clear_color(&clearcolor); if (mui->textures.bg) @@ -858,46 +967,69 @@ static void mui_frame(void *data) return; if (background_rendered || libretro_running) - menu_display_set_alpha(lightblue_bg, 0.75); + menu_display_set_alpha(blue_50, 0.75); else - menu_display_set_alpha(lightblue_bg, 1.0); + menu_display_set_alpha(blue_50, 1.0); /* highlighted entry */ - mui_render_quad(mui, 0, - header_height - mui->scroll_y + mui->line_height * - selection, width, mui->line_height, - width, height, - &lightblue_bg[0]); + mui_render_quad( + mui, + 0, + header_height - mui->scroll_y + mui->line_height *selection, + width, + mui->line_height, + width, + height, + &highlighted_entry_color[0] + ); menu_display_font_bind_block(&mui->list_block); - mui_render_menu_list(mui, width, height, - normal_color, hover_color, &pure_white[0]); + mui_render_menu_list( + mui, + width, + height, + font_normal_color, + font_hover_color, + &pure_white[0] + ); menu_display_font_flush_block(); menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL); /* header */ - mui_render_quad(mui, 0, 0, width, header_height, - width, height, &blue_bg[0]); + mui_render_quad( + mui, + 0, + 0, + width, + header_height, + width, + height, + &header_bg_color[0]); mui->tabs_height = 0; /* display tabs if depth equal one, if not hide them */ if (mui_list_get_size(mui, MENU_LIST_PLAIN) == 1) { - mui_draw_tab_begin(mui, width, height, &white_bg[0], &grey_bg[0]); + mui_draw_tab_begin(mui, width, height, &footer_bg_color[0], &grey_bg[0]); for (i = 0; i <= MUI_SYSTEM_TAB_END; i++) mui_draw_tab(mui, i, width, height, &pure_white[0]); - mui_draw_tab_end(mui, width, height, header_height, &blue_bg[0]); + mui_draw_tab_end(mui, width, height, header_height, &active_tab_marker_color[0]); } - mui_render_quad(mui, 0, header_height, width, - mui->shadow_height, - width, height, - &shadow_bg[0]); + mui_render_quad( + mui, + 0, + header_height, + width, + mui->shadow_height, + width, + height, + &shadow_bg[0]); title_margin = mui->margin; @@ -905,15 +1037,16 @@ static void mui_frame(void *data) { title_margin = mui->icon_size; mui_draw_icon( - mui->icon_size, - mui->textures.list[MUI_TEXTURE_BACK], - 0, - 0, - width, - height, - 0, - 1, - &pure_white[0]); + mui->icon_size, + mui->textures.list[MUI_TEXTURE_BACK], + 0, + 0, + width, + height, + 0, + 1, + &pure_white[0] + ); } ticker_limit = (width - mui->margin*2) / mui->glyph_width; @@ -951,7 +1084,7 @@ static void mui_frame(void *data) } mui_draw_text(title_margin, header_height / 2, width, height, - title_buf, title_color, TEXT_ALIGN_LEFT); + title_buf, font_header_color, TEXT_ALIGN_LEFT); mui_draw_scrollbar(mui, width, height, &grey_bg[0]); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 8c2fd192b8..9efa21dc45 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -312,7 +312,7 @@ float gradient_dark[16] = { const char *xmb_theme_ident(void) { settings_t *settings = config_get_ptr(); - switch (settings->menu.xmb_theme) + switch (settings->menu.xmb.theme) { case 1: return "flatui"; @@ -355,7 +355,7 @@ static float *xmb_gradient_ident(void) { settings_t *settings = config_get_ptr(); - switch (settings->menu.background_gradient) + switch (settings->menu.xmb.menu_color_theme) { case 1: return &gradient_dark_purple[0]; @@ -497,7 +497,7 @@ static void xmb_draw_icon( draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - if (settings->menu.xmb_shadows_enable) + if (settings->menu.xmb.shadows_enable) { for (i = 0; i < 16; i++) shadow[i] = 0; @@ -554,7 +554,7 @@ static void xmb_draw_thumbnail(xmb_handle_t *xmb, float *color, draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline.id = 0; - if (settings->menu.xmb_shadows_enable) + if (settings->menu.xmb.shadows_enable) { for (i = 0; i < 16; i++) shadow[i] = 0; @@ -569,6 +569,7 @@ static void xmb_draw_thumbnail(xmb_handle_t *xmb, float *color, } coords.color = (const float*)color; + menu_display_set_alpha((float*)coords.color, 1.0f); draw.x = x; draw.y = height - y; @@ -607,7 +608,7 @@ static void xmb_draw_text(xmb_handle_t *xmb, params.full_screen = true; params.text_align = text_align; - if (settings->menu.xmb_shadows_enable) + if (settings->menu.xmb.shadows_enable) { params.drop_x = xmb->shadow_offset; params.drop_y = -xmb->shadow_offset; @@ -1270,8 +1271,8 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb) info.list = xmb->horizontal_list; info.menu_list = NULL; info.type = 0; + info.flags = 0; info.type_default = FILE_TYPE_PLAIN; - info.flags = SL_FLAG_ALLOW_EMPTY_LIST; info.enum_idx = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST; strlcpy(info.label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), @@ -1924,7 +1925,7 @@ static void xmb_draw_bg( menu_display_set_viewport(); #ifdef HAVE_SHADERPIPELINE - if (settings->menu.shader_pipeline > 0) + if (settings->menu.xmb.shader_pipeline > 0) { draw.color = xmb_gradient_ident(); @@ -1936,7 +1937,7 @@ static void xmb_draw_bg( menu_display_draw_gradient(&draw); draw.pipeline.id = VIDEO_SHADER_MENU_SEC; - if (settings->menu.shader_pipeline == 2) + if (settings->menu.xmb.shader_pipeline == 2) draw.pipeline.id = VIDEO_SHADER_MENU; menu_display_draw_pipeline(&draw); @@ -2027,7 +2028,7 @@ static void xmb_frame(void *data) } menu_display_set_alpha(coord_black, MIN( - (float)settings->menu.xmb_alpha_factor/100, xmb->alpha)); + (float)settings->menu.xmb.alpha_factor/100, xmb->alpha)); menu_display_set_alpha(coord_white, xmb->alpha); xmb_draw_bg( @@ -2258,7 +2259,7 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width) float scale_factor; settings_t *settings = config_get_ptr(); - scale_factor = (settings->menu.xmb_scale_factor * width) / (1920.0 * 100); + scale_factor = (settings->menu.xmb.scale_factor * width) / (1920.0 * 100); xmb->above_subitem_offset = 1.5; xmb->above_item_offset = -1.0; @@ -2306,7 +2307,7 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width) float scale_factor; settings_t *settings = config_get_ptr(); - scale_factor = ((settings->menu.xmb_scale_factor * width) / (1920.0 * 100)) * 1.5; + scale_factor = ((settings->menu.xmb.scale_factor * width) / (1920.0 * 100)) * 1.5; xmb->above_subitem_offset = 1.5; xmb->above_item_offset = -1.0; diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index df818d9987..269cb2fe97 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -209,7 +209,7 @@ static bool zarch_zui_check_button_down(zui_t *zui, hitbox.y1 = y1; hitbox.y2 = y2; - if (menu_input_ctl(MENU_INPUT_CTL_CHECK_INSIDE_HITBOX, &hitbox)) + if (menu_input_mouse_check_vector_inside_hitbox(&hitbox)) zui->item.hot = id; if ( zui->item.hot == id @@ -233,7 +233,7 @@ static bool zarch_zui_check_button_up(zui_t *zui, hitbox.y1 = y1; hitbox.y2 = y2; - if (menu_input_ctl(MENU_INPUT_CTL_CHECK_INSIDE_HITBOX, &hitbox)) + if (menu_input_mouse_check_vector_inside_hitbox(&hitbox)) zui->item.hot = id; if ( zui->item.active == id diff --git a/menu/menu_cbs.c b/menu/menu_cbs.c index 1d6b03218a..8698d29b8a 100644 --- a/menu/menu_cbs.c +++ b/menu/menu_cbs.c @@ -118,7 +118,7 @@ void menu_cbs_init(void *data, menu_cbs_init_log(repr_label, "REFRESH", cbs->action_refresh_ident); - menu_cbs_init_bind_get_string_representation(cbs, path, label, type, idx, label_hash, menu_label_hash); + menu_cbs_init_bind_get_string_representation(cbs, path, label, type, idx); menu_cbs_init_log(repr_label, "GET VALUE", cbs->action_get_value_ident); @@ -136,7 +136,6 @@ void menu_cbs_init(void *data, bind_info.type = type; bind_info.idx = idx; bind_info.label_hash = label_hash; - bind_info.menu_label_hash = menu_label_hash; menu_driver_ctl(RARCH_MENU_CTL_BIND_INIT, &bind_info); } diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index d8940c7d3e..bce8a9ffec 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -27,6 +27,7 @@ enum ACTION_OK_DL_DEFAULT = 0, ACTION_OK_DL_OPEN_ARCHIVE, ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE, + ACTION_OK_DL_SCAN_DIR_LIST, ACTION_OK_DL_HELP, ACTION_OK_DL_RPL_ENTRY, ACTION_OK_DL_RDB_ENTRY, @@ -37,7 +38,7 @@ enum ACTION_OK_DL_SHADER_PRESET, ACTION_OK_DL_GENERIC, ACTION_OK_DL_PUSH_DEFAULT, - ACTION_OK_DL_DOWNLOADS_DIR, + ACTION_OK_DL_FILE_BROWSER_SELECT_DIR, ACTION_OK_DL_INPUT_SETTINGS_LIST, ACTION_OK_DL_DRIVER_SETTINGS_LIST, ACTION_OK_DL_VIDEO_SETTINGS_LIST, @@ -104,7 +105,7 @@ 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, +int generic_action_ok_displaylist_push(const char *path, const char *new_path, const char *label, unsigned type, size_t idx, size_t entry_idx, unsigned action_type); @@ -145,8 +146,7 @@ int menu_cbs_init_bind_refresh(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx); int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, - const char *path, const char *label, unsigned type, size_t idx, - uint32_t label_hash, uint32_t menu_label_hash); + const char *path, const char *label, unsigned type, size_t idx); int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx); diff --git a/menu/menu_display.c b/menu/menu_display.c index c588d2e1f0..730f61bbc8 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -476,6 +476,16 @@ void menu_display_draw(menu_display_ctx_draw_t *draw) menu_disp->draw(draw); } +bool menu_display_shader_pipeline_active(void) +{ + settings_t *settings = config_get_ptr(); + if (!string_is_equal(menu_driver_ident(), "xmb")) + return false; + if (settings->menu.xmb.shader_pipeline == 0) + return false; + return true; +} + void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw) { if (!menu_disp || !draw || !menu_disp->draw_pipeline) @@ -488,6 +498,7 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw) static struct video_coords coords; const float *new_vertex = NULL; const float *new_tex_coord = NULL; + settings_t *settings = config_get_ptr(); if (!menu_disp || !draw) return; @@ -507,6 +518,9 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw) draw->coords = &coords; + if (!menu_display_libretro_running() && !menu_display_shader_pipeline_active()) + menu_display_set_alpha(draw->color, settings->menu.wallpaper.opacity); + if (!draw->texture) draw->texture = menu_display_white_texture; diff --git a/menu/menu_display.h b/menu/menu_display.h index 87c2ce14b9..fec61bd476 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -29,6 +29,15 @@ RETRO_BEGIN_DECLS +enum materialui_color_theme +{ + MATERIALUI_THEME_BLUE = 0, + MATERIALUI_THEME_GREEN, + MATERIALUI_THEME_RED, + MATERIALUI_THEME_YELLOW, + MATERIALUI_THEME_DARK_BLUE +}; + enum menu_display_prim_type { MENU_DISPLAY_PRIM_NONE = 0, @@ -201,6 +210,8 @@ void menu_display_draw_cursor( void menu_display_draw_text(const char *msg, int width, int height, struct font_params *params); +bool menu_display_shader_pipeline_active(void); + void menu_display_set_alpha(float *color, float alpha_value); bool menu_display_font(enum application_special_type type); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 0e29c587e5..3a8f7d4c6b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3136,8 +3136,6 @@ static int menu_displaylist_parse_options_remappings( if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return -1; - runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); - for (p = 0; p < settings->input.max_users; p++) { char key_type[PATH_MAX_LENGTH] = {0}; @@ -3170,6 +3168,8 @@ static int menu_displaylist_parse_options_remappings( MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME, MENU_SETTING_ACTION, 0, 0); + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); + if (system) { for (p = 0; p < settings->input.max_users; p++) @@ -3204,18 +3204,114 @@ static int menu_displaylist_parse_options_remappings( return 0; } -static int menu_displaylist_parse_generic( - menu_displaylist_info_t *info, bool horizontal) +enum filebrowser_enums +{ + FILEBROWSER_NONE = 0, + FILEBROWSER_SELECT_DIR, + FILEBROWSER_SCAN_DIR, + FILEBROWSER_SELECT_COLLECTION +}; + +static unsigned filebrowser_types = 0; + +static int menu_displaylist_parse_playlists_horizontal( + menu_displaylist_info_t *info) { - bool path_is_compressed, push_dir, filter_ext; size_t i, list_size; struct string_list *str_list = NULL; - core_info_list_t *list = NULL; + unsigned items_found = 0; + + if (!*info->path) + { + if (frontend_driver_parse_drive_list(info->list) != 0) + menu_entries_add_enum(info->list, "/", "", + MSG_UNKNOWN, FILE_TYPE_DIRECTORY, 0, 0); + return 0; + } + + str_list = dir_list_new(info->path, NULL, true, true); + + if (!str_list) + { + const char *str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND); + (void)str; + return 0; + } + + dir_list_sort(str_list, true); + + list_size = str_list->size; + + if (list_size == 0) + { + menu_entries_add_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_NO_ITEM, 0, 0); + + string_list_free(str_list); + + return 0; + } + + for (i = 0; i < list_size; i++) + { + char label[PATH_MAX_LENGTH] = {0}; + const char *path = NULL; + enum msg_file_type file_type = FILE_TYPE_NONE; + + switch (str_list->elems[i].attr.i) + { + case RARCH_DIRECTORY: + file_type = FILE_TYPE_DIRECTORY; + break; + case RARCH_PLAIN_FILE: + default: + file_type = (enum msg_file_type)info->type_default; + break; + } + + if (file_type == FILE_TYPE_DIRECTORY) + continue; + + file_type = FILE_TYPE_PLAYLIST_COLLECTION; + /* Need to preserve slash first time. */ + path = str_list->elems[i].data; + + if (*info->path) + path = path_basename(path); + + items_found++; + menu_entries_add_enum(info->list, path, label, + MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY, + file_type, 0, 0); + } + + string_list_free(str_list); + + if (items_found == 0) + { + menu_entries_add_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_NO_ITEM, 0, 0); + } + + return 0; +} + +static int menu_displaylist_parse_generic( + menu_displaylist_info_t *info, + enum menu_displaylist_ctl_state type) +{ + size_t i, list_size; + bool path_is_compressed = false; + bool filter_ext = false; + struct string_list *str_list = NULL; unsigned items_found = 0; settings_t *settings = config_get_ptr(); - uint32_t hash_label = msg_hash_calculate(info->label); - - core_info_get_list(&list); if (!*info->path) { @@ -3226,8 +3322,6 @@ static int menu_displaylist_parse_generic( } path_is_compressed = path_is_compressed_file(info->path); - push_dir = - (menu_setting_get_browser_selection_type(info->setting) == ST_DIR); filter_ext = settings->menu.navigation.browser.filter.supported_extensions_enable; @@ -3241,26 +3335,26 @@ static int menu_displaylist_parse_generic( filter_ext ? info->exts : NULL, true, true); - if (string_is_equal(info->label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY))) + if (BIT32_GET(filebrowser_types, FILEBROWSER_SCAN_DIR)) menu_entries_prepend(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_THIS_DIRECTORY), msg_hash_to_str(MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY), MENU_ENUM_LABEL_SCAN_THIS_DIRECTORY, FILE_TYPE_SCAN_DIRECTORY, 0 ,0); - if (push_dir) + if (BIT32_GET(filebrowser_types, FILEBROWSER_SELECT_DIR)) menu_entries_prepend(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USE_THIS_DIRECTORY), msg_hash_to_str(MENU_ENUM_LABEL_USE_THIS_DIRECTORY), MENU_ENUM_LABEL_USE_THIS_DIRECTORY, FILE_TYPE_USE_DIRECTORY, 0 ,0); - if (!horizontal && hash_label != MENU_LABEL_CORE_LIST) + if (type == DISPLAYLIST_CORES) { char out_dir[PATH_MAX_LENGTH] = {0}; fill_pathname_parent_dir(out_dir, info->path, sizeof(out_dir)); - if (!string_is_empty(out_dir)) + if (string_is_empty(out_dir)) { menu_entries_prepend(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY), @@ -3276,9 +3370,8 @@ static int menu_displaylist_parse_generic( ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND); - if (! horizontal) - menu_entries_add_enum(info->list, str, "", - MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, 0, 0, 0); + menu_entries_add_enum(info->list, str, "", + MENU_ENUM_LABEL_VALUE_DIRECTORY_NOT_FOUND, 0, 0, 0); return 0; } @@ -3288,22 +3381,19 @@ static int menu_displaylist_parse_generic( if (list_size == 0) { - if (!(info->flags & SL_FLAG_ALLOW_EMPTY_LIST)) - { - menu_entries_add_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), - msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), - MENU_ENUM_LABEL_NO_ITEMS, - MENU_SETTING_NO_ITEM, 0, 0); + menu_entries_add_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_NO_ITEM, 0, 0); #ifdef HAVE_NETWORKING - if (hash_label == MENU_LABEL_CORE_LIST) - menu_entries_add_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE), - msg_hash_to_str(MENU_ENUM_LABEL_CORE_UPDATER_LIST), - MENU_ENUM_LABEL_CORE_UPDATER_LIST, - MENU_SETTING_ACTION, 0, 0); + if (type == DISPLAYLIST_CORES) + menu_entries_add_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOAD_CORE), + msg_hash_to_str(MENU_ENUM_LABEL_CORE_UPDATER_LIST), + MENU_ENUM_LABEL_CORE_UPDATER_LIST, + MENU_SETTING_ACTION, 0, 0); #endif - } string_list_free(str_list); @@ -3330,20 +3420,17 @@ static int menu_displaylist_parse_generic( break; case RARCH_PLAIN_FILE: default: - switch (hash_label) + file_type = (enum msg_file_type)info->type_default; + switch (type) { - case MENU_LABEL_DETECT_CORE_LIST: - case MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST: + case DISPLAYLIST_CORES_DETECTED: + /* in case of deferred_core_list we have to interpret + * every archive as an archive to disallow instant loading + */ if (path_is_compressed_file(str_list->elems[i].data)) - { - /* in case of deferred_core_list we have to interpret - * every archive as an archive to disallow instant loading - */ file_type = FILE_TYPE_CARCHIVE; - break; - } + break; default: - file_type = (enum msg_file_type)info->type_default; break; } break; @@ -3353,7 +3440,9 @@ static int menu_displaylist_parse_generic( if (!is_dir) { - if (push_dir || hash_label == MENU_LABEL_SCAN_DIRECTORY) + if (BIT32_GET(filebrowser_types, FILEBROWSER_SELECT_DIR)) + continue; + if (BIT32_GET(filebrowser_types, FILEBROWSER_SCAN_DIR)) continue; } @@ -3363,41 +3452,36 @@ static int menu_displaylist_parse_generic( if (*info->path && !path_is_compressed) path = path_basename(path); - /* Push type further down in the chain. - * Needed for shader manager currently. */ - switch (hash_label) + if (type == DISPLAYLIST_CORES) { - case MENU_LABEL_CONTENT_COLLECTION_LIST: - if (is_dir && !horizontal) - file_type = FILE_TYPE_DIRECTORY; - else if (is_dir && horizontal) - continue; - else - file_type = FILE_TYPE_PLAYLIST_COLLECTION; - break; - case MENU_LABEL_CORE_LIST: #ifndef HAVE_DYNAMIC - if (frontend_driver_has_fork()) + if (frontend_driver_has_fork()) + { + char salamander_name[PATH_MAX_LENGTH] = {0}; + + if (frontend_driver_get_salamander_basename( + salamander_name, sizeof(salamander_name))) { - char salamander_name[PATH_MAX_LENGTH] = {0}; - - if (frontend_driver_get_salamander_basename( - salamander_name, sizeof(salamander_name))) - { - if (string_is_equal_noncase(path, salamander_name)) - continue; - } - - if (is_dir) + if (string_is_equal_noncase(path, salamander_name)) continue; } -#endif - /* Compressed cores are unsupported */ - if (file_type == FILE_TYPE_CARCHIVE) - continue; - file_type = is_dir ? FILE_TYPE_DIRECTORY : FILE_TYPE_CORE; - break; + if (is_dir) + continue; + } +#endif + /* Compressed cores are unsupported */ + if (file_type == FILE_TYPE_CARCHIVE) + continue; + + file_type = is_dir ? FILE_TYPE_DIRECTORY : FILE_TYPE_CORE; + } + else if (BIT32_GET(filebrowser_types, FILEBROWSER_SELECT_COLLECTION)) + { + if (is_dir) + file_type = FILE_TYPE_DIRECTORY; + else + file_type = FILE_TYPE_PLAYLIST_COLLECTION; } if (settings->multimedia.builtin_mediaplayer_enable || @@ -3420,9 +3504,12 @@ static int menu_displaylist_parse_generic( case RARCH_CONTENT_IMAGE: #ifdef HAVE_IMAGEVIEWER if (settings->multimedia.builtin_imageviewer_enable - && hash_label != MENU_LABEL_MENU_WALLPAPER) + && type != DISPLAYLIST_IMAGES) file_type = FILE_TYPE_IMAGEVIEWER; + else + file_type = FILE_TYPE_IMAGE; #endif + break; default: break; } @@ -3438,52 +3525,48 @@ static int menu_displaylist_parse_generic( if (items_found == 0) { - if (!(info->flags & SL_FLAG_ALLOW_EMPTY_LIST)) - { - menu_entries_add_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), - msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), - MENU_ENUM_LABEL_NO_ITEMS, - MENU_SETTING_NO_ITEM, 0, 0); - } + menu_entries_add_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_NO_ITEM, 0, 0); return 0; } - switch (hash_label) + if (type == DISPLAYLIST_CORES) { - case MENU_LABEL_CORE_LIST: - { - enum msg_hash_enums enum_idx = MSG_UNKNOWN; - const char *dir = NULL; + enum msg_hash_enums enum_idx = MSG_UNKNOWN; + core_info_list_t *list = NULL; + const char *dir = NULL; - menu_entries_get_last_stack(&dir, NULL, NULL, &enum_idx, NULL); + core_info_get_list(&list); - list_size = file_list_get_size(info->list); + menu_entries_get_last_stack(&dir, NULL, NULL, &enum_idx, NULL); - for (i = 0; i < list_size; i++) - { - char core_path[PATH_MAX_LENGTH] = {0}; - char display_name[PATH_MAX_LENGTH] = {0}; - unsigned type = 0; - const char *path = NULL; + list_size = file_list_get_size(info->list); - menu_entries_get_at_offset(info->list, - i, &path, NULL, &type, NULL, - NULL); + for (i = 0; i < list_size; i++) + { + char core_path[PATH_MAX_LENGTH] = {0}; + char display_name[PATH_MAX_LENGTH] = {0}; + unsigned type = 0; + const char *path = NULL; - if (type != FILE_TYPE_CORE) - continue; + menu_entries_get_at_offset(info->list, + i, &path, NULL, &type, NULL, + NULL); - fill_pathname_join(core_path, dir, path, sizeof(core_path)); + if (type != FILE_TYPE_CORE) + continue; - if (core_info_list_get_display_name(list, - core_path, display_name, sizeof(display_name))) - menu_entries_set_alt_at_offset(info->list, i, display_name); - } - info->need_sort = true; - } - break; + fill_pathname_join(core_path, dir, path, sizeof(core_path)); + + if (core_info_list_get_display_name(list, + core_path, display_name, sizeof(display_name))) + menu_entries_set_alt_at_offset(info->list, i, display_name); + } + info->need_sort = true; } return 0; @@ -3699,6 +3782,11 @@ static bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) return true; } +void menu_displaylist_reset_filebrowser(void) +{ + BIT32_CLEAR_ALL(filebrowser_types); +} + bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) { size_t i; @@ -3828,6 +3916,24 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) break; } + switch (type) + { + case DISPLAYLIST_FILE_BROWSER_SCAN_DIR: + BIT32_CLEAR_ALL(filebrowser_types); + BIT32_SET(filebrowser_types, FILEBROWSER_SCAN_DIR); + break; + case DISPLAYLIST_FILE_BROWSER_SELECT_DIR: + BIT32_CLEAR_ALL(filebrowser_types); + BIT32_SET(filebrowser_types, FILEBROWSER_SELECT_DIR); + break; + case DISPLAYLIST_FILE_BROWSER_SELECT_COLLECTION: + BIT32_CLEAR_ALL(filebrowser_types); + BIT32_SET(filebrowser_types, FILEBROWSER_SELECT_COLLECTION); + break; + default: + break; + } + switch (type) { case DISPLAYLIST_NONE: @@ -3836,6 +3942,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_entries_add_enum(info->list, info->path, info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0); break; + case DISPLAYLIST_FILE_BROWSER_SCAN_DIR: + case DISPLAYLIST_FILE_BROWSER_SELECT_DIR: + case DISPLAYLIST_FILE_BROWSER_SELECT_FILE: + case DISPLAYLIST_FILE_BROWSER_SELECT_CORE: + case DISPLAYLIST_FILE_BROWSER_SELECT_COLLECTION: case DISPLAYLIST_GENERIC: { menu_ctx_list_t list_info; @@ -4066,8 +4177,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) for (i = 0; i < RARCH_BIND_LIST_END; i++) { - ret = menu_displaylist_parse_settings(menu, info, - input_config_bind_map_get_base(i), PARSE_ONLY_BIND, false); + ret = menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i, + PARSE_ONLY_BIND, false); (void)ret; } } @@ -4249,6 +4361,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_DYNAMIC_WALLPAPER, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY, + PARSE_ONLY_FLOAT, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_PAUSE_LIBRETRO, PARSE_ONLY_BOOL, false); @@ -4304,7 +4419,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_XMB_RIBBON_ENABLE, PARSE_ONLY_UINT, false); menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_XMB_GRADIENT, + MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME, + PARSE_ONLY_UINT, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME, PARSE_ONLY_UINT, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN, @@ -5267,6 +5385,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) strlcpy(info->exts, file_path_str(FILE_PATH_RDB_EXTENSION), sizeof(info->exts)); + info->enum_idx = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST; strlcpy(info->path, settings->path.content_database, sizeof(info->path)); break; case DISPLAYLIST_ARCHIVE_ACTION: @@ -5371,8 +5490,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) switch (type) { - case DISPLAYLIST_DATABASES: + case DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL: + if (menu_displaylist_parse_playlists_horizontal(info) == 0) + { + info->need_refresh = true; + info->need_push = true; + } + break; case DISPLAYLIST_DEFAULT: + case DISPLAYLIST_DATABASES: case DISPLAYLIST_CORES: case DISPLAYLIST_CORES_DETECTED: case DISPLAYLIST_SHADER_PASS: @@ -5389,16 +5515,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_RECORD_CONFIG_FILES: case DISPLAYLIST_CONFIG_FILES: case DISPLAYLIST_CONTENT_HISTORY: - case DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL: + if (menu_displaylist_parse_generic(info, type) == 0) { - bool horizontal = - (type == DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL); - - if (menu_displaylist_parse_generic(info, horizontal) == 0) - { - info->need_refresh = true; - info->need_push = true; - } + info->need_refresh = true; + info->need_push = true; } break; default: diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 4a08b85f3f..8eeb7a6b0b 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -64,6 +64,11 @@ enum menu_displaylist_ctl_state DISPLAYLIST_HISTORY, DISPLAYLIST_PLAYLIST_COLLECTION, DISPLAYLIST_DEFAULT, + DISPLAYLIST_FILE_BROWSER_SELECT_DIR, + DISPLAYLIST_FILE_BROWSER_SCAN_DIR, + DISPLAYLIST_FILE_BROWSER_SELECT_FILE, + DISPLAYLIST_FILE_BROWSER_SELECT_CORE, + DISPLAYLIST_FILE_BROWSER_SELECT_COLLECTION, DISPLAYLIST_CORES, DISPLAYLIST_CORES_SUPPORTED, DISPLAYLIST_CORES_COLLECTION_SUPPORTED, @@ -185,6 +190,8 @@ typedef struct menu_displaylist_ctx_entry file_list_t *list; } menu_displaylist_ctx_entry_t; +void menu_displaylist_reset_filebrowser(void); + bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data); RETRO_END_DECLS diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 86a7f5d6c6..1a3f647723 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -64,6 +64,19 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = { NULL }; +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; +static bool menu_driver_data_own = false; +static bool menu_driver_pending_quit = false; +static bool menu_driver_pending_shutdown = false; +static playlist_t *menu_driver_playlist = NULL; +static struct video_shader *menu_driver_shader = NULL; +static menu_handle_t *menu_driver_data = NULL; +static const menu_ctx_driver_t *menu_driver_ctx = NULL; +static void *menu_userdata = NULL; /** * menu_driver_find_handle: @@ -193,8 +206,6 @@ static bool menu_init(menu_handle_t *menu_data) return true; } -static menu_ctx_iterate_t pending_iter; - static void menu_input_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mod) { @@ -263,23 +274,17 @@ static void menu_driver_toggle(bool latch) input_driver_set_flushing_input(); } +const char *menu_driver_ident(void) +{ + if (!menu_driver_alive) + return NULL; + if (!menu_driver_ctx || !menu_driver_ctx->ident) + return NULL; + return menu_driver_ctx->ident; +} + 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; - static bool menu_driver_data_own = false; - static bool menu_driver_pending_quit = false; - static bool menu_driver_pending_shutdown = false; - static playlist_t *menu_driver_playlist = NULL; - static struct video_shader *menu_driver_shader = NULL; - static menu_handle_t *menu_driver_data = NULL; - static const menu_ctx_driver_t *menu_driver_ctx = NULL; - static void *menu_userdata = NULL; - settings_t *settings = config_get_ptr(); - switch (state) { case RARCH_MENU_CTL_DRIVER_DATA_GET: @@ -548,28 +553,31 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) menu_driver_data = NULL; break; case RARCH_MENU_CTL_INIT: - if (menu_driver_data) - return true; - - menu_driver_data = (menu_handle_t*) - menu_driver_ctx->init(&menu_userdata); - - if (!menu_driver_data || !menu_init(menu_driver_data)) { - retroarch_fail(1, "init_menu()"); - return false; - } + settings_t *settings = config_get_ptr(); + if (menu_driver_data) + return true; - strlcpy(settings->menu.driver, menu_driver_ctx->ident, - sizeof(settings->menu.driver)); + menu_driver_data = (menu_handle_t*) + menu_driver_ctx->init(&menu_userdata); - if (menu_driver_ctx->lists_init) - { - if (!menu_driver_ctx->lists_init(menu_driver_data)) + if (!menu_driver_data || !menu_init(menu_driver_data)) { retroarch_fail(1, "init_menu()"); return false; } + + strlcpy(settings->menu.driver, menu_driver_ctx->ident, + sizeof(settings->menu.driver)); + + if (menu_driver_ctx->lists_init) + { + if (!menu_driver_ctx->lists_init(menu_driver_data)) + { + retroarch_fail(1, "init_menu()"); + return false; + } + } } break; case RARCH_MENU_CTL_LOAD_NO_CONTENT_GET: @@ -813,7 +821,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) menu_entries_flush_stack(NULL, MENU_SETTINGS); menu_display_set_msg_force(true); - generic_action_ok_displaylist_push("", + generic_action_ok_displaylist_push("", NULL, "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL)) diff --git a/menu/menu_driver.h b/menu/menu_driver.h index d667dbe9aa..f3ec9f263e 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -379,7 +379,6 @@ typedef struct menu_ctx_bind unsigned type; size_t idx; uint32_t label_hash; - uint32_t menu_label_hash; int retcode; } menu_ctx_bind_t; @@ -415,6 +414,8 @@ const char* config_get_menu_driver_options(void); /* HACK */ extern unsigned int rdb_entry_start_game_selection_ptr; +const char *menu_driver_ident(void); + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data); extern menu_ctx_driver_t menu_ctx_xui; diff --git a/menu/menu_entries.h b/menu/menu_entries.h index e6ddcff6ad..6724b70dae 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -111,7 +111,10 @@ typedef struct menu_file_list_cbs int (*action_up)(unsigned type, const char *label); const char *action_up_ident; - int (*action_label)(char *s, size_t len); + int (*action_label)(file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len); const char *action_label_ident; int (*action_down)(unsigned type, const char *label); diff --git a/menu/menu_entry.c b/menu/menu_entry.c index 72ff6c3f1f..2b7a942c61 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -290,23 +290,25 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (cbs) { + const char *label = NULL; + enum msg_hash_enums enum_idx = MSG_UNKNOWN; + entry->enum_idx = cbs->enum_idx; - if (cbs->action_get_value && use_representation) - { - enum msg_hash_enums enum_idx = MSG_UNKNOWN; - const char *label = NULL; - menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL); + menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL); + if (cbs->action_get_value && use_representation) cbs->action_get_value(list, &entry->spacing, entry->type, i, label, entry->value, sizeof(entry->value), entry_label, path, entry->path, sizeof(entry->path)); - } if (cbs->action_label) - cbs->action_label(entry->rich_label, + cbs->action_label(list, + entry->type, i, + label, path, + entry->rich_label, sizeof(entry->rich_label)); } diff --git a/menu/menu_input.c b/menu/menu_input.c index 8722c1b3a7..f098cc90bc 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -609,6 +609,20 @@ static bool menu_input_key_bind_iterate(char *s, size_t len) return false; } +bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox) +{ + int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS); + int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS); + bool inside_hitbox = + (mouse_x >= hitbox->x1) + && (mouse_x <= hitbox->x2) + && (mouse_y >= hitbox->y1) + && (mouse_y <= hitbox->y2) + ; + + return inside_hitbox; +} + bool menu_input_ctl(enum menu_input_ctl_state state, void *data) { static char menu_input_keyboard_label_setting[256]; @@ -633,22 +647,6 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data) menu_input->binds.last = lim->max; } break; - case MENU_INPUT_CTL_CHECK_INSIDE_HITBOX: - { - menu_input_ctx_hitbox_t *hitbox = (menu_input_ctx_hitbox_t*)data; - int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS); - int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS); - bool inside_hitbox = - (mouse_x >= hitbox->x1) - && (mouse_x <= hitbox->x2) - && (mouse_y >= hitbox->y1) - && (mouse_y <= hitbox->y2) - ; - - if (!inside_hitbox) - return false; - } - break; case MENU_INPUT_CTL_DEINIT: memset(menu_input, 0, sizeof(menu_input_t)); pointer_dragging = false; @@ -791,16 +789,19 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data) static int menu_input_pointer(unsigned *action) { - unsigned fb_width, fb_height; - int pointer_device, pointer_x, pointer_y; const struct retro_keybind *binds[MAX_USERS] = {NULL}; menu_input_t *menu_input = menu_input_get_ptr(); - - fb_width = menu_display_get_width(); - fb_height = menu_display_get_height(); - - pointer_device = menu_driver_ctl(RARCH_MENU_CTL_IS_SET_TEXTURE, NULL) ? + unsigned fb_width = menu_display_get_width(); + unsigned fb_height = menu_display_get_height(); + int pointer_device = + menu_driver_ctl(RARCH_MENU_CTL_IS_SET_TEXTURE, NULL) ? RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN; + int pointer_x = + input_driver_state(binds, 0, pointer_device, + 0, RETRO_DEVICE_ID_POINTER_X); + int pointer_y = + input_driver_state(binds, 0, pointer_device, + 0, RETRO_DEVICE_ID_POINTER_Y); menu_input->pointer.pressed[0] = input_driver_state(binds, 0, pointer_device, @@ -811,11 +812,6 @@ static int menu_input_pointer(unsigned *action) menu_input->pointer.back = input_driver_state(binds, 0, pointer_device, 0, RARCH_DEVICE_ID_POINTER_BACK); - pointer_x = input_driver_state(binds, 0, pointer_device, - 0, RETRO_DEVICE_ID_POINTER_X); - pointer_y = input_driver_state(binds, 0, pointer_device, - 0, RETRO_DEVICE_ID_POINTER_Y); - menu_input->pointer.x = ((pointer_x + 0x7fff) * (int)fb_width) / 0xFFFF; menu_input->pointer.y = ((pointer_y + 0x7fff) * (int)fb_height) / 0xFFFF; diff --git a/menu/menu_input.h b/menu/menu_input.h index b8cef6817b..7b7a8b8a26 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -87,7 +87,6 @@ enum menu_input_ctl_state MENU_INPUT_CTL_UNSET_KEYBOARD_LABEL_SETTING, MENU_INPUT_CTL_SEARCH_START, MENU_INPUT_CTL_DEINIT, - MENU_INPUT_CTL_CHECK_INSIDE_HITBOX, MENU_INPUT_CTL_BIND_NONE, MENU_INPUT_CTL_BIND_SINGLE, MENU_INPUT_CTL_BIND_ALL, @@ -138,6 +137,8 @@ int16_t menu_input_pointer_state(enum menu_input_pointer_state state); int16_t menu_input_mouse_state(enum menu_input_mouse_state state); +bool menu_input_mouse_check_vector_inside_hitbox(menu_input_ctx_hitbox_t *hitbox); + void menu_input_key_end_line(void); bool menu_input_ctl(enum menu_input_ctl_state state, void *data); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index defcae1fac..b45b98bd50 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2246,6 +2246,7 @@ int menu_action_handle_setting(rarch_setting_t *setting, info.list = menu_stack; info.directory_ptr = selection; info.type = type; + info.enum_idx = MSG_UNKNOWN; strlcpy(info.path, setting->default_value.string, sizeof(info.path)); strlcpy(info.label, name, sizeof(info.label)); @@ -3761,9 +3762,11 @@ static bool setting_append_list_input_player_options( snprintf(key[user], sizeof(key[user]), "input_player%u_joypad_index", user + 1); snprintf(key_type[user], sizeof(key_type[user]), - "input_libretro_device_p%u", user + 1); + msg_hash_to_str(MENU_ENUM_LABEL_INPUT_LIBRETRO_DEVICE), + user + 1); snprintf(key_analog[user], sizeof(key_analog[user]), - "input_player%u_analog_dpad_mode", user + 1); + msg_hash_to_str(MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE), + user + 1); snprintf(key_bind_all[user], sizeof(key_bind_all[user]), "input_player%u_bind_all", user + 1); snprintf(key_bind_all_save_autoconfig[user], sizeof(key_bind_all[user]), @@ -3878,9 +3881,8 @@ static bool setting_append_list_input_player_options( for (i = 0; i < RARCH_BIND_LIST_END; i ++) { - char label[PATH_MAX_LENGTH]; - char name[PATH_MAX_LENGTH]; - bool do_add = true; + char label[PATH_MAX_LENGTH] = {0}; + char name[PATH_MAX_LENGTH] = {0}; if (input_config_bind_map_get_meta(i)) continue; @@ -3888,6 +3890,7 @@ static bool setting_append_list_input_player_options( fill_pathname_noext(label, buffer[user], " ", sizeof(label)); + if ( settings->input.input_descriptor_label_show && (i < RARCH_FIRST_META_KEY) @@ -3905,7 +3908,7 @@ static bool setting_append_list_input_player_options( sizeof(label)); if (settings->input.input_descriptor_hide_unbound) - do_add = false; + continue; } } else @@ -3913,21 +3916,18 @@ static bool setting_append_list_input_player_options( snprintf(name, sizeof(name), "p%u_%s", user + 1, input_config_bind_map_get_base(i)); - if (do_add) - { - CONFIG_BIND( - list, list_info, - &settings->input.binds[user][i], - user + 1, - user, - strdup(name), - strdup(label), - &defaults[i], - &group_info, - &subgroup_info, - parent_group); - (*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN; - } + CONFIG_BIND( + list, list_info, + &settings->input.binds[user][i], + user + 1, + user, + strdup(name), + strdup(label), + &defaults[i], + &group_info, + &subgroup_info, + parent_group); + (*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN; } END_SUB_GROUP(list, list_info, parent_group); @@ -6254,7 +6254,8 @@ static bool setting_append_list( &retro_keybinds_1[i], &group_info, &subgroup_info, parent_group); (*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN; - /* TODO - add enum_idx */ + menu_settings_list_current_add_enum_idx(list, list_info, + MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i); } END_SUB_GROUP(list, list_info, parent_group); @@ -6591,6 +6592,21 @@ static bool setting_append_list( menu_settings_list_current_add_values(list, list_info, "png"); menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_MENU_WALLPAPER); + CONFIG_FLOAT( + list, list_info, + &settings->menu.wallpaper.opacity, + msg_hash_to_str(MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY), + menu_wallpaper_opacity, + "%.3f %", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, 0.0, 1.0, 0.010, true, true); + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY); + CONFIG_BOOL( list, list_info, &settings->menu.dynamic_wallpaper_enable, @@ -6833,7 +6849,7 @@ static bool setting_append_list( { CONFIG_UINT( list, list_info, - &settings->menu.xmb_alpha_factor, + &settings->menu.xmb.alpha_factor, msg_hash_to_str(MENU_ENUM_LABEL_XMB_ALPHA_FACTOR), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR), xmb_alpha_factor, @@ -6847,7 +6863,7 @@ static bool setting_append_list( CONFIG_UINT( list, list_info, - &settings->menu.xmb_scale_factor, + &settings->menu.xmb.scale_factor, msg_hash_to_str(MENU_ENUM_LABEL_XMB_SCALE_FACTOR), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR), xmb_scale_factor, @@ -6861,11 +6877,11 @@ static bool setting_append_list( CONFIG_PATH( list, list_info, - settings->menu.xmb_font, - sizeof(settings->menu.xmb_font), + settings->menu.xmb.font, + sizeof(settings->menu.xmb.font), msg_hash_to_str(MENU_ENUM_LABEL_XMB_FONT), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_FONT), - settings->menu.xmb_font, + settings->menu.xmb.font, &group_info, &subgroup_info, parent_group, @@ -6875,7 +6891,7 @@ static bool setting_append_list( CONFIG_UINT( list, list_info, - &settings->menu.xmb_theme, + &settings->menu.xmb.theme, msg_hash_to_str(MENU_ENUM_LABEL_XMB_THEME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_THEME), xmb_theme, @@ -6889,7 +6905,7 @@ static bool setting_append_list( CONFIG_BOOL( list, list_info, - &settings->menu.xmb_shadows_enable, + &settings->menu.xmb.shadows_enable, msg_hash_to_str(MENU_ENUM_LABEL_XMB_SHADOWS_ENABLE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE), xmb_shadows_enable, @@ -6906,7 +6922,7 @@ static bool setting_append_list( #ifdef HAVE_SHADERPIPELINE CONFIG_UINT( list, list_info, - &settings->menu.shader_pipeline, + &settings->menu.xmb.shader_pipeline, msg_hash_to_str(MENU_ENUM_LABEL_XMB_RIBBON_ENABLE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE), menu_shader_pipeline, @@ -6921,9 +6937,9 @@ static bool setting_append_list( CONFIG_UINT( list, list_info, - &settings->menu.background_gradient, - msg_hash_to_str(MENU_ENUM_LABEL_XMB_GRADIENT), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_GRADIENT), + &settings->menu.xmb.menu_color_theme, + msg_hash_to_str(MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME), menu_background_gradient, &group_info, &subgroup_info, @@ -6931,7 +6947,25 @@ static bool setting_append_list( general_write_handler, general_read_handler); menu_settings_list_current_add_range(list, list_info, 0, 8, 1, true, true); - menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_GRADIENT); + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME); + } + + /* only MaterialUI uses these values, don't show them on other drivers */ + if (string_is_equal(settings->menu.driver, "glui")) + { + CONFIG_UINT( + list, list_info, + &settings->menu.materialui.menu_color_theme, + msg_hash_to_str(MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME), + menu_background_gradient, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, 0, 4, 1, true, true); + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME); } CONFIG_BOOL( diff --git a/menu/menu_setting.h b/menu/menu_setting.h index 6a7cd2ff8f..bdf84116bd 100644 --- a/menu/menu_setting.h +++ b/menu/menu_setting.h @@ -112,8 +112,7 @@ enum setting_list_flags SL_FLAG_SETTINGS_LOGGING_OPTIONS = (1 << 27), SL_FLAG_SETTINGS_SAVING_OPTIONS = (1 << 28), SL_FLAG_SETTINGS_SUB_ACCOUNTS_OPTIONS = (1 << 29), - SL_FLAG_SETTINGS_ALL = (1 << 30), - SL_FLAG_ALLOW_EMPTY_LIST = (1 << 31) + SL_FLAG_SETTINGS_ALL = (1 << 30) }; typedef struct rarch_setting_group_info rarch_setting_group_info_t; diff --git a/msg_hash.h b/msg_hash.h index f8774fcc4e..d4ca8117ad 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -22,6 +22,7 @@ #include +#include "driver.h" #include "input/input_driver.h" RETRO_BEGIN_DECLS @@ -284,7 +285,39 @@ enum msg_hash_enums MSG_EXTRACTING_FILE, MSG_NO_CONTENT_STARTING_DUMMY_CORE, - MENU_ENUM_LABEL_CHEEVOS_ENTRY, + MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN, + MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END = MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + RARCH_BIND_LIST_END, + + MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY, + MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER_OPACITY, + + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK, + + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON_SIMPLIFIED, + MENU_ENUM_LABEL_VALUE_SHADER_PIPELINE_RIBBON, + + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_BLUE, + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_RED, + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_GREEN, + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_YELLOW, + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME_DARK_BLUE, + + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_LATE, + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_NORMAL, + MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR_EARLY, + MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY, + MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY, + MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, + MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY, + MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, MENU_ENUM_LABEL_FILEBROWSER_ENTRY, MENU_ENUM_LABEL_SHADER_PARAMETERS_ENTRY, MENU_ENUM_LABEL_RDB_ENTRY, @@ -495,11 +528,12 @@ enum msg_hash_enums MENU_ENUM_LABEL_XMB_ALPHA_FACTOR, MENU_ENUM_LABEL_XMB_FONT, MENU_ENUM_LABEL_XMB_THEME, - MENU_ENUM_LABEL_XMB_GRADIENT, + MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME, MENU_ENUM_LABEL_XMB_SHADOWS_ENABLE, MENU_ENUM_LABEL_XMB_RIBBON_ENABLE, MENU_ENUM_LABEL_THUMBNAILS, MENU_ENUM_LABEL_TIMEDATE_ENABLE, + MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME, MENU_ENUM_LABEL_VALUE_MENU_WALLPAPER, MENU_ENUM_LABEL_VALUE_DYNAMIC_WALLPAPER, @@ -516,12 +550,14 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR, MENU_ENUM_LABEL_VALUE_XMB_FONT, MENU_ENUM_LABEL_VALUE_XMB_THEME, - MENU_ENUM_LABEL_VALUE_XMB_GRADIENT, + MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE, MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE, MENU_ENUM_LABEL_VALUE_THUMBNAILS, MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, + MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME, + /* UI settings */ MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION, MENU_ENUM_LABEL_UI_COMPANION_ENABLE, @@ -546,6 +582,8 @@ enum msg_hash_enums MENU_ENUM_LABEL_MENU_THROTTLE_FRAMERATE, + MENU_ENUM_LABEL_NO_ACHIEVEMENTS_TO_DISPLAY, + MENU_ENUM_LABEL_VALUE_NO_ACHIEVEMENTS_TO_DISPLAY, MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY, MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY, diff --git a/ui/drivers/win32/ui_win32_browser_window.c b/ui/drivers/win32/ui_win32_browser_window.c index 5e06a272a8..1aeaccf0d8 100644 --- a/ui/drivers/win32/ui_win32_browser_window.c +++ b/ui/drivers/win32/ui_win32_browser_window.c @@ -23,11 +23,9 @@ #include "../../ui_companion_driver.h" -static bool ui_browser_window_win32_open(ui_browser_window_state_t *state) +static bool ui_browser_window_win32_core(ui_browser_window_state_t *state, bool save) { - OPENFILENAME ofn; - - memset((void*)&ofn, 0, sizeof(OPENFILENAME)); + OPENFILENAME ofn = {}; ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = (HWND)state->window; @@ -39,15 +37,22 @@ static bool ui_browser_window_win32_open(ui_browser_window_state_t *state) ofn.nMaxFile = PATH_MAX; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR; - if (!GetOpenFileName(&ofn)) - return false; + if ( save && !GetOpenFileName(&ofn)) + return false; + if (!save && !GetSaveFileName(&ofn)) + return false; return true; } +static bool ui_browser_window_win32_open(ui_browser_window_state_t *state) +{ + return ui_browser_window_win32_core(state, false); +} + static bool ui_browser_window_win32_save(ui_browser_window_state_t *state) { - return false; + return ui_browser_window_win32_core(state, true); } const ui_browser_window_t ui_browser_window_win32 = {