menu_cbs_sublabel: collapse the boilerplate sublabel functions to data

The common sublabel case was expressed as ~1090 generated functions,
each with the identical body strlcpy(s, msg_hash_to_str(ENUM), len)
differing only by the enum, plus a data table pairing each label enum
to its function. That is a function per setting for what is really a
single lookup.

The sublabel_map table now stores the description enum directly
({ label, sublabel }) and one generic handler
(action_bind_sublabel_from_enum) reads it, so 791 of the generated
functions become dead and are removed. Entries whose sublabel is
compile-conditional (runahead_mode, video_ctx_scaling,
menu_widget_scale_factor, quit_retroarch, gamemode_enable) or
genuinely dynamic (core/playlist/subsystem entries) keep their
functions via a separate sublabel_func_map walked after the enum map.

The label->sublabel mapping is unchanged: verified statically that
all 831 entries resolve to the identical sublabel as before (0 lost,
0 changed), and verified at runtime by dumping the resolved string
for every bound enum (814 entries, all correct). Guard-permutation
sweep clean; the removed functions are dead under both minimal and
full HAVE_ flag sets. Settings dump byte-identical.

menu_cbs_sublabel.o: .text 60649 -> 22822 (-37827), and the
function-pointer table in .data.rel.ro collapses 13504 -> 544; net
object ~43KB smaller. Source 4492 -> 3729 lines. A new setting's
description now resolves from its enum with no sublabel edit for the
common case, removing one of the parallel per-setting tables.
This commit is contained in:
libretroadmin authored and libretroadmin committed 2026-07-08 17:48:05 +02:00
1 parent a47787771c
commit d636ba135c
2 files changed
+846 -1606

No files matched your search

+843 -1606
View File
File diff suppressed because it is too large. Load diff
+3
View File
@@ -156,6 +156,9 @@ typedef struct menu_file_list_cbs
char *s2, size_t len2);
menu_search_terms_t search;
enum msg_hash_enums enum_idx;
/* When the generic sublabel handler is bound from the data map,
* this carries the description enum to look up. */
enum msg_hash_enums sublabel_enum;
bool checked;
} menu_file_list_cbs_t;