From 8b106c8d9934df8d64a23674a7864811b008333f Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 16 May 2022 19:59:34 +0200 Subject: [PATCH] Fixed an issue where the screensaver would include all games when in Kid UI mode. --- es-app/src/Screensaver.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/es-app/src/Screensaver.cpp b/es-app/src/Screensaver.cpp index bc12f2e2d..30f14e49e 100644 --- a/es-app/src/Screensaver.cpp +++ b/es-app/src/Screensaver.cpp @@ -12,6 +12,7 @@ #include "FileData.h" #include "Log.h" #include "SystemData.h" +#include "UIModeController.h" #include "components/VideoFFmpegComponent.h" #include "resources/Font.h" #include "utils/FileSystemUtil.h" @@ -444,8 +445,12 @@ void Screensaver::generateImageList() if (!(*it)->isGameSystem() || (*it)->isCollection()) continue; - std::vector allFiles = (*it)->getRootFolder()->getFilesRecursive(GAME, true); + std::vector allFiles {(*it)->getRootFolder()->getFilesRecursive(GAME, true)}; for (auto it2 = allFiles.cbegin(); it2 != allFiles.cend(); ++it2) { + // Only include games suitable for children if we're in Kid UI mode. + if (UIModeController::getInstance()->isUIModeKid() && + (*it2)->metadata.get("kidgame") != "true") + continue; std::string imagePath = (*it2)->getImagePath(); if (imagePath != "") mImageFiles.push_back((*it2)); @@ -461,8 +466,12 @@ void Screensaver::generateVideoList() if (!(*it)->isGameSystem() || (*it)->isCollection()) continue; - std::vector allFiles = (*it)->getRootFolder()->getFilesRecursive(GAME, true); + std::vector allFiles {(*it)->getRootFolder()->getFilesRecursive(GAME, true)}; for (auto it2 = allFiles.cbegin(); it2 != allFiles.cend(); ++it2) { + // Only include games suitable for children if we're in Kid UI mode. + if (UIModeController::getInstance()->isUIModeKid() && + (*it2)->metadata.get("kidgame") != "true") + continue; std::string videoPath = (*it2)->getVideoPath(); if (videoPath != "") mVideoFiles.push_back((*it2));