From d3065fd694cd9f4ce7ba9be8c2cdac0a0a5aeb6b Mon Sep 17 00:00:00 2001 From: emoose Date: Sat, 11 Jan 2020 18:22:13 +0000 Subject: [PATCH] [Kernel] CreateContent: create headers.bin file with the content info --- src/xenia/kernel/xam/content_manager.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/xenia/kernel/xam/content_manager.cc b/src/xenia/kernel/xam/content_manager.cc index d43e54112..fd045cdaa 100644 --- a/src/xenia/kernel/xam/content_manager.cc +++ b/src/xenia/kernel/xam/content_manager.cc @@ -112,7 +112,8 @@ std::vector ContentManager::ListContent(uint32_t device_id, auto* header = (vfs::StfsHeader*)map->data(); content_data.content_type = static_cast(header->metadata.content_type); - content_data.display_name = header->metadata.display_name[0]; + content_data.display_name = + header->metadata.get_display_name(XLanguage::kEnglish); // TODO: select localized display name // some games may expect different ones depending on language setting. map->Close(); @@ -184,6 +185,23 @@ X_RESULT ContentManager::CreateContent(std::string root_name, return X_ERROR_FUNCTION_FAILED; // Failed to create directory? } + // Create .headers.bin file + auto headers_path = package_path + ContentManager::kStfsHeadersExtension; + auto* file = xe::filesystem::OpenFile(headers_path, "wb"); + if (!file) { + return X_ERROR_FUNCTION_FAILED; // failed to create headers file :( + } + + // Set headers using data from XCONTENT_DATA + vfs::StfsHeader* header = new vfs::StfsHeader(); + // TODO: set title_id, title_name & publisher from XDBF info + header->metadata.content_type = (xe::vfs::XContentType)data.content_type; + header->metadata.set_display_name(data.display_name, XLanguage::kEnglish); + // TODO: set display name locale that's currently in use + fwrite(header, sizeof(vfs::StfsHeader), 1, file); + fclose(file); + delete header; + if (!package->Mount(root_name)) { return X_ERROR_DEVICE_NOT_CONNECTED; }