From b0c0d6444c6d97b7337f6617fddefef898c77285 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 28 Jan 2025 17:09:09 +1000 Subject: [PATCH] GPU/TextureCache: Fix parsing of C16 replacement names --- src/core/gpu_hw_texture_cache.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/gpu_hw_texture_cache.cpp b/src/core/gpu_hw_texture_cache.cpp index ea8917982..1694c365b 100644 --- a/src/core/gpu_hw_texture_cache.cpp +++ b/src/core/gpu_hw_texture_cache.cpp @@ -2460,13 +2460,14 @@ bool GPUTextureCache::TextureReplacementName::Parse(const std::string_view file_ if (token.size() != 16 || !(val64 = StringUtil::FromChars(token, 16)).has_value()) return false; src_hash = val64.value(); - start_pos = end_pos + 1; - end_pos = file_title.find("-", start_pos + 1); - if (end_pos == std::string_view::npos) - return false; if (GetTextureMode() < GPUTextureMode::Direct16Bit) { + start_pos = end_pos + 1; + end_pos = file_title.find("-", start_pos + 1); + if (end_pos == std::string_view::npos) + return false; + // pal_hash token = file_title.substr(start_pos, end_pos - start_pos); if (token.size() != 16 || !(val64 = StringUtil::FromChars(token, 16)).has_value()) @@ -2564,6 +2565,11 @@ bool GPUTextureCache::TextureReplacementName::Parse(const std::string_view file_ } else { + start_pos = end_pos + 1; + end_pos = file_title.find("x", start_pos + 1); + if (end_pos == std::string_view::npos) + return false; + // src_width token = file_title.substr(start_pos, end_pos - start_pos); std::optional val16;