Skip to content

Commit

Permalink
[UI] Install Content: Install savefiles to profile signed to first slot.
Browse files Browse the repository at this point in the history
This will prevent installation of savefiles to non-existing profiles
  • Loading branch information
Gliniak committed Dec 9, 2024
1 parent fadc8d5 commit c7c5aed
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/xenia/emulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>(0));

uint64_t xuid = dev->xuid();
if (dev->content_type() == static_cast<uint32_t>(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 =
Expand Down

0 comments on commit c7c5aed

Please # to comment.