From 6141bc5598e65433e98434f9c7f2a508c5f4138d Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 24 Jan 2018 20:04:35 +0100 Subject: [PATCH] Fix firmware installation for vfs --- rpcs3/Emu/RSX/overlay_controls.h | 3 ++- rpcs3/Emu/System.cpp | 20 +++++++++----------- rpcs3/Emu/System.h | 1 + rpcs3/rpcs3qt/main_window.cpp | 2 +- rpcs3/rpcs3qt/trophy_manager_dialog.cpp | 4 +--- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/rpcs3/Emu/RSX/overlay_controls.h b/rpcs3/Emu/RSX/overlay_controls.h index 448d5319fe..f0587cc954 100644 --- a/rpcs3/Emu/RSX/overlay_controls.h +++ b/rpcs3/Emu/RSX/overlay_controls.h @@ -1,6 +1,7 @@ #pragma once #include "Utilities/types.h" #include "Utilities/geometry.h" +#include "Emu/System.h" #include #include @@ -137,7 +138,7 @@ namespace rsx fallback_fonts.push_back("/usr/share/fonts/TTF/DejaVuSans.ttf"); //arch #endif //Also attempt to load from dev_flash as a last resort - fallback_fonts.push_back(fs::get_config_dir() + "dev_flash/data/font/SCE-PS3-VR-R-LATIN.TTF"); + fallback_fonts.push_back(Emu.GetEmuDir() + "dev_flash/data/font/SCE-PS3-VR-R-LATIN.TTF"); std::string requested_file = font_dir + ttf_name + ".ttf"; std::string file_path = requested_file; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index a88124533b..43e6c8c800 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -198,8 +198,7 @@ void Emulator::Init() g_cfg.from_string(fs::file(fs::get_config_dir() + "/config.yml", fs::read + fs::create).to_string()); // Create directories - const std::string emu_dir_ = g_cfg.vfs.emulator_dir; - const std::string emu_dir = emu_dir_.empty() ? fs::get_config_dir() : emu_dir_; + const std::string emu_dir = GetEmuDir(); const std::string dev_hdd0 = fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", emu_dir); const std::string dev_hdd1 = fmt::replace_all(g_cfg.vfs.dev_hdd1, "$(EmulatorDir)", emu_dir); const std::string dev_usb = fmt::replace_all(g_cfg.vfs.dev_usb000, "$(EmulatorDir)", emu_dir); @@ -307,20 +306,20 @@ bool Emulator::InstallPkg(const std::string& path) return false; } -std::string Emulator::GetHddDir() +std::string Emulator::GetEmuDir() { const std::string& emu_dir_ = g_cfg.vfs.emulator_dir; - const std::string& emu_dir = emu_dir_.empty() ? fs::get_config_dir() : emu_dir_; + return emu_dir_.empty() ? fs::get_config_dir() : emu_dir_; +} - return fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", emu_dir); +std::string Emulator::GetHddDir() +{ + return fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", GetEmuDir()); } std::string Emulator::GetLibDir() { - const std::string& emu_dir_ = g_cfg.vfs.emulator_dir; - const std::string& emu_dir = emu_dir_.empty() ? fs::get_config_dir() : emu_dir_; - - return fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", emu_dir) + "sys/external/"; + return fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", GetEmuDir()) + "sys/external/"; } void Emulator::SetForceBoot(bool force_boot) @@ -423,8 +422,7 @@ void Emulator::Load(bool add_only) fxm::check_unlocked()->append(m_cache_path + "/patch.yml"); // Mount all devices - const std::string emu_dir_ = g_cfg.vfs.emulator_dir; - const std::string emu_dir = emu_dir_.empty() ? fs::get_config_dir() : emu_dir_; + const std::string emu_dir = GetEmuDir(); const std::string home_dir = g_cfg.vfs.app_home; std::string bdvd_dir = g_cfg.vfs.dev_bdvd; diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index da00df8ae1..a0f794ae47 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -243,6 +243,7 @@ public: bool BootGame(const std::string& path, bool direct = false, bool add_only = false); bool InstallPkg(const std::string& path); + static std::string GetEmuDir(); static std::string GetHddDir(); static std::string GetLibDir(); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 6aa17c09b2..b9e9e0101f 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -495,7 +495,7 @@ void main_window::InstallPup(const QString& dropPath) } tar_object dev_flash_tar(dev_flash_tar_f[2]); - if (!dev_flash_tar.extract(fs::get_config_dir())) + if (!dev_flash_tar.extract(Emu.GetEmuDir())) { LOG_ERROR(GENERAL, "Error while installing firmware: TAR contents are invalid."); QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: TAR contents are invalid.")); diff --git a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp index 1beea283d7..81715131ff 100644 --- a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp @@ -52,9 +52,7 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr gui_s m_show_platinum_trophies = m_gui_settings->GetValue(gui::tr_show_platinum).toBool(); // HACK: dev_hdd0 must be mounted for vfs to work for loading trophies. - const std::string emu_dir_ = g_cfg.vfs.emulator_dir; - const std::string emu_dir = emu_dir_.empty() ? fs::get_config_dir() : emu_dir_; - vfs::mount("dev_hdd0", fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", emu_dir)); + vfs::mount("dev_hdd0", Emu.GetHddDir()); // Trophy Tree m_trophy_tree = new QTreeWidget();