From 0949ebfb38b4193d45ca13fa44614e9d5d763fa1 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Fri, 18 Oct 2024 17:48:54 +0200 Subject: [PATCH] [XAM] Fixed issue with removing savefiles and searching for header in specific condition --- src/xenia/kernel/xam/content_manager.cc | 3 ++- src/xenia/kernel/xam/xam_content.cc | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/xenia/kernel/xam/content_manager.cc b/src/xenia/kernel/xam/content_manager.cc index 48fb6e3ad..ca833e400 100644 --- a/src/xenia/kernel/xam/content_manager.cc +++ b/src/xenia/kernel/xam/content_manager.cc @@ -263,8 +263,9 @@ X_RESULT ContentManager::WriteContentHeaderFile(const uint64_t xuid, if (data.xuid == -1) { data.xuid = xuid; } + uint64_t used_xuid = (data.xuid != -1 && data.xuid != 0) ? data.xuid : xuid; - auto header_path = ResolvePackageHeaderPath(data.file_name(), xuid, + auto header_path = ResolvePackageHeaderPath(data.file_name(), used_xuid, data.title_id, data.content_type); auto parent_path = header_path.parent_path(); diff --git a/src/xenia/kernel/xam/xam_content.cc b/src/xenia/kernel/xam/xam_content.cc index 8ee5c8dea..9444483c1 100644 --- a/src/xenia/kernel/xam/xam_content.cc +++ b/src/xenia/kernel/xam/xam_content.cc @@ -521,20 +521,21 @@ DECLARE_XAM_EXPORT1(XamContentSetThumbnail, kContent, kImplemented); dword_result_t XamContentDelete_entry(dword_t user_index, lpvoid_t content_data_ptr, lpunknown_t overlapped_ptr) { - if (user_index >= XUserMaxUserCount) { - return X_ERROR_ACCESS_DENIED; - } + uint64_t xuid = 0; + if (user_index != XUserIndexNone) { + const auto& user = kernel_state()->xam_state()->GetUserProfile(user_index); - const auto& user = kernel_state()->xam_state()->GetUserProfile(user_index); + if (!user) { + return X_ERROR_NO_SUCH_USER; + } - if (!user) { - return X_ERROR_NO_SUCH_USER; + xuid = user->xuid(); } XCONTENT_AGGREGATE_DATA content_data = *content_data_ptr.as(); - auto result = kernel_state()->content_manager()->DeleteContent(user->xuid(), - content_data); + auto result = + kernel_state()->content_manager()->DeleteContent(xuid, content_data); if (overlapped_ptr) { kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);