Skip to content

Commit cde459b

Browse files
f4mrfauxclaude
andcommitted
overlay: add user-configurable Minimal Overlay Preset (FR #18178)
Wire up the minimal-preset path that the conditional resolver was already returning OVERLAY_PROFILE_MINIMAL for. Before this commit the master enum + English strings existed but the menu entry, file browser, default constant, and resolver fallback were not connected. - file_path_special.h: FILE_PATH_DEFAULT_OVERLAY_MINIMAL = "gamepads/neo-retropad/neo-retropad_collapsed.cfg". - configuration.c: fill settings->paths.path_overlay_minimal with the default at config-defaults time (mirrors path_overlay). - menu/menu_setting.c: CONFIG_PATH for path_overlay_minimal under the overlay group; emits CMD_EVENT_OVERLAY_INIT on change. Also remove the obsolete "Hide When Controller Connected" bool menu entry - it is superseded by input_overlay_behavior. cfg key + migration remain for downgrade safety. - menu/cbs/menu_cbs.h, menu_cbs_ok.c: ACTION_OK_DL_INPUT_OVERLAY_MINIMAL_PRESET with the same expansion+archive-delim handling the main preset uses. - intl/msg_hash_lbl.h, msg_hash_lbl_str.h: register the label enum and cfg key "input_overlay_minimal". - input/input_driver.{h,c}: extend overlay_resolve_profile() with a minimal_available parameter. When CONDITIONAL is selected and the user has not set a minimal preset, downgrade MINIMAL to FULL so the caller's state machine stays consistent with what input_overlay_path() will actually return. Removes the runtime fallback inside input_overlay_path() (the resolver handles it now). Three call sites updated (input_overlay_want_hidden, input_overlay_loaded, input_overlay_path). - runloop.c: pass minimal_available into the runloop resolver call. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c3051c8 commit cde459b

12 files changed

Lines changed: 100 additions & 34 deletions

configuration.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,6 +3359,11 @@ void config_set_defaults(void *data)
33593359
settings->paths.directory_overlay,
33603360
FILE_PATH_DEFAULT_OVERLAY,
33613361
sizeof(settings->paths.path_overlay));
3362+
/* No default for path_overlay_minimal: leave it empty so the
3363+
* resolver falls back to the main preset until the user explicitly
3364+
* picks a minimal preset via Settings -> On-Screen Display -> On-Screen
3365+
* Overlay -> Minimal Overlay Preset. Avoids pointing at an asset that
3366+
* may not ship in the user's overlay bundle. */
33623367
if (!*settings->paths.path_osk_overlay)
33633368
fill_pathname_join_special(settings->paths.path_osk_overlay,
33643369
settings->paths.directory_overlay,
@@ -4021,7 +4026,10 @@ static bool config_load_file(global_t *global,
40214026
const char *extra_path = NULL;
40224027
#ifdef HAVE_OVERLAY
40234028
char old_overlay_path[PATH_MAX_LENGTH], new_overlay_path[PATH_MAX_LENGTH];
4029+
char old_overlay_minimal_path[PATH_MAX_LENGTH], new_overlay_minimal_path[PATH_MAX_LENGTH];
40244030
config_get_path(conf, "input_overlay", old_overlay_path, sizeof(old_overlay_path));
4031+
config_get_path(conf, "input_overlay_minimal",
4032+
old_overlay_minimal_path, sizeof(old_overlay_minimal_path));
40254033
#endif
40264034
strlcpy(tmp_append_path, path_get(RARCH_PATH_CONFIG_OVERRIDE),
40274035
sizeof(tmp_append_path));
@@ -4051,6 +4059,11 @@ static bool config_load_file(global_t *global,
40514059
config_get_path(conf, "input_overlay", new_overlay_path, sizeof(new_overlay_path));
40524060
if (!string_is_equal(old_overlay_path, new_overlay_path))
40534061
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_OVERLAY_PRESET, NULL);
4062+
config_get_path(conf, "input_overlay_minimal",
4063+
new_overlay_minimal_path, sizeof(new_overlay_minimal_path));
4064+
if (!string_is_equal(old_overlay_minimal_path, new_overlay_minimal_path))
4065+
retroarch_override_setting_set(
4066+
RARCH_OVERRIDE_SETTING_OVERLAY_MINIMAL_PRESET, NULL);
40544067
#endif
40554068
}
40564069

input/input_driver.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6174,16 +6174,19 @@ void input_overlay_set_visibility(int overlay_idx,
61746174
* it is safe to call every frame. Additional input sources (e.g. an active
61756175
* stylus) can be added as parameters here without touching the call sites. */
61766176
enum overlay_profile overlay_resolve_profile(
6177-
unsigned behavior, bool controller_connected)
6177+
unsigned behavior, bool controller_connected,
6178+
bool minimal_available)
61786179
{
61796180
switch (behavior)
61806181
{
61816182
case OVERLAY_BEHAVIOR_HIDE_WHEN_GAMEPAD:
61826183
return controller_connected
61836184
? OVERLAY_PROFILE_HIDDEN : OVERLAY_PROFILE_FULL;
61846185
case OVERLAY_BEHAVIOR_CONDITIONAL:
6185-
return controller_connected
6186-
? OVERLAY_PROFILE_MINIMAL : OVERLAY_PROFILE_FULL;
6186+
if (controller_connected)
6187+
return minimal_available
6188+
? OVERLAY_PROFILE_MINIMAL : OVERLAY_PROFILE_FULL;
6189+
return OVERLAY_PROFILE_FULL;
61876190
case OVERLAY_BEHAVIOR_STATIC:
61886191
default:
61896192
break;
@@ -6207,7 +6210,9 @@ static bool input_overlay_want_hidden(void)
62076210
{
62086211
unsigned behavior = settings->uints.input_overlay_behavior;
62096212
bool controller_connected = (input_config_get_device_name(0) != NULL);
6210-
if (overlay_resolve_profile(behavior, controller_connected)
6213+
bool minimal_available = (*settings->paths.path_overlay_minimal != '\0');
6214+
if (overlay_resolve_profile(behavior, controller_connected,
6215+
minimal_available)
62116216
== OVERLAY_PROFILE_HIDDEN)
62126217
hide = true;
62136218
}
@@ -6346,7 +6351,8 @@ static void input_overlay_loaded(retro_task_t *task,
63466351
if (enable_overlay
63476352
&& settings->bools.input_overlay_pointer_enable
63486353
&& overlay_resolve_profile(behavior,
6349-
input_config_get_device_name(0) != NULL)
6354+
input_config_get_device_name(0) != NULL,
6355+
*settings->paths.path_overlay_minimal != '\0')
63506356
== OVERLAY_PROFILE_HIDDEN)
63516357
ol->flags |= INPUT_OVERLAY_GAMEPAD_HIDDEN;
63526358
}
@@ -6387,20 +6393,18 @@ static const char *input_overlay_path(bool want_osk)
63876393
return settings->paths.path_osk_overlay;
63886394

63896395
/* Conditional profiles: when the resolved profile is MINIMAL, skip the
6390-
* auto-preferred lookup and return the user's minimal preset directly,
6391-
* falling back to the full preset when it is unset. */
6396+
* auto-preferred lookup and return the user's minimal preset directly.
6397+
* The resolver only returns MINIMAL when the path is non-empty, so no
6398+
* further fallback is needed here. */
63926399
{
63936400
unsigned behavior = settings->uints.input_overlay_behavior;
63946401
bool controller_active = (input_config_get_device_name(0) != NULL);
6402+
bool minimal_available = (*settings->paths.path_overlay_minimal != '\0');
63956403
enum overlay_profile profile = overlay_resolve_profile(
6396-
behavior, controller_active);
6404+
behavior, controller_active, minimal_available);
63976405

63986406
if (profile == OVERLAY_PROFILE_MINIMAL)
6399-
{
6400-
if (*settings->paths.path_overlay_minimal)
6401-
return settings->paths.path_overlay_minimal;
6402-
return settings->paths.path_overlay;
6403-
}
6407+
return settings->paths.path_overlay_minimal;
64046408
}
64056409

64066410
/* If the option is set to turn this off, just return default */

input/input_driver.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,9 +1141,13 @@ void input_overlay_unload(void);
11411141
void input_overlay_init(void);
11421142

11431143
/* Conditional overlay profiles (FR #18178): pure resolver mapping the
1144-
* behaviour mode + controller state to the overlay profile to show. */
1144+
* behaviour mode + controller state to the overlay profile to show.
1145+
* minimal_available must be true iff a non-empty Minimal Overlay Preset path
1146+
* is configured; when false the resolver downgrades MINIMAL to FULL so the
1147+
* caller's state machine stays in sync with what will actually be loaded. */
11451148
enum overlay_profile overlay_resolve_profile(
1146-
unsigned behavior, bool controller_connected);
1149+
unsigned behavior, bool controller_connected,
1150+
bool minimal_available);
11471151

11481152
void input_overlay_check_mouse_cursor(void);
11491153
#endif

intl/msg_hash_lbl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,6 +2736,10 @@ MSG_HASH(
27362736
MENU_ENUM_LABEL_OVERLAY_PRESET,
27372737
MENU_ENUM_LABEL_OVERLAY_PRESET_STR
27382738
)
2739+
MSG_HASH(
2740+
MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET,
2741+
MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET_STR
2742+
)
27392743
MSG_HASH(
27402744
MENU_ENUM_LABEL_OSK_OVERLAY_PRESET,
27412745
MENU_ENUM_LABEL_OSK_OVERLAY_PRESET_STR

menu/cbs/menu_cbs_ok.c

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,32 @@ int generic_action_ok_displaylist_push(
11301130
parent_dir, sizeof(parent_dir), true);
11311131
}
11321132

1133+
info_path = parent_dir;
1134+
break;
1135+
case ACTION_OK_DL_INPUT_OVERLAY_MINIMAL_PRESET:
1136+
filebrowser_set_type(FILEBROWSER_SELECT_OVERLAY);
1137+
info.directory_ptr = idx;
1138+
info_label = MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET_STR;
1139+
info.enum_idx = MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET;
1140+
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
1141+
1142+
{
1143+
char expanded[PATH_MAX_LENGTH];
1144+
fill_pathname_expand_special(expanded,
1145+
settings->paths.path_overlay_minimal, sizeof(expanded));
1146+
#ifdef HAVE_COMPRESSION
1147+
{
1148+
char *delim = (char*)path_get_archive_delim(expanded);
1149+
if (delim)
1150+
*delim = '\0';
1151+
}
1152+
#endif
1153+
action_ok_get_file_browser_start_path(
1154+
expanded,
1155+
settings->paths.directory_overlay,
1156+
parent_dir, sizeof(parent_dir), true);
1157+
}
1158+
11331159
info_path = parent_dir;
11341160
break;
11351161
case ACTION_OK_DL_OSK_OVERLAY_PRESET:
@@ -2476,7 +2502,18 @@ static int generic_action_ok(const char *path,
24762502
break;
24772503
case ACTION_OK_SET_PATH_OVERLAY:
24782504
flush_char = MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST_STR;
2479-
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_OVERLAY_PRESET, NULL);
2505+
/* Both the main and minimal overlay-preset file pickers reach this
2506+
* case (both register FILEBROWSER_SELECT_OVERLAY). Dispatch the
2507+
* override flag based on which setting the user is editing so the
2508+
* minimal-preset path participates in per-game / per-core overrides
2509+
* symmetrically with the main preset. */
2510+
if (string_is_equal(menu_label,
2511+
MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET_STR))
2512+
retroarch_override_setting_set(
2513+
RARCH_OVERRIDE_SETTING_OVERLAY_MINIMAL_PRESET, NULL);
2514+
else
2515+
retroarch_override_setting_set(
2516+
RARCH_OVERRIDE_SETTING_OVERLAY_PRESET, NULL);
24802517
ret = set_path_generic(menu_label, action_path);
24812518
break;
24822519
case ACTION_OK_SET_PATH_OSK_OVERLAY:
@@ -6691,6 +6728,7 @@ STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_generic_list, ACTION_OK_DL_GENERIC)
66916728
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_audio_dsp_plugin, ACTION_OK_DL_AUDIO_DSP_PLUGIN)
66926729
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_video_filter, ACTION_OK_DL_VIDEO_FILTER)
66936730
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_overlay_preset, ACTION_OK_DL_OVERLAY_PRESET)
6731+
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_input_overlay_minimal_preset, ACTION_OK_DL_INPUT_OVERLAY_MINIMAL_PRESET)
66946732
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_osk_overlay_preset, ACTION_OK_DL_OSK_OVERLAY_PRESET)
66956733
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_video_font, ACTION_OK_DL_VIDEO_FONT)
66966734
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_rpl_entry, ACTION_OK_DL_RPL_ENTRY)
@@ -9324,6 +9362,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
93249362
{MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN, action_ok_audio_dsp_plugin},
93259363
{MENU_ENUM_LABEL_VIDEO_FILTER, action_ok_video_filter},
93269364
{MENU_ENUM_LABEL_OVERLAY_PRESET, action_ok_overlay_preset},
9365+
{MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET, action_ok_input_overlay_minimal_preset},
93279366
{MENU_ENUM_LABEL_OSK_OVERLAY_PRESET, action_ok_osk_overlay_preset},
93289367
{MENU_ENUM_LABEL_RECORD_CONFIG, action_ok_record_configfile},
93299368
{MENU_ENUM_LABEL_STREAM_CONFIG, action_ok_stream_configfile},
@@ -9579,6 +9618,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
95799618
{MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN, action_ok_audio_dsp_plugin},
95809619
{MENU_ENUM_LABEL_VIDEO_FILTER, action_ok_video_filter},
95819620
{MENU_ENUM_LABEL_OVERLAY_PRESET, action_ok_overlay_preset},
9621+
{MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET, action_ok_input_overlay_minimal_preset},
95829622
{MENU_ENUM_LABEL_OSK_OVERLAY_PRESET, action_ok_osk_overlay_preset},
95839623
{MENU_ENUM_LABEL_REMAP_FILE_LOAD, action_ok_remap_file},
95849624
{MENU_ENUM_LABEL_OVERRIDE_FILE_LOAD, action_ok_override_file},

