From e0f69cddc59e7ba36d5bcf9569a8ab3221c89f06 Mon Sep 17 00:00:00 2001 From: emoose Date: Sat, 11 Jan 2020 18:44:14 +0000 Subject: [PATCH] [Kernel] Support XCONTENTFLAG flags inside CreateContent --- src/xenia/kernel/xam/content_manager.cc | 15 ++++++++++++++- src/xenia/kernel/xam/content_manager.h | 13 ++++++++++++- src/xenia/kernel/xam/xam_content.cc | 3 ++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/xenia/kernel/xam/content_manager.cc b/src/xenia/kernel/xam/content_manager.cc index 1e529577e..69516a758 100644 --- a/src/xenia/kernel/xam/content_manager.cc +++ b/src/xenia/kernel/xam/content_manager.cc @@ -164,7 +164,8 @@ bool ContentManager::ContentExists(const XCONTENT_DATA& data) { } X_RESULT ContentManager::CreateContent(std::string root_name, - const XCONTENT_DATA& data) { + const XCONTENT_DATA& data, + uint32_t flags) { auto global_lock = global_critical_region_.Acquire(); auto package_path = ResolvePackagePath(data); @@ -203,6 +204,18 @@ X_RESULT ContentManager::CreateContent(std::string root_name, vfs::StfsHeader* header = new vfs::StfsHeader(); header->set_defaults(); + // Set metadata flags... + if (flags & XCONTENTFLAG_NODEVICE_TRANSFER) { + header->metadata.flags.bits.device_transfer = false; + } + if ((flags & XCONTENTFLAG_ALLOWPROFILE_TRANSFER) && + !(flags & XCONTENTFLAG_NOPROFILE_TRANSFER)) { + header->metadata.flags.bits.profile_transfer = true; + } + if (flags & XCONTENTFLAG_MOVEONLY_TRANSFER) { + header->metadata.flags.bits.move_only_transfer = true; + } + // Try copying execution info from XEX opt headers auto exe_module = kernel_state_->GetExecutableModule(); if (exe_module) { diff --git a/src/xenia/kernel/xam/content_manager.h b/src/xenia/kernel/xam/content_manager.h index 92c7c9b1e..ed87e6bb3 100644 --- a/src/xenia/kernel/xam/content_manager.h +++ b/src/xenia/kernel/xam/content_manager.h @@ -26,6 +26,16 @@ class KernelState; } // namespace kernel } // namespace xe +// https://github.com/ThirteenAG/Ultimate-ASI-Loader/blob/master/source/xlive/xliveless.h +#define XCONTENTFLAG_NOPROFILE_TRANSFER 0x00000010 +#define XCONTENTFLAG_NODEVICE_TRANSFER 0x00000020 +#define XCONTENTFLAG_STRONG_SIGNED 0x00000040 +#define XCONTENTFLAG_ALLOWPROFILE_TRANSFER 0x00000080 +#define XCONTENTFLAG_MOVEONLY_TRANSFER 0x00000800 +#define XCONTENTFLAG_MANAGESTORAGE 0x00000100 +#define XCONTENTFLAG_FORCE_SHOW_UI 0x00000200 +#define XCONTENTFLAG_ENUM_EXCLUDECOMMON 0x00001000 + namespace xe { namespace kernel { namespace xam { @@ -69,7 +79,8 @@ class ContentManager { uint32_t title_id = -1); bool ContentExists(const XCONTENT_DATA& data); - X_RESULT CreateContent(std::string root_name, const XCONTENT_DATA& data); + X_RESULT CreateContent(std::string root_name, const XCONTENT_DATA& data, + uint32_t flags); X_RESULT OpenContent(std::string root_name, const XCONTENT_DATA& data); X_RESULT CloseContent(std::string root_name); X_RESULT GetContentThumbnail(const XCONTENT_DATA& data, diff --git a/src/xenia/kernel/xam/xam_content.cc b/src/xenia/kernel/xam/xam_content.cc index 848b38f88..5b0e47483 100644 --- a/src/xenia/kernel/xam/xam_content.cc +++ b/src/xenia/kernel/xam/xam_content.cc @@ -321,7 +321,8 @@ dword_result_t XamContentCreateEx(dword_t user_index, lpstring_t root_name, } if (create) { - result = content_manager->CreateContent(root_name.value(), content_data); + result = + content_manager->CreateContent(root_name.value(), content_data, flags); } else if (open) { result = content_manager->OpenContent(root_name.value(), content_data); }