Commit f7f6bf7f authored by Bkg2k's avatar Bkg2k Committed by OyyoDams

Resolve "Demo mode do not list games in subfolders"

parent f640bcf3
......@@ -24,13 +24,16 @@ DemoMode::DemoMode(Window& window)
const std::string& name = allSystems[i]->getName();
bool includeSystem = mRecalboxConf.getBool(name + ".demo.include");
bool systemIsInIncludeList = !systemListExists || mRecalboxConf.isInList("global.demo.systemlist", name);
if ((includeSystem || systemIsInIncludeList) &&
(allSystems[i]->getRootFolder()->countAllDisplayableItemsRecursively(false) > 0))
int gameCount = allSystems[i]->getRootFolder()->countAllDisplayableItemsRecursively(false);
LOG(LogDebug) << "System elligible for Demo : " << allSystems[i]->getName() << " - isSelected: " << (includeSystem | systemIsInIncludeList) << " - gameCount: " << gameCount;
if ((includeSystem || systemIsInIncludeList) && (gameCount > 0))
{
mDemoSystems.push_back(allSystems[i]);
int systemDuration = mRecalboxConf.getUInt(name + ".demo.duration", (unsigned int)mDefaultDuration);
mDurations.push_back(systemDuration);
LOG(LogInfo) << "System selected for demo : " << allSystems[i]->getName() << " with session of " << systemDuration << "s";
}
else LOG(LogDebug) << "System NOT selected for demo : " << allSystems[i]->getName();
}
// Check if there is at least one system.
......
......@@ -185,7 +185,7 @@ class FolderData : public FileData
* @param includefolders True to include subfolders in the resulting list
* @return Number of displayable items
*/
int countAllDisplayableItemsRecursively(bool includefolders) const { return countItems(Filter::Normal | Filter::Favorite, includefolders); }
int countAllDisplayableItemsRecursively(bool includefolders) const { return countItemsRecursively(Filter::Normal | Filter::Favorite, includefolders); }
/*!
* Get filtered items recursively starting from the current folder
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment