ncm_types: Address review

This commit is contained in:
Adubbz 2020-02-25 22:05:51 +11:00
parent 46b0d45aad
commit 3b731c9bf2

View File

@ -20,45 +20,45 @@
namespace ams::ncm { namespace ams::ncm {
enum class ContentMetaType : u8 { enum class ContentMetaType : u8 {
Unknown = 0x0, Unknown = 0x0,
SystemProgram = 0x1, SystemProgram = 0x1,
SystemData = 0x2, SystemData = 0x2,
SystemUpdate = 0x3, SystemUpdate = 0x3,
BootImagePackage = 0x4, BootImagePackage = 0x4,
BootImagePackageSafe = 0x5, BootImagePackageSafe = 0x5,
Application = 0x80, Application = 0x80,
Patch = 0x81, Patch = 0x81,
AddOnContent = 0x82, AddOnContent = 0x82,
Delta = 0x83, Delta = 0x83,
}; };
enum class ContentType : u8 { enum class ContentType : u8 {
Meta = 0, Meta = 0,
Program = 1, Program = 1,
Data = 2, Data = 2,
Control = 3, Control = 3,
HtmlDocument = 4, HtmlDocument = 4,
LegalInformation = 5, LegalInformation = 5,
DeltaFragment = 6, DeltaFragment = 6,
}; };
enum class ContentMetaAttribute : u8 { enum class ContentMetaAttribute : u8 {
None = 0, None = 0,
IncludesExFatDriver = 1, IncludesExFatDriver = 1,
Rebootless = 2, Rebootless = 2,
}; };
enum class ContentInstallType : u8 { enum class ContentInstallType : u8 {
Full = 0, Full = 0,
FragmentOnly = 1, FragmentOnly = 1,
Unknown = 7, Unknown = 7,
}; };
struct MountName { struct MountName {
char name[0x10]; char name[0x10];
}; };
struct PlaceHolderId { alignas(8) struct PlaceHolderId {
util::Uuid uuid; util::Uuid uuid;
bool operator==(const PlaceHolderId& other) const { bool operator==(const PlaceHolderId& other) const {
@ -76,11 +76,11 @@ namespace ams::ncm {
bool operator!=(const util::Uuid& other) const { bool operator!=(const util::Uuid& other) const {
return this->uuid != other; return this->uuid != other;
} }
} __attribute__((aligned(8))); };
static_assert(__alignof__(PlaceHolderId) == 8, "PlaceHolderId definition!"); static_assert(alignof(PlaceHolderId) == 8, "PlaceHolderId definition!");
struct ContentId { alignas(4) struct ContentId {
util::Uuid uuid; util::Uuid uuid;
bool operator==(const ContentId& other) const { bool operator==(const ContentId& other) const {
@ -98,12 +98,12 @@ namespace ams::ncm {
bool operator!=(const util::Uuid& other) const { bool operator!=(const util::Uuid& other) const {
return this->uuid != other; return this->uuid != other;
} }
} __attribute__((aligned(4))); };
static_assert(__alignof__(ContentId) == 4, "ContentId definition!"); static_assert(alignof(ContentId) == 4, "ContentId definition!");
static constexpr PlaceHolderId InvalidPlaceHolderId = { util::InvalidUuid }; constexpr inline PlaceHolderId InvalidPlaceHolderId = { util::InvalidUuid };
static constexpr ContentId InvalidContentId = { util::InvalidUuid }; constexpr inline ContentId InvalidContentId = { util::InvalidUuid };
struct ContentInfo { struct ContentInfo {
ContentId content_id; ContentId content_id;
@ -114,8 +114,8 @@ namespace ams::ncm {
static_assert(sizeof(ContentInfo) == 0x18, "ContentInfo definition!"); static_assert(sizeof(ContentInfo) == 0x18, "ContentInfo definition!");
typedef void (*MakeContentPathFunc)(char* out, ContentId content_id, const char* root); using MakeContentPathFunc = void (*)(char* out, ContentId content_id, const char* root);
typedef void (*MakePlaceHolderPathFunc)(char* out, PlaceHolderId placeholder_id, const char* root); using MakePlaceHolderPathFunc = void (*)(char* out, PlaceHolderId placeholder_id, const char* root);
/* Storage IDs. */ /* Storage IDs. */
enum class StorageId : u8 { enum class StorageId : u8 {
@ -594,7 +594,7 @@ namespace ams::ncm {
static_assert(sizeof(ContentMetaKey) == 0x10, "ContentMetaKey definition!"); static_assert(sizeof(ContentMetaKey) == 0x10, "ContentMetaKey definition!");
/* Used by system updates. They share the exact same struct as ContentMetaKey */ /* Used by system updates. They share the exact same struct as ContentMetaKey */
typedef ContentMetaKey ContentMetaInfo; using ContentMetaInfo = ContentMetaKey;
struct ApplicationContentMetaKey { struct ApplicationContentMetaKey {
ContentMetaKey key; ContentMetaKey key;