menu/menu_cbs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ enum
8484
ACTION_OK_DL_AUDIO_DSP_PLUGIN,
8585
ACTION_OK_DL_VIDEO_FILTER,
8686
ACTION_OK_DL_OVERLAY_PRESET,
87+
ACTION_OK_DL_INPUT_OVERLAY_MINIMAL_PRESET,
8788
ACTION_OK_DL_OSK_OVERLAY_PRESET,
8889
ACTION_OK_DL_VIDEO_FONT,
8990
ACTION_OK_DL_SHADER_PASS,

menu/menu_setting.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18136,22 +18136,10 @@ static bool setting_append_list(
1813618136
);
1813718137
(*list)[list_info->index - 1].change_handler = overlay_enable_toggle_change_handler;
1813818138

18139-
CONFIG_BOOL(
18140-
list, list_info,
18141-
&settings->bools.input_overlay_hide_when_gamepad_connected,
18142-
MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED,
18143-
MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED,
18144-
DEFAULT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED,
18145-
MENU_ENUM_LABEL_VALUE_OFF,
18146-
MENU_ENUM_LABEL_VALUE_ON,
18147-
&group_info,
18148-
&subgroup_info,
18149-
parent_group,
18150-
general_write_handler,
18151-
general_read_handler,
18152-
SD_FLAG_NONE
18153-
);
18154-
(*list)[list_info->index - 1].change_handler = overlay_enable_toggle_change_handler;
18139+
/* Legacy "Hide When Controller Is Connected" bool is superseded by
18140+
* input_overlay_behavior (FR #18178). The cfg key + migration in
18141+
* configuration.c are kept for downgrade safety; the menu entry is
18142+
* intentionally not registered so users see only the new enum. */
1815518143

