From 9503c9efaf3add6d3b4357678779810922c55397 Mon Sep 17 00:00:00 2001 From: emoose Date: Tue, 15 Jun 2021 22:33:45 +0100 Subject: [PATCH] [Kernel] Move title_id field in XCONTENT_AGGREGATE_DATA struct XamAppEnumerateContentAggregate seems to store title_id at 0x140, so I've moved title_id to there, now AGGREGATE_DATA seems to match the size of the struct used by XamContentCreateInternal. Also removed unneeded/useless checks inside XamAppEnumerateContentAggregate. --- src/xenia/kernel/xam/apps/xam_app.cc | 9 ++------- src/xenia/kernel/xam/content_manager.h | 4 +++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/xenia/kernel/xam/apps/xam_app.cc b/src/xenia/kernel/xam/apps/xam_app.cc index a565a49ac..664e1e60f 100644 --- a/src/xenia/kernel/xam/apps/xam_app.cc +++ b/src/xenia/kernel/xam/apps/xam_app.cc @@ -59,13 +59,8 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, uint32_t item_count = 0; auto result = e->WriteItems(data->buffer_ptr, buffer, data->buffer_size, &item_count); - assert_true(XSUCCEEDED(result)); - assert_true(item_count <= 1); - if (XSUCCEEDED(result) && item_count == 1) { - auto content_data = reinterpret_cast(buffer); - // TODO(gibbed): WTF? - *reinterpret_cast*>(&buffer[0x140]) = - content_data->title_id; + + if (result == X_ERROR_SUCCESS && item_count >= 1) { if (data->length_ptr) { auto length_ptr = memory_->TranslateVirtual*>(data->length_ptr); diff --git a/src/xenia/kernel/xam/content_manager.h b/src/xenia/kernel/xam/content_manager.h index b65c1f22c..4876bfd1c 100644 --- a/src/xenia/kernel/xam/content_manager.h +++ b/src/xenia/kernel/xam/content_manager.h @@ -93,6 +93,7 @@ struct XCONTENT_DATA { static_assert_size(XCONTENT_DATA, 0x134); struct XCONTENT_AGGREGATE_DATA : XCONTENT_DATA { + be unk134; // some titles store XUID here? be title_id; XCONTENT_AGGREGATE_DATA() = default; @@ -102,6 +103,7 @@ struct XCONTENT_AGGREGATE_DATA : XCONTENT_DATA { set_display_name(other.display_name()); set_file_name(other.file_name()); padding[0] = padding[1] = 0; + unk134 = 0; title_id = kCurrentlyRunningTitleId; } @@ -113,7 +115,7 @@ struct XCONTENT_AGGREGATE_DATA : XCONTENT_DATA { file_name() == other.file_name(); } }; -static_assert_size(XCONTENT_AGGREGATE_DATA, 0x138); +static_assert_size(XCONTENT_AGGREGATE_DATA, 0x148); class ContentPackage { public: