diff --git a/GPU/Common/ReplacedTexture.cpp b/GPU/Common/ReplacedTexture.cpp index 692a03465f..9340ec4ed8 100644 --- a/GPU/Common/ReplacedTexture.cpp +++ b/GPU/Common/ReplacedTexture.cpp @@ -88,18 +88,24 @@ private: bool ReplacedTexture::IsReady(double budget) { _assert_(vfs_ != nullptr); + double now = time_now_d(); + switch (State()) { case ReplacementState::ACTIVE: case ReplacementState::NOT_FOUND: if (threadWaitable_) { if (!threadWaitable_->WaitFor(budget)) { + lastUsed_ = now; return false; } // Successfully waited! Can get rid of it. threadWaitable_->WaitAndRelease(); threadWaitable_ = nullptr; + if (levelData_) { + levelData_->lastUsed = now; + } } - lastUsed_ = time_now_d(); + lastUsed_ = now; return true; case ReplacementState::UNINITIALIZED: // _dbg_assert_(false); @@ -112,7 +118,7 @@ bool ReplacedTexture::IsReady(double budget) { break; } - lastUsed_ = time_now_d(); + lastUsed_ = now; // Let's not even start a new texture if we're already behind. if (budget < 0.0) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index dbda83389d..3a7d149cba 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1514,7 +1514,7 @@ ReplacedTexture *TextureCacheCommon::FindReplacement(TexCacheEntry *entry, int & return nullptr; } - if ((entry->status & TexCacheEntry::STATUS_VIDEO) && replacer_.AllowVideo()) { + if ((entry->status & TexCacheEntry::STATUS_VIDEO) && !replacer_.AllowVideo()) { return nullptr; } diff --git a/GPU/Common/TextureReplacer.cpp b/GPU/Common/TextureReplacer.cpp index 6c94b76f73..94bf8c4126 100644 --- a/GPU/Common/TextureReplacer.cpp +++ b/GPU/Common/TextureReplacer.cpp @@ -216,8 +216,6 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, bool isOverride) { bool filenameWarning = false; if (ini.HasSection("hashes")) { - aliases_.clear(); - auto hashes = ini.GetOrCreateSection("hashes")->ToMap(); // Format: hashname = filename.png bool checkFilenames = g_Config.bSaveNewTextures && !g_Config.bIgnoreTextureFilenames && !vfsIsZip_; @@ -693,6 +691,9 @@ void TextureReplacer::NotifyTextureDecoded(const ReplacedTextureDecodeInfo &repl #endif if (slash != hashfile.npos) { // Does this ever happen? + // Answer: An alias could be used to save a texture in a subfolder of newTextureDir_ + // (i.e. if you had the hash and purged out your pngs to redump them), although I guess this usage is probably uncommon. - unknown + // Create any directory structure as needed. task->saveDirectory = newTextureDir_ / hashfile.substr(0, slash); task->createSaveDirectory = true;