Skip to content

Commit

Permalink
Default menu sound fx to off
Browse files Browse the repository at this point in the history
Rename functions to better describe them.
  • Loading branch information
networkfusion committed Dec 28, 2024
1 parent e14ea9c commit 0068699
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static void menu_init (boot_params_t *boot_params) {

path_free(path);

sound_use_sfx(menu->settings.sound_enabled);
sound_use_sfx(menu->settings.soundfx_enabled);

menu->browser.directory = path_init(menu->storage_prefix, menu->settings.default_directory);
if (!directory_exists(path_get(menu->browser.directory))) {
Expand Down
6 changes: 3 additions & 3 deletions src/menu/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static settings_t init = {
.show_protected_entries = false,
.default_directory = "/",
.use_saves_folder = true,
.sound_enabled = true,
.soundfx_enabled = false,
.rom_autoload_enabled = false,
.rom_autoload_path = "",
.rom_autoload_filename = "",
Expand Down Expand Up @@ -42,7 +42,7 @@ 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->sound_enabled = mini_get_bool(ini, "menu", "sound_enabled", init.sound_enabled);
settings->soundfx_enabled = mini_get_bool(ini, "menu", "soundfx_enabled", init.soundfx_enabled);

settings->rom_autoload_enabled = mini_get_bool(ini, "menu", "autoload_rom_enabled", init.rom_autoload_enabled);
settings->rom_autoload_path = strdup(mini_get_string(ini, "autoload", "rom_path", init.rom_autoload_path));
Expand All @@ -62,7 +62,7 @@ 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", "sound_enabled", settings->sound_enabled);
mini_set_bool(ini, "menu", "soundfx_enabled", settings->soundfx_enabled);
mini_set_bool(ini, "menu", "autoload_rom_enabled", settings->rom_autoload_enabled);
mini_set_string(ini, "autoload", "rom_path", settings->rom_autoload_path);
mini_set_string(ini, "autoload", "rom_filename", settings->rom_autoload_filename);
Expand Down
2 changes: 1 addition & 1 deletion src/menu/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef struct {
bool bgm_enabled;

/** @brief Enable Sounds */
bool sound_enabled;
bool soundfx_enabled;

/** @brief Enable rumble feedback */
bool rumble_enabled;
Expand Down
16 changes: 8 additions & 8 deletions src/menu/views/settings_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ static void set_use_saves_folder_type (menu_t *menu, void *arg) {
settings_save(&menu->settings);
}

static void set_sound_enabled_type (menu_t *menu, void *arg) {
menu->settings.sound_enabled = (bool)(uintptr_t)(arg);
sound_use_sfx(menu->settings.sound_enabled);
static void set_soundfx_enabled_type (menu_t *menu, void *arg) {
menu->settings.soundfx_enabled = (bool)(uintptr_t)(arg);
sound_use_sfx(menu->settings.soundfx_enabled);
settings_save(&menu->settings);
}

Expand Down Expand Up @@ -58,9 +58,9 @@ static component_context_menu_t set_protected_entries_type_context_menu = { .lis
COMPONENT_CONTEXT_MENU_LIST_END,
}};

static component_context_menu_t set_sound_enabled_type_context_menu = { .list = {
{.text = "On", .action = set_sound_enabled_type, .arg = (void *)(uintptr_t)(true) },
{.text = "Off", .action = set_sound_enabled_type, .arg = (void *)(uintptr_t)(false) },
static component_context_menu_t set_soundfx_enabled_type_context_menu = { .list = {
{.text = "On", .action = set_soundfx_enabled_type, .arg = (void *)(uintptr_t)(true) },
{.text = "Off", .action = set_soundfx_enabled_type, .arg = (void *)(uintptr_t)(false) },
COMPONENT_CONTEXT_MENU_LIST_END,
}};

Expand Down Expand Up @@ -92,7 +92,7 @@ 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_sound_enabled_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 },
#ifdef BETA_SETTINGS
{ .text = "PAL60 Mode", .submenu = &set_pal60_type_context_menu },
Expand Down Expand Up @@ -154,7 +154,7 @@ static void draw (menu_t *menu, surface_t *d) {
format_switch(menu->settings.rom_autoload_enabled),
format_switch(menu->settings.show_protected_entries),
format_switch(menu->settings.use_saves_folder),
format_switch(menu->settings.sound_enabled)
format_switch(menu->settings.soundfx_enabled)
#ifdef BETA_SETTINGS
,
format_switch(menu->settings.pal60_enabled),
Expand Down

0 comments on commit 0068699

Please sign in to comment.