From a6e073f0186797f4efc74c82d2a6eb5c29e7af34 Mon Sep 17 00:00:00 2001 From: wiidev Date: Sun, 1 Jan 2023 17:00:15 +0000 Subject: [PATCH] Refresh less when downloading covers --- source/network/ImageDownloader.cpp | 22 ++++++++++------------ source/usbloader/GetMissingGameFiles.cpp | 20 ++++++++++++-------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/source/network/ImageDownloader.cpp b/source/network/ImageDownloader.cpp index 8f541e81..e48d4ecc 100644 --- a/source/network/ImageDownloader.cpp +++ b/source/network/ImageDownloader.cpp @@ -28,6 +28,7 @@ #include "language/gettext.h" #include "usbloader/GetMissingGameFiles.hpp" #include "utils/StringTools.h" +#include "usbloader/GameList.h" #include "gecko.h" #define VALID_IMAGE(x) (!(x->size == 36864 || x->size <= 1024 || x->size == 7386 || x->size <= 1174 || x->size == 4446 || x->data == NULL)) @@ -89,6 +90,11 @@ void ImageDownloader::Start() void ImageDownloader::FindMissingImages() { + wString oldFilter(gameList.GetCurrentFilter()); + + // Make sure that all games are added to the gamelist + gameList.LoadUnfiltered(); + if(choices & CheckedBox1) FindMissing(Settings.covers_path, Settings.URL_Covers3D, NULL, tr("Downloading 3D Covers"), NULL, ".png"); @@ -117,6 +123,9 @@ void ImageDownloader::FindMissingImages() { FindMissing(Settings.BNRCachePath, Settings.URL_Banners, NULL, tr("Downloading Custom Banners"), NULL, ".bnr"); } + + // Bring the game list back to it's old state + gameList.FilterList(oldFilter.c_str()); } void ImageDownloader::FindMissing(const char *writepath, const char *downloadURL, const char *backupURL, const char *progressTitle, const char *backupProgressTitle, const char *fileExt) @@ -128,18 +137,7 @@ void ImageDownloader::FindMissing(const char *writepath, const char *downloadURL } std::vector MissingFilesList; - - if((Settings.LoaderMode & MODE_GCGAMES) && strcmp(fileExt, ".bnr") == 0) - { - short LoaderModeBackup = Settings.LoaderMode; - Settings.LoaderMode = MODE_GCGAMES; // Limit banner download for GameCube Only. - GetMissingGameFiles(writepath, fileExt, MissingFilesList); - Settings.LoaderMode = LoaderModeBackup; - } - else - { - GetMissingGameFiles(writepath, fileExt, MissingFilesList); - } + GetMissingGameFiles(writepath, fileExt, MissingFilesList); int size = MissingImages.size(); MissingImages.resize(size+MissingFilesList.size()); diff --git a/source/usbloader/GetMissingGameFiles.cpp b/source/usbloader/GetMissingGameFiles.cpp index f04b3e67..486d5292 100644 --- a/source/usbloader/GetMissingGameFiles.cpp +++ b/source/usbloader/GetMissingGameFiles.cpp @@ -1,7 +1,9 @@ #include -#include +#include #include #include "FileOperations/fileops.h" +#include "settings/CSettings.h" +#include "settings/SettingsEnums.h" #include "usbloader/GameList.h" #include "wstring.hpp" #include "gecko.h" @@ -20,14 +22,19 @@ int GetMissingGameFiles(const char * path, const char * fileext, std::vectortype >= TYPE_GAME_GC_IMG && header->type <= TYPE_GAME_GC_EXTRACTED)) + continue; + + // NAND and EmuNAND games don't have disc artwork + if (strcmp(path, Settings.disc_path) == 0 && (header->type == TYPE_GAME_NANDCHAN || header->type == TYPE_GAME_EMUNANDCHAN)) + continue; + snprintf(gameID, sizeof(gameID), "%s", (char *) header->id); snprintf(filepath, sizeof(filepath), "%s/%s%s", path, gameID, fileext); @@ -64,9 +71,6 @@ int GetMissingGameFiles(const char * path, const char * fileext, std::vector