Host: Remove resource read wrappers

No more wx, no need to abstract this.
This commit is contained in:
Stenzek 2023-10-01 01:50:11 +10:00 committed by Connor McLaughlin
parent 0e79db6cf7
commit 93a4e67813
15 changed files with 74 additions and 129 deletions

View File

@ -764,6 +764,15 @@ s64 FileSystem::GetPathFileSize(const char* Path)
return sd.Size;
}
std::optional<std::time_t> FileSystem::GetFileTimestamp(const char* path)
{
FILESYSTEM_STAT_DATA sd;
if (!StatFile(path, &sd))
return std::nullopt;
return sd.ModificationTime;
}
std::optional<std::vector<u8>> FileSystem::ReadBinaryFile(const char* filename)
{
ManagedCFilePtr fp = OpenManagedCFile(filename, "rb");

View File

@ -87,6 +87,9 @@ namespace FileSystem
bool StatFile(std::FILE* fp, FILESYSTEM_STAT_DATA* pStatData);
s64 GetPathFileSize(const char* path);
/// Returns the last modified timestamp for a file.
std::optional<std::time_t> GetFileTimestamp(const char* path);
/// File exists?
bool FileExists(const char* path);

View File

@ -168,34 +168,6 @@ void Host::SetDefaultUISettings(SettingsInterface& si)
// nothing
}
std::optional<std::vector<u8>> Host::ReadResourceFile(const char* filename)
{
const std::string path(Path::Combine(EmuFolders::Resources, filename));
std::optional<std::vector<u8>> ret(FileSystem::ReadBinaryFile(path.c_str()));
if (!ret.has_value())
Console.Error("Failed to read resource file '%s'", filename);
return ret;
}
std::optional<std::string> Host::ReadResourceFileToString(const char* filename)
{
const std::string path(Path::Combine(EmuFolders::Resources, filename));
std::optional<std::string> ret(FileSystem::ReadFileToString(path.c_str()));
if (!ret.has_value())
Console.Error("Failed to read resource file to string '%s'", filename);
return ret;
}
std::optional<std::time_t> Host::GetResourceFileTimestamp(const char* filename)
{
const std::string path(Path::Combine(EmuFolders::Resources, filename));
FILESYSTEM_STAT_DATA sd;
if (!FileSystem::StatFile(filename, &sd))
return std::nullopt;
return sd.ModificationTime;
}
void Host::ReportErrorAsync(const std::string_view& title, const std::string_view& message)
{
if (!title.empty() && !message.empty())

View File

@ -1407,34 +1407,6 @@ QString QtHost::GetResourcesBasePath()
return QString::fromStdString(EmuFolders::Resources);
}
std::optional<std::vector<u8>> Host::ReadResourceFile(const char* filename)
{
const std::string path(Path::Combine(EmuFolders::Resources, filename));
std::optional<std::vector<u8>> ret(FileSystem::ReadBinaryFile(path.c_str()));
if (!ret.has_value())
Console.Error("Failed to read resource file '%s'", filename);
return ret;
}
std::optional<std::string> Host::ReadResourceFileToString(const char* filename)
{
const std::string path(Path::Combine(EmuFolders::Resources, filename));
std::optional<std::string> ret(FileSystem::ReadFileToString(path.c_str()));
if (!ret.has_value())
Console.Error("Failed to read resource file to string '%s'", filename);
return ret;
}
std::optional<std::time_t> Host::GetResourceFileTimestamp(const char* filename)
{
const std::string path(Path::Combine(EmuFolders::Resources, filename));
FILESYSTEM_STAT_DATA sd;
if (!FileSystem::StatFile(filename, &sd))
return std::nullopt;
return sd.ModificationTime;
}
void Host::ReportErrorAsync(const std::string_view& title, const std::string_view& message)
{
if (!title.empty() && !message.empty())

View File

@ -21,6 +21,8 @@
#include "Host.h"
#include "common/BitUtils.h"
#include "common/FileSystem.h"
#include "common/Path.h"
#include "common/StringUtil.h"
#include "imgui.h"
@ -188,6 +190,11 @@ void GSDevice::GenerateExpansionIndexBuffer(void* buffer)
}
}
std::optional<std::string> GSDevice::ReadShaderSource(const char* filename)
{
return FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, filename).c_str());
}
bool GSDevice::Create()
{
m_vsync_mode = Host::GetEffectiveVSyncMode();
@ -710,8 +717,8 @@ void GSDevice::SetHWDrawConfigForAlphaPass(GSHWDrawConfig::PSSelector* ps,
bool GSDevice::GetCASShaderSource(std::string* source)
{
std::optional<std::string> ffx_a_source(Host::ReadResourceFileToString("shaders/common/ffx_a.h"));
std::optional<std::string> ffx_cas_source(Host::ReadResourceFileToString("shaders/common/ffx_cas.h"));
std::optional<std::string> ffx_a_source = ReadShaderSource("shaders/common/ffx_a.h");
std::optional<std::string> ffx_cas_source = ReadShaderSource("shaders/common/ffx_cas.h");
if (!ffx_a_source.has_value() || !ffx_cas_source.has_value())
return false;

View File

@ -824,6 +824,9 @@ public:
/// Generates a fixed index buffer for expanding points and sprites. Buffer is assumed to be at least EXPAND_BUFFER_SIZE in size.
static void GenerateExpansionIndexBuffer(void* buffer);
/// Reads the specified shader source file.
static std::optional<std::string> ReadShaderSource(const char* filename);
__fi u64 GetPoolMemoryUsage() const { return m_pool_memory_usage; }
__fi FeatureSupport Features() const { return m_features; }

View File

@ -179,7 +179,7 @@ bool GSDevice11::Create()
SetFeatures(dxgi_adapter.get());
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/dx11/tfx.fx");
std::optional<std::string> shader = ReadShaderSource("shaders/dx11/tfx.fx");
if (!shader.has_value())
return false;
m_tfx_source = std::move(*shader);
@ -193,7 +193,7 @@ bool GSDevice11::Create()
{"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0},
};
std::optional<std::string> convert_hlsl = Host::ReadResourceFileToString("shaders/dx11/convert.fx");
const std::optional<std::string> convert_hlsl = ReadShaderSource("shaders/dx11/convert.fx");
if (!convert_hlsl.has_value())
return false;
if (!m_shader_cache.GetVertexShaderAndInputLayout(m_dev.get(), m_convert.vs.put(), m_convert.il.put(),
@ -209,7 +209,7 @@ bool GSDevice11::Create()
return false;
}
shader = Host::ReadResourceFileToString("shaders/dx11/present.fx");
shader = ReadShaderSource("shaders/dx11/present.fx");
if (!shader.has_value())
return false;
if (!m_shader_cache.GetVertexShaderAndInputLayout(m_dev.get(), m_present.vs.put(), m_present.il.put(),
@ -261,7 +261,7 @@ bool GSDevice11::Create()
m_dev->CreateBuffer(&bd, nullptr, m_merge.cb.put());
shader = Host::ReadResourceFileToString("shaders/dx11/merge.fx");
shader = ReadShaderSource("shaders/dx11/merge.fx");
if (!shader.has_value())
return false;
@ -296,7 +296,7 @@ bool GSDevice11::Create()
m_dev->CreateBuffer(&bd, nullptr, m_interlace.cb.put());
shader = Host::ReadResourceFileToString("shaders/dx11/interlace.fx");
shader = ReadShaderSource("shaders/dx11/interlace.fx");
if (!shader.has_value())
return false;
for (size_t i = 0; i < std::size(m_interlace.ps); i++)
@ -316,7 +316,7 @@ bool GSDevice11::Create()
m_dev->CreateBuffer(&bd, nullptr, m_shadeboost.cb.put());
shader = Host::ReadResourceFileToString("shaders/dx11/shadeboost.fx");
shader = ReadShaderSource("shaders/dx11/shadeboost.fx");
if (!shader.has_value())
return false;
m_shadeboost.ps = m_shader_cache.GetPixelShader(m_dev.get(), *shader, nullptr, "ps_main");
@ -1565,7 +1565,7 @@ void GSDevice11::DoFXAA(GSTexture* sTex, GSTexture* dTex)
if (!m_fxaa_ps)
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/common/fxaa.fx");
const std::optional<std::string> shader = ReadShaderSource("shaders/common/fxaa.fx");
if (!shader.has_value())
{
Console.Error("FXAA shader is missing");
@ -1879,7 +1879,7 @@ bool GSDevice11::CreateCASShaders()
if (FAILED(hr))
return false;
std::optional<std::string> cas_source(Host::ReadResourceFileToString("shaders/dx11/cas.hlsl"));
std::optional<std::string> cas_source = ReadShaderSource("shaders/dx11/cas.hlsl");
if (!cas_source.has_value() || !GetCASShaderSource(&cas_source.value()))
return false;
@ -1927,7 +1927,7 @@ bool GSDevice11::CreateImGuiResources()
{
HRESULT hr;
const std::optional<std::string> hlsl = Host::ReadResourceFileToString("shaders/dx11/imgui.fx");
const std::optional<std::string> hlsl = ReadShaderSource("shaders/dx11/imgui.fx");
if (!hlsl.has_value())
{
Console.Error("Failed to read imgui.fx");

View File

@ -707,7 +707,7 @@ bool GSDevice12::Create()
return false;
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/dx11/tfx.fx");
std::optional<std::string> shader = ReadShaderSource("shaders/dx11/tfx.fx");
if (!shader.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/dx11/tfx.fxf.");
@ -1871,7 +1871,7 @@ bool GSDevice12::CompileCASPipelines()
if (!m_cas_root_signature)
return false;
std::optional<std::string> cas_source(Host::ReadResourceFileToString("shaders/dx11/cas.hlsl"));
std::optional<std::string> cas_source = ReadShaderSource("shaders/dx11/cas.hlsl");
if (!cas_source.has_value() || !GetCASShaderSource(&cas_source.value()))
return false;
@ -1899,7 +1899,7 @@ bool GSDevice12::CompileCASPipelines()
bool GSDevice12::CompileImGuiPipeline()
{
const std::optional<std::string> hlsl = Host::ReadResourceFileToString("shaders/dx11/imgui.fx");
const std::optional<std::string> hlsl = ReadShaderSource("shaders/dx11/imgui.fx");
if (!hlsl.has_value())
{
Console.Error("Failed to read imgui.fx");
@ -2368,7 +2368,7 @@ bool GSDevice12::CreateRootSignatures()
bool GSDevice12::CompileConvertPipelines()
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/dx11/convert.fx");
std::optional<std::string> shader = ReadShaderSource("shaders/dx11/convert.fx");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/dx11/convert.fx.");
@ -2519,7 +2519,7 @@ bool GSDevice12::CompileConvertPipelines()
bool GSDevice12::CompilePresentPipelines()
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/dx11/present.fx");
const std::optional<std::string> shader = ReadShaderSource("shaders/dx11/present.fx");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/dx11/present.fx.");
@ -2563,7 +2563,7 @@ bool GSDevice12::CompilePresentPipelines()
bool GSDevice12::CompileInterlacePipelines()
{
std::optional<std::string> source = Host::ReadResourceFileToString("shaders/dx11/interlace.fx");
const std::optional<std::string> source = ReadShaderSource("shaders/dx11/interlace.fx");
if (!source)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/dx11/interlace.fx.");
@ -2599,7 +2599,7 @@ bool GSDevice12::CompileInterlacePipelines()
bool GSDevice12::CompileMergePipelines()
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/dx11/merge.fx");
const std::optional<std::string> shader = ReadShaderSource("shaders/dx11/merge.fx");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/dx11/merge.fx.");
@ -2646,7 +2646,7 @@ bool GSDevice12::CompilePostProcessingPipelines()
gpb.SetVertexShader(m_convert_vs.get());
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/common/fxaa.fx");
const std::optional<std::string> shader = ReadShaderSource("shaders/common/fxaa.fx");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/common/fxaa.fx.");
@ -2669,7 +2669,7 @@ bool GSDevice12::CompilePostProcessingPipelines()
}
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/dx11/shadeboost.fx");
const std::optional<std::string> shader = ReadShaderSource("shaders/dx11/shadeboost.fx");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/dx11/shadeboost.fx.");

View File

@ -339,7 +339,7 @@ bool GSDeviceOGL::Create()
}
// these all share the same vertex shader
const auto convert_glsl = Host::ReadResourceFileToString("shaders/opengl/convert.glsl");
const std::optional<std::string> convert_glsl = ReadShaderSource("shaders/opengl/convert.glsl");
if (!convert_glsl.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/opengl/convert.glsl.");
@ -401,7 +401,7 @@ bool GSDeviceOGL::Create()
GL_PUSH("GSDeviceOGL::Present");
// these all share the same vertex shader
const auto shader = Host::ReadResourceFileToString("shaders/opengl/present.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/opengl/present.glsl");
if (!shader.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/opengl/present.glsl.");
@ -437,7 +437,7 @@ bool GSDeviceOGL::Create()
{
GL_PUSH("GSDeviceOGL::Merge");
const auto shader = Host::ReadResourceFileToString("shaders/opengl/merge.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/opengl/merge.glsl");
if (!shader.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/opengl/merge.glsl.");
@ -460,7 +460,7 @@ bool GSDeviceOGL::Create()
{
GL_PUSH("GSDeviceOGL::Interlace");
const auto shader = Host::ReadResourceFileToString("shaders/opengl/interlace.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/opengl/interlace.glsl");
if (!shader.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/opengl/interlace.glsl.");
@ -588,8 +588,8 @@ bool GSDeviceOGL::CreateTextureFX()
{
GL_PUSH("GSDeviceOGL::CreateTextureFX");
auto vertex_shader = Host::ReadResourceFileToString("shaders/opengl/tfx_vgs.glsl");
auto fragment_shader = Host::ReadResourceFileToString("shaders/opengl/tfx_fs.glsl");
std::optional<std::string> vertex_shader = ReadShaderSource("shaders/opengl/tfx_vgs.glsl");
std::optional<std::string> fragment_shader = ReadShaderSource("shaders/opengl/tfx_fs.glsl");
if (!vertex_shader.has_value() || !fragment_shader.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/opengl/tfx_{vgs,fs}.glsl.");
@ -1796,7 +1796,7 @@ void GSDeviceOGL::DoInterlace(GSTexture* sTex, const GSVector4& sRect, GSTexture
bool GSDeviceOGL::CompileFXAAProgram()
{
const std::string_view fxaa_macro = "#define FXAA_GLSL_130 1\n";
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/common/fxaa.fx");
const std::optional<std::string> shader = ReadShaderSource("shaders/common/fxaa.fx");
if (!shader.has_value())
{
Console.Error("Failed to read fxaa.fs");
@ -1834,7 +1834,7 @@ void GSDeviceOGL::DoFXAA(GSTexture* sTex, GSTexture* dTex)
bool GSDeviceOGL::CompileShadeBoostProgram()
{
const auto shader = Host::ReadResourceFileToString("shaders/opengl/shadeboost.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/opengl/shadeboost.glsl");
if (!shader.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/opengl/shadeboost.glsl.");
@ -1974,7 +1974,7 @@ void GSDeviceOGL::ClearSamplerCache()
bool GSDeviceOGL::CreateCASPrograms()
{
std::optional<std::string> cas_source(Host::ReadResourceFileToString("shaders/opengl/cas.glsl"));
std::optional<std::string> cas_source = ReadShaderSource("shaders/opengl/cas.glsl");
if (!cas_source.has_value() || !GetCASShaderSource(&cas_source.value()))
{
m_features.cas_sharpening = false;
@ -2027,7 +2027,7 @@ bool GSDeviceOGL::DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, con
bool GSDeviceOGL::CreateImGuiProgram()
{
std::optional<std::string> glsl = Host::ReadResourceFileToString("shaders/opengl/imgui.glsl");
const std::optional<std::string> glsl = ReadShaderSource("shaders/opengl/imgui.glsl");
if (!glsl.has_value())
{
Console.Error("Failed to read imgui.glsl");

View File

@ -2079,7 +2079,7 @@ bool GSDeviceVK::Create()
}
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/vulkan/tfx.glsl");
std::optional<std::string> shader = ReadShaderSource("shaders/vulkan/tfx.glsl");
if (!shader.has_value())
{
Host::ReportErrorAsync("GS", "Failed to read shaders/vulkan/tfx.glsl.");
@ -3827,7 +3827,7 @@ bool GSDeviceVK::CreateRenderPasses()
bool GSDeviceVK::CompileConvertPipelines()
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/vulkan/convert.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/vulkan/convert.glsl");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/vulkan/convert.glsl.");
@ -4015,7 +4015,7 @@ bool GSDeviceVK::CompilePresentPipelines()
if (m_swap_chain_render_pass == VK_NULL_HANDLE)
return false;
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/vulkan/present.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/vulkan/present.glsl");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/vulkan/present.glsl.");
@ -4066,7 +4066,7 @@ bool GSDeviceVK::CompilePresentPipelines()
bool GSDeviceVK::CompileInterlacePipelines()
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/vulkan/interlace.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/vulkan/interlace.glsl");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/vulkan/interlace.glsl.");
@ -4117,7 +4117,7 @@ bool GSDeviceVK::CompileInterlacePipelines()
bool GSDeviceVK::CompileMergePipelines()
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/vulkan/merge.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/vulkan/merge.glsl");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/vulkan/merge.glsl.");
@ -4187,14 +4187,14 @@ bool GSDeviceVK::CompilePostProcessingPipelines()
gpb.SetRenderPass(rp, 0);
{
std::optional<std::string> vshader = Host::ReadResourceFileToString("shaders/vulkan/convert.glsl");
const std::optional<std::string> vshader = ReadShaderSource("shaders/vulkan/convert.glsl");
if (!vshader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/vulkan/convert.glsl.");
return false;
}
std::optional<std::string> pshader = Host::ReadResourceFileToString("shaders/common/fxaa.fx");
const std::optional<std::string> pshader = ReadShaderSource("shaders/common/fxaa.fx");
if (!pshader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/common/fxaa.fx.");
@ -4222,7 +4222,7 @@ bool GSDeviceVK::CompilePostProcessingPipelines()
}
{
std::optional<std::string> shader = Host::ReadResourceFileToString("shaders/vulkan/shadeboost.glsl");
const std::optional<std::string> shader = ReadShaderSource("shaders/vulkan/shadeboost.glsl");
if (!shader)
{
Host::ReportErrorAsync("GS", "Failed to read shaders/vulkan/shadeboost.glsl.");
@ -4272,7 +4272,7 @@ bool GSDeviceVK::CompileCASPipelines()
Vulkan::SetObjectName(dev, m_cas_pipeline_layout, "CAS pipeline layout");
// we use specialization constants to avoid compiling it twice
std::optional<std::string> cas_source(Host::ReadResourceFileToString("shaders/vulkan/cas.glsl"));
std::optional<std::string> cas_source = ReadShaderSource("shaders/vulkan/cas.glsl");
if (!cas_source.has_value() || !GetCASShaderSource(&cas_source.value()))
return false;
@ -4298,7 +4298,7 @@ bool GSDeviceVK::CompileCASPipelines()
bool GSDeviceVK::CompileImGuiPipeline()
{
const std::optional<std::string> glsl = Host::ReadResourceFileToString("shaders/vulkan/imgui.glsl");
const std::optional<std::string> glsl = ReadShaderSource("shaders/vulkan/imgui.glsl");
if (!glsl.has_value())
{
Console.Error("Failed to read imgui.glsl");

View File

@ -912,7 +912,7 @@ void GameDatabase::initDatabase()
Console.Error(fmt::format("[GameDB YAML] Internal Parsing error: {}", std::string_view(msg, msg_size)));
});
auto buf = Host::ReadResourceFileToString(GAMEDB_YAML_FILE_NAME);
auto buf = FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, GAMEDB_YAML_FILE_NAME).c_str());
if (!buf.has_value())
{
Console.Error("[GameDB] Unable to open GameDB file, file does not exist.");
@ -1073,7 +1073,7 @@ bool GameDatabase::loadHashDatabase()
Common::Timer load_timer;
auto buf = Host::ReadResourceFileToString(HASHDB_YAML_FILE_NAME);
auto buf = FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, HASHDB_YAML_FILE_NAME).c_str());
if (!buf.has_value())
{
Console.Error("[GameDB] Unable to open hash database file, file does not exist.");

View File

@ -40,16 +40,6 @@ namespace Host
static constexpr float OSD_INFO_DURATION = 5.0f;
static constexpr float OSD_QUICK_DURATION = 2.5f;
/// Reads a file from the resources directory of the application.
/// This may be outside of the "normal" filesystem on platforms such as Mac.
std::optional<std::vector<u8>> ReadResourceFile(const char* filename);
/// Reads a resource file file from the resources directory as a string.
std::optional<std::string> ReadResourceFileToString(const char* filename);
/// Returns the modified time of a resource.
std::optional<std::time_t> GetResourceFileTimestamp(const char* filename);
/// Returns a localized version of the specified string within the specified context.
/// The pointer is guaranteed to be valid until the next language change.
const char* TranslateToCString(const std::string_view& context, const std::string_view& msg);

View File

@ -270,7 +270,7 @@ std::optional<Common::RGBA8Image> ImGuiFullscreen::LoadTextureImage(const char*
if (Path::IsAbsolute(path))
data = FileSystem::ReadBinaryFile(path);
else
data = Host::ReadResourceFile(path);
data = FileSystem::ReadBinaryFile(Path::Combine(EmuFolders::Resources, path).c_str());
if (data.has_value())
{
image = Common::RGBA8Image();

View File

@ -34,6 +34,7 @@
#include "common/FileSystem.h"
#include "common/Easing.h"
#include "common/StringUtil.h"
#include "common/Path.h"
#include "common/Timer.h"
#include "fmt/core.h"
@ -390,9 +391,10 @@ bool ImGuiManager::LoadFontData()
{
if (s_standard_font_data.empty())
{
std::optional<std::vector<u8>> font_data = s_font_path.empty() ?
Host::ReadResourceFile("fonts/Roboto-Regular.ttf") :
FileSystem::ReadBinaryFile(s_font_path.c_str());
std::optional<std::vector<u8>> font_data =
s_font_path.empty() ? FileSystem::ReadBinaryFile(
Path::Combine(EmuFolders::Resources, "fonts" FS_OSPATH_SEPARATOR_STR "Roboto-Regular.ttf").c_str()) :
FileSystem::ReadBinaryFile(s_font_path.c_str());
if (!font_data.has_value())
return false;
@ -401,7 +403,8 @@ bool ImGuiManager::LoadFontData()
if (s_fixed_font_data.empty())
{
std::optional<std::vector<u8>> font_data = Host::ReadResourceFile("fonts/RobotoMono-Medium.ttf");
std::optional<std::vector<u8>> font_data = FileSystem::ReadBinaryFile(
Path::Combine(EmuFolders::Resources, "fonts" FS_OSPATH_SEPARATOR_STR "RobotoMono-Medium.ttf").c_str());
if (!font_data.has_value())
return false;
@ -410,7 +413,8 @@ bool ImGuiManager::LoadFontData()
if (s_icon_font_data.empty())
{
std::optional<std::vector<u8>> font_data = Host::ReadResourceFile("fonts/fa-solid-900.ttf");
std::optional<std::vector<u8>> font_data =
FileSystem::ReadBinaryFile(Path::Combine(EmuFolders::Resources, "fonts" FS_OSPATH_SEPARATOR_STR "fa-solid-900.ttf").c_str());
if (!font_data.has_value())
return false;

View File

@ -41,21 +41,6 @@ void Host::SetDefaultUISettings(SettingsInterface& si)
{
}
std::optional<std::vector<u8>> Host::ReadResourceFile(const char* filename)
{
return std::nullopt;
}
std::optional<std::string> Host::ReadResourceFileToString(const char* filename)
{
return std::nullopt;
}
std::optional<std::time_t> Host::GetResourceFileTimestamp(const char* filename)
{
return std::nullopt;
}
void Host::ReportErrorAsync(const std::string_view& title, const std::string_view& message)
{
}