Skip to content

Commit 4ef465c

Browse files
committed
PostProcessing/FX: Fix loading of resource textures
1 parent edae13d commit 4ef465c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/util/postprocessing_shader_fx.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "shadergen.h"
77

88
// TODO: Remove me
9+
#include "core/host.h"
910
#include "core/settings.h"
1011

1112
#include "common/assert.h"
@@ -775,13 +776,19 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
775776
return false;
776777
}
777778

778-
const std::string image_path =
779-
Path::Combine(EmuFolders::Shaders, Path::Combine("reshade" FS_OSPATH_SEPARATOR_STR "Textures", source));
780779
Common::RGBA8Image image;
781-
if (!image.LoadFromFile(image_path.c_str()))
780+
if (const std::string image_path =
781+
Path::Combine(EmuFolders::Shaders, Path::Combine("reshade" FS_OSPATH_SEPARATOR_STR "Textures", source));
782+
!image.LoadFromFile(image_path.c_str()))
782783
{
783-
Error::SetString(error, fmt::format("Failed to load image '{}' (from '{}')", source, image_path).c_str());
784-
return false;
784+
// Might be a base file/resource instead.
785+
const std::string resource_name = Path::Combine("shaders/reshade/Textures", source);
786+
if (std::optional<std::vector<u8>> resdata = Host::ReadResourceFile(resource_name.c_str());
787+
!resdata.has_value() || !image.LoadFromBuffer(resource_name.c_str(), resdata->data(), resdata->size()))
788+
{
789+
Error::SetString(error, fmt::format("Failed to load image '{}' (from '{}')", source, image_path).c_str());
790+
return false;
791+
}
785792
}
786793

787794
tex.rt_scale = 0.0f;

0 commit comments

Comments
 (0)