Fix default renderer when creating a brand new config

This commit is contained in:
Megamouse 2023-07-16 20:56:03 +02:00
parent 41d38975f7
commit db029ed29f

View File

@ -265,14 +265,6 @@ void Emulator::Init()
g_cfg.from_default();
g_cfg.name.clear();
const std::string cfg_path = fs::get_config_dir() + "/config.yml";
// Save new global config if it doesn't exist or is empty
if (fs::stat_t info{}; !fs::stat(cfg_path, info) || info.size == 0)
{
Emulator::SaveSettings(g_cfg.to_string(), {});
}
// Not all renderers are known at compile time, so set a provided default if possible
if (m_default_renderer == video_renderer::vulkan && !m_default_graphics_adapter.empty())
{
@ -282,6 +274,14 @@ void Emulator::Init()
g_cfg_defaults = g_cfg.to_string();
const std::string cfg_path = fs::get_config_dir() + "/config.yml";
// Save new global config if it doesn't exist or is empty
if (fs::stat_t info{}; !fs::stat(cfg_path, info) || info.size == 0)
{
Emulator::SaveSettings(g_cfg_defaults, {});
}
// Load VFS config
g_cfg_vfs.load();
sys_log.notice("Using VFS config:\n%s", g_cfg_vfs.to_string());