Refresh less when downloading covers

This commit is contained in:
wiidev 2023-01-01 17:00:15 +00:00
parent fbfcba4200
commit a6e073f018
2 changed files with 22 additions and 20 deletions

View File

@ -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<std::string> 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());

View File

@ -1,7 +1,9 @@
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>
#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::vector<std
char gameID[7];
char filepath[512];
MissingFilesList.clear();
wString oldFilter(gameList.GetCurrentFilter());
//! make sure that all games are added to the gamelist
gameList.LoadUnfiltered();
for (int i = 0; i < gameList.size(); ++i)
{
struct discHdr* header = gameList[i];
// Only GameCube games might have missing banners
if (strcmp(fileext, ".bnr") == 0 && !(header->type >= 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<std
}
}
//! Bring game list to the old state
gameList.FilterList(oldFilter.c_str());
gprintf(" = %i\n", MissingFilesList.size());
return MissingFilesList.size();