From 7855a8c5ad1e7cec0dd4076240a8edd2d7cdd64a Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 7 May 2025 14:36:29 -0700 Subject: [PATCH 01/22] options menu updated added hide options for: extensions rom tags save folder moved show loading bar option to change in ui load_rom.c modified to catch crash --- src/menu/settings.c | 10 +++- src/menu/settings.h | 9 ++++ src/menu/views/browser.c | 71 +++++++++++++++++++++++++++-- src/menu/views/load_rom.c | 5 +- src/menu/views/settings_editor.c | 78 +++++++++++++++++++++++++++----- 5 files changed, 156 insertions(+), 17 deletions(-) diff --git a/src/menu/settings.c b/src/menu/settings.c index e81e24ebe..3d1e7f31d 100644 --- a/src/menu/settings.c +++ b/src/menu/settings.c @@ -17,6 +17,9 @@ static settings_t init = { .show_protected_entries = false, .default_directory = "/", .use_saves_folder = true, + .hide_extension = false, + .hide_rom_tags = false, + .hide_saves_folder = false, .soundfx_enabled = false, .loading_progress_bar_enabled = true, .rom_autoload_enabled = false, @@ -52,9 +55,11 @@ void settings_load (settings_t *settings) { settings->show_protected_entries = mini_get_bool(ini, "menu", "show_protected_entries", init.show_protected_entries); settings->default_directory = strdup(mini_get_string(ini, "menu", "default_directory", init.default_directory)); settings->use_saves_folder = mini_get_bool(ini, "menu", "use_saves_folder", init.use_saves_folder); + settings->hide_extension = mini_get_bool(ini, "menu", "hide_extension", init.hide_extension); + settings->hide_rom_tags = mini_get_bool(ini, "menu", "hide_rom_tags", init.hide_rom_tags); + settings->hide_saves_folder = mini_get_bool(ini, "menu", "hide_saves_folder", init.hide_saves_folder); settings->soundfx_enabled = mini_get_bool(ini, "menu", "soundfx_enabled", init.soundfx_enabled); settings->loading_progress_bar_enabled = mini_get_bool(ini, "menu", "loading_progress_bar_enabled", init.loading_progress_bar_enabled); - settings->rom_autoload_enabled = mini_get_bool(ini, "menu", "autoload_rom_enabled", init.rom_autoload_enabled); settings->rom_fast_reboot_enabled = mini_get_bool(ini, "menu", "reboot_rom_enabled", init.rom_fast_reboot_enabled); settings->rom_autoload_path = strdup(mini_get_string(ini, "autoload", "rom_path", init.rom_autoload_path)); @@ -78,6 +83,9 @@ void settings_save (settings_t *settings) { mini_set_bool(ini, "menu", "show_protected_entries", settings->show_protected_entries); mini_set_string(ini, "menu", "default_directory", settings->default_directory); mini_set_bool(ini, "menu", "use_saves_folder", settings->use_saves_folder); + mini_set_bool(ini, "menu", "hide_extension", settings->hide_extension); + mini_set_bool(ini, "menu", "hide_rom_tags", settings->hide_rom_tags); + mini_set_bool(ini, "menu", "hide_saves_folder", settings->hide_saves_folder); mini_set_bool(ini, "menu", "soundfx_enabled", settings->soundfx_enabled); mini_set_bool(ini, "menu", "loading_progress_bar_enabled", settings->loading_progress_bar_enabled); mini_set_bool(ini, "menu", "autoload_rom_enabled", settings->rom_autoload_enabled); diff --git a/src/menu/settings.h b/src/menu/settings.h index ad9a815d6..85cf589b7 100644 --- a/src/menu/settings.h +++ b/src/menu/settings.h @@ -34,6 +34,15 @@ typedef struct { /** @brief Put saves into separate directory */ bool use_saves_folder; + /** @brief Hide file extensions */ + bool hide_extension; + + /** @brief Hide rom tags */ + bool hide_rom_tags; + + /** @brief Hide saves folder */ + bool hide_saves_folder; + /** @brief Enable Background music */ bool bgm_enabled; diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index 37c61dc79..f6ede3236 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -51,6 +51,30 @@ static const struct substr hidden_prefixes[] = { }; #define HIDDEN_PREFIXES_COUNT (sizeof(hidden_prefixes) / sizeof(hidden_prefixes[0])) +static char *strip_extension(const char *filename) { + char *copy = strdup(filename); + if (!copy) return NULL; + + char *dot = strrchr(copy, '.'); + if (dot) *dot = '\0'; + + return copy; +} + +static char *strip_rom_tags (const char *filename) { + char *name = strdup(filename); + for (char *p = name; *p; ++p) { + if (*p == '(' || *p == '[') { + *p = '\0'; + break; + } + } + // Trim trailing space + for (char *end = name + strlen(name) - 1; end > name && *end == ' '; --end) { + *end = '\0'; + } + return name; +} static bool path_is_hidden (path_t *path) { char *stripped_path = strip_fs_prefix(path_get(path)); @@ -151,16 +175,24 @@ static bool load_directory (menu_t *menu) { while (result == 0) { bool hide = false; - + if (!menu->settings.show_protected_entries) { path_push(path, info.d_name); hide = path_is_hidden(path); path_pop(path); } + + if (info.d_type == DT_DIR && menu->settings.hide_saves_folder) { + const char *name = info.d_name; + if (strcasecmp(name, "saves") == 0 || strstr(name, "/saves") || strstr(name, "\\saves")) { + result = dir_findnext(path_get(path), &info); + continue; + } + } if (!hide) { menu->browser.list = realloc(menu->browser.list, (menu->browser.entries + 1) * sizeof(entry_t)); - + entry_t *entry = &menu->browser.list[menu->browser.entries++]; entry->name = strdup(info.d_name); @@ -413,8 +445,39 @@ static void draw (menu_t *menu, surface_t *d) { ui_components_layout_draw_tabbed(); - ui_components_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected); - + if (menu->settings.hide_extension || menu->settings.hide_rom_tags) { + entry_t *stripped_entries = malloc(sizeof(entry_t) * menu->browser.entries); + for (int i = 0; i < menu->browser.entries; i++) { + stripped_entries[i] = menu->browser.list[i]; + char *name = menu->browser.list[i].name; + + if (menu->settings.hide_extension && + (menu->browser.list[i].type == ENTRY_TYPE_ROM || menu->browser.list[i].type == ENTRY_TYPE_DISK || menu->browser.list[i].type == ENTRY_TYPE_EMULATOR)) { + name = strip_extension(name); + } else { + name = strdup(name); + } + + if (menu->settings.hide_rom_tags && + (menu->browser.list[i].type == ENTRY_TYPE_ROM || menu->browser.list[i].type == ENTRY_TYPE_DISK || menu->browser.list[i].type == ENTRY_TYPE_EMULATOR)) { + char *stripped = strip_rom_tags(name); + free(name); + name = stripped; + } + + stripped_entries[i].name = name; + } + + ui_components_file_list_draw(stripped_entries, menu->browser.entries, menu->browser.selected); + + for (int i = 0; i < menu->browser.entries; i++) { + free(stripped_entries[i].name); + } + free(stripped_entries); + } else { + ui_components_file_list_draw(menu->browser.list, menu->browser.entries, menu->browser.selected); + } + const char *action = NULL; if (menu->browser.entry) { diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index 9fb97458f..7e171e5b9 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -322,7 +322,10 @@ static void draw (menu_t *menu, surface_t *d) { ); } - ui_components_context_menu_draw(&options_context_menu); + if (!menu->settings.rom_autoload_enabled) { + ui_components_context_menu_draw(&options_context_menu); + } + } rdpq_detach_show(); diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 4779cf288..ae1ee74f3 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -11,6 +11,11 @@ static const char *format_switch (bool state) { } } +static void set_loading_progress_bar_enabled_type (menu_t *menu, void *arg) { + menu->settings.loading_progress_bar_enabled = (bool)(uintptr_t)(arg); + settings_save(&menu->settings); +} + static void set_protected_entries_type (menu_t *menu, void *arg) { menu->settings.show_protected_entries = (bool)(uintptr_t)(arg); settings_save(&menu->settings); @@ -34,6 +39,23 @@ static void set_use_rom_fast_reboot_enabled_type (menu_t *menu, void *arg) { settings_save(&menu->settings); } +static void set_hide_extension_type(menu_t *menu, void *arg) { + menu->settings.hide_extension = (bool)(uintptr_t)(arg); + settings_save(&menu->settings); + menu->browser.reload = true; +} + +static void set_hide_rom_tags_type (menu_t *menu, void *arg) { + menu->settings.hide_rom_tags = (bool)(uintptr_t)(arg); + settings_save(&menu->settings); +} + +static void set_hide_saves_folder(menu_t *menu, void *arg) { + menu->settings.hide_saves_folder = (bool)(uintptr_t)(arg); + settings_save(&menu->settings); + menu->browser.reload = true; +} + #ifdef BETA_SETTINGS static void set_pal60_type (menu_t *menu, void *arg) { menu->settings.pal60_enabled = (bool)(uintptr_t)(arg); @@ -61,6 +83,12 @@ static void set_rumble_enabled_type (menu_t *menu, void *arg) { // } #endif +static component_context_menu_t set_loading_progress_bar_enabled_context_menu = { .list = { + {.text = "On", .action = set_loading_progress_bar_enabled_type, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_loading_progress_bar_enabled_type, .arg = (void *)(uintptr_t)(false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + static component_context_menu_t set_protected_entries_type_context_menu = { .list = { {.text = "On", .action = set_protected_entries_type, .arg = (void *)(uintptr_t)(true) }, {.text = "Off", .action = set_protected_entries_type, .arg = (void *)(uintptr_t)(false) }, @@ -85,6 +113,24 @@ static component_context_menu_t set_use_rom_fast_reboot_context_menu = { .list = COMPONENT_CONTEXT_MENU_LIST_END, }}; +static component_context_menu_t set_hide_extension_context_menu = { .list = { + { .text = "On", .action = set_hide_extension_type, .arg = (void *)(uintptr_t)(true) }, + { .text = "Off", .action = set_hide_extension_type, .arg = (void *)(uintptr_t)(false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + +static component_context_menu_t set_hide_rom_tags_context_menu = { .list = { + {.text = "On", .action = set_hide_rom_tags_type, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_hide_rom_tags_type, .arg = (void *)(uintptr_t)(false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + +static component_context_menu_t set_hide_saves_folder_context_menu = { .list = { + {.text = "On", .action = set_hide_saves_folder, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_hide_saves_folder, .arg = (void *)(uintptr_t)(false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + #ifdef BETA_SETTINGS static component_context_menu_t set_pal60_type_context_menu = { .list = { {.text = "On", .action = set_pal60_type, .arg = (void *)(uintptr_t)(true) }, @@ -112,10 +158,14 @@ static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = #endif static component_context_menu_t options_context_menu = { .list = { + { .text = "ROM Loading Bar", .submenu = &set_loading_progress_bar_enabled_context_menu }, + { .text = "Fast Reboot ROM", .submenu = &set_use_rom_fast_reboot_context_menu }, { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, - { .text = "Sound Effects", .submenu = &set_soundfx_enabled_type_context_menu }, { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, - { .text = "Fast Reboot ROM", .submenu = &set_use_rom_fast_reboot_context_menu }, + { .text = "Sound Effects", .submenu = &set_soundfx_enabled_type_context_menu }, + { .text = "Hide Extensions", .submenu = &set_hide_extension_context_menu }, + { .text = "Hide ROM Tags", .submenu = &set_hide_rom_tags_context_menu }, + { .text = "Hide Saves Folder", .submenu = &set_hide_saves_folder_context_menu }, #ifdef BETA_SETTINGS { .text = "PAL60 Mode", .submenu = &set_pal60_type_context_menu }, { .text = "PAL60 Compatibility", .submenu = &set_pal60_mod_compatibility_type_context_menu }, @@ -158,14 +208,17 @@ static void draw (menu_t *menu, surface_t *d) { ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n\n" - " Default Directory : %s\n\n" - " Autoload ROM : %s\n" - " ROM Loading Bar : %s\n\n" - "To change the following menu settings, press 'A':\n" - " Fast Reboot ROM : %s\n" - " Show Hidden Files : %s\n" - " Use Saves folder : %s\n" - " Sound Effects : %s\n" + " Default Directory : %s\n" + " Autoload ROM : %s\n\n" + " To change the following menu settings, press 'A':\n\n" + " ROM Loading Bar : %s\n" + " Fast Reboot ROM : %s\n" + " Show Hidden Files : %s\n" + " Use Saves Folder : %s\n" + " Sound Effects : %s\n" + " Hide Extensions : %s\n" + " Hide ROM Tags : %s\n" + " Hide Saves Folder : %s\n" #ifdef BETA_SETTINGS "* PAL60 Mode : %s\n" "* PAL60 Mod Compat : %s\n" @@ -182,7 +235,10 @@ static void draw (menu_t *menu, surface_t *d) { format_switch(menu->settings.rom_fast_reboot_enabled), format_switch(menu->settings.show_protected_entries), format_switch(menu->settings.use_saves_folder), - format_switch(menu->settings.soundfx_enabled) + format_switch(menu->settings.soundfx_enabled), + format_switch(menu->settings.hide_extension), + format_switch(menu->settings.hide_rom_tags), + format_switch(menu->settings.hide_saves_folder) #ifdef BETA_SETTINGS , format_switch(menu->settings.pal60_enabled), From 1f66f3aa60e02b36083883673e6783331b328d6b Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 7 May 2025 14:38:12 -0700 Subject: [PATCH 02/22] Update browser.c --- src/menu/views/browser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index f6ede3236..b2c72a068 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -175,7 +175,7 @@ static bool load_directory (menu_t *menu) { while (result == 0) { bool hide = false; - + if (!menu->settings.show_protected_entries) { path_push(path, info.d_name); hide = path_is_hidden(path); @@ -192,7 +192,7 @@ static bool load_directory (menu_t *menu) { if (!hide) { menu->browser.list = realloc(menu->browser.list, (menu->browser.entries + 1) * sizeof(entry_t)); - + entry_t *entry = &menu->browser.list[menu->browser.entries++]; entry->name = strdup(info.d_name); From db9f98617a218b6e996723bf009eb13c6fec99a7 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 14:21:07 -0700 Subject: [PATCH 03/22] Update settings_editor.c --- src/menu/views/settings_editor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index c3666175c..f964e1cfc 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -158,7 +158,9 @@ static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = #endif static component_context_menu_t options_context_menu = { .list = { +#ifdef ED64_AUTOLOAD_ROM { .text = "ROM Loading Bar", .submenu = &set_loading_progress_bar_enabled_context_menu }, +#endif { .text = "Fast Reboot ROM", .submenu = &set_use_rom_fast_reboot_context_menu }, { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, From c36c22f7a5f08ac6c4f0c0e209f3b3e00b94bc8c Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 14:30:56 -0700 Subject: [PATCH 04/22] Update src/menu/views/settings_editor.c Co-authored-by: Robin Jones --- src/menu/views/settings_editor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index f964e1cfc..3e595b01d 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -11,6 +11,7 @@ static const char *format_switch (bool state) { } } +#ifdef ED64_AUTOLOAD_ROM static void set_loading_progress_bar_enabled_type (menu_t *menu, void *arg) { menu->settings.loading_progress_bar_enabled = (bool)(uintptr_t)(arg); settings_save(&menu->settings); From 9b795e9225329e54f8cbdfb5eeb1e8a8482b1d8c Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 14:31:07 -0700 Subject: [PATCH 05/22] Update src/menu/views/settings_editor.c Co-authored-by: Robin Jones --- src/menu/views/settings_editor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 3e595b01d..d72b5bd27 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -16,6 +16,7 @@ static void set_loading_progress_bar_enabled_type (menu_t *menu, void *arg) { menu->settings.loading_progress_bar_enabled = (bool)(uintptr_t)(arg); settings_save(&menu->settings); } +#endif static void set_protected_entries_type (menu_t *menu, void *arg) { menu->settings.show_protected_entries = (bool)(uintptr_t)(arg); From 973d6b5f81fca48de66013299df3a93e1dfadabc Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 14:31:19 -0700 Subject: [PATCH 06/22] Update src/menu/views/settings_editor.c Co-authored-by: Robin Jones --- src/menu/views/settings_editor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index d72b5bd27..e2302aaed 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -11,6 +11,7 @@ static const char *format_switch (bool state) { } } +#ifdef ED64_AUTOLOAD_ROM #ifdef ED64_AUTOLOAD_ROM static void set_loading_progress_bar_enabled_type (menu_t *menu, void *arg) { menu->settings.loading_progress_bar_enabled = (bool)(uintptr_t)(arg); From ecffb117b126a59f24cc97aef60d0bb4adc5be0b Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 14:39:05 -0700 Subject: [PATCH 07/22] Update src/menu/views/settings_editor.c Co-authored-by: Robin Jones --- src/menu/views/settings_editor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index e2302aaed..d72b5bd27 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -11,7 +11,6 @@ static const char *format_switch (bool state) { } } -#ifdef ED64_AUTOLOAD_ROM #ifdef ED64_AUTOLOAD_ROM static void set_loading_progress_bar_enabled_type (menu_t *menu, void *arg) { menu->settings.loading_progress_bar_enabled = (bool)(uintptr_t)(arg); From fc7b2136da3aa551fa28eea7e967f1ed0afe3090 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 14:48:43 -0700 Subject: [PATCH 08/22] Update settings_editor.c --- src/menu/views/settings_editor.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index d72b5bd27..bb3cfab8e 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -160,9 +160,7 @@ static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = #endif static component_context_menu_t options_context_menu = { .list = { -#ifdef ED64_AUTOLOAD_ROM { .text = "ROM Loading Bar", .submenu = &set_loading_progress_bar_enabled_context_menu }, -#endif { .text = "Fast Reboot ROM", .submenu = &set_use_rom_fast_reboot_context_menu }, { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, From eac865bbd802f8aff7029dbf01fc8de2ae169822 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 21 May 2025 23:09:27 +0100 Subject: [PATCH 09/22] Update settings_editor.c Exclude set_loading_progress_bar_enabled_context_menu when ED64_AUTOLOAD_ROM is not enabled. --- src/menu/views/settings_editor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index bb3cfab8e..a2111bb60 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -85,11 +85,13 @@ static void set_rumble_enabled_type (menu_t *menu, void *arg) { // } #endif +#ifdef ED64_AUTOLOAD_ROM static component_context_menu_t set_loading_progress_bar_enabled_context_menu = { .list = { {.text = "On", .action = set_loading_progress_bar_enabled_type, .arg = (void *)(uintptr_t)(true) }, {.text = "Off", .action = set_loading_progress_bar_enabled_type, .arg = (void *)(uintptr_t)(false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; +#endif static component_context_menu_t set_protected_entries_type_context_menu = { .list = { {.text = "On", .action = set_protected_entries_type, .arg = (void *)(uintptr_t)(true) }, From d683cd193ffbce4741936a8e4253f45c5d787a0d Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 21 May 2025 23:16:04 +0100 Subject: [PATCH 10/22] Update settings_editor.c Fix load bar setting option --- src/menu/views/settings_editor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index a2111bb60..dce1ee232 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -162,7 +162,9 @@ static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = #endif static component_context_menu_t options_context_menu = { .list = { +#ifdef ED64_AUTOLOAD_ROM { .text = "ROM Loading Bar", .submenu = &set_loading_progress_bar_enabled_context_menu }, +#endif { .text = "Fast Reboot ROM", .submenu = &set_use_rom_fast_reboot_context_menu }, { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, From 7e05e26c509134fbc8da8eb5aa3b11475a74b6b8 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 15:37:50 -0700 Subject: [PATCH 11/22] Update settings_editor.c --- src/menu/views/settings_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index dce1ee232..84fee328c 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -214,7 +214,7 @@ static void draw (menu_t *menu, surface_t *d) { ui_components_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n\n" - " Default Directory : %s\n" + " Default Directory : %s\n\n" #ifdef ED64_AUTOLOAD_ROM " Autoload ROM : %s\n\n" " ROM Loading Bar : %s\n" From 0335c869fddc50a837c7bec0c905b6c2695a6d36 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 15:39:12 -0700 Subject: [PATCH 12/22] Update settings_editor.c --- src/menu/views/settings_editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 84fee328c..56fd5e2a4 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -216,8 +216,8 @@ static void draw (menu_t *menu, surface_t *d) { "\n\n" " Default Directory : %s\n\n" #ifdef ED64_AUTOLOAD_ROM - " Autoload ROM : %s\n\n" - " ROM Loading Bar : %s\n" + " Autoload ROM : %s\n" + " ROM Loading Bar : %s\n\n" #endif " To change the following menu settings, press 'A':\n\n" " Fast Reboot ROM : %s\n" From dd53d702a7dd124c5982f82cebef43ad18f3d9c1 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 15:52:43 -0700 Subject: [PATCH 13/22] Update src/menu/views/settings_editor.c This gap is supposed to be there. Allows for title gap option Co-authored-by: Robin Jones --- src/menu/views/settings_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 56fd5e2a4..b1139dfe6 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -219,7 +219,7 @@ static void draw (menu_t *menu, surface_t *d) { " Autoload ROM : %s\n" " ROM Loading Bar : %s\n\n" #endif - " To change the following menu settings, press 'A':\n\n" + " To change the following menu settings, press 'A':\n" " Fast Reboot ROM : %s\n" " Show Hidden Files : %s\n" " Use Saves Folder : %s\n" From 5e2ca7e035b77bc46a74835923d5849c416ef1b8 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Wed, 21 May 2025 15:54:18 -0700 Subject: [PATCH 14/22] Update settings_editor.c --- src/menu/views/settings_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index b1139dfe6..43ec59311 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -219,7 +219,7 @@ static void draw (menu_t *menu, surface_t *d) { " Autoload ROM : %s\n" " ROM Loading Bar : %s\n\n" #endif - " To change the following menu settings, press 'A':\n" + " To change the following menu settings, press 'A':\n\n" " Fast Reboot ROM : %s\n" " Show Hidden Files : %s\n" " Use Saves Folder : %s\n" From 9c7f617510d6c71352433df6b38f8f8b5e93f342 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Thu, 22 May 2025 11:58:52 -0700 Subject: [PATCH 15/22] updated parent dir from / to .. --- src/menu/ui_components/file_list.c | 6 +---- src/menu/views/browser.c | 39 +++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/menu/ui_components/file_list.c b/src/menu/ui_components/file_list.c index 45348aab4..73730e89c 100644 --- a/src/menu/ui_components/file_list.c +++ b/src/menu/ui_components/file_list.c @@ -10,7 +10,6 @@ #include "../fonts.h" #include "constants.h" -static const char *dir_prefix = "/"; /** * @brief Format the file size into a human-readable string. @@ -76,7 +75,7 @@ void ui_components_file_list_draw (entry_t *list, int entries, int selected) { } else { size_t length = strlen(list[entry_index].name); name_lengths[i] = length; - total_length += length + (list[entry_index].type == ENTRY_TYPE_DIR ? strlen(dir_prefix) : 0); + total_length += length; } } @@ -117,9 +116,6 @@ void ui_components_file_list_draw (entry_t *list, int entries, int selected) { rdpq_paragraph_builder_style(style); - if (entry->type == ENTRY_TYPE_DIR) { - rdpq_paragraph_builder_span(dir_prefix, strlen(dir_prefix)); - } rdpq_paragraph_builder_span(entry->name, name_lengths[i]); diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index b2c72a068..8600e8133 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -163,7 +163,7 @@ static void browser_list_free (menu_t *menu) { menu->browser.selected = -1; } -static bool load_directory (menu_t *menu) { +static bool load_directory(menu_t *menu) { int result; dir_t info; @@ -171,6 +171,15 @@ static bool load_directory (menu_t *menu) { path_t *path = path_clone(menu->browser.directory); + if (!path_is_root(menu->browser.directory)) { + menu->browser.list = malloc(sizeof(entry_t)); + entry_t *up = &menu->browser.list[0]; + up->name = strdup(".."); + up->type = ENTRY_TYPE_DIR; + up->size = 0; + menu->browser.entries = 1; + } + result = dir_findfirst(path_get(path), &info); while (result == 0) { @@ -184,7 +193,9 @@ static bool load_directory (menu_t *menu) { if (info.d_type == DT_DIR && menu->settings.hide_saves_folder) { const char *name = info.d_name; - if (strcasecmp(name, "saves") == 0 || strstr(name, "/saves") || strstr(name, "\\saves")) { + if (strcasecmp(name, "saves") == 0 || + strstr(name, "/saves") || + strstr(name, "\\saves")) { result = dir_findnext(path_get(path), &info); continue; } @@ -208,7 +219,7 @@ static bool load_directory (menu_t *menu) { entry->type = ENTRY_TYPE_ROM; } else if (file_has_extensions(entry->name, disk_extensions)) { entry->type = ENTRY_TYPE_DISK; - }else if (file_has_extensions(entry->name, emulator_extensions)) { + } else if (file_has_extensions(entry->name, emulator_extensions)) { entry->type = ENTRY_TYPE_EMULATOR; } else if (file_has_extensions(entry->name, save_extensions)) { entry->type = ENTRY_TYPE_SAVE; @@ -230,18 +241,23 @@ static bool load_directory (menu_t *menu) { path_free(path); - if (result < -1) { - browser_list_free(menu); - return true; + { + int offset = path_is_root(menu->browser.directory) ? 0 : 1; + if (menu->browser.entries > offset) { + qsort( + menu->browser.list + offset, + menu->browser.entries - offset, + sizeof(entry_t), + compare_entry + ); + } } if (menu->browser.entries > 0) { menu->browser.selected = 0; - menu->browser.entry = &menu->browser.list[menu->browser.selected]; + menu->browser.entry = &menu->browser.list[0]; } - qsort(menu->browser.list, menu->browser.entries, sizeof(entry_t), compare_entry); - return false; } @@ -368,6 +384,7 @@ static void process (menu_t *menu) { } int scroll_speed = menu->actions.go_fast ? 10 : 1; + int min_index = 0; if (menu->browser.entries > 1) { if (menu->actions.go_up) { @@ -388,6 +405,10 @@ static void process (menu_t *menu) { if (menu->actions.enter && menu->browser.entry) { sound_play_effect(SFX_ENTER); + if (menu->browser.selected == 0 && !path_is_root(menu->browser.directory)) { + pop_directory(menu); + return; + } switch (menu->browser.entry->type) { case ENTRY_TYPE_DIR: if (push_directory(menu, menu->browser.entry->name)) { From 0ac044dca065b18966360d201bf6487f55221a83 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Thu, 22 May 2025 11:59:49 -0700 Subject: [PATCH 16/22] Update src/menu/views/settings_editor.c Co-authored-by: Robin Jones --- src/menu/views/settings_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 43ec59311..35d1c0536 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -219,7 +219,7 @@ static void draw (menu_t *menu, surface_t *d) { " Autoload ROM : %s\n" " ROM Loading Bar : %s\n\n" #endif - " To change the following menu settings, press 'A':\n\n" + "To change the following menu settings, press 'A':\n" " Fast Reboot ROM : %s\n" " Show Hidden Files : %s\n" " Use Saves Folder : %s\n" From f166210531a9ed6f1b8a1302dd0537bd67e60823 Mon Sep 17 00:00:00 2001 From: Kev <36553759+forkymcforkface@users.noreply.github.com> Date: Thu, 22 May 2025 14:20:27 -0700 Subject: [PATCH 17/22] refined hide saves folder option --- src/menu/views/browser.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index 8600e8133..fc62372b8 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -163,7 +163,7 @@ static void browser_list_free (menu_t *menu) { menu->browser.selected = -1; } -static bool load_directory(menu_t *menu) { +static bool load_directory (menu_t *menu) { int result; dir_t info; @@ -179,7 +179,6 @@ static bool load_directory(menu_t *menu) { up->size = 0; menu->browser.entries = 1; } - result = dir_findfirst(path_get(path), &info); while (result == 0) { @@ -192,10 +191,7 @@ static bool load_directory(menu_t *menu) { } if (info.d_type == DT_DIR && menu->settings.hide_saves_folder) { - const char *name = info.d_name; - if (strcasecmp(name, "saves") == 0 || - strstr(name, "/saves") || - strstr(name, "\\saves")) { + if (strcasecmp(info.d_name, "saves") == 0) { result = dir_findnext(path_get(path), &info); continue; } From d2bc5587a3599318f8a2a33ca1a4aa0a3e18687b Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 26 May 2025 00:50:40 +0100 Subject: [PATCH 18/22] Fix merge conflicts Minor fix --- src/menu/settings.c | 1 - src/menu/settings.h | 2 +- src/menu/views/browser.c | 7 ------- src/menu/views/settings_editor.c | 19 ++++--------------- 4 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/menu/settings.c b/src/menu/settings.c index 3797612d8..1482bab9d 100644 --- a/src/menu/settings.c +++ b/src/menu/settings.c @@ -91,7 +91,6 @@ void settings_save (settings_t *settings) { mini_set_bool(ini, "menu", "show_saves_folder", settings->show_saves_folder); mini_set_bool(ini, "menu", "hide_extension", settings->hide_extension); mini_set_bool(ini, "menu", "hide_rom_tags", settings->hide_rom_tags); - mini_set_bool(ini, "menu", "hide_saves_folder", settings->hide_saves_folder); mini_set_bool(ini, "menu", "soundfx_enabled", settings->soundfx_enabled); #ifdef FEATURE_AUTOLOAD_ROM mini_set_bool(ini, "menu", "autoload_rom_enabled", settings->rom_autoload_enabled); diff --git a/src/menu/settings.h b/src/menu/settings.h index 66cf12f2e..89c148b31 100644 --- a/src/menu/settings.h +++ b/src/menu/settings.h @@ -33,7 +33,7 @@ typedef struct { /** @brief Put saves into separate directory */ bool use_saves_folder; - + /** @brief Show saves folder in file browser */ bool show_saves_folder; diff --git a/src/menu/views/browser.c b/src/menu/views/browser.c index 7c58dcbd1..39623953d 100644 --- a/src/menu/views/browser.c +++ b/src/menu/views/browser.c @@ -189,13 +189,6 @@ static bool load_directory (menu_t *menu) { hide = path_is_hidden(path); path_pop(path); } - - if (info.d_type == DT_DIR && menu->settings.hide_saves_folder) { - if (strcasecmp(info.d_name, "saves") == 0) { - result = dir_findnext(path_get(path), &info); - continue; - } - } if (!menu->settings.show_saves_folder) { path_push(path, info.d_name); diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 630700560..bd0f3c4d7 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -59,12 +59,6 @@ static void set_hide_rom_tags_type (menu_t *menu, void *arg) { settings_save(&menu->settings); } -static void set_hide_saves_folder(menu_t *menu, void *arg) { - menu->settings.hide_saves_folder = (bool)(uintptr_t)(arg); - settings_save(&menu->settings); - menu->browser.reload = true; -} - #ifdef BETA_SETTINGS static void set_pal60_type (menu_t *menu, void *arg) { menu->settings.pal60_enabled = (bool)(uintptr_t)(arg); @@ -142,12 +136,6 @@ static component_context_menu_t set_hide_rom_tags_context_menu = { .list = { COMPONENT_CONTEXT_MENU_LIST_END, }}; -static component_context_menu_t set_hide_saves_folder_context_menu = { .list = { - {.text = "On", .action = set_hide_saves_folder, .arg = (void *)(uintptr_t)(true) }, - {.text = "Off", .action = set_hide_saves_folder, .arg = (void *)(uintptr_t)(false) }, - COMPONENT_CONTEXT_MENU_LIST_END, -}}; - #ifdef BETA_SETTINGS static component_context_menu_t set_pal60_type_context_menu = { .list = { {.text = "On", .action = set_pal60_type, .arg = (void *)(uintptr_t)(true) }, @@ -175,10 +163,11 @@ static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = #endif static component_context_menu_t options_context_menu = { .list = { -#ifdef ED64_AUTOLOAD_ROM +#ifdef FEATURE_AUTOLOAD_ROM { .text = "ROM Loading Bar", .submenu = &set_loading_progress_bar_enabled_context_menu }, -#endif +#else { .text = "Fast Reboot ROM", .submenu = &set_use_rom_fast_reboot_context_menu }, +#endif { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, { .text = "Show Saves Folder", .submenu = &set_show_saves_folder_type_context_menu }, @@ -265,7 +254,7 @@ static void draw (menu_t *menu, surface_t *d) { format_switch(menu->settings.show_saves_folder), format_switch(menu->settings.soundfx_enabled), format_switch(menu->settings.hide_extension), - format_switch(menu->settings.hide_rom_tags), + format_switch(menu->settings.hide_rom_tags) #ifdef BETA_SETTINGS , format_switch(menu->settings.pal60_enabled), From 9b166a33977cbe3690d82acf58c01745bec25ec9 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 26 May 2025 01:41:14 +0100 Subject: [PATCH 19/22] Fix merge --- src/menu/views/settings_editor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 95877e30e..068efad4d 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -166,6 +166,11 @@ static component_context_menu_t options_context_menu = { .list = { { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, { .text = "Show Saves Folder", .submenu = &set_show_saves_folder_type_context_menu }, +#ifdef FEATURE_AUTOLOAD_ROM + { .text = "ROM Loading Bar", .submenu = &set_loading_progress_bar_enabled_context_menu }, +#else + { .text = "Fast Reboot ROM", .submenu = &set_use_rom_fast_reboot_context_menu }, +#endif { .text = "Sound Effects", .submenu = &set_soundfx_enabled_type_context_menu }, { .text = "Hide Extensions", .submenu = &set_hide_extension_context_menu }, { .text = "Hide ROM Tags", .submenu = &set_hide_rom_tags_context_menu }, From 37ab8c1e7e194962e3459b83029e86dbb64058c8 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Tue, 22 Jul 2025 13:46:37 +0200 Subject: [PATCH 20/22] boot: reset value of FCR31 to the boot value (0) (#254) This improves emulation of cold boot, as otherwise the FPU might start in an unexpected state. ## Summary by CodeRabbit * **Chores** * Improved initialization procedures during system boot for enhanced stability. --- src/boot/boot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/boot/boot.c b/src/boot/boot.c index 2fc0a889e..1d4f74991 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -58,6 +58,7 @@ void boot (boot_params_t *params) { } C0_WRITE_STATUS(C0_STATUS_CU1 | C0_STATUS_CU0 | C0_STATUS_FR); + C1_WRITE_FCR31(0); while (!(cpu_io_read(&SP->SR) & SP_SR_HALT)); From 61bfba755740840e19eaba1aac2155346be39508 Mon Sep 17 00:00:00 2001 From: lategator <212063191+lategator@users.noreply.github.com> Date: Tue, 22 Jul 2025 08:10:17 -0400 Subject: [PATCH 21/22] Fix missing enum case for 1 mbit SRAM saves (#253) ## Description This allows the menu to boot ROMs with 1 MBit saves. ## Motivation and Context Without this I get "Error occured during save loading" when trying to load a ROM using this save type in the header. ## How Has This Been Tested? From a libdragon install, run `ed64romconfig --savetype sram1m file.z64` on any ROM to change the header byte, then try to load it in the menu. With the patch, the ROM should load successfully. Sample using a test ROM here: [test_sram1m.zip](https://github.com/user-attachments/files/21261604/test_sram1m.zip) ## Screenshots None ## Types of changes - [ ] Improvement (non-breaking change that adds a new feature) - [X] Bug fix (fixes an issue) - [ ] Breaking change (breaking change) - [ ] Documentation Improvement - [ ] Config and build (change in the configuration and build system, has no impact on code or features) ## Checklist: - [X] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [X] All new and existing tests passed. Signed-off-by: lategator <212063191+lategator@users.noreply.github.com> ## Summary by CodeRabbit * **Bug Fixes** * Improved compatibility for games using the 1Mbit SRAM save type, ensuring proper save data handling. Co-authored-by: Robin Jones --- src/flashcart/sc64/sc64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/flashcart/sc64/sc64.c b/src/flashcart/sc64/sc64.c index 66261c754..919ec672c 100644 --- a/src/flashcart/sc64/sc64.c +++ b/src/flashcart/sc64/sc64.c @@ -498,6 +498,7 @@ static flashcart_err_t sc64_load_save (char *save_path) { case SAVE_TYPE_SRAM_256KBIT: case SAVE_TYPE_FLASHRAM_1MBIT: case SAVE_TYPE_SRAM_BANKED: + case SAVE_TYPE_SRAM_1MBIT: address = (void *) (SRAM_FLASHRAM_ADDRESS); break; case SAVE_TYPE_NONE: From 3b7f17f5389913498b0edc3ade8c7b0c5cb8a7eb Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 24 Jul 2025 17:04:29 +0100 Subject: [PATCH 22/22] Create FUNDING.yml --- .github/FUNDING.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..131620c89 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +ko_fi: polprzewodnikowy +github: networkfusion