From b34b4bde0fc352ed90fcbd8d3405ddca888625b8 Mon Sep 17 00:00:00 2001 From: Dario Date: Mon, 10 Feb 2025 17:14:56 -0300 Subject: [PATCH] Add GraphicsDevice option and fix error in Config class to accept strings. Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com> --- UnleashedRecomp/gpu/video.cpp | 2 +- UnleashedRecomp/user/config.cpp | 2 +- UnleashedRecomp/user/config_def.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index ecc8d3ae..7073c865 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -1615,7 +1615,7 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) g_interface = interfaceFunction(); if (g_interface != nullptr) { - g_device = g_interface->createDevice(); + g_device = g_interface->createDevice(Config::GraphicsDevice); if (g_device != nullptr) { #ifdef UNLEASHED_RECOMP_D3D12 diff --git a/UnleashedRecomp/user/config.cpp b/UnleashedRecomp/user/config.cpp index 4aeafb9f..918c7b6d 100644 --- a/UnleashedRecomp/user/config.cpp +++ b/UnleashedRecomp/user/config.cpp @@ -472,7 +472,7 @@ void ConfigDef::ReadValue(toml::v3::ex::parse_result& toml) if constexpr (std::is_same::value) { - Value = section[Name].value_or(DefaultValue); + Value = section[Name].value_or(DefaultValue); } else if constexpr (std::is_enum_v) { diff --git a/UnleashedRecomp/user/config_def.h b/UnleashedRecomp/user/config_def.h index 611aff3e..a9720297 100644 --- a/UnleashedRecomp/user/config_def.h +++ b/UnleashedRecomp/user/config_def.h @@ -46,6 +46,8 @@ CONFIG_DEFINE_ENUM_LOCALISED("Audio", EChannelConfiguration, ChannelConfiguratio CONFIG_DEFINE_LOCALISED("Audio", bool, MusicAttenuation, false); CONFIG_DEFINE_LOCALISED("Audio", bool, BattleTheme, true); +CONFIG_DEFINE("Video", std::string, GraphicsDevice, ""); + #ifdef UNLEASHED_RECOMP_D3D12 CONFIG_DEFINE_ENUM("Video", EGraphicsAPI, GraphicsAPI, EGraphicsAPI::D3D12); #else