Improved docs

This commit is contained in:
Adubbz 2019-09-24 22:11:40 +10:00
parent 3d7e3c52f7
commit a34e066e0e

View File

@ -9,76 +9,87 @@
#include "../services/fs.h" #include "../services/fs.h"
#include "../services/sm.h" #include "../services/sm.h"
/// NcmContentStorage
typedef struct { typedef struct {
Service s; Service s; ///< IContentStorage
} NcmContentStorage; } NcmContentStorage;
/// NcmContentMetaDatabase
typedef struct { typedef struct {
Service s; Service s; ///< IContentMetaDatabase
} NcmContentMetaDatabase; } NcmContentMetaDatabase;
/// ContentType
typedef enum { typedef enum {
NcmContentType_Meta = 0, NcmContentType_Meta = 0, ///< Meta
NcmContentType_Program = 1, NcmContentType_Program = 1, ///< Program
NcmContentType_Data = 2, NcmContentType_Data = 2, ///< Data
NcmContentType_Control = 3, NcmContentType_Control = 3, ///< Control
NcmContentType_HtmlDocument = 4, NcmContentType_HtmlDocument = 4, ///< HtmlDocument
NcmContentType_LegalInformation = 5, NcmContentType_LegalInformation = 5, ///< LegalInformation
NcmContentType_DeltaFragment = 6, NcmContentType_DeltaFragment = 6, ///< DeltaFragment
} NcmContentType; } NcmContentType;
/// ContentMetaType
typedef enum { typedef enum {
NcmContentMetaType_Unknown = 0x0, NcmContentMetaType_Unknown = 0x0, ///< Unknown
NcmContentMetaType_SystemProgram = 0x1, NcmContentMetaType_SystemProgram = 0x1, ///< SystemProgram
NcmContentMetaType_SystemData = 0x2, NcmContentMetaType_SystemData = 0x2, ///< SystemData
NcmContentMetaType_SystemUpdate = 0x3, NcmContentMetaType_SystemUpdate = 0x3, ///< SystemUpdate
NcmContentMetaType_BootImagePackage = 0x4, NcmContentMetaType_BootImagePackage = 0x4, ///< BootImagePackage
NcmContentMetaType_BootImagePackageSafe = 0x5, NcmContentMetaType_BootImagePackageSafe = 0x5, ///< BootImagePackageSafe
NcmContentMetaType_Application = 0x80, NcmContentMetaType_Application = 0x80, ///< Application
NcmContentMetaType_Patch = 0x81, NcmContentMetaType_Patch = 0x81, ///< Patch
NcmContentMetaType_AddOnContent = 0x82, NcmContentMetaType_AddOnContent = 0x82, ///< AddOnContent
NcmContentMetaType_Delta = 0x83, NcmContentMetaType_Delta = 0x83, ///< Delta
} NcmContentMetaType; } NcmContentMetaType;
/// ContentMetaAttribute
typedef enum { typedef enum {
NcmContentMetaAttribute_None = 0, NcmContentMetaAttribute_None = 0, ///< None
NcmContentMetaAttribute_IncludesExFatDriver = BIT(0), NcmContentMetaAttribute_IncludesExFatDriver = BIT(0), ///< IncludesExFatDriver
NcmContentMetaAttribute_Rebootless = BIT(1), NcmContentMetaAttribute_Rebootless = BIT(1), ///< Rebootless
} NcmContentMetaAttribute; } NcmContentMetaAttribute;
/// ContentInstallType
typedef enum { typedef enum {
NcmContentInstallType_Full = 0, NcmContentInstallType_Full = 0, ///< Full
NcmContentInstallType_FragmentOnly = 1, NcmContentInstallType_FragmentOnly = 1, ///< FragmentOnly
NcmContentInstallType_Unknown = 7, NcmContentInstallType_Unknown = 7, ///< Unknown
} NcmContentInstallType; } NcmContentInstallType;
/// NcaId
typedef struct { typedef struct {
u8 c[0x10]; u8 c[0x10]; ///< Id
} NcmNcaId; } NcmNcaId;
/// ContentMetaKey
typedef struct { typedef struct {
u64 id; u64 id; ///< Title id.
u32 version; u32 version; ///< Title version.
NcmContentMetaType type; NcmContentMetaType type; ///< \ref NcmContentMetaType
NcmContentInstallType install_type; NcmContentInstallType install_type; ///< \ref NcmContentInstallType
u8 padding[2]; u8 padding[2]; ///< Padding.
} NcmContentMetaKey; } NcmContentMetaKey;
/// ApplicationContentMetaKey
typedef struct { typedef struct {
NcmContentMetaKey key; NcmContentMetaKey key; ///< \ref NcmContentMetaKey
u64 application_id; u64 application_id; ///< Title id of an application.
} NcmApplicationContentMetaKey; } NcmApplicationContentMetaKey;
/// ContentInfo
typedef struct { typedef struct {
NcmNcaId content_id; NcmNcaId content_id; ///< \ref NcmNcaId
u8 size[0x6]; u8 size[0x6]; ///< Content size.
NcmContentType content_type; NcmContentType content_type; ///< \ref NcmContentType.
u8 id_offset; u8 id_offset; ///< Offset of this content. Unused by most applications.
} NcmContentInfo; } NcmContentInfo;
/* Used by system updates. They share the exact same struct as NcmContentMetaKey */ /* Used by system updates. They share the exact same struct as NcmContentMetaKey */
typedef NcmContentMetaKey NcmContentMetaInfo; typedef NcmContentMetaKey NcmContentMetaInfo;
/// ContentMetaHeader
typedef struct { typedef struct {
u16 extended_header_size; ///< Size of optional struct that comes after this one. u16 extended_header_size; ///< Size of optional struct that comes after this one.
u16 content_count; ///< Number of NcmContentInfos after the extra bytes. u16 content_count; ///< Number of NcmContentInfos after the extra bytes.
@ -87,27 +98,31 @@ typedef struct {
FsStorageId storage_id; ///< Usually None (0). FsStorageId storage_id; ///< Usually None (0).
} NcmContentMetaHeader; } NcmContentMetaHeader;
/// ApplicationMetaExtendedHeader
typedef struct { typedef struct {
u64 patch_id; u64 patch_id; ///< Title id of this application's patch.
u32 required_system_version; u32 required_system_version; ///< Firmware version required by this application.
u32 padding; u32 padding; ///< Padding.
} NcmApplicationMetaExtendedHeader; } NcmApplicationMetaExtendedHeader;
/// PatchMetaExtendedHeader
typedef struct { typedef struct {
u64 application_id; u64 application_id; ///< Title id of this patch's corresponding application.
u32 required_system_version; u32 required_system_version; ///< Firmware version required by this patch.
u32 extended_data_size; u32 extended_data_size; ///< Size of the extended data following the NcmContentInfos.
u8 reserved[0x8]; u8 reserved[0x8]; ///< Unused.
} NcmPatchMetaExtendedHeader; } NcmPatchMetaExtendedHeader;
/// AddOnContentMetaExtendedHeader
typedef struct { typedef struct {
u64 application_id; u64 application_id; ///< Title id of this add-on-content's corresponding application.
u32 required_application_version; u32 required_application_version; ///< Version of the application required by this add-on-content.
u32 padding; u32 padding; ///< Padding.
} NcmAddOnContentMetaExtendedHeader; } NcmAddOnContentMetaExtendedHeader;
/// SystemUpdateMetaExtendedHeader
typedef struct { typedef struct {
u32 extended_data_size; u32 extended_data_size; ///< Size of the extended data after NcmContentInfos and NcmContentMetaInfos.
} NcmSystemUpdateMetaExtendedHeader; } NcmSystemUpdateMetaExtendedHeader;
Result ncmInitialize(void); Result ncmInitialize(void);