1815618144
CONFIG_UINT(
1815718145
list, list_info,

msg_hash_lbl_str.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@
685685
#define MENU_ENUM_LABEL_OVERLAY_OPACITY_STR "input_overlay_opacity"
686686
#define MENU_ENUM_LABEL_OSK_OVERLAY_OPACITY_STR "input_osk_overlay_opacity"
687687
#define MENU_ENUM_LABEL_OVERLAY_PRESET_STR "input_overlay"
688+
#define MENU_ENUM_LABEL_INPUT_OVERLAY_MINIMAL_PRESET_STR "input_overlay_minimal"
688689
#define MENU_ENUM_LABEL_OSK_OVERLAY_PRESET_STR "input_osk_overlay"
689690
#define MENU_ENUM_LABEL_OVERLAY_SCALE_LANDSCAPE_STR "input_overlay_scale_landscape"
690691
#define MENU_ENUM_LABEL_OVERLAY_ASPECT_ADJUST_LANDSCAPE_STR "input_overlay_aspect_adjust_landscape"

retroarch.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5865,6 +5865,9 @@ void retroarch_override_setting_set(
58655865
case RARCH_OVERRIDE_SETTING_OVERLAY_PRESET:
58665866
p_rarch->flags |= RARCH_FLAGS_HAS_SET_OVERLAY_PRESET;
58675867
break;
5868+
case RARCH_OVERRIDE_SETTING_OVERLAY_MINIMAL_PRESET:
5869+
p_rarch->flags |= RARCH_FLAGS_HAS_SET_OVERLAY_MINIMAL_PRESET;
5870+
break;
58685871
case RARCH_OVERRIDE_SETTING_NONE:
58695872
default:
58705873
break;
@@ -5950,6 +5953,9 @@ void retroarch_override_setting_unset(
59505953
case RARCH_OVERRIDE_SETTING_OVERLAY_PRESET:
59515954
p_rarch->flags &= ~RARCH_FLAGS_HAS_SET_OVERLAY_PRESET;
59525955
break;
5956+
case RARCH_OVERRIDE_SETTING_OVERLAY_MINIMAL_PRESET:
5957+
p_rarch->flags &= ~RARCH_FLAGS_HAS_SET_OVERLAY_MINIMAL_PRESET;
5958+
break;
59535959
case RARCH_OVERRIDE_SETTING_NONE:
59545960
default:
59555961
break;
@@ -8821,6 +8827,8 @@ bool retroarch_override_setting_is_set(
88218827
return ((p_rarch->flags & RARCH_FLAGS_CLI_DATABASE_SCAN) > 0);
88228828
case RARCH_OVERRIDE_SETTING_OVERLAY_PRESET:
88238829
return ((p_rarch->flags & RARCH_FLAGS_HAS_SET_OVERLAY_PRESET) > 0);
8830+
case RARCH_OVERRIDE_SETTING_OVERLAY_MINIMAL_PRESET:
8831+
return ((p_rarch->flags & RARCH_FLAGS_HAS_SET_OVERLAY_MINIMAL_PRESET) > 0);
88248832
case RARCH_OVERRIDE_SETTING_NONE:
88258833
default:
88268834
break;

retroarch.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ enum rarch_state_flags
112112
RARCH_FLAGS_CLI_DATABASE_SCAN = (1 << 14),
113113
RARCH_FLAGS_HAS_SET_XDELTA_PREF = (1 << 15),
114114
RARCH_FLAGS_XDELTA_PREF = (1 << 16),
115-
RARCH_FLAGS_HAS_SET_OVERLAY_PRESET = (1 << 17)
115+
RARCH_FLAGS_HAS_SET_OVERLAY_PRESET = (1 << 17),
116+
RARCH_FLAGS_HAS_SET_OVERLAY_MINIMAL_PRESET = (1 << 18)
116117
};
117118

118119
bool retroarch_ctl(enum rarch_ctl_state state, void *data);

0 commit comments

Comments
 (0)