MENU: Hide dependent settings on the fly when their master toggle changes

Several settings pages leave dependent entries visible when the
toggle that controls them is turned off, and in one case the entries
fail to re-hide at all without leaving and re-entering the page.
Fix three such cases:

Settings -> Video -> Scaling:
Hide 'Integer Scale Axis' and 'Integer Scale Scaling' when
'Integer Scale' is off. Wrap both entries in a
settings->bools.video_scale_integer guard in
DISPLAYLIST_VIDEO_SCALING_SETTINGS_LIST. The master toggle already
uses setting_bool_action_left/right_with_refresh, so the page
rebuilds on toggle and the entries appear/disappear instantly.
This mirrors the conditional rendering already used a few lines
below for the Aspect Ratio index's custom viewport fields.

Settings -> Audio -> Output:
Hide 'WASAPI Exclusive Mode', 'WASAPI Float Format' and
'WASAPI Shared Buffer Length' unless audio_driver is "wasapi",
mirroring the existing HAVE_ASIO block directly below that gates
the ASIO Control Panel on audio_driver == "asio". To make this
apply on the fly, add audio_driver_write_handler next to
record_driver_write_handler; it delegates to general_write_handler
and sets MENU_ST_FLAG_PREVENT_POPULATE | MENU_ST_FLAG_ENTRIES_NEED_REFRESH.
Install it via the change_handler slot on the AUDIO_DRIVER entry
in the drivers registration loop. Because
setting_string_action_left/right_driver and the dropdown OK path
(generic_action_ok_dropdown_setting) both call change_handler after
writing, a single hook covers the scroll and dropdown-select paths
with no action_left/right wrappers. As a side benefit, switching
into or out of "asio" now also shows/hides the ASIO Control Panel
entry on the fly, where previously it required navigating out of
and back into the page.

Settings -> Achievements:
Fix sub-entries (Username, Password, Appearance, Visibility,
Hardcore Mode, etc.) not hiding when 'Achievements' is toggled off.
The refresh itself was firing correctly - CHEEVOS_ENABLE uses
setting_bool_action_left/right_with_refresh - but the visibility
loop in DISPLAYLIST_RETRO_ACHIEVEMENTS_SETTINGS_LIST only ever set
build_list[i].checked = true and never reset it. Because build_list
is static, 'checked' persisted across rebuilds, so once Achievements
had been enabled all sub-entries stayed permanently visible. Reset
'checked' on every pass: CHEEVOS_ENABLE itself is always shown, and
every other entry mirrors cheevos_enable. This matches the reset
pattern already in use in the sibling
DISPLAYLIST_CHEEVOS_APPEARANCE_SETTINGS_LIST block.

Note: the same static-build_list-without-full-reset pattern exists
in several other displaylist cases in this file and is worth an
audit as a follow-up.
This commit is contained in:
U-DESKTOP-SPFP6AQ\twistedtechre committed 2026-04-18 03:00:50 +02:00
1 parent a19f629f1f
commit dbc9a08beb
2 files changed
+59 -21

No files matched your search

+33 -21
View File
@@ -7831,18 +7831,21 @@ unsigned menu_displaylist_build_list(
PARSE_ONLY_UINT, false) == 0)
count++;
#ifdef HAVE_WASAPI
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_AUDIO_WASAPI_EXCLUSIVE_MODE,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_AUDIO_WASAPI_FLOAT_FORMAT,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH,
PARSE_ONLY_UINT, false) == 0)
count++;
if (string_is_equal(settings->arrays.audio_driver, "wasapi"))
{
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_AUDIO_WASAPI_EXCLUSIVE_MODE,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_AUDIO_WASAPI_FLOAT_FORMAT,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH,
PARSE_ONLY_UINT, false) == 0)
count++;
}
#endif
#ifdef HAVE_ASIO
if ( string_is_equal(settings->arrays.audio_driver, "asio")
@@ -9649,8 +9652,14 @@ unsigned menu_displaylist_build_list(
for (i = 0; i < ARRAY_SIZE(build_list); i++)
{
if (cheevos_enable)
/* The build_list array is static, so 'checked' retains
* state from previous menu builds. We must explicitly
* reset it on each pass: only CHEEVOS_ENABLE itself is
* always shown; everything else is gated on it. */
if (build_list[i].enum_idx == MENU_ENUM_LABEL_CHEEVOS_ENABLE)
build_list[i].checked = true;
else
build_list[i].checked = cheevos_enable;
}
for (i = 0; i < ARRAY_SIZE(build_list); i++)
@@ -10245,14 +10254,17 @@ unsigned menu_displaylist_build_list(
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_AXIS,
PARSE_ONLY_UINT, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_SCALING,
PARSE_ONLY_UINT, false) == 0)
count++;
if (settings->bools.video_scale_integer)
{
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_AXIS,
PARSE_ONLY_UINT, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_SCALING,
PARSE_ONLY_UINT, false) == 0)
count++;
}
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX,
PARSE_ONLY_UINT, false) == 0)
+26
View File
@@ -9547,6 +9547,20 @@ static void record_driver_write_handler(rarch_setting_t *setting)
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
}
static void audio_driver_write_handler(rarch_setting_t *setting)
{
/* Delegate to the generic write handler, then force the audio
* output settings page to rebuild so that driver-specific items
* (e.g. WASAPI options) are shown/hidden immediately when the
* audio driver changes. This fires for every write path
* (left/right scroll and dropdown OK selection) because they
* both invoke setting->change_handler. */
struct menu_state *menu_st = menu_state_get_ptr();
general_write_handler(setting);
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE
| MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
}
static int setting_record_driver_action_left(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
@@ -11419,6 +11433,18 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_right
= setting_record_driver_action_right;
}
/* Audio driver needs a refresh-aware write handler so that
* the audio output settings page rebuilds when the driver
* changes, hiding/showing driver-specific items such as
* the WASAPI options. Using change_handler (rather than
* action_left/right wrappers) covers both the left/right
* scroll and the dropdown OK selection paths, since each
* invokes setting->change_handler after writing. */
if (string_options_entries[i].name_enum_idx
== MENU_ENUM_LABEL_AUDIO_DRIVER)
(*list)[list_info->index - 1].change_handler
= audio_driver_write_handler;
}
END_SUB_GROUP(list, list_info, parent_group);