Skip to content

Conversation

@nchapman
Copy link
Collaborator

Resolves issues where core options would not appear or cause crashes when option visibility changed during menu navigation. The root cause was twofold: FC/FDS config files locked visibility toggle options (preventing users from seeing advanced options), and the menu system would crash when libretro cores changed option visibility mid-session.

Changes:

  • Remove locked status from fceumm_show_adv_* options in FC/FDS configs
  • Add dirty flag system to PlayerOptionList and MenuList for deferred rebuilds
  • Implement Menu_refreshItems() to safely update menu after visibility changes
  • Track selected option by key (not index) to preserve selection across rebuilds
  • Call update_visibility_callback after option changes, rebuild immediately if dirty
  • Add NULL safety checks when accessing current_key

Copilot AI review requested due to automatic review settings December 19, 2025 23:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes critical issues with libretro core option visibility and menu refresh crashes. The root cause was twofold: FC/FDS config files had locked visibility toggle options (preventing users from accessing advanced options), and the menu system would crash when libretro cores dynamically changed option visibility during menu navigation.

Key changes:

  • Implements a dirty flag system for deferred menu rebuilds when option visibility changes
  • Adds Menu_refreshItems() to safely update menu state after visibility changes mid-session
  • Tracks selected option by key (not index) to preserve user selection across rebuilds

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
workspace/all/player/player_options.h Adds dirty flag to PlayerOptionList to track when visibility changes require rebuild
workspace/all/player/player_menu_types.h Adds dirty flag to MenuList to signal that items array needs reloading
workspace/all/player/player.c Implements deferred rebuild logic, Menu_refreshItems helper, and key-based selection tracking
workspace/all/paks/Emus/configs/base/FC/default.cfg Removes locked status from visibility options; changes sound quality setting
workspace/all/paks/Emus/configs/base/FDS/default.cfg Removes locked status from visibility options; changes sound quality setting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Resolves issues where core options would not appear or cause crashes
when option visibility changed during menu navigation. The root cause
was twofold: FC/FDS config files locked visibility toggle options
(preventing users from seeing advanced options), and the menu system
would crash when libretro cores changed option visibility mid-session.

Changes:
- Remove locked status from fceumm_show_adv_* options in FC/FDS configs
- Add dirty flag system to PlayerOptionList and MenuList for deferred
  rebuilds
- Implement Menu_refreshItems() to safely update menu after visibility
  changes
- Track selected option by key (not index) to preserve selection across
  rebuilds
- Call update_visibility_callback after option changes, rebuild
  immediately if dirty
- Add NULL safety checks when accessing current_key
@nchapman nchapman force-pushed the feature/fix-libretro-menu-options branch from 9d04d0a to 0d2a442 Compare December 19, 2025 23:46
When changing an option triggered visibility updates, the on_change
callback was calling OptionsMenu_buildAndShow() which recursively
entered Menu_options(), creating a nested menu with fresh state.

Split OptionsMenu_buildAndShow into OptionsMenu_rebuild (build-only) and
OptionsMenu_buildAndShow (build + show). The callback now uses
OptionsMenu_rebuild, allowing the existing menu loop to handle the
refresh via Menu_refreshItems which preserves selection by key.
@nchapman nchapman merged commit db0af0e into develop Dec 20, 2025
4 checks passed
@nchapman nchapman deleted the feature/fix-libretro-menu-options branch December 20, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants