Files
LibretroAdmin bc33d8426a menu: the verbosity toggle transitions instead of snapping back
The logger audit asked whether verbosity_get_ptr() could go; walking
its one consumer found the setting bound to it broken outright. The
menu's bool actions write the bound flag first and run the change
handler second, and write_handler_logging_verbosity() read
verbosity_is_enabled() - the same memory, post-write - to pick the
transition. Every press therefore ran the opposite one: from off,
toggling on saw the freshly written true, called verbosity_disable()
and rarch_log_file_deinit(), and snapped the flag back; from a
config-loaded on, toggling off re-initialized the log file and
re-enabled. The setting was stuck in both directions, churning the
log file against the display, and because verbosity_enable() and
verbosity_disable() re-assert the flag, the snap-back was invisible
to everything but the person pressing the button.

The handler now reads the freshly written value - the transition the
person asked for - and re-drives enable/disable from it, which also
answers the audit's bypass concern: the direct write through the
bound pointer is immediately reconciled, so the console
attach/detach side effect always follows.

On removing the getter: not worth it. The setting framework needs a
bool target to bind, the flag must stay in verbosity.c (logging
works before settings exist), and the alternative is a shadow bool
in menu code synced by hand. The getter stays with its contract
stated at the definition: one consumer, every write reconciled by
the change handler, nothing else writes through it.

samples/settings/verbosity_toggle links the shipping objects with
only main() replaced, boots the menu headless, finds the
LOG_VERBOSITY setting, verifies it is bound to the verbosity flag,
and drives its own right-press action: from off, press one lands
enabled with the log file open, press two lands disabled with it
closed, press three lands enabled again. Against the pre-fix handler
the probe fails exactly as the defect predicts - press one snaps
back to off with no file, and only the accidental parity of an
already-broken press one lets press two look right.

Verified: the toggle harness green (and red pre-fix as stated),
playlist_nav green, thread-read audit 0 findings / 0 allowlisted
pairs, C89 gate clean on menu_setting.c, full build scanned clean
for the warning classes, hot-function budgets and the 74-lane
compile matrix.
2026-09-16 09:45:57 +02:00
..