From fe5b06cc17eccd81630f47044dd4911a6ca32c40 Mon Sep 17 00:00:00 2001 From: NR74W <62298614+NR74W@users.noreply.github.com> Date: Mon, 13 Apr 2020 03:32:03 +0200 Subject: [PATCH] Add option to prevent Mipmaps from being dumped --- Core/TextureReplacer.cpp | 5 +++++ Core/TextureReplacer.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index 1c1270d894..7ad5ac246e 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -80,6 +80,7 @@ bool TextureReplacer::LoadIni() { allowVideo_ = false; ignoreAddress_ = false; reduceHash_ = false; + disallowMipmap_ = false; if (File::Exists(basePath_ + INI_FILENAME)) { IniFile ini; @@ -128,6 +129,7 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, bool isOverride) { options->Get("ignoreAddress", &ignoreAddress_, ignoreAddress_); // Multiplies sizeInRAM/bytesPerLine in XXHASH by 0.5. options->Get("reduceHash", &reduceHash_, reduceHash_); + options->Get("disallowMipmap", &disallowMipmap_, disallowMipmap_); if (reduceHash_ && hash_ == ReplacedTextureHash::QUICK) { reduceHash_ = false; ERROR_LOG(G3D, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead."); @@ -411,6 +413,9 @@ void TextureReplacer::NotifyTextureDecoded(const ReplacedTextureDecodeInfo &repl if (ignoreAddress_) { cachekey = cachekey & 0xFFFFFFFFULL; } + if (disallowMipmap_ && level > 0) { + return; + } std::string hashfile = LookupHashFile(cachekey, replacedInfo.hash, level); const std::string filename = basePath_ + hashfile; diff --git a/Core/TextureReplacer.h b/Core/TextureReplacer.h index 35e3c22a1a..5035251cd5 100644 --- a/Core/TextureReplacer.h +++ b/Core/TextureReplacer.h @@ -203,6 +203,7 @@ protected: bool allowVideo_ = false; bool ignoreAddress_ = false; bool reduceHash_ = false; + bool disallowMipmap_ = false; std::string gameID_; std::string basePath_; ReplacedTextureHash hash_ = ReplacedTextureHash::QUICK;