[XAM] Fixed issue with invalid path returned in launch_data

This commit is contained in:
Gliniak 2024-03-11 20:09:49 +01:00 committed by Radosław Gliński
parent 08c740c788
commit e8afad8f8a
3 changed files with 14 additions and 9 deletions

View File

@ -398,13 +398,13 @@ X_STATUS Emulator::MountPath(const std::filesystem::path& path,
return X_STATUS_NO_SUCH_FILE;
}
file_system_->UnregisterSymbolicLink(kDefaultPartitonSymbolicLink);
file_system_->UnregisterSymbolicLink(kDefaultPartitionSymbolicLink);
file_system_->UnregisterSymbolicLink(kDefaultGameSymbolicLink);
file_system_->UnregisterSymbolicLink("plugins:");
// Create symlinks to the device.
file_system_->RegisterSymbolicLink(kDefaultGameSymbolicLink, mount_path);
file_system_->RegisterSymbolicLink(kDefaultPartitonSymbolicLink, mount_path);
file_system_->RegisterSymbolicLink(kDefaultPartitionSymbolicLink, mount_path);
return X_STATUS_SUCCESS;
}
@ -875,14 +875,14 @@ std::string Emulator::FindLaunchModule() {
// Remove previous symbolic links.
// Some titles can provide root within specific directory.
kernel_state_->file_system()->UnregisterSymbolicLink(
kDefaultPartitonSymbolicLink);
kDefaultPartitionSymbolicLink);
kernel_state_->file_system()->UnregisterSymbolicLink(
kDefaultGameSymbolicLink);
file_path /= std::filesystem::path(xam->loader_data().launch_path);
kernel_state_->file_system()->RegisterSymbolicLink(
kDefaultPartitonSymbolicLink,
kDefaultPartitionSymbolicLink,
xe::path_to_utf8(file_path.parent_path()));
kernel_state_->file_system()->RegisterSymbolicLink(
kDefaultGameSymbolicLink, xe::path_to_utf8(file_path.parent_path()));

View File

@ -53,7 +53,7 @@ namespace xe {
constexpr fourcc_t kEmulatorSaveSignature = make_fourcc("XSAV");
static const std::string kDefaultGameSymbolicLink = "GAME:";
static const std::string kDefaultPartitonSymbolicLink = "D:";
static const std::string kDefaultPartitionSymbolicLink = "D:";
// The main type that runs the whole emulator.
// This is responsible for initializing and managing all the various subsystems.

View File

@ -110,10 +110,15 @@ void XamModule::SaveLoaderData() {
std::filesystem::path host_path = loader_data_.host_path;
std::string launch_path = loader_data_.launch_path;
const std::string launch_prefix = "game:\\";
if (launch_path.compare(0, launch_prefix.length(), launch_prefix) == 0) {
launch_path = launch_path.substr(launch_prefix.length());
}
auto remove_prefix = [&launch_path](std::string& prefix) {
if (launch_path.compare(0, prefix.length(), prefix) == 0) {
launch_path = launch_path.substr(prefix.length());
}
};
remove_prefix(std::string("game:\\"));
remove_prefix(std::string("d:\\"));
if (host_path.extension() == ".xex") {
host_path.remove_filename();