[Kernel] Support XCONTENTFLAG flags inside CreateContent

This commit is contained in:
emoose 2020-01-11 18:44:14 +00:00
parent a7b2abb53d
commit 178aca3648
3 changed files with 28 additions and 3 deletions

View File

@ -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) {

View File

@ -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,

View File

@ -310,7 +310,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);
}