Fix firmware installation for vfs

This commit is contained in:
Megamouse 2018-01-24 20:04:35 +01:00 committed by Ivan
parent 9138d537c8
commit 6141bc5598
5 changed files with 14 additions and 16 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include "Utilities/types.h"
#include "Utilities/geometry.h"
#include "Emu/System.h"
#include <string>
#include <vector>
@ -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;

View File

@ -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<patch_engine>()->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;

View File

@ -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();

View File

@ -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."));

View File

@ -52,9 +52,7 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> 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();