Settings: Add UserResources to EmuFolders

Allowing some resources, such as fonts/sounds to be overridden by the
user.
This commit is contained in:
Stenzek
2024-01-10 13:35:06 +10:00
parent e4e7080f98
commit 73cee9f705
14 changed files with 105 additions and 59 deletions

View File

@ -45,7 +45,7 @@ static bool PreprocessorFileExistsCallback(const std::string& path)
if (Path::IsAbsolute(path))
return FileSystem::FileExists(path.c_str());
return Host::ResourceFileExists(path.c_str());
return Host::ResourceFileExists(path.c_str(), true);
}
static bool PreprocessorReadFileCallback(const std::string& path, std::string& data)
@ -54,7 +54,7 @@ static bool PreprocessorReadFileCallback(const std::string& path, std::string& d
if (Path::IsAbsolute(path))
rdata = FileSystem::ReadFileToString(path.c_str());
else
rdata = Host::ReadResourceFileToString(path.c_str());
rdata = Host::ReadResourceFileToString(path.c_str(), true);
if (!rdata.has_value())
return false;
@ -935,7 +935,7 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
{
// Might be a base file/resource instead.
const std::string resource_name = Path::Combine("shaders/reshade/Textures", source);
if (std::optional<std::vector<u8>> resdata = Host::ReadResourceFile(resource_name.c_str());
if (std::optional<std::vector<u8>> resdata = Host::ReadResourceFile(resource_name.c_str(), true);
!resdata.has_value() || !image.LoadFromBuffer(resource_name.c_str(), resdata->data(), resdata->size()))
{
Error::SetString(error, fmt::format("Failed to load image '{}' (from '{}')", source, image_path).c_str());