summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/HiresTextures.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-06-20 04:01:19 -0400
committerGitHub <noreply@github.com>2021-06-20 04:01:19 -0400
commitc788beecfc2946260e87ae11718608ad4e10d898 (patch)
tree4bfea3bb81c50cacc72f38efc6f81b26702cde51 /Source/Core/VideoCommon/HiresTextures.cpp
parent3e1a25ead050554add154efcc236e1f7a9d427e9 (diff)
parentdf53a5f8809d1f9c21a2975a2fd6e98e9c7a8424 (diff)
Merge pull request #9711 from iwubcode/enhance-wildcard-support
VideoCommon: enhance wildcard support in hi res texture lookup
Diffstat (limited to 'Source/Core/VideoCommon/HiresTextures.cpp')
-rw-r--r--Source/Core/VideoCommon/HiresTextures.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp
index 96c9ccbf10..20a394586b 100644
--- a/Source/Core/VideoCommon/HiresTextures.cpp
+++ b/Source/Core/VideoCommon/HiresTextures.cpp
@@ -221,20 +221,29 @@ std::string HiresTexture::GenBaseName(TextureInfo& texture_info, bool dump)
const auto texture_name_details = texture_info.CalculateTextureName();
- // try to match a wildcard template
- if (!dump)
- {
- const std::string texture_name =
- fmt::format("{}_${}", texture_name_details.base_name, texture_name_details.format_name);
- if (s_textureMap.find(texture_name) != s_textureMap.end())
- return texture_name;
- }
-
- // else generate the complete texture
+ // look for an exact match first
const std::string full_name = texture_name_details.GetFullName();
if (dump || s_textureMap.find(full_name) != s_textureMap.end())
return full_name;
+ // else try and find a wildcard
+ if (!dump)
+ {
+ // Single wildcard ignoring the tlut hash
+ const std::string texture_name_single_wildcard_tlut =
+ fmt::format("{}_{}_$_{}", texture_name_details.base_name, texture_name_details.texture_name,
+ texture_name_details.format_name);
+ if (s_textureMap.find(texture_name_single_wildcard_tlut) != s_textureMap.end())
+ return texture_name_single_wildcard_tlut;
+
+ // Single wildcard ignoring the texture hash
+ const std::string texture_name_single_wildcard_tex =
+ fmt::format("{}_${}_{}", texture_name_details.base_name, texture_name_details.tlut_name,
+ texture_name_details.format_name);
+ if (s_textureMap.find(texture_name_single_wildcard_tex) != s_textureMap.end())
+ return texture_name_single_wildcard_tex;
+ }
+
return "";
}