Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7855a8c
options menu updated
forkymcforkface May 7, 2025
1f66f3a
Update browser.c
forkymcforkface May 7, 2025
ec94ef6
Merge branch 'Polprzewodnikowy:main' into hide_options
forkymcforkface May 21, 2025
ea7f587
Merge branch 'develop' into hide_options
forkymcforkface May 21, 2025
db9f986
Update settings_editor.c
forkymcforkface May 21, 2025
c36c22f
Update src/menu/views/settings_editor.c
forkymcforkface May 21, 2025
9b795e9
Update src/menu/views/settings_editor.c
forkymcforkface May 21, 2025
973d6b5
Update src/menu/views/settings_editor.c
forkymcforkface May 21, 2025
ecffb11
Update src/menu/views/settings_editor.c
forkymcforkface May 21, 2025
fc7b213
Update settings_editor.c
forkymcforkface May 21, 2025
eac865b
Update settings_editor.c
networkfusion May 21, 2025
d683cd1
Update settings_editor.c
networkfusion May 21, 2025
7e05e26
Update settings_editor.c
forkymcforkface May 21, 2025
0335c86
Update settings_editor.c
forkymcforkface May 21, 2025
dd53d70
Update src/menu/views/settings_editor.c
forkymcforkface May 21, 2025
5e2ca7e
Update settings_editor.c
forkymcforkface May 21, 2025
9c7f617
updated parent dir from / to ..
forkymcforkface May 22, 2025
0ac044d
Update src/menu/views/settings_editor.c
forkymcforkface May 22, 2025
f166210
refined hide saves folder option
forkymcforkface May 22, 2025
714d8c3
Merge branch 'develop' into hide_options
networkfusion May 25, 2025
d2bc558
Fix merge conflicts
networkfusion May 25, 2025
fd5140e
Merge branch 'develop' into hide_options
networkfusion May 26, 2025
9b166a3
Fix merge
networkfusion May 26, 2025
4ad9b5b
Merge branch 'develop' into hide_options
networkfusion May 30, 2025
bf468bf
Merge branch 'develop' into hide_options
networkfusion May 30, 2025
4d20ca4
Merge branch 'develop' into hide_options
networkfusion Jun 25, 2025
37ab8c1
boot: reset value of FCR31 to the boot value (0) (#254)
rasky Jul 22, 2025
61bfba7
Fix missing enum case for 1 mbit SRAM saves (#253)
LateGator Jul 22, 2025
3b7f17f
Create FUNDING.yml
networkfusion Jul 24, 2025
2958fba
Merge branch 'develop' into hide_options
networkfusion Sep 9, 2025
0794f4c
Merge branch 'Polprzewodnikowy:main' into hide_options
forkymcforkface Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/menu/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ static settings_t init = {
.default_directory = "/",
.use_saves_folder = true,
.show_saves_folder = false,
.hide_extension = false,
.hide_rom_tags = false,
.soundfx_enabled = false,
#ifdef FEATURE_AUTOLOAD_ROM_ENABLED
.rom_autoload_enabled = false,
Expand Down Expand Up @@ -56,6 +58,8 @@ void settings_load (settings_t *settings) {
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->show_saves_folder = mini_get_bool(ini, "menu", "show_saves_folder", init.show_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->soundfx_enabled = mini_get_bool(ini, "menu", "soundfx_enabled", init.soundfx_enabled);

#ifdef FEATURE_AUTOLOAD_ROM_ENABLED
Expand Down Expand Up @@ -85,6 +89,8 @@ void settings_save (settings_t *settings) {
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", "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", "soundfx_enabled", settings->soundfx_enabled);
#ifdef FEATURE_AUTOLOAD_ROM_ENABLED
mini_set_bool(ini, "menu", "autoload_rom_enabled", settings->rom_autoload_enabled);
Expand Down
6 changes: 6 additions & 0 deletions src/menu/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ typedef struct {
/** @brief Show saves folder in file browser */
bool show_saves_folder;

/** @brief Hide file extensions */
bool hide_extension;

/** @brief Hide rom tags */
bool hide_rom_tags;

/** @brief Enable Background music */
bool bgm_enabled;

Expand Down
6 changes: 1 addition & 5 deletions src/menu/ui_components/file_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -77,7 +76,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;
}
}

Expand Down Expand Up @@ -118,9 +117,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]);

Expand Down
89 changes: 81 additions & 8 deletions src/menu/views/browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,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));
Expand Down Expand Up @@ -158,6 +182,14 @@ 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) {
Expand Down Expand Up @@ -222,18 +254,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;
}

Expand Down Expand Up @@ -360,6 +397,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) {
Expand All @@ -380,6 +418,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)) {
Expand Down Expand Up @@ -446,8 +488,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) {
Expand Down
33 changes: 31 additions & 2 deletions src/menu/views/settings_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ static void set_use_rom_fast_reboot_enabled_type (menu_t *menu, void *arg) {
}
#endif

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);
}

#ifdef BETA_SETTINGS
static void set_pal60_type (menu_t *menu, void *arg) {
menu->settings.pal60_enabled = (bool)(uintptr_t)(arg);
Expand Down Expand Up @@ -118,6 +129,18 @@ static component_context_menu_t set_use_rom_fast_reboot_context_menu = { .list =
}};
#endif

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,
}};

#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) },
Expand Down Expand Up @@ -146,14 +169,16 @@ static component_context_menu_t set_rumble_enabled_type_context_menu = { .list =

static component_context_menu_t options_context_menu = { .list = {
{ .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 = "Show Saves Folder", .submenu = &set_show_saves_folder_type_context_menu },
#ifdef FEATURE_AUTOLOAD_ROM_ENABLED
{ .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 },
#ifdef BETA_SETTINGS
{ .text = "PAL60 Mode", .submenu = &set_pal60_type_context_menu },
{ .text = "PAL60 Compatibility", .submenu = &set_pal60_mod_compatibility_type_context_menu },
Expand Down Expand Up @@ -224,6 +249,8 @@ static void draw (menu_t *menu, surface_t *d) {
" Use Saves folder : %s\n"
" Show Saves folder : %s\n"
" Sound Effects : %s\n"
" Hide Extensions : %s\n"
" Hide ROM Tags : %s\n"
#ifdef BETA_SETTINGS
"* PAL60 Mode : %s\n"
"* PAL60 Mod Compat : %s\n"
Expand All @@ -244,7 +271,9 @@ static void draw (menu_t *menu, surface_t *d) {
format_switch(menu->settings.show_protected_entries),
format_switch(menu->settings.use_saves_folder),
format_switch(menu->settings.show_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)
#ifdef BETA_SETTINGS
,
format_switch(menu->settings.pal60_enabled),
Expand Down