1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Emu: Move VFS mount to Init

This commit is contained in:
Megamouse 2021-10-20 19:51:47 +02:00
parent a90376a7c4
commit e9fe90244f
6 changed files with 40 additions and 28 deletions

View File

@ -24,6 +24,7 @@ bool cfg_camera::load()
return from_string(cfg_file.to_string());
}
camera_log.notice("Camera config missing. Using default settings. Path: %s", path);
from_default();
return false;
}

View File

@ -8,11 +8,19 @@ LOG_CHANNEL(rpcn_log, "rpcn");
void cfg_rpcn::load()
{
fs::file cfg_file(cfg_rpcn::get_path(), fs::read);
const std::string path = cfg_rpcn::get_path();
fs::file cfg_file(path, fs::read);
if (cfg_file)
{
rpcn_log.notice("Loading RPCN config. Path: %s", path);
from_string(cfg_file.to_string());
}
else
{
rpcn_log.notice("RPCN config missing. Using default settings. Path: %s", path);
from_default();
}
}
void cfg_rpcn::save() const

View File

@ -153,6 +153,25 @@ void Emulator::Init(bool add_only)
// Load VFS config
g_cfg_vfs.load();
sys_log.notice("Using VFS config:\n%s", g_cfg_vfs.to_string());
// Mount all devices
const std::string emu_dir = rpcs3::utils::get_emu_dir();
const std::string elf_dir = fs::get_parent_dir(m_path);
vfs::mount("/dev_hdd0", g_cfg_vfs.get(g_cfg_vfs.dev_hdd0, emu_dir));
vfs::mount("/dev_flash", g_cfg_vfs.get_dev_flash());
vfs::mount("/dev_flash2", g_cfg_vfs.get_dev_flash2());
vfs::mount("/dev_flash3", g_cfg_vfs.get_dev_flash3());
vfs::mount("/dev_usb", g_cfg_vfs.get(g_cfg_vfs.dev_usb000, emu_dir));
vfs::mount("/dev_usb000", g_cfg_vfs.get(g_cfg_vfs.dev_usb000, emu_dir));
vfs::mount("/app_home", g_cfg_vfs.app_home.to_string().empty() ? elf_dir + '/' : g_cfg_vfs.get(g_cfg_vfs.app_home, emu_dir));
if (!hdd1.empty())
{
vfs::mount("/dev_hdd1", hdd1);
sys_log.notice("Hdd1: %s", vfs::get("/dev_hdd1"));
}
// Load config file
if (m_config_mode == cfg_mode::config_override)
@ -204,7 +223,6 @@ void Emulator::Init(bool add_only)
}
// Create directories (can be disabled if necessary)
const std::string emu_dir = rpcs3::utils::get_emu_dir();
const std::string dev_hdd0 = rpcs3::utils::get_hdd0_dir();
const std::string dev_hdd1 = g_cfg_vfs.get(g_cfg_vfs.dev_hdd1, emu_dir);
const std::string dev_usb = g_cfg_vfs.get(g_cfg_vfs.dev_usb000, emu_dir);
@ -548,6 +566,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
}
sys_log.notice("Selected config: mode=%s, path=\"%s\"", m_config_mode, m_config_path);
sys_log.notice("Path: %s", m_path);
{
Init(add_only);
@ -572,8 +591,6 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
games.reset();
}
sys_log.notice("Path: %s", m_path);
const std::string elf_dir = fs::get_parent_dir(m_path);
// Load PARAM.SFO (TODO)
@ -730,8 +747,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
g_rtm_tx_limit2 = static_cast<u64>(g_cfg.core.tx_limit2_ns * _1ns);
}
// Mount all devices
const std::string emu_dir = rpcs3::utils::get_emu_dir();
// Set bdvd_dir
std::string bdvd_dir;
if (!add_only)
@ -751,21 +767,6 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
}
}
// Mount default relative path to non-existent directory
vfs::mount("/dev_hdd0", g_cfg_vfs.get(g_cfg_vfs.dev_hdd0, emu_dir));
vfs::mount("/dev_flash", g_cfg_vfs.get_dev_flash());
vfs::mount("/dev_flash2", g_cfg_vfs.get_dev_flash2());
vfs::mount("/dev_flash3", g_cfg_vfs.get_dev_flash3());
vfs::mount("/dev_usb", g_cfg_vfs.get(g_cfg_vfs.dev_usb000, emu_dir));
vfs::mount("/dev_usb000", g_cfg_vfs.get(g_cfg_vfs.dev_usb000, emu_dir));
vfs::mount("/app_home", g_cfg_vfs.app_home.to_string().empty() ? elf_dir + '/' : g_cfg_vfs.get(g_cfg_vfs.app_home, emu_dir));
if (!hdd1.empty())
{
vfs::mount("/dev_hdd1", hdd1);
sys_log.notice("Hdd1: %s", vfs::get("/dev_hdd1"));
}
// Special boot mode (directory scan)
if (!add_only && fs::is_dir(m_path))
{

View File

@ -51,10 +51,18 @@ std::string cfg_vfs::get(const cfg::string& _cfg, std::string_view emu_dir) cons
void cfg_vfs::load()
{
if (fs::file cfg_file{cfg_vfs::get_path(), fs::read})
const std::string path = cfg_vfs::get_path();
if (fs::file cfg_file{path, fs::read})
{
vfs_log.notice("Loading VFS config. Path: %s", path);
from_string(cfg_file.to_string());
}
else
{
vfs_log.notice("VFS config missing. Using default settings. Path: %s", path);
from_default();
}
}
void cfg_vfs::save() const

View File

@ -28,9 +28,6 @@ screenshot_manager_dialog::screenshot_manager_dialog(QWidget* parent) : QDialog(
m_grid->setIconSize(m_icon_size);
m_grid->setGridSize(m_icon_size + QSize(10, 10));
// HACK: dev_hdd0 must be mounted for vfs to work for loading trophies.
vfs::mount("/dev_hdd0", rpcs3::utils::get_hdd0_dir());
const std::string screenshot_path_qt = fs::get_config_dir() + "screenshots/";
const std::string screenshot_path_cell = vfs::get("/dev_hdd0/photo/");
const QStringList filter{ QStringLiteral("*.png") };

View File

@ -60,9 +60,6 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
m_show_gold_trophies = m_gui_settings->GetValue(gui::tr_show_gold).toBool();
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.
vfs::mount("/dev_hdd0", rpcs3::utils::get_hdd0_dir());
// Get the currently selected user's trophy path.
m_trophy_dir = "/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/";