Fixed an issue where the gamelist would not always display newly generated miximages.

Also changed some MiximageGenerator error message from uppercase to lowercase.
This commit is contained in:
Leon Styhre 2021-06-08 21:07:35 +02:00
parent e25c43a6cc
commit 4fde0e72d1
2 changed files with 14 additions and 9 deletions

View file

@ -43,6 +43,7 @@ void MiximageGenerator::startThread(std::promise<bool>* miximagePromise)
if (mGame->getMiximagePath() != "" && !Settings::getInstance()->getBool("MiximageOverwrite")) {
LOG(LogDebug) << "MiximageGenerator::MiximageGenerator(): File already exists and miximage "
"overwriting has not been enabled, aborting";
mResult = true;
mMiximagePromise->set_value(true);
return;
}
@ -50,7 +51,8 @@ void MiximageGenerator::startThread(std::promise<bool>* miximagePromise)
if ((mScreenshotPath = mGame->getScreenshotPath()) == "") {
LOG(LogDebug) << "MiximageGenerator::MiximageGenerator(): "
"No screenshot image found, aborting";
mResultMessage = "NO SCREENSHOT IMAGE FOUND, COULDN'T GENERATE MIXIMAGE";
mResultMessage = "No screenshot image found, couldn't generate miximage";
mResult = true;
mMiximagePromise->set_value(true);
return;
}
@ -97,6 +99,7 @@ void MiximageGenerator::startThread(std::promise<bool>* miximagePromise)
(endTime - startTime).count() << " ms";
}
mResult = false;
mResultMessage = mMessage;
mMiximagePromise->set_value(false);
}
@ -128,7 +131,7 @@ bool MiximageGenerator::generateImage()
if (fileFormat == FIF_UNKNOWN) {
LOG(LogError) << "Screenshot image in unknown image format, aborting";
mMessage = "SCREENSHOT IMAGE IN UNKNOWN FORMAT, COULDN'T GENERATE MIXIMAGE";
mMessage = "Screenshot image in unknown format, couldn't generate miximage";
return true;
}
@ -143,13 +146,13 @@ bool MiximageGenerator::generateImage()
}
else {
LOG(LogError) << "Screenshot file format not supported";
mMessage = "SCREENSHOT IMAGE IN UNSUPPORTED FORMAT, COULDN'T GENERATE MIXIMAGE";
mMessage = "Screenshot image in unsupported format, couldn't generate miximage";
return true;
}
if (!screenshotFile) {
LOG(LogError) << "Error loading screenshot image, corrupt file?";
mMessage = "ERROR LOADING SCREENSHOT IMAGE, COULDN'T GENERATE MIXIMAGE";
mMessage = "Error loading screenshot image, couldn't generate miximage";
return true;
}
@ -187,7 +190,7 @@ bool MiximageGenerator::generateImage()
#endif
if (!marqueeFile) {
LOG(LogError) << "Couldn't load marquee image, corrupt file?";
mMessage = "ERROR LOADING MARQUEE IMAGE, CORRUPT FILE?";
mMessage = "Error loading marquee image, corrupt file?";
mMarquee = false;
}
}
@ -226,7 +229,7 @@ bool MiximageGenerator::generateImage()
#endif
if (!boxFile) {
LOG(LogError) << "Couldn't load 3D box image, corrupt file?";
mMessage = "ERROR LOADING 3D BOX IMAGE, CORRUPT FILE?";
mMessage = "Error loading 3d box image, corrupt file?";
mBox3D = false;
}
}
@ -265,7 +268,7 @@ bool MiximageGenerator::generateImage()
#endif
if (!boxFile) {
LOG(LogError) << "Couldn't load box cover image, corrupt file?";
mMessage = "ERROR LOADING BOX COVER IMAGE, CORRUPT FILE?";
mMessage = "Error loading box cover image, corrupt file?";
mCover = false;
}
}

View file

@ -318,6 +318,7 @@ void GuiScraperSearch::updateViewStyle()
void GuiScraperSearch::search(const ScraperSearchParams& params)
{
mBlockAccept = true;
mMiximageResult = false;
mScrapeResult = {};
mResultList->clear();
@ -339,6 +340,7 @@ void GuiScraperSearch::stop()
mMDRetrieveURLsHandle.reset();
mMiximageGenerator.reset();
mBlockAccept = false;
mMiximageResult = false;
mScrapeResult = {};
}
@ -663,11 +665,11 @@ void GuiScraperSearch::update(int deltaTime)
// Only wait one millisecond, this update() function runs very frequently.
if (mGeneratorFuture.wait_for(std::chrono::milliseconds(1)) == std::future_status::ready) {
mMDResolveHandle.reset();
// We always let the miximage generator thread complete.
mMiximageGeneratorThread.join();
if (!mMiximageResult)
mScrapeResult.savedNewMedia = true;
returnResult(mScrapeResult);
// We always let the miximage generator thread complete.
mMiximageGeneratorThread.join();
mMiximageGenerator.reset();
}
}