launch module fallback
This commit is contained in:
parent
d84df6e47f
commit
9f1605a2e7
|
@ -329,7 +329,10 @@ const std::unique_ptr<vfs::Device> Emulator::CreateVfsDeviceBasedOnPath(
|
|||
auto parent_path = path.parent_path();
|
||||
return std::make_unique<vfs::HostPathDevice>(
|
||||
mount_path, parent_path, !cvars::allow_game_relative_writes);
|
||||
} else if (extension == ".7z" || extension == ".zip" || extension == ".rar" ||
|
||||
} else if (extension == ".zar") {
|
||||
return std::make_unique<vfs::DiscZarchiveDevice>(mount_path, path);
|
||||
}
|
||||
else if (extension == ".7z" || extension == ".zip" || extension == ".rar" ||
|
||||
extension == ".tar" || extension == ".gz") {
|
||||
xe::ShowSimpleMessageBox(
|
||||
xe::SimpleMessageBoxType::Error,
|
||||
|
@ -422,6 +425,7 @@ X_STATUS Emulator::LaunchPath(const std::filesystem::path& path) {
|
|||
return LaunchXexFile(path);
|
||||
} else if (extension == ".zar") {
|
||||
// Assume a disc image.
|
||||
MountPath(path, "\\Device\\Cdrom0");
|
||||
return LaunchDiscArchive(path);
|
||||
} else {
|
||||
// Assume a disc image.
|
||||
|
@ -446,35 +450,42 @@ X_STATUS Emulator::LaunchXexFile(const std::filesystem::path& path) {
|
|||
}
|
||||
|
||||
X_STATUS Emulator::LaunchDiscImage(const std::filesystem::path& path) {
|
||||
auto module_path(FindLaunchModule());
|
||||
return CompleteLaunch(path, module_path);
|
||||
std::string module_path = FindLaunchModule();
|
||||
X_STATUS result = CompleteLaunch(path, module_path);
|
||||
|
||||
if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) {
|
||||
return LaunchDefaultModule(path);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
X_STATUS Emulator::LaunchDiscArchive(const std::filesystem::path& path) {
|
||||
auto mount_path = "\\Device\\Cdrom0";
|
||||
std::string module_path = FindLaunchModule();
|
||||
X_STATUS result = CompleteLaunch(path, module_path);
|
||||
|
||||
// Register the disc image in the virtual filesystem.
|
||||
auto device = std::make_unique<vfs::DiscZarchiveDevice>(mount_path, path);
|
||||
if (!device->Initialize()) {
|
||||
xe::FatalError("Unable to mount disc image; file not found or corrupt.");
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
if (!file_system_->RegisterDevice(std::move(device))) {
|
||||
xe::FatalError("Unable to register disc image.");
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) {
|
||||
return LaunchDefaultModule(path);
|
||||
}
|
||||
|
||||
// Create symlinks to the device.
|
||||
file_system_->RegisterSymbolicLink("game:", mount_path);
|
||||
file_system_->RegisterSymbolicLink("d:", mount_path);
|
||||
|
||||
// Launch the game.
|
||||
auto module_path(FindLaunchModule());
|
||||
return CompleteLaunch(path, module_path);
|
||||
return result;
|
||||
}
|
||||
|
||||
X_STATUS Emulator::LaunchStfsContainer(const std::filesystem::path& path) {
|
||||
auto module_path(FindLaunchModule());
|
||||
std::string module_path = FindLaunchModule();
|
||||
X_STATUS result = CompleteLaunch(path, module_path);
|
||||
|
||||
if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) {
|
||||
return LaunchDefaultModule(path);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
X_STATUS Emulator::LaunchDefaultModule(const std::filesystem::path& path) {
|
||||
cvars::launch_module = "";
|
||||
std::string module_path = FindLaunchModule();
|
||||
|
||||
return CompleteLaunch(path, module_path);
|
||||
}
|
||||
|
||||
|
|
|
@ -202,6 +202,8 @@ class Emulator {
|
|||
// Launches a game from an STFS container file.
|
||||
X_STATUS LaunchStfsContainer(const std::filesystem::path& path);
|
||||
|
||||
X_STATUS LaunchDefaultModule(const std::filesystem::path& path);
|
||||
|
||||
// Extract content of package to content specific directory.
|
||||
X_STATUS InstallContentPackage(const std::filesystem::path& path);
|
||||
|
||||
|
|
Loading…
Reference in New Issue