Remove /dev_flash/ configuration

Simplify code by using root config location for /dev_flash/
Hide Emu.GetEmuDir() function due to the risk of misuse
This commit is contained in:
Nekotekina 2018-06-22 14:12:21 +03:00
parent e4da284176
commit 81e5f3b7f2
10 changed files with 56 additions and 69 deletions

View file

@ -57,7 +57,7 @@ s32 cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size, vm::ptr<u
cellSsl.trace("cellSslCertificateLoader(flag=%llu, buffer=0x%x, size=%zu, required=0x%x)", flag, buffer, size, required); cellSsl.trace("cellSslCertificateLoader(flag=%llu, buffer=0x%x, size=%zu, required=0x%x)", flag, buffer, size, required);
const std::bitset<58> flagBits(flag); const std::bitset<58> flagBits(flag);
const std::string certPath = vfs::get("/dev_flash/") + "data/cert/"; const std::string certPath = vfs::get("/dev_flash/data/cert/");
if (required) if (required)
{ {

View file

@ -140,11 +140,11 @@ namespace rsx
fallback_fonts.push_back("/usr/share/fonts/TTF/DejaVuSans.ttf"); //arch fallback_fonts.push_back("/usr/share/fonts/TTF/DejaVuSans.ttf"); //arch
#endif #endif
//Search dev_flash for the font too //Search dev_flash for the font too
font_dirs.push_back(Emu.GetEmuDir() + "dev_flash/data/font/"); font_dirs.push_back(fs::get_config_dir() + "dev_flash/data/font/");
font_dirs.push_back(Emu.GetEmuDir() + "dev_flash/data/font/SONY-CC/"); font_dirs.push_back(fs::get_config_dir() + "dev_flash/data/font/SONY-CC/");
//Attempt to load a font from dev_flash as a last resort //Attempt to load a font from dev_flash as a last resort
fallback_fonts.push_back(Emu.GetEmuDir() + "dev_flash/data/font/SCE-PS3-VR-R-LATIN.TTF"); fallback_fonts.push_back(fs::get_config_dir() + "dev_flash/data/font/SCE-PS3-VR-R-LATIN.TTF");
//Attemt to load requested font //Attemt to load requested font
std::string file_path; std::string file_path;

View file

@ -296,7 +296,8 @@ void Emulator::Init()
fs::create_dir(dev_hdd0 + "disc/"); fs::create_dir(dev_hdd0 + "disc/");
fs::create_dir(dev_hdd1 + "cache/"); fs::create_dir(dev_hdd1 + "cache/");
fs::create_dir(dev_hdd1 + "game/"); fs::create_dir(dev_hdd1 + "game/");
fs::create_path(emu_dir + "/shaderlog");
fs::create_path(fs::get_config_dir() + "shaderlog/");
#ifdef WITH_GDB_DEBUGGER #ifdef WITH_GDB_DEBUGGER
LOG_SUCCESS(GENERAL, "GDB debug server will be started and listening on %d upon emulator boot", (int) g_cfg.misc.gdb_server_port); LOG_SUCCESS(GENERAL, "GDB debug server will be started and listening on %d upon emulator boot", (int) g_cfg.misc.gdb_server_port);
@ -530,11 +531,6 @@ std::string Emulator::GetHddDir()
return fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", GetEmuDir()); return fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", GetEmuDir());
} }
std::string Emulator::GetLibDir()
{
return fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", GetEmuDir()) + "sys/external/";
}
void Emulator::SetForceBoot(bool force_boot) void Emulator::SetForceBoot(bool force_boot)
{ {
m_force_boot = force_boot; m_force_boot = force_boot;
@ -683,7 +679,7 @@ void Emulator::Load(bool add_only)
vfs::mount("", fs::get_config_dir() + "delete_this_dir/"); vfs::mount("", fs::get_config_dir() + "delete_this_dir/");
vfs::mount("dev_hdd0", fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", emu_dir)); vfs::mount("dev_hdd0", fmt::replace_all(g_cfg.vfs.dev_hdd0, "$(EmulatorDir)", emu_dir));
vfs::mount("dev_hdd1", fmt::replace_all(g_cfg.vfs.dev_hdd1, "$(EmulatorDir)", emu_dir)); vfs::mount("dev_hdd1", fmt::replace_all(g_cfg.vfs.dev_hdd1, "$(EmulatorDir)", emu_dir));
vfs::mount("dev_flash", fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", emu_dir)); vfs::mount("dev_flash", fs::get_config_dir() + "dev_flash/");
vfs::mount("dev_usb", fmt::replace_all(g_cfg.vfs.dev_usb000, "$(EmulatorDir)", emu_dir)); vfs::mount("dev_usb", fmt::replace_all(g_cfg.vfs.dev_usb000, "$(EmulatorDir)", emu_dir));
vfs::mount("dev_usb000", fmt::replace_all(g_cfg.vfs.dev_usb000, "$(EmulatorDir)", emu_dir)); vfs::mount("dev_usb000", fmt::replace_all(g_cfg.vfs.dev_usb000, "$(EmulatorDir)", emu_dir));
vfs::mount("app_home", home_dir.empty() ? elf_dir + '/' : fmt::replace_all(home_dir, "$(EmulatorDir)", emu_dir)); vfs::mount("app_home", home_dir.empty() ? elf_dir + '/' : fmt::replace_all(home_dir, "$(EmulatorDir)", emu_dir));

View file

@ -286,9 +286,10 @@ public:
bool BootRsxCapture(const std::string& path); bool BootRsxCapture(const std::string& path);
bool InstallPkg(const std::string& path); bool InstallPkg(const std::string& path);
private:
static std::string GetEmuDir(); static std::string GetEmuDir();
public:
static std::string GetHddDir(); static std::string GetHddDir();
static std::string GetLibDir();
void SetForceBoot(bool force_boot); void SetForceBoot(bool force_boot);
@ -356,7 +357,6 @@ struct cfg_root : cfg::node
cfg::string emulator_dir{this, "$(EmulatorDir)"}; // Default (empty): taken from fs::get_config_dir() cfg::string emulator_dir{this, "$(EmulatorDir)"}; // Default (empty): taken from fs::get_config_dir()
cfg::string dev_hdd0{this, "/dev_hdd0/", "$(EmulatorDir)dev_hdd0/"}; cfg::string dev_hdd0{this, "/dev_hdd0/", "$(EmulatorDir)dev_hdd0/"};
cfg::string dev_hdd1{this, "/dev_hdd1/", "$(EmulatorDir)dev_hdd1/"}; cfg::string dev_hdd1{this, "/dev_hdd1/", "$(EmulatorDir)dev_hdd1/"};
cfg::string dev_flash{this, "/dev_flash/", "$(EmulatorDir)dev_flash/"};
cfg::string dev_usb000{this, "/dev_usb000/", "$(EmulatorDir)dev_usb000/"}; cfg::string dev_usb000{this, "/dev_usb000/", "$(EmulatorDir)dev_usb000/"};
cfg::string dev_bdvd{this, "/dev_bdvd/"}; // Not mounted cfg::string dev_bdvd{this, "/dev_bdvd/"}; // Not mounted
cfg::string app_home{this, "/app_home/"}; // Not mounted cfg::string app_home{this, "/app_home/"}; // Not mounted

View file

@ -396,11 +396,8 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
{ {
QString config_dir = qstr(fs::get_config_dir()); QString config_dir = qstr(fs::get_config_dir());
// HACK: dev_flash must be mounted for vfs to work for loading fonts.
vfs::mount("dev_flash", fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", Emu.GetEmuDir()));
// Add PS3 fonts // Add PS3 fonts
QDirIterator ps3_font_it(qstr(vfs::get("/dev_flash/data/font/")), QStringList() << "*.ttf", QDir::Files, QDirIterator::Subdirectories); QDirIterator ps3_font_it(qstr(fs::get_config_dir() + "dev_flash/data/font/"), QStringList() << "*.ttf", QDir::Files, QDirIterator::Subdirectories);
while (ps3_font_it.hasNext()) while (ps3_font_it.hasNext())
QFontDatabase::addApplicationFont(ps3_font_it.next()); QFontDatabase::addApplicationFont(ps3_font_it.next());

View file

@ -111,7 +111,6 @@ public:
emulatorLocation, emulatorLocation,
dev_hdd0Location, dev_hdd0Location,
dev_hdd1Location, dev_hdd1Location,
dev_flashLocation,
dev_usb000Location, dev_usb000Location,
}; };
@ -281,7 +280,6 @@ private:
{ emulatorLocation, { "VFS", "$(EmulatorDir)"}}, { emulatorLocation, { "VFS", "$(EmulatorDir)"}},
{ dev_hdd0Location, { "VFS", "/dev_hdd0/" }}, { dev_hdd0Location, { "VFS", "/dev_hdd0/" }},
{ dev_hdd1Location, { "VFS", "/dev_hdd1/" }}, { dev_hdd1Location, { "VFS", "/dev_hdd1/" }},
{ dev_flashLocation, { "VFS", "/dev_flash/"}},
{ dev_usb000Location, { "VFS", "/dev_usb000/"}}, { dev_usb000Location, { "VFS", "/dev_usb000/"}},
}; };

View file

@ -180,7 +180,6 @@ namespace gui
const gui_save fs_emulator_dir_list = gui_save(fs, "emulator_dir_list", QStringList()); const gui_save fs_emulator_dir_list = gui_save(fs, "emulator_dir_list", QStringList());
const gui_save fs_dev_hdd0_list = gui_save(fs, "dev_hdd0_list", QStringList()); const gui_save fs_dev_hdd0_list = gui_save(fs, "dev_hdd0_list", QStringList());
const gui_save fs_dev_hdd1_list = gui_save(fs, "dev_hdd1_list", QStringList()); const gui_save fs_dev_hdd1_list = gui_save(fs, "dev_hdd1_list", QStringList());
const gui_save fs_dev_flash_list = gui_save(fs, "dev_flash_list", QStringList());
const gui_save fs_dev_usb000_list = gui_save(fs, "dev_usb000_list", QStringList()); const gui_save fs_dev_usb000_list = gui_save(fs, "dev_usb000_list", QStringList());
const gui_save l_tty = gui_save(logger, "TTY", true); const gui_save l_tty = gui_save(logger, "TTY", true);

View file

@ -546,7 +546,7 @@ void main_window::InstallPup(const QString& dropPath)
} }
tar_object dev_flash_tar(dev_flash_tar_f[2]); tar_object dev_flash_tar(dev_flash_tar_f[2]);
if (!dev_flash_tar.extract(Emu.GetEmuDir())) if (!dev_flash_tar.extract(fs::get_config_dir()))
{ {
LOG_ERROR(GENERAL, "Error while installing firmware: TAR contents are invalid."); 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.")); QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: TAR contents are invalid."));
@ -587,7 +587,7 @@ void main_window::InstallPup(const QString& dropPath)
guiSettings->ShowInfoBox(gui::ib_pup_success, tr("Success!"), tr("Successfully installed PS3 firmware and LLE Modules!"), this); guiSettings->ShowInfoBox(gui::ib_pup_success, tr("Success!"), tr("Successfully installed PS3 firmware and LLE Modules!"), this);
Emu.SetForceBoot(true); Emu.SetForceBoot(true);
Emu.BootGame(Emu.GetLibDir(), true); Emu.BootGame(fs::get_config_dir() + "dev_flash/sys/external/", true);
} }
} }

View file

@ -299,7 +299,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
item->setCheckState(Qt::Checked); // AND initialize check state item->setCheckState(Qt::Checked); // AND initialize check state
ui->lleList->addItem(item); ui->lleList->addItem(item);
} }
const std::string& lle_dir = Emu.GetLibDir(); // TODO
const std::string lle_dir = fs::get_config_dir() + "dev_flash/sys/external/";
std::unordered_set<std::string> set(loadedLibs.begin(), loadedLibs.end()); std::unordered_set<std::string> set(loadedLibs.begin(), loadedLibs.end());
std::vector<std::string> lle_module_list_unselected; std::vector<std::string> lle_module_list_unselected;

View file

@ -22,16 +22,12 @@ vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_pt
vfs_dialog_tab* dev_hdd1_tab = new vfs_dialog_tab({ "dev_hdd1", emu_settings::dev_hdd1Location, gui::fs_dev_hdd1_list, &g_cfg.vfs.dev_hdd1 }, vfs_dialog_tab* dev_hdd1_tab = new vfs_dialog_tab({ "dev_hdd1", emu_settings::dev_hdd1Location, gui::fs_dev_hdd1_list, &g_cfg.vfs.dev_hdd1 },
m_gui_settings, m_emu_settings, this); m_gui_settings, m_emu_settings, this);
vfs_dialog_tab* dev_flash_tab = new vfs_dialog_tab({ "dev_flash", emu_settings::dev_flashLocation, gui::fs_dev_flash_list, &g_cfg.vfs.dev_flash },
m_gui_settings, m_emu_settings, this);
vfs_dialog_tab* dev_usb000_tab = new vfs_dialog_tab({ "dev_usb000", emu_settings::dev_usb000Location, gui::fs_dev_usb000_list, &g_cfg.vfs.dev_usb000 }, vfs_dialog_tab* dev_usb000_tab = new vfs_dialog_tab({ "dev_usb000", emu_settings::dev_usb000Location, gui::fs_dev_usb000_list, &g_cfg.vfs.dev_usb000 },
m_gui_settings, m_emu_settings, this); m_gui_settings, m_emu_settings, this);
tabs->addTab(emulator_tab, "$(EmulatorDir)"); tabs->addTab(emulator_tab, "$(EmulatorDir)");
tabs->addTab(dev_hdd0_tab, "dev_hdd0"); tabs->addTab(dev_hdd0_tab, "dev_hdd0");
tabs->addTab(dev_hdd1_tab, "dev_hdd1"); tabs->addTab(dev_hdd1_tab, "dev_hdd1");
tabs->addTab(dev_flash_tab, "dev_flash");
tabs->addTab(dev_usb000_tab, "dev_usb000"); tabs->addTab(dev_usb000_tab, "dev_usb000");
// Create buttons // Create buttons