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

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);
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)
{

View File

@ -140,11 +140,11 @@ namespace rsx
fallback_fonts.push_back("/usr/share/fonts/TTF/DejaVuSans.ttf"); //arch
#endif
//Search dev_flash for the font too
font_dirs.push_back(Emu.GetEmuDir() + "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/");
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
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
std::string file_path;

View File

@ -296,7 +296,8 @@ void Emulator::Init()
fs::create_dir(dev_hdd0 + "disc/");
fs::create_dir(dev_hdd1 + "cache/");
fs::create_dir(dev_hdd1 + "game/");
fs::create_path(emu_dir + "/shaderlog");
fs::create_path(fs::get_config_dir() + "shaderlog/");
#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);
@ -530,11 +531,6 @@ std::string Emulator::GetHddDir()
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)
{
m_force_boot = force_boot;
@ -662,7 +658,7 @@ void Emulator::Load(bool add_only)
#endif
LOG_NOTICE(LOADER, "Used configuration:\n%s\n", g_cfg.to_string());
// Set RTM usage
g_use_rtm = utils::has_rtm() && ((utils::has_mpx() && g_cfg.core.enable_TSX == tsx_usage::enabled) || g_cfg.core.enable_TSX == tsx_usage::forced);
if (g_use_rtm && !utils::has_mpx())
@ -683,7 +679,7 @@ void Emulator::Load(bool add_only)
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_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_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));

View File

@ -286,9 +286,10 @@ public:
bool BootRsxCapture(const std::string& path);
bool InstallPkg(const std::string& path);
private:
static std::string GetEmuDir();
public:
static std::string GetHddDir();
static std::string GetLibDir();
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 dev_hdd0{this, "/dev_hdd0/", "$(EmulatorDir)dev_hdd0/"};
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_bdvd{this, "/dev_bdvd/"}; // 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());
// 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
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())
QFontDatabase::addApplicationFont(ps3_font_it.next());

View File

@ -111,7 +111,6 @@ public:
emulatorLocation,
dev_hdd0Location,
dev_hdd1Location,
dev_flashLocation,
dev_usb000Location,
};
@ -281,7 +280,6 @@ private:
{ emulatorLocation, { "VFS", "$(EmulatorDir)"}},
{ dev_hdd0Location, { "VFS", "/dev_hdd0/" }},
{ dev_hdd1Location, { "VFS", "/dev_hdd1/" }},
{ dev_flashLocation, { "VFS", "/dev_flash/"}},
{ 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_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_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 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]);
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.");
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);
Emu.SetForceBoot(true);
Emu.BootGame(Emu.GetLibDir(), true);
Emu.BootGame(fs::get_config_dir() + "dev_flash/sys/external/", true);
}
}

View File

@ -159,12 +159,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
ui->cancelButton->setFocus();
});
// _____ _____ _ _ _______ _
// / ____| __ \| | | | |__ __| | |
// | | | |__) | | | | | | __ _| |__
// _____ _____ _ _ _______ _
// / ____| __ \| | | | |__ __| | |
// | | | |__) | | | | | | __ _| |__
// | | | ___/| | | | | |/ _` | '_ \
// | |____| | | |__| | | | (_| | |_) |
// \_____|_| \____/ |_|\__,_|_.__/
// \_____|_| \____/ |_|\__,_|_.__/
// Checkboxes
@ -299,7 +299,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
item->setCheckState(Qt::Checked); // AND initialize check state
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::vector<std::string> lle_module_list_unselected;
@ -387,12 +388,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
l_OnLibButtonClicked(buttid);
}
// _____ _____ _ _ _______ _
// / ____| __ \| | | | |__ __| | |
// | | __| |__) | | | | | | __ _| |__
// _____ _____ _ _ _______ _
// / ____| __ \| | | | |__ __| | |
// | | __| |__) | | | | | | __ _| |__
// | | |_ | ___/| | | | | |/ _` | '_ \
// | |__| | | | |__| | | | (_| | |_) |
// \_____|_| \____/ |_|\__,_|_.__/
// \_____|_| \____/ |_|\__,_|_.__/
emu_settings::Render_Creator render_creator = xemu_settings.get()->m_render_creator;
@ -640,12 +641,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
fixGLLegacy(ui->renderBox->currentText()); // Init
connect(ui->renderBox, &QComboBox::currentTextChanged, fixGLLegacy);
// _ _ _______ _
// /\ | (_) |__ __| | |
// / \ _ _ __| |_ ___ | | __ _| |__
// _ _ _______ _
// /\ | (_) |__ __| | |
// / \ _ _ __| |_ ___ | | __ _| |__
// / /\ \| | | |/ _` | |/ _ \ | |/ _` | '_ \
// / ____ \ |_| | (_| | | (_) | | | (_| | |_) |
// /_/ \_\__,_|\__,_|_|\___/ |_|\__,_|_.__/
// /_/ \_\__,_|\__,_|_|\___/ |_|\__,_|_.__/
// Comboboxes
@ -667,12 +668,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
xemu_settings->EnhanceCheckBox(ui->downmix, emu_settings::DownmixStereo);
SubscribeTooltip(ui->downmix, json_audio["downmix"].toString());
// _____ __ ____ _______ _
// |_ _| / / / __ \ |__ __| | |
// | | / / | | | | | | __ _| |__
// _____ __ ____ _______ _
// |_ _| / / / __ \ |__ __| | |
// | | / / | | | | | | __ _| |__
// | | / / | | | | | |/ _` | '_ \
// _| |_ / / | |__| | | | (_| | |_) |
// |_____| /_/ \____/ |_|\__,_|_.__/
// |_____| /_/ \____/ |_|\__,_|_.__/
// Comboboxes
@ -691,14 +692,14 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
xemu_settings->EnhanceComboBox(ui->moveBox, emu_settings::Move);
SubscribeTooltip(ui->moveBox, json_input["moveBox"].toString());
// _____ _ _______ _
// / ____| | | |__ __| | |
// | (___ _ _ ___| |_ ___ _ __ ___ | | __ _| |__
// _____ _ _______ _
// / ____| | | |__ __| | |
// | (___ _ _ ___| |_ ___ _ __ ___ | | __ _| |__
// \___ \| | | / __| __/ _ \ '_ ` _ \ | |/ _` | '_ \
// ____) | |_| \__ \ || __/ | | | | | | | (_| | |_) |
// |_____/ \__, |___/\__\___|_| |_| |_| |_|\__,_|_.__/
// __/ |
// |___/
// |_____/ \__, |___/\__\___|_| |_| |_| |_|\__,_|_.__/
// __/ |
// |___/
// Comboboxes
@ -710,24 +711,24 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
xemu_settings->EnhanceCheckBox(ui->enableHostRoot, emu_settings::EnableHostRoot);
SubscribeTooltip(ui->enableHostRoot, json_sys["enableHostRoot"].toString());
// _ _ _ _ _______ _
// | \ | | | | | | |__ __| | |
// | \| | ___| |___ _____ _ __| | __ | | __ _| |__
// _ _ _ _ _______ _
// | \ | | | | | | |__ __| | |
// | \| | ___| |___ _____ _ __| | __ | | __ _| |__
// | . ` |/ _ \ __\ \ /\ / / _ \| '__| |/ / | |/ _` | '_ \
// | |\ | __/ |_ \ V V / (_) | | | < | | (_| | |_) |
// |_| \_|\___|\__| \_/\_/ \___/|_| |_|\_\ |_|\__,_|_.__/
// |_| \_|\___|\__| \_/\_/ \___/|_| |_|\_\ |_|\__,_|_.__/
// Comboboxes
xemu_settings->EnhanceComboBox(ui->netStatusBox, emu_settings::ConnectionStatus);
SubscribeTooltip(ui->netStatusBox, json_net["netStatusBox"].toString());
// ______ _ _ _______ _
// | ____| | | | | |__ __| | |
// | |__ _ __ ___ _ _| | __ _| |_ ___ _ __ | | __ _| |__
// ______ _ _ _______ _
// | ____| | | | | |__ __| | |
// | |__ _ __ ___ _ _| | __ _| |_ ___ _ __ | | __ _| |__
// | __| | '_ ` _ \| | | | |/ _` | __/ _ \| '__| | |/ _` | '_ \
// | |____| | | | | | |_| | | (_| | || (_) | | | | (_| | |_) |
// |______|_| |_| |_|\__,_|_|\__,_|\__\___/|_| |_|\__,_|_.__/
// |______|_| |_| |_|\__,_|_|\__,_|\__\___/|_| |_|\__,_|_.__/
// Comboboxes
@ -839,12 +840,12 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
});
}
// _____ _ _ _ _______ _
// / ____|| | | || | |__ __| | |
// | | __|| | | || | | | __ _| |__
// _____ _ _ _ _______ _
// / ____|| | | || | |__ __| | |
// | | __|| | | || | | | __ _| |__
// | | |_ || | | || | | |/ _` | '_ \
// | |__| || |__| || | | | (_| | |_) |
// \_____| \____/ |_| |_|\__,_|_.__/
// \_____| \____/ |_| |_|\__,_|_.__/
// Comboboxes
SubscribeTooltip(ui->combo_configs, json_gui["configs"].toString());
@ -1025,14 +1026,14 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
AddStylesheets();
}
// _____ _ _______ _
// | __ \ | | |__ __| | |
// | | | | ___| |__ _ _ __ _ | | __ _| |__
// _____ _ _______ _
// | __ \ | | |__ __| | |
// | | | | ___| |__ _ _ __ _ | | __ _| |__
// | | | |/ _ \ '_ \| | | |/ _` | | |/ _` | '_ \
// | |__| | __/ |_) | |_| | (_| | | | (_| | |_) |
// |_____/ \___|_.__/ \__,_|\__, | |_|\__,_|_.__/
// __/ |
// |___/
// |_____/ \___|_.__/ \__,_|\__, | |_|\__,_|_.__/
// __/ |
// |___/
// Checkboxes: gpu debug options
xemu_settings->EnhanceCheckBox(ui->glLegacyBuffers, emu_settings::LegacyBuffers);
@ -1080,7 +1081,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
xemu_settings->EnhanceCheckBox(ui->spuDebug, emu_settings::SPUDebug);
SubscribeTooltip(ui->spuDebug, json_debug["spuDebug"].toString());
if (utils::has_rtm())
{
xemu_settings->EnhanceComboBox(ui->enableTSX, emu_settings::EnableTSX);

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 },
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 },
m_gui_settings, m_emu_settings, this);
tabs->addTab(emulator_tab, "$(EmulatorDir)");
tabs->addTab(dev_hdd0_tab, "dev_hdd0");
tabs->addTab(dev_hdd1_tab, "dev_hdd1");
tabs->addTab(dev_flash_tab, "dev_flash");
tabs->addTab(dev_usb000_tab, "dev_usb000");
// Create buttons