From c7c5aed94893e0e7d7ae20a99a43aa231094c3be Mon Sep 17 00:00:00 2001 From: Gliniak Date: Mon, 9 Dec 2024 19:52:21 +0100 Subject: [PATCH] [UI] Install Content: Install savefiles to profile signed to first slot. This will prevent installation of savefiles to non-existing profiles --- src/xenia/emulator.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 7fd639525..10a0f0907 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -788,18 +788,29 @@ X_STATUS Emulator::InstallContentPackage( const vfs::XContentContainerDevice* dev = (vfs::XContentContainerDevice*)device.get(); + // Always install savefiles to user signed to slot 0. + const auto profile = + kernel_state_->xam_state()->profile_manager()->GetProfile( + static_cast(0)); + + uint64_t xuid = dev->xuid(); + if (dev->content_type() == static_cast(XContentType::kSavedGame) && + profile) { + xuid = profile->xuid(); + } + std::filesystem::path installation_path = - content_root() / fmt::format("{:016X}", dev->xuid()) / + content_root() / fmt::format("{:016X}", xuid) / fmt::format("{:08X}", dev->title_id()) / fmt::format("{:08X}", dev->content_type()) / path.filename(); std::filesystem::path header_path = - content_root() / fmt::format("{:016X}", dev->xuid()) / + content_root() / fmt::format("{:016X}", xuid) / fmt::format("{:08X}", dev->title_id()) / "Headers" / fmt::format("{:08X}", dev->content_type()) / path.filename(); installation_info.installation_path = - fmt::format("{:016X}/{:08X}/{:08X}/{}", dev->xuid(), dev->title_id(), + fmt::format("{:016X}/{:08X}/{:08X}/{}", xuid, dev->title_id(), dev->content_type(), xe::path_to_utf8(path.filename())); installation_info.content_name =