mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-08 07:51:28 +12:00
Improve vfs::mount
Mount /dev_bdvd/PS3_GAME if necessary
This commit is contained in:
parent
f4d2fccdfe
commit
eea2c20420
3 changed files with 29 additions and 9 deletions
|
@ -513,12 +513,17 @@ void Emulator::Load(bool add_only)
|
||||||
{
|
{
|
||||||
// Don't need /dev_bdvd
|
// Don't need /dev_bdvd
|
||||||
}
|
}
|
||||||
else if (disc.empty() && !from_hdd0_game)
|
else if (m_cat == "DG" && from_hdd0_game)
|
||||||
|
{
|
||||||
|
vfs::mount("dev_bdvd/PS3_GAME", hdd0_game + m_path.substr(hdd0_game.size(), 10));
|
||||||
|
LOG_NOTICE(LOADER, "Game: %s", vfs::get("/dev_bdvd/PS3_GAME"));
|
||||||
|
}
|
||||||
|
else if (disc.empty())
|
||||||
{
|
{
|
||||||
LOG_ERROR(LOADER, "Failed to mount disc directory for the disc game %s", m_title_id);
|
LOG_ERROR(LOADER, "Failed to mount disc directory for the disc game %s", m_title_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!disc.empty())
|
else
|
||||||
{
|
{
|
||||||
bdvd_dir = disc;
|
bdvd_dir = disc;
|
||||||
vfs::mount("dev_bdvd", bdvd_dir);
|
vfs::mount("dev_bdvd", bdvd_dir);
|
||||||
|
|
|
@ -18,20 +18,20 @@ bool vfs::mount(const std::string& dev_name, const std::string& path)
|
||||||
{
|
{
|
||||||
const auto table = fxm::get_always<vfs_manager>();
|
const auto table = fxm::get_always<vfs_manager>();
|
||||||
|
|
||||||
writer_lock lock(table->mutex);
|
safe_writer_lock lock(table->mutex);
|
||||||
|
|
||||||
return table->mounted.emplace(dev_name, path).second;
|
return table->mounted.emplace(dev_name, path).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string vfs::get(const std::string& vpath)
|
std::string vfs::get(const std::string& vpath, const std::string* prev, std::size_t pos)
|
||||||
{
|
{
|
||||||
const auto table = fxm::get_always<vfs_manager>();
|
const auto table = fxm::get_always<vfs_manager>();
|
||||||
|
|
||||||
reader_lock lock(table->mutex);
|
safe_reader_lock lock(table->mutex);
|
||||||
|
|
||||||
std::smatch match;
|
std::smatch match;
|
||||||
|
|
||||||
if (!std::regex_match(vpath, match, s_regex_ps3))
|
if (!std::regex_match(vpath.begin() + pos, vpath.end(), match, s_regex_ps3))
|
||||||
{
|
{
|
||||||
const auto found = table->mounted.find("");
|
const auto found = table->mounted.find("");
|
||||||
|
|
||||||
|
@ -44,15 +44,30 @@ std::string vfs::get(const std::string& vpath)
|
||||||
return found->second + vfs::escape(vpath);
|
return found->second + vfs::escape(vpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match.length(1) == 0)
|
if (match.length(1) + pos == 0)
|
||||||
{
|
{
|
||||||
return "/";
|
return "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto found = table->mounted.find(match.str(1));
|
std::string dev;
|
||||||
|
|
||||||
|
if (prev)
|
||||||
|
{
|
||||||
|
dev += *prev;
|
||||||
|
dev += '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
dev += match.str(1);
|
||||||
|
|
||||||
|
const auto found = table->mounted.find(dev);
|
||||||
|
|
||||||
if (found == table->mounted.end())
|
if (found == table->mounted.end())
|
||||||
{
|
{
|
||||||
|
if (match.length(2))
|
||||||
|
{
|
||||||
|
return vfs::get(vpath, &dev, pos + match.position(1) + match.length(1));
|
||||||
|
}
|
||||||
|
|
||||||
LOG_WARNING(GENERAL, "vfs::get(): device not found: %s", vpath);
|
LOG_WARNING(GENERAL, "vfs::get(): device not found: %s", vpath);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace vfs
|
||||||
bool mount(const std::string& dev_name, const std::string& path);
|
bool mount(const std::string& dev_name, const std::string& path);
|
||||||
|
|
||||||
// Convert VFS path to fs path
|
// Convert VFS path to fs path
|
||||||
std::string get(const std::string& vpath);
|
std::string get(const std::string& vpath, const std::string* = nullptr, std::size_t = 0);
|
||||||
|
|
||||||
// Escape VFS path by replacing non-portable characters with surrogates
|
// Escape VFS path by replacing non-portable characters with surrogates
|
||||||
std::string escape(const std::string& path);
|
std::string escape(const std::string& path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue