diff --git a/Utilities/File.cpp b/Utilities/File.cpp index a640d43ff6..8ef949a65e 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -167,8 +167,7 @@ bool fs::is_file(const std::string& file) #ifdef _WIN32 DWORD attrs; - const std::string path = fmt::replace_all(file, "/", "\\"); - if ((attrs = GetFileAttributesW(to_wchar(path).get())) == INVALID_FILE_ATTRIBUTES) + if ((attrs = GetFileAttributesW(to_wchar(file).get())) == INVALID_FILE_ATTRIBUTES) { return false; } @@ -191,8 +190,7 @@ bool fs::is_dir(const std::string& dir) #ifdef _WIN32 DWORD attrs; - const std::string path = fmt::replace_all(dir, "/", "\\"); - if ((attrs = GetFileAttributesW(to_wchar(path).get())) == INVALID_FILE_ATTRIBUTES) + if ((attrs = GetFileAttributesW(to_wchar(dir).get())) == INVALID_FILE_ATTRIBUTES) { return false; } @@ -214,8 +212,7 @@ bool fs::create_dir(const std::string& dir) g_tls_error = fse::ok; #ifdef _WIN32 - const std::string path = fmt::replace_all(dir, "/", "\\"); - if (!CreateDirectoryW(to_wchar(path).get(), NULL)) + if (!CreateDirectoryW(to_wchar(dir).get(), NULL)) #else if (mkdir(dir.c_str(), 0777)) #endif diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 16d2cbba9c..36aceeac50 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -191,24 +191,10 @@ void Emulator::Load() ResetInfo(); GetVFS().Init(elf_dir); - // load custom config as global - if (!Ini.UseDefaultIni.GetValue()) - { - std::string& name = PSFLoader{ vfsFile{ "/app_home/../PARAM.SFO" } }.GetString("TITLE_ID"); - if (name.size()) - { - name = name.substr(0, 4) + "-" + name.substr(4, 5); - CreateConfig(name); - rpcs3::config.path("data/" + name + "/" + name + ".ini"); - rpcs3::config.load(); - } - } - // TODO: use state configuration instead of global config rpcs3::state.config = rpcs3::config; LOG_NOTICE(LOADER, "Loading '%s'...", m_path.c_str()); - LOG_NOTICE(LOADER, "Used configuration: '%s'", rpcs3::config.path().c_str()); // /dev_bdvd/ mounting vfsFile f("/app_home/../dev_bdvd.path"); @@ -276,6 +262,21 @@ void Emulator::Load() title.length() ? SetTitle(title) : SetTitle(m_path); SetTitleID(title_id); + // load custom config as global + if (!Ini.UseDefaultIni.GetValue()) + { + std::string& name = title_id; + if (name.size()) + { + name = name.substr(0, 4) + "-" + name.substr(4, 5); + CreateConfig(name); + rpcs3::config.path("data/" + name + "/" + name + ".ini"); + rpcs3::config.load(); + } + } + + LOG_NOTICE(LOADER, "Used configuration: '%s'", rpcs3::config.path().c_str()); + if (m_elf_path.empty()) { GetVFS().GetDeviceLocal(m_path, m_elf_path);