diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2022-07-21 22:26:36 -0500 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2022-08-06 12:01:33 -0500 |
| commit | 0b5f7d2c5f8006ba46c05a964bf22e9fc6fcba96 (patch) | |
| tree | 3ad003f3985e7b6a2f20689cdc7a2eb758931e1e /Source/Core/VideoCommon/GraphicsModSystem/Config | |
| parent | 7b2b559743f09d2b087728d7eb0c14c6b81a9f2a (diff) | |
VideoCommon: fix graphics target not properly setting 'draw_started' texture names for efb/xfb
Diffstat (limited to 'Source/Core/VideoCommon/GraphicsModSystem/Config')
| -rw-r--r-- | Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsTarget.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsTarget.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsTarget.cpp index f55f184520..07f00624e4 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsTarget.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsTarget.cpp @@ -124,30 +124,30 @@ std::optional<std::string> ExtractTextureFilenameForConfig(const picojson::objec return std::nullopt; } std::string texture_info = texture_filename_iter->second.get<std::string>(); - if (texture_info.find(EFB_DUMP_PREFIX) != std::string::npos) - { - const auto letter_c_pos = texture_info.find_first_of('n'); - if (letter_c_pos == std::string::npos) - { - ERROR_LOG_FMT(VIDEO, "Failed to load mod configuration file, value in 'texture_filename' " - "is an efb without a count"); - return std::nullopt; - } - texture_info = - texture_info.substr(letter_c_pos - 1, texture_info.find_first_of("_", letter_c_pos)); - } - else if (texture_info.find(XFB_DUMP_PREFIX) != std::string::npos) - { - const auto letter_c_pos = texture_info.find_first_of('n'); - if (letter_c_pos == std::string::npos) + + const auto handle_fb_texture = + [&texture_info](std::string_view type) -> std::optional<std::string> { + const auto letter_n_pos = texture_info.find("_n"); + if (letter_n_pos == std::string::npos) { - ERROR_LOG_FMT(VIDEO, "Failed to load mod configuration file, value in 'texture_filename' " - "is an xfb without a count"); + ERROR_LOG_FMT(VIDEO, + "Failed to load mod configuration file, value in 'texture_filename' " + "is {} without a count", + type); return std::nullopt; } - texture_info = - texture_info.substr(letter_c_pos - 1, texture_info.find_first_of("_", letter_c_pos)); - } + + const auto post_underscore = texture_info.find_first_of('_', letter_n_pos + 2); + if (post_underscore == std::string::npos) + return texture_info.erase(letter_n_pos, texture_info.size() - letter_n_pos); + else + return texture_info.erase(letter_n_pos, post_underscore - letter_n_pos); + }; + + if (texture_info.starts_with(EFB_DUMP_PREFIX)) + return handle_fb_texture("an efb"); + else if (texture_info.starts_with(XFB_DUMP_PREFIX)) + return handle_fb_texture("a xfb"); return texture_info; } } // namespace |
