diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 0f54e6715e..08fd998c49 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -408,7 +408,20 @@ void Emulator::Init(bool add_only) } } - make_path_verbose(dev_hdd0 + "disc/"); + const std::string games_common_dir = g_cfg_vfs.get(g_cfg_vfs.games_dir, emu_dir); + + if (make_path_verbose(games_common_dir)) + { + fs::write_file(games_common_dir + "/Disc Games Can Be Put Here For Automatic Detection.txt", fs::create + fs::excl + fs::write, ""s); + +#ifdef _WIN32 + if (std::string rpcs3_shortcuts = games_common_dir + "/shortcuts"; make_path_verbose(rpcs3_shortcuts)) + { + fs::write_file(rpcs3_shortcuts + "/Copyable Shortcuts For Installed Games Would Be Added Here.txt", fs::create + fs::excl + fs::write, ""s); + } +#endif + } + make_path_verbose(dev_hdd0 + "savedata/"); make_path_verbose(dev_hdd0 + "savedata/vmc/"); make_path_verbose(dev_hdd0 + "photo/"); @@ -422,11 +435,6 @@ void Emulator::Init(bool add_only) make_path_verbose(fs::get_config_dir() + "sounds/"); make_path_verbose(patch_engine::get_patches_path()); - if (const std::string games_common = fs::get_config_dir() + "/games/"; make_path_verbose(games_common)) - { - fs::write_file(games_common + "/Disc Games Can Be Put Here For Automatic Detection.txt", fs::create + fs::excl + fs::write, ""s); - } - if (add_only) { // We don't need to initialize the rest if we only add games @@ -1459,18 +1467,18 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool // Booting disc game from wrong location sys_log.error("Disc game %s found at invalid location /dev_hdd0/game/", m_title_id); - const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/"); - const std::string dst_dir = hdd0_disc + sfb_dir.substr(hdd0_game.size()); + const std::string games_common = g_cfg_vfs.get(g_cfg_vfs.games_dir, rpcs3::utils::get_emu_dir()); + const std::string dst_dir = games_common + sfb_dir.substr(hdd0_game.size()); // Move and retry from correct location if (fs::create_path(fs::get_parent_dir(dst_dir)) && fs::rename(sfb_dir, dst_dir, false)) { - sys_log.success("Disc game %s moved to special location /dev_hdd0/disc/", m_title_id); - m_path = hdd0_disc + m_path.substr(hdd0_game.size()); + sys_log.success("Disc game %s moved to special location '%s'", m_title_id, dst_dir); + m_path = games_common + m_path.substr(hdd0_game.size()); return Load(m_title_id, add_only); } - sys_log.error("Failed to move disc game %s to /dev_hdd0/disc/ (%s)", m_title_id, fs::g_tls_error); + sys_log.error("Failed to move disc game %s to '%s' (%s)", m_title_id, dst_dir, fs::g_tls_error); return game_boot_result::wrong_disc_location; } } diff --git a/rpcs3/Emu/vfs_config.h b/rpcs3/Emu/vfs_config.h index 74a0f0d880..eaba041344 100644 --- a/rpcs3/Emu/vfs_config.h +++ b/rpcs3/Emu/vfs_config.h @@ -16,6 +16,7 @@ struct cfg_vfs : cfg::node cfg::string dev_flash2{ this, "/dev_flash2/", "$(EmulatorDir)dev_flash2/" }; cfg::string dev_flash3{ this, "/dev_flash3/", "$(EmulatorDir)dev_flash3/" }; cfg::string dev_bdvd{ this, "/dev_bdvd/", "$(EmulatorDir)dev_bdvd/" }; // Only mounted in some special cases + cfg::string games_dir{ this, "/games/", "$(EmulatorDir)games/" }; // Not mounted cfg::string app_home{ this, "/app_home/" }; // Not mounted cfg::device_entry dev_usb{ this, "/dev_usb***/", diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 7fc35c77e0..5d4a7e4daa 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -456,7 +456,7 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after) if (Emu.IsStopped()) { - Emu.AddGamesFromDir(fs::get_config_dir() + "/games"); + Emu.AddGamesFromDir(g_cfg_vfs.get(g_cfg_vfs.games_dir, rpcs3::utils::get_emu_dir())); } const std::string _hdd = rpcs3::utils::get_hdd0_dir(); @@ -514,7 +514,7 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after) }; add_dir(_hdd + "game/", false); - add_dir(_hdd + "disc/", true); + add_dir(_hdd + "disc/", true); // Deprecated auto get_games = []() -> YAML::Node { @@ -564,6 +564,12 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after) if (frag.find_first_of('/') + 1 == 0) { game_list_log.trace("Removed duplicate for %s: %s", pair.first.Scalar(), pair.second.Scalar()); + + if (static std::unordered_set warn_once_list; warn_once_list.emplace(game_dir).second) + { + game_list_log.todo("Game at '%s' is using deprecated directory '/dev_hdd0/disc/'.\nConsider moving into '%s'.", game_dir, g_cfg_vfs.get(g_cfg_vfs.games_dir, rpcs3::utils::get_emu_dir())); + } + continue; } } diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index fad84cd8fc..472c24dc9d 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -190,6 +190,7 @@ namespace gui const gui_save fs_dev_flash2_list = gui_save(fs, "dev_flash2_list", QStringList()); const gui_save fs_dev_flash3_list = gui_save(fs, "dev_flash3_list", QStringList()); const gui_save fs_dev_bdvd_list = gui_save(fs, "dev_bdvd_list", QStringList()); + const gui_save fs_games_list = gui_save(fs, "games_list", QStringList()); const gui_save fs_dev_usb_list = gui_save(fs, "dev_usb00X_list", QStringList()); // Used as a template for all usb paths const gui_save l_tty = gui_save(logger, "TTY", true); diff --git a/rpcs3/rpcs3qt/shortcut_utils.cpp b/rpcs3/rpcs3qt/shortcut_utils.cpp index d4c99d25da..88dffc2143 100644 --- a/rpcs3/rpcs3qt/shortcut_utils.cpp +++ b/rpcs3/rpcs3qt/shortcut_utils.cpp @@ -3,6 +3,7 @@ #include "qt_utils.h" #include "Emu/system_utils.hpp" #include "Emu/VFS.h" +#include "Emu/vfs_config.h" #include "Utilities/StrUtil.h" #ifdef _WIN32 @@ -95,7 +96,7 @@ namespace gui::utils #ifdef _WIN32 else if (location == shortcut_location::rpcs3_shortcuts) { - link_path = fs::get_config_dir() + "/games/shortcuts/"; + link_path = g_cfg_vfs.get(g_cfg_vfs.games_dir, rpcs3::utils::get_emu_dir()) + "/shortcuts/"; fs::create_dir(link_path); } #endif diff --git a/rpcs3/rpcs3qt/vfs_dialog.cpp b/rpcs3/rpcs3qt/vfs_dialog.cpp index b9b6693bd3..b038b3840e 100644 --- a/rpcs3/rpcs3qt/vfs_dialog.cpp +++ b/rpcs3/rpcs3qt/vfs_dialog.cpp @@ -34,6 +34,7 @@ vfs_dialog::vfs_dialog(std::shared_ptr _gui_settings, QWidget* par vfs_dialog_tab* dev_flash3_tab = new vfs_dialog_tab("dev_flash3", gui::fs_dev_flash3_list, &g_cfg_vfs.dev_flash3, m_gui_settings, this); vfs_dialog_tab* dev_bdvd_tab = new vfs_dialog_tab("dev_bdvd", gui::fs_dev_bdvd_list, &g_cfg_vfs.dev_bdvd, m_gui_settings, this); vfs_dialog_usb_tab* dev_usb_tab = new vfs_dialog_usb_tab(&g_cfg_vfs.dev_usb, m_gui_settings, this); + vfs_dialog_tab* games_tab = new vfs_dialog_tab("games", gui::fs_games_list, &g_cfg_vfs.games_dir, m_gui_settings, this); tabs->addTab(emulator_tab, "$(EmulatorDir)"); tabs->addTab(dev_hdd0_tab, "dev_hdd0"); @@ -43,6 +44,7 @@ vfs_dialog::vfs_dialog(std::shared_ptr _gui_settings, QWidget* par tabs->addTab(dev_flash3_tab, "dev_flash3"); tabs->addTab(dev_bdvd_tab, "dev_bdvd"); tabs->addTab(dev_usb_tab, "dev_usb"); + tabs->addTab(games_tab, "games"); // Create buttons QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Close | QDialogButtonBox::Save | QDialogButtonBox::RestoreDefaults);