Skip to content

Commit

Permalink
Merge pull request hrydgard#17084 from hrydgard/replacement-remove-op…
Browse files Browse the repository at this point in the history
…tion

Remove hidden option ReplaceTextureAllowLate
  • Loading branch information
hrydgard authored Mar 9, 2023
2 parents cabc00b + 8e02f14 commit 938230e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
1 change: 0 additions & 1 deletion Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,6 @@ static const ConfigSetting graphicsSettings[] = {
ReportedConfigSetting("ReplaceTextures", &g_Config.bReplaceTextures, true, true, true),
ReportedConfigSetting("SaveNewTextures", &g_Config.bSaveNewTextures, false, true, true),
ConfigSetting("IgnoreTextureFilenames", &g_Config.bIgnoreTextureFilenames, false, true, true),
ConfigSetting("ReplaceTexturesAllowLate", &g_Config.bReplaceTexturesAllowLate, true, true, true),

ReportedConfigSetting("TexScalingLevel", &g_Config.iTexScalingLevel, 1, true, true),
ReportedConfigSetting("TexScalingType", &g_Config.iTexScalingType, 0, true, true),
Expand Down
1 change: 0 additions & 1 deletion Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ struct Config {
bool bReplaceTextures;
bool bSaveNewTextures;
bool bIgnoreTextureFilenames;
bool bReplaceTexturesAllowLate;
int iTexScalingLevel; // 0 = auto, 1 = off, 2 = 2x, ..., 5 = 5x
int iTexScalingType; // 0 = xBRZ, 1 = Hybrid
bool bTexDeposterize;
Expand Down
23 changes: 8 additions & 15 deletions Core/TextureReplacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ ReplacedTexture *TextureReplacer::FindReplacement(u64 cachekey, u32 hash, int w,
ReplacedTexture *result = new ReplacedTexture();
cache_[replacementKey] = result;
result->vfs_ = this->vfs_;
if (!g_Config.bReplaceTexturesAllowLate || budget > 0.0) {
if (budget > 0.0) {
PopulateReplacement(result, cachekey, hash, w, h);
}
return result;
Expand Down Expand Up @@ -998,20 +998,13 @@ bool ReplacedTexture::IsReady(double budget) {
if (!prepareDone_)
return false;

if (g_Config.bReplaceTexturesAllowLate) {
if (threadWaitable_)
delete threadWaitable_;
threadWaitable_ = new LimitedWaitable();
g_threadManager.EnqueueTask(new ReplacedTextureTask(vfs_, *this, threadWaitable_));

if (threadWaitable_->WaitFor(budget)) {
// If we finished all the levels, we're done.
return initDone_ && levelData_ != nullptr && !levelData_->data.empty();
}
} else {
Prepare(vfs_);
_assert_(initDone_);
return true;
if (threadWaitable_)
delete threadWaitable_;
threadWaitable_ = new LimitedWaitable();
g_threadManager.EnqueueTask(new ReplacedTextureTask(vfs_, *this, threadWaitable_));
if (threadWaitable_->WaitFor(budget)) {
// If we finished all the levels, we're done.
return initDone_ && levelData_ != nullptr && !levelData_->data.empty();
}

// Still pending on thread.
Expand Down

0 comments on commit 938230e

Please sign in to comment.