From 3a59c77d3e3904728b6c46e5a51b9df8e60fcdfa Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 6 Aug 2020 22:11:55 +0200 Subject: [PATCH] Games marked not to be counted are now also excluded from the 'Recent' and 'Favorites' collections. Also fixed a crash when opening the game options menu when a placeholder was selected. --- es-app/src/CollectionSystemManager.cpp | 14 +++++++------- es-app/src/guis/GuiGamelistOptions.cpp | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/es-app/src/CollectionSystemManager.cpp b/es-app/src/CollectionSystemManager.cpp index 45d799aa9..f4e0aa1d2 100644 --- a/es-app/src/CollectionSystemManager.cpp +++ b/es-app/src/CollectionSystemManager.cpp @@ -281,8 +281,7 @@ void CollectionSystemManager::refreshCollectionSystems(FileData* file) void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionSystemData sysData) { - if (sysData.isPopulated) - { + if (sysData.isPopulated) { // Collection files use the full path as key, to avoid clashes. std::string key = file->getFullPath(); @@ -316,7 +315,7 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS ViewController::get()-> getGameListView(curSys).get()->remove(collectionEntry, false); } - else if (name == "all" && !file->getCountAsGame()) { + else if (curSys->isCollection() && !file->getCountAsGame()) { // If the countasgame flag has been set to false, then remove the game. ViewController::get()-> getGameListView(curSys).get()->remove(collectionEntry, false); @@ -331,9 +330,10 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS else { bool addGame = false; // We didn't find it here - we need to check if we should add it. - if (name == "recent" && file->metadata.get("playcount") > "0" && - includeFileInAutoCollections(file) || name == "favorites" && - file->metadata.get("favorite") == "true") + if ((name == "recent" && file->metadata.get("playcount") > "0" && + file->getCountAsGame() && includeFileInAutoCollections(file)) || + (name == "favorites" && file->metadata.get("favorite") == "true" && + file->getCountAsGame())) addGame = true; else if (name == "all" && file->getCountAsGame()) addGame = true; @@ -839,7 +839,7 @@ void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysDa if (include) { // Exclude files that are set not to be counted as games. - if (rootFolder->getName() == "all" && !(*gameIt)->getCountAsGame()) + if (!(*gameIt)->getCountAsGame()) continue; CollectionFileData* newGame = new CollectionFileData(*gameIt, newSys); diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index 910814e41..257406d8f 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -42,7 +42,8 @@ GuiGamelistOptions::GuiGamelistOptions( // Read the setting for whether folders are sorted on top of the gamelists. // Also check if the gamelist only contains folders, as generated by the FileData sorting. mFoldersOnTop = Settings::getInstance()->getBool("FoldersOnTop"); - mOnlyHasFolders = file->getParent()->getOnlyFoldersFlag(); + if (file->getType() != PLACEHOLDER) + mOnlyHasFolders = file->getParent()->getOnlyFoldersFlag(); // Read the applicable favorite sorting setting depending on whether the // system is a custom collection or not.