Fixed an issue where custom collections 'Jump to game' caused multiple mCursorStackHistory entries.

This commit is contained in:
Leon Styhre 2021-03-27 12:06:37 +01:00
parent 308bcc1085
commit ad04963431

View file

@ -214,6 +214,18 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
// Jump to the randomly selected game. // Jump to the randomly selected game.
if (mRandomGame) { if (mRandomGame) {
NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND); NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND);
// If there is already an mCursorStackHistory entry for the collection, then
// remove it so we don't get multiple entries.
std::vector<FileData*> listEntries =
mRandomGame->getSystem()->getRootFolder()->getChildrenListToDisplay();
for (auto it = mCursorStackHistory.begin();
it != mCursorStackHistory.end(); it++) {
if (std::find(listEntries.begin(), listEntries.end(), *it) !=
listEntries.end()) {
mCursorStackHistory.erase(it);
break;
}
}
setCursor(mRandomGame); setCursor(mRandomGame);
updateHelpPrompts(); updateHelpPrompts();
} }