Conversation
The last played game is flagged with submenu.selected while the list is being appended, and GUI_OP_APPEND_MENU turns that flag into remindLast. That branch is an "else if" chained to the "first subitem in list" case, so when the remembered game happens to be index 0 of the unsorted list the first branch consumes it and remindLast is never set. GUI_OP_SORT then sees remindLast == 0 and resets current to the head of the sorted list, so that one game is never restored, and the Last Played Auto Start counter is never released for it either. Which entry is index 0 is not visible to the user: sbReadList() places ul.cfg entries first and scanForISO() prepends while walking the directory, so it is typically the most recently copied ISO. Split the chain into two independent ifs. Behaviour is unchanged for every other entry; for index 0 the second block just re-assigns the same node and raises remindLast. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
I will review it by tomorrow. |
|
Merged, it seems fine. |
Problem
With "remember last played" enabled, exactly one game per device list is never restored,
and the Last Played Auto Start countdown never fires for it. Which game that is looks
arbitrary from the outside: it is whichever entry ends up at index 0 of the unsorted list,
which in practice is usually the most recently copied ISO.
Cause
updateMenuFromGameList()flags the remembered game withsubmenu.selected, andGUI_OP_APPEND_MENUturns that flag intomenu->remindLast. That branch is chained as anelse ifto the "first subitem in list" case:When the remembered game is the first item appended, the first branch consumes it and
remindLastis never set.GUI_OP_SORTthen runs:and the cursor goes back to the top of the alphabetically sorted list. The same branch
also holds the
DisableCron = 0that releases the auto start counter, so that never firesfor this entry either.
Which entry sits at index 0 is not visible to the user:
sbReadList()stores theul.cfgentries first, and
scanForISO()prepends each entry while walking the directory, so thelast file
readdir()returns is the one that ends up first.Fix
Split the chain into two independent
ifs. Behaviour is unchanged for every other entry;for index 0 the second block simply re-assigns the same node and raises
remindLast.Testing
Reproduced on real hardware with the most recently copied ISO on an MMCE device: the game
id was written to
wopl_last_played.cfgcorrectly, but the list always opened on the firstentry and no auto start countdown appeared. With this patch the same game is restored as
the selected item and the countdown shows up. Every other game in the list behaves exactly
as before.
🤖 Generated with Claude Code