mirror of https://github.com/RPCS3/rpcs3.git
Adaptive /dev_bdvd/ mounting
This commit is contained in:
parent
fbc268e993
commit
2f4d6fc2a1
|
@ -15,13 +15,14 @@ std::vector<std::string> simplify_path_blocks(const std::string& path)
|
||||||
// fmt::tolower() removed
|
// fmt::tolower() removed
|
||||||
std::vector<std::string> path_blocks = std::move(fmt::split(path, { "/", "\\" }));
|
std::vector<std::string> path_blocks = std::move(fmt::split(path, { "/", "\\" }));
|
||||||
|
|
||||||
for (size_t i = 0; i < path_blocks.size(); ++i)
|
for (s32 i = 0; i < path_blocks.size(); ++i)
|
||||||
{
|
{
|
||||||
if (path_blocks[i] == ".")
|
if (path_blocks[i] == "." || (i > 0 && path_blocks[i].empty()))
|
||||||
{
|
{
|
||||||
path_blocks.erase(path_blocks.begin() + i--);
|
path_blocks.erase(path_blocks.begin() + i);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
else if (i && path_blocks[i] == "..")
|
else if (i > 0 && path_blocks[i] == "..")
|
||||||
{
|
{
|
||||||
path_blocks.erase(path_blocks.begin() + (i - 1), path_blocks.begin() + (i + 1));
|
path_blocks.erase(path_blocks.begin() + (i - 1), path_blocks.begin() + (i + 1));
|
||||||
i--;
|
i--;
|
||||||
|
@ -493,7 +494,6 @@ void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
|
||||||
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_flash/", "/dev_flash/");
|
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_flash/", "/dev_flash/");
|
||||||
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb000/");
|
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb000/");
|
||||||
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb/");
|
res.emplace_back(vfsDevice_LocalFile, "$(EmulatorDir)/dev_usb000/", "/dev_usb/");
|
||||||
res.emplace_back(vfsDevice_LocalFile, "$(GameDir)/../../", "/dev_bdvd/");
|
|
||||||
res.emplace_back(vfsDevice_LocalFile, "", "/host_root/");
|
res.emplace_back(vfsDevice_LocalFile, "", "/host_root/");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -222,6 +222,29 @@ void Emulator::Load()
|
||||||
GetInfo().Reset();
|
GetInfo().Reset();
|
||||||
GetVFS().Init(elf_dir);
|
GetVFS().Init(elf_dir);
|
||||||
|
|
||||||
|
// /dev_bdvd/ mounting
|
||||||
|
vfsFile f("/app_home/../dev_bdvd.path");
|
||||||
|
if (f.IsOpened())
|
||||||
|
{
|
||||||
|
// load specified /dev_bdvd/ directory and mount it
|
||||||
|
std::string bdvd;
|
||||||
|
bdvd.resize(f.GetSize());
|
||||||
|
f.Read(&bdvd[0], bdvd.size());
|
||||||
|
|
||||||
|
Emu.GetVFS().Mount("/dev_bdvd/", bdvd, new vfsDeviceLocalFile());
|
||||||
|
}
|
||||||
|
else if (rIsFile(elf_dir + "../../PS3_DISC.SFB")) // guess loading disc game
|
||||||
|
{
|
||||||
|
const auto dir_list = fmt::split(elf_dir, { "/", "\\" });
|
||||||
|
|
||||||
|
// check latest two directories
|
||||||
|
if (dir_list.size() >= 2 && dir_list.back() == "USRDIR" && *(dir_list.end() - 2) == "PS3_GAME")
|
||||||
|
{
|
||||||
|
// mount detected /dev_bdvd/ directory
|
||||||
|
Emu.GetVFS().Mount("/dev_bdvd/", elf_dir.substr(0, elf_dir.length() - 17), new vfsDeviceLocalFile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LOG_NOTICE(LOADER, " "); //used to be skip_line
|
LOG_NOTICE(LOADER, " "); //used to be skip_line
|
||||||
LOG_NOTICE(LOADER, "Mount info:");
|
LOG_NOTICE(LOADER, "Mount info:");
|
||||||
for (uint i = 0; i < GetVFS().m_devices.size(); ++i)
|
for (uint i = 0; i < GetVFS().m_devices.size(); ++i)
|
||||||
|
@ -230,7 +253,7 @@ void Emulator::Load()
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_NOTICE(LOADER, " "); //used to be skip_line
|
LOG_NOTICE(LOADER, " "); //used to be skip_line
|
||||||
vfsFile f("/app_home/../PARAM.SFO");
|
f.Open("/app_home/../PARAM.SFO");
|
||||||
const PSFLoader psf(f);
|
const PSFLoader psf(f);
|
||||||
std::string title = psf.GetString("TITLE");
|
std::string title = psf.GetString("TITLE");
|
||||||
std::string title_id = psf.GetString("TITLE_ID");
|
std::string title_id = psf.GetString("TITLE_ID");
|
||||||
|
@ -240,23 +263,13 @@ void Emulator::Load()
|
||||||
title.length() ? SetTitle(title) : SetTitle(m_path);
|
title.length() ? SetTitle(title) : SetTitle(m_path);
|
||||||
SetTitleID(title_id);
|
SetTitleID(title_id);
|
||||||
|
|
||||||
// bdvd inserting imitation
|
|
||||||
f.Open("/app_home/../dev_bdvd.path");
|
|
||||||
if (f.IsOpened())
|
|
||||||
{
|
|
||||||
std::string bdvd;
|
|
||||||
bdvd.resize(f.GetSize());
|
|
||||||
f.Read(&bdvd[0], bdvd.size());
|
|
||||||
|
|
||||||
// load desired /dev_bdvd/ real directory and remount
|
|
||||||
Emu.GetVFS().Mount("/dev_bdvd/", bdvd, new vfsDeviceLocalFile());
|
|
||||||
LOG_NOTICE(LOADER, "/dev_bdvd/ remounted into %s", bdvd.c_str());
|
|
||||||
}
|
|
||||||
LOG_NOTICE(LOADER, " "); //used to be skip_line
|
|
||||||
|
|
||||||
if (m_elf_path.empty())
|
if (m_elf_path.empty())
|
||||||
{
|
{
|
||||||
GetVFS().GetDeviceLocal(m_path, m_elf_path);
|
if (!GetVFS().GetDeviceLocal(m_path, m_elf_path))
|
||||||
|
{
|
||||||
|
m_elf_path = "/host_root/" + m_path; // should be probably app_home
|
||||||
|
}
|
||||||
|
|
||||||
LOG_NOTICE(LOADER, "Elf path: %s", m_elf_path);
|
LOG_NOTICE(LOADER, "Elf path: %s", m_elf_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue