[Kernel] CreateContent: create headers.bin file with the content info
This commit is contained in:
parent
5c23c4043c
commit
b41d51a7a4
|
@ -112,7 +112,8 @@ std::vector<XCONTENT_DATA> ContentManager::ListContent(uint32_t device_id,
|
||||||
auto* header = (vfs::StfsHeader*)map->data();
|
auto* header = (vfs::StfsHeader*)map->data();
|
||||||
content_data.content_type =
|
content_data.content_type =
|
||||||
static_cast<uint32_t>(header->metadata.content_type);
|
static_cast<uint32_t>(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
|
// TODO: select localized display name
|
||||||
// some games may expect different ones depending on language setting.
|
// some games may expect different ones depending on language setting.
|
||||||
map->Close();
|
map->Close();
|
||||||
|
@ -184,6 +185,23 @@ X_RESULT ContentManager::CreateContent(std::string root_name,
|
||||||
return X_ERROR_FUNCTION_FAILED; // Failed to create directory?
|
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)) {
|
if (!package->Mount(root_name)) {
|
||||||
return X_ERROR_DEVICE_NOT_CONNECTED;
|
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue