From e2c2ef9788723a86cd3a46b1582865f87e32e928 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 8 Jul 2023 18:44:47 +0200 Subject: [PATCH] Write config.yml if it doesn't exist or is empty on boot --- rpcs3/Emu/System.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index f147f4f1b6..2cd9b3af56 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -264,6 +264,14 @@ 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()) { @@ -354,8 +362,6 @@ void Emulator::Init() // Reload global configuration if (m_config_mode != cfg_mode::config_override && m_config_mode != cfg_mode::default_config) { - const auto cfg_path = fs::get_config_dir() + "/config.yml"; - if (const fs::file cfg_file{cfg_path, fs::read + fs::create}) { sys_log.notice("Applying global config: %s", cfg_path);