Add more mount paths for the local directory
This adds more mount paths for the XEX's local directory to Emulator::LaunchXexFile, so any XEXs that try to use these mountpoints can load files from the XEX directory. Mount points added: - \Device\Harddisk0\Partition0 - original mountpoint used by Xenia - \Device\Harddisk0\Partition1 - some games/apps seem to use this to refer to HDD1: - \Device\Harddisk0\Partition1\DEVKIT Used by xshell.xex, gets linked as E: (aka "development drive") Even if a DEVKIT folder exists inside the local folder, it seems we still have to add this mount point explicitly. - \Device\LauncherData Also used by xshell.xex for various UI resources The xlaunch.fdf file is normally mounted via DmMountFdfxVolume to this path (xlaunch.fdf is a FATX formatted container) By mounting this xshell can retrieve extracted resources from the local dir. - \SystemRoot Normally refers to the NAND, used by dash.xex to retrieve XZP resources when they aren't inside xam.xex. Other apps also use this to refer to other system XEXs/resources By mounting it we can just place any needed resources in the local dir.
This commit is contained in:
parent
d3c3dc5cf6
commit
64144ffdca
|
@ -275,28 +275,38 @@ X_STATUS Emulator::LaunchXexFile(const std::filesystem::path& path,
|
||||||
// and then get that symlinked to game:\, so
|
// and then get that symlinked to game:\, so
|
||||||
// -> game:\foo.xex
|
// -> game:\foo.xex
|
||||||
|
|
||||||
auto mount_path = "\\Device\\Harddisk0\\Partition0";
|
// Register local directory as some commonly used mount paths
|
||||||
|
std::filesystem::path mount_paths[] = {
|
||||||
|
"\\Device\\Harddisk0\\Partition0",
|
||||||
|
"\\Device\\Harddisk0\\Partition1",
|
||||||
|
"\\Device\\Harddisk0\\Partition1\\DEVKIT",
|
||||||
|
"\\Device\\LauncherData",
|
||||||
|
"\\SystemRoot",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Todo: is this even remotely correct?
|
||||||
if (discSwap) {
|
if (discSwap) {
|
||||||
mount_path = "\\Device\\LauncherData";
|
mount_paths[0] = "\\Device\\LauncherData";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the local directory in the virtual filesystem.
|
// Register the local directory in the virtual filesystem.
|
||||||
auto parent_path = path.parent_path();
|
auto parent_path = path.parent_path();
|
||||||
|
for (auto mount_path : mount_paths) {
|
||||||
auto device =
|
auto device =
|
||||||
std::make_unique<vfs::HostPathDevice>(mount_path, parent_path, true);
|
std::make_unique<vfs::HostPathDevice>(mount_path.u8string(), parent_path, true);
|
||||||
if (!device->Initialize()) {
|
if (!device->Initialize()) {
|
||||||
XELOGE("Unable to scan host path");
|
XELOGE("Unable to scan host path");
|
||||||
return X_STATUS_NO_SUCH_FILE;
|
return X_STATUS_NO_SUCH_FILE;
|
||||||
}
|
}
|
||||||
if (!file_system_->RegisterDevice(std::move(device))) {
|
if (!file_system_->RegisterDevice(std::move(device))) {
|
||||||
XELOGE("Unable to register host path");
|
XELOGE("Unable to register host path as {}", mount_path.u8string());
|
||||||
return X_STATUS_NO_SUCH_FILE;
|
return X_STATUS_NO_SUCH_FILE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create symlinks to the device.
|
// Create symlinks to the device.
|
||||||
file_system_->RegisterSymbolicLink("game:", mount_path);
|
file_system_->RegisterSymbolicLink("game:", mount_paths[0].u8string());
|
||||||
file_system_->RegisterSymbolicLink("d:", mount_path);
|
file_system_->RegisterSymbolicLink("d:", mount_paths[0].u8string());
|
||||||
|
|
||||||
// Get just the filename (foo.xex).
|
// Get just the filename (foo.xex).
|
||||||
auto file_name = path.filename();
|
auto file_name = path.filename();
|
||||||
|
|
Loading…
Reference in New Issue