Skip to content

menu: Scan on the Playlists tab and Ozone's sidebar no longer freezes the menu - #19904

Open
milnet01 wants to merge 2 commits into
libretro:masterfrom
milnet01:pr/playlists-scan
Open

milnet01 wants to merge 2 commits into
libretro:masterfrom
milnet01:pr/playlists-scan

Conversation

@milnet01

Copy link
Copy Markdown
Contributor

On the Playlists tab, Scan jumps to a random playlist other than the selected one. All four menu drivers did this by drawing random rows until one was a different playlist. With no other playlist to land on, the draw never ended and the menu froze. That happens with no playlists at all, or with only the selected one. random_range() can also return one past its maximum. The draw then read no row, kept the previous row's type, and the loop exited with the selection one past the end of the list.

One shared helper, menu_playlists_tab_random_selection() in menu_driver.c, now counts the other playlists and picks one of them with equal chance. With none, it returns the current selection and the driver does nothing. The four copies of the loop are gone. MaterialUI keeps its own navigation_set(..., false), as it had.

Ozone's sidebar has the same loop for its playlist tabs, fixed in the second commit. With one playlist tab, already selected, the draw never ended. With no playlist tabs, Scan opened a tab that does not exist, and a second Scan from there froze. It now counts the other playlist tabs the same way. Its scroll sound tested the list row rather than the tab; it now tests the tab.

Testing: a new harness, samples/menu/playlists_scan, links the shipping objects of a --disable-qt build with only main() replaced, the same way as samples/menu/playlist_nav. It boots each menu driver headless (null video, audio and input) and presses Scan through the driver's own action handler with zero, one and two playlists. On master, all four drivers (rgui, ozone, xmb, glui) fail: Scan never returns with no playlists, and with one playlist the selection moves to index 5 or 6 of a 5-row list (indexes 0 to 4). In Ozone's sidebar on master, one playlist tab freezes and zero tabs moves to a nonexistent tab. With the change, all four drivers and the three sidebar cases (zero, one and two playlist tabs) pass. Full ./configure --disable-qt && make -j4 builds with no warnings in the touched files.

🤖 Generated with Claude Code

milnet01 and others added 2 commits October 23, 2026 16:00
On the Playlists tab, Scan jumps to a random playlist other than the
selected one.  Each of the four menu drivers drew rows at random until
it hit one, so with no other playlist to land on the draw never ended
and the menu froze: no playlists at all, or only the selected one.
random_range() can also return one past its maximum; the draw then
read nothing, kept the previous row's type, and the loop exited with
the selection one past the end of the list.

One shared helper, menu_playlists_tab_random_selection(), now counts
the other playlists and picks one of them; with none it returns the
current selection and the driver does nothing.  The four copies of the
loop are gone.  MaterialUI keeps its own navigation_set(..., false).

Test: samples/menu/playlists_scan boots the shipping objects headless
(null video) per driver and presses Scan with zero, one and two
playlists.  Before the fix, rgui, ozone, xmb and glui froze with no
playlists; with one, the selection went to 5 on a 5-row list.  After,
all four pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In Ozone's sidebar each playlist is a tab, and Scan jumps to a random
playlist tab other than the current one by drawing until it hits one.
With one playlist tab, already selected, the draw never ended and the
menu froze.  With no playlist tabs the draw returned the slot after the
last tab, so Scan opened a tab that does not exist; a second Scan from
there froze.  Scan now counts the other playlist tabs, picks one of
them with equal chance, and does nothing when there is none.  The
scroll sound tested `selection` (the list row) rather than
`tab_selection`; it now tests the tab.

Test: samples/menu/playlists_scan gains `ozone sidebar<N>` runs with
0, 1 and 2 playlist tabs, entering the sidebar by Left and Up.  Red
before: sidebar0 moved to a nonexistent playlist tab then froze;
sidebar1 froze.  Green after: all three, and the four drivers' tab
runs.  Mutations, each red: no decrement for the current tab
(sidebar1 jumps past the end); no skip of the current tab (sidebar2
lands on itself); no "none" check (sidebar0 moves).  The zero-tab run
starts on the first tab, because from the last system tab the
no-check mutation lands back where it started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milnet01 added a commit to milnet01/RetroArch that referenced this pull request Oct 23, 2026
…debar Scan freezes)

CLAUDE.md rule 14: ROADMAP.md is not a contract document, no gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant