LaunchXexFile switched to const string_view instead of path

Added savedisk as possible savepoint
This commit is contained in:
Gliniak 2020-07-27 10:43:06 +02:00
parent 856cce8fe3
commit ca04efd7cb
1 changed files with 6 additions and 11 deletions

View File

@ -278,37 +278,32 @@ X_STATUS Emulator::LaunchXexFile(const std::filesystem::path& path,
// -> game:\foo.xex // -> game:\foo.xex
// Register local directory as some commonly used mount paths // Register local directory as some commonly used mount paths
std::filesystem::path mount_paths[] = { const std::string_view mount_paths[] = {
"\\Device\\Harddisk0\\Partition0", "\\Device\\Harddisk0\\Partition0",
"\\Device\\Harddisk0\\Partition1", "\\Device\\Harddisk0\\Partition1",
"\\Device\\Harddisk0\\Partition1\\DEVKIT", "\\Device\\Harddisk0\\Partition1\\DEVKIT",
"\\Device\\LauncherData", "\\Device\\LauncherData",
"\\SystemRoot", "\\SystemRoot",
"\\savedisk"
}; };
// Todo: is this even remotely correct?
if (discSwap) {
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) { for (auto mount_path : mount_paths) {
auto device = std::make_unique<vfs::HostPathDevice>(mount_path.u8string(), auto device = std::make_unique<vfs::HostPathDevice>(mount_path, parent_path, true);
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 as {}", mount_path.u8string()); XELOGE("Unable to register host path as {}", mount_path);
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_paths[0].u8string()); file_system_->RegisterSymbolicLink("game:", mount_paths[0]);
file_system_->RegisterSymbolicLink("d:", mount_paths[0].u8string()); file_system_->RegisterSymbolicLink("d:", mount_paths[0]);
// Get just the filename (foo.xex). // Get just the filename (foo.xex).
auto file_name = path.filename(); auto file_name = path.filename();