Skip to content

Commit

Permalink
VideoCommon: enhance hi res texture support by having exact matches b…
Browse files Browse the repository at this point in the history
…e picked before wildcard matches. Additionally, add the ability to ignore the texture hash portion of the texture name when loading a hi res texture
  • Loading branch information
iwubcode committed May 16, 2021
1 parent 46f69cf commit 6981cc7
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions Source/Core/VideoCommon/HiresTextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}

Expand Down

0 comments on commit 6981cc7

Please sign in to comment.