libnx  v4.2.1
caps.h
Go to the documentation of this file.
1 /**
2  * @file caps.h
3  * @brief Common caps (caps:*) service IPC header.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../services/acc.h"
10 
11 /// ImageOrientation
12 typedef enum {
13  AlbumImageOrientation_Unknown0 = 0, ///< Unknown. Default.
14  AlbumImageOrientation_Unknown1 = 1, ///< Unknown.
15  AlbumImageOrientation_Unknown2 = 2, ///< Unknown.
16  AlbumImageOrientation_Unknown3 = 3, ///< Unknown.
18 
19 /// AlbumReportOption
20 typedef enum {
21  AlbumReportOption_Disable = 0, ///< Don't display the screenshot-taken Overlay-applet notification.
22  AlbumReportOption_Enable = 1, ///< Display the screenshot-taken Overlay notification.
24 
25 typedef enum {
26  CapsAlbumStorage_Nand = 0, ///< Nand
27  CapsAlbumStorage_Sd = 1, ///< Sd
29 
30 /// ContentType
31 typedef enum {
32  CapsContentType_Screenshot = 0, ///< Album screenshots.
33  CapsContentType_Movie = 1, ///< Album videos.
34  CapsContentType_ExtraMovie = 3, ///< Videos recorded by the current host Application via \ref grcCreateMovieMaker.
36 
37 /// ScreenShotAttribute
38 typedef struct {
39  u32 unk_x0; ///< Always set to 0 by official sw.
40  u32 orientation; ///< \ref AlbumImageOrientation
41  u32 unk_x8; ///< Always set to 0 by official sw.
42  u32 unk_xc; ///< Always set to 1 by official sw.
43  u8 unk_x10[0x30]; ///< Always set to 0 by official sw.
45 
46 /// ScreenShotAttributeForApplication. Only unk_x0 is used by official sw.
47 typedef struct {
48  u32 unk_x0; ///< Unknown.
49  u8 unk_x4; ///< Unknown.
50  u8 unk_x5; ///< Unknown.
51  u8 unk_x6; ///< Unknown.
52  u8 pad; ///< Padding.
53  u32 unk_x8; ///< Unknown.
54  u32 unk_xc; ///< Unknown.
55  u32 unk_x10; ///< Unknown.
56  u32 unk_x14; ///< Unknown.
57  u32 unk_x18; ///< Unknown.
58  u32 unk_x1c; ///< Unknown.
59  u16 unk_x20; ///< Unknown.
60  u16 unk_x22; ///< Unknown.
61  u16 unk_x24; ///< Unknown.
62  u16 unk_x26; ///< Unknown.
63  u8 reserved[0x18]; ///< Always zero.
65 
66 /// ScreenShotDecoderFlag
67 typedef enum {
68  CapsScreenShotDecoderFlag_None = 0, ///< No special processing.
69  CapsScreenShotDecoderFlag_EnableFancyUpsampling = BIT(0), ///< See libjpeg-turbo do_fancy_upsampling.
70  CapsScreenShotDecoderFlag_EnableBlockSmoothing = BIT(1), ///< See libjpeg-turbo do_block_smoothing.
72 
73 /// ScreenShotDecodeOption
74 typedef struct {
75  u64 flags; ///< Bitflags, see \ref CapsScreenShotDecoderFlag.
76  u64 reserved[0x3]; ///< Reserved. Unused by official sw.
78 
79 /// AlbumFileDateTime. This corresponds to each field in the Album entry filename, prior to the "-": "YYYYMMDDHHMMSSII".
80 typedef struct {
81  u16 year; ///< Year.
82  u8 month; ///< Month.
83  u8 day; ///< Day of the month.
84  u8 hour; ///< Hour.
85  u8 minute; ///< Minute.
86  u8 second; ///< Second.
87  u8 id; ///< Unique ID for when there's multiple Album files with the same timestamp.
89 
90 /// AlbumEntryId
91 typedef struct {
92  u64 application_id; ///< ApplicationId
93  CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
94  u8 storage; ///< \ref CapsAlbumStorage
95  u8 content; ///< \ref CapsAlbumFileContents
96  u8 pad_x12[0x6]; ///< padding
98 
99 /// AlbumEntry
100 typedef struct {
101  u64 size; ///< Size.
102  CapsAlbumFileId file_id; ///< \ref CapsAlbumFileId
104 
105 /// ApplicationAlbumEntry
106 typedef struct {
107  union {
108  u8 data[0x20]; ///< Data.
109 
110  struct {
111  u8 unk_x0[0x20]; ///< aes256 with random key over \ref AlbumEntry.
112  } v0; ///< Pre-7.0.0
113 
114  struct {
115  u64 size; ///< size of the entry
116  u64 hash; ///< aes256 with hardcoded key over \ref AlbumEntry.
117  CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
118  u8 storage; ///< \ref CapsAlbumStorage
119  u8 content; ///< \ref CapsAlbumFileContents
120  u8 pad_x1a[0x5]; ///< padding
121  u8 unk_x1f; ///< Set to 1 by official software
122  } v1; ///< [7.0.0+]
123  };
125 
126 /// ApplicationAlbumFileEntry
127 typedef struct {
128  CapsApplicationAlbumEntry entry; ///< \ref CapsApplicationAlbumEntry
129  CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
130  u64 unk_x28; ///< Unknown.
132 
133 /// ApplicationData
134 typedef struct {
135  u8 userdata[0x400]; ///< UserData.
136  u32 size; ///< UserData size.
138 
139 /// AlbumFileContents
140 typedef enum {
141  CapsAlbumFileContents_ScreenShot = 0,
142  CapsAlbumFileContents_Movie = 1,
143  CapsAlbumFileContents_ExtraScreenShot = 2,
144  CapsAlbumFileContents_ExtraMovie = 3,
146 
147 typedef enum {
148  CapsAlbumContentsUsageFlag_HasGreaterUsage = BIT(0), ///< Indicates that there are additional files not captured by the count/size fields of CapsAlbumContentsUsage
149  CapsAlbumContentsUsageFlag_IsUnknownContents = BIT(1), ///< Indicates that the file is not a known content type
151 
152 typedef struct {
153  s64 count; ///< Count.
154  s64 size; ///< Size. Used storage space.
155  u32 flags; ///< \ref CapsAlbumContentsUsageFlag
156  u8 file_contents; ///< \ref CapsAlbumFileContents
157  u8 pad_x15[0x3]; ///< Unused
159 
160 typedef struct {
161  CapsAlbumContentsUsage usages[2]; ///< \ref CapsAlbumContentsUsage
163 
164 typedef struct {
165  CapsAlbumContentsUsage usages[3]; ///< \ref CapsAlbumContentsUsage
167 
168 typedef struct {
169  CapsAlbumContentsUsage usages[16]; ///< \ref CapsAlbumContentsUsage
171 
172 /// UserIdList
173 typedef struct {
174  AccountUid uids[ACC_USER_LIST_SIZE]; ///< \ref AccountUid
175  u8 count; ///< Total userIDs.
176  u8 pad[7]; ///< Padding.
178 
179 /// LoadAlbumScreenShotImageOutputForApplication
180 typedef struct {
181  s64 width; ///< Width. Official sw copies this to a s32 output field.
182  s64 height; ///< Height. Official sw copies this to a s32 output field.
183  CapsScreenShotAttributeForApplication attr; ///< \ref CapsScreenShotAttributeForApplication
184  CapsApplicationData appdata; ///< \ref CapsApplicationData
185  u8 reserved[0xac]; ///< Unused.
187 
188 /// LoadAlbumScreenShotImageOutput
189 typedef struct {
190  s64 width; ///< Width. Official sw copies this to a s32 output field.
191  s64 height; ///< Height. Official sw copies this to a s32 output field.
192  CapsScreenShotAttribute attr; ///< \ref CapsScreenShotAttribute
193  u8 unk_x50[0x400]; ///< Unused.
195 
196 /// AlbumFileContentsFlag
197 typedef enum {
198  CapsAlbumFileContentsFlag_ScreenShot = BIT(0), ///< Query for ScreenShot files.
199  CapsAlbumFileContentsFlag_Movie = BIT(1), ///< Query for Movie files.
201 
202 /// AlbumCache
203 typedef struct {
204  u64 count; ///< Count
205  u64 unk_x8; ///< Unknown
207 
208 /// Gets the ShimLibraryVersion.
210 
211 /// Gets the default start_datetime.
213  return (CapsAlbumFileDateTime){.year = 1970, .month = 1, .day = 1};
214 }
215 
216 /// Gets the default end_datetime.
218  return (CapsAlbumFileDateTime){.year = 3000, .month = 1, .day = 1};
219 }
220 
221 /// Convert a \ref CapsApplicationAlbumFileEntry to \ref CapsApplicationAlbumEntry.
223  *out = in->entry;
224 }
225 
226 /// Convert a \ref CapsApplicationAlbumEntry to \ref CapsApplicationAlbumFileEntry. Should only be used on [7.0.0+].
228  out->entry = *in;
229  out->datetime = in->v1.datetime;
230  out->unk_x28 = 0;
231 }
232 
CapsScreenShotDecodeOption::flags
u64 flags
Bitflags, see CapsScreenShotDecoderFlag.
Definition: caps.h:75
s64
int64_t s64
64-bit signed integer.
Definition: types.h:28
CapsScreenShotAttributeForApplication::unk_x14
u32 unk_x14
Unknown.
Definition: caps.h:56
CapsScreenShotAttributeForApplication::unk_x1c
u32 unk_x1c
Unknown.
Definition: caps.h:58
CapsScreenShotDecoderFlag_EnableBlockSmoothing
@ CapsScreenShotDecoderFlag_EnableBlockSmoothing
See libjpeg-turbo do_block_smoothing.
Definition: caps.h:70
CapsAlbumFileContentsFlag
CapsAlbumFileContentsFlag
AlbumFileContentsFlag.
Definition: caps.h:197
CapsContentType
CapsContentType
ContentType.
Definition: caps.h:31
CapsAlbumStorage_Nand
@ CapsAlbumStorage_Nand
Nand.
Definition: caps.h:26
CapsContentType_Movie
@ CapsContentType_Movie
Album videos.
Definition: caps.h:33
CapsLoadAlbumScreenShotImageOutputForApplication::height
s64 height
Height. Official sw copies this to a s32 output field.
Definition: caps.h:182
CapsScreenShotDecoderFlag_None
@ CapsScreenShotDecoderFlag_None
No special processing.
Definition: caps.h:68
CapsAlbumFileId::datetime
CapsAlbumFileDateTime datetime
CapsAlbumFileDateTime
Definition: caps.h:93
CapsApplicationData
ApplicationData.
Definition: caps.h:134
CapsLoadAlbumScreenShotImageOutputForApplication
LoadAlbumScreenShotImageOutputForApplication.
Definition: caps.h:180
CapsAlbumFileContents
CapsAlbumFileContents
AlbumFileContents.
Definition: caps.h:140
CapsScreenShotAttributeForApplication::unk_x24
u16 unk_x24
Unknown.
Definition: caps.h:61
u8
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
CapsScreenShotDecodeOption
ScreenShotDecodeOption.
Definition: caps.h:74
CapsScreenShotAttributeForApplication::unk_x5
u8 unk_x5
Unknown.
Definition: caps.h:50
CapsScreenShotAttributeForApplication::unk_x0
u32 unk_x0
Unknown.
Definition: caps.h:48
CapsAlbumContentsUsageFlag_IsUnknownContents
@ CapsAlbumContentsUsageFlag_IsUnknownContents
Indicates that the file is not a known content type.
Definition: caps.h:149
CapsAlbumUsage2
Definition: caps.h:160
CapsAlbumFileDateTime::minute
u8 minute
Minute.
Definition: caps.h:85
AccountUid
Account UserId.
Definition: acc.h:25
CapsApplicationAlbumEntry::storage
u8 storage
CapsAlbumStorage
Definition: caps.h:118
CapsAlbumEntry::file_id
CapsAlbumFileId file_id
CapsAlbumFileId
Definition: caps.h:102
CapsLoadAlbumScreenShotImageOutputForApplication::width
s64 width
Width. Official sw copies this to a s32 output field.
Definition: caps.h:181
CapsLoadAlbumScreenShotImageOutput
LoadAlbumScreenShotImageOutput.
Definition: caps.h:189
CapsAlbumUsage16
Definition: caps.h:168
CapsScreenShotAttributeForApplication::unk_x18
u32 unk_x18
Unknown.
Definition: caps.h:57
CapsScreenShotAttributeForApplication::unk_x8
u32 unk_x8
Unknown.
Definition: caps.h:53
CapsLoadAlbumScreenShotImageOutputForApplication::attr
CapsScreenShotAttributeForApplication attr
CapsScreenShotAttributeForApplication
Definition: caps.h:183
CapsAlbumContentsUsage::size
s64 size
Size. Used storage space.
Definition: caps.h:154
CapsAlbumStorage
CapsAlbumStorage
Definition: caps.h:25
CapsAlbumEntry::size
u64 size
Size.
Definition: caps.h:101
CapsLoadAlbumScreenShotImageOutput::width
s64 width
Width. Official sw copies this to a s32 output field.
Definition: caps.h:190
CapsApplicationAlbumFileEntry
ApplicationAlbumFileEntry.
Definition: caps.h:127
CapsAlbumFileDateTime::year
u16 year
Year.
Definition: caps.h:81
CapsAlbumFileId
AlbumEntryId.
Definition: caps.h:91
CapsScreenShotAttributeForApplication::unk_x6
u8 unk_x6
Unknown.
Definition: caps.h:51
AlbumImageOrientation_Unknown1
@ AlbumImageOrientation_Unknown1
Unknown.
Definition: caps.h:14
CapsApplicationAlbumEntry::datetime
CapsAlbumFileDateTime datetime
CapsAlbumFileDateTime
Definition: caps.h:117
CapsScreenShotAttribute
ScreenShotAttribute.
Definition: caps.h:38
CapsScreenShotDecoderFlag
CapsScreenShotDecoderFlag
ScreenShotDecoderFlag.
Definition: caps.h:67
CapsAlbumFileDateTime::id
u8 id
Unique ID for when there's multiple Album files with the same timestamp.
Definition: caps.h:87
CapsApplicationAlbumEntry::v1
struct CapsApplicationAlbumEntry::@127::@130 v1
[7.0.0+]
CapsApplicationAlbumEntry::content
u8 content
CapsAlbumFileContents
Definition: caps.h:119
CapsLoadAlbumScreenShotImageOutput::attr
CapsScreenShotAttribute attr
CapsScreenShotAttribute
Definition: caps.h:192
CapsAlbumEntry
AlbumEntry.
Definition: caps.h:100
CapsScreenShotAttributeForApplication::unk_x4
u8 unk_x4
Unknown.
Definition: caps.h:49
CapsApplicationAlbumFileEntry::datetime
CapsAlbumFileDateTime datetime
CapsAlbumFileDateTime
Definition: caps.h:129
CapsScreenShotAttributeForApplication::unk_x20
u16 unk_x20
Unknown.
Definition: caps.h:59
AlbumReportOption
AlbumReportOption
AlbumReportOption.
Definition: caps.h:20
capsGetDefaultStartDateTime
static CapsAlbumFileDateTime capsGetDefaultStartDateTime(void)
Gets the default start_datetime.
Definition: caps.h:212
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
CapsAlbumFileContentsFlag_ScreenShot
@ CapsAlbumFileContentsFlag_ScreenShot
Query for ScreenShot files.
Definition: caps.h:198
CapsScreenShotAttributeForApplication::unk_x26
u16 unk_x26
Unknown.
Definition: caps.h:62
CapsScreenShotAttributeForApplication::unk_x22
u16 unk_x22
Unknown.
Definition: caps.h:60
CapsAlbumFileId::application_id
u64 application_id
ApplicationId.
Definition: caps.h:92
CapsScreenShotAttributeForApplication
ScreenShotAttributeForApplication. Only unk_x0 is used by official sw.
Definition: caps.h:47
CapsAlbumFileId::storage
u8 storage
CapsAlbumStorage
Definition: caps.h:94
CapsAlbumFileId::content
u8 content
CapsAlbumFileContents
Definition: caps.h:95
CapsScreenShotAttribute::orientation
u32 orientation
AlbumImageOrientation
Definition: caps.h:40
u64
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
CapsApplicationData::size
u32 size
UserData size.
Definition: caps.h:136
CapsAlbumContentsUsage::flags
u32 flags
CapsAlbumContentsUsageFlag
Definition: caps.h:155
capsGetDefaultEndDateTime
static CapsAlbumFileDateTime capsGetDefaultEndDateTime(void)
Gets the default end_datetime.
Definition: caps.h:217
CapsAlbumCache::count
u64 count
Count.
Definition: caps.h:204
CapsScreenShotAttributeForApplication::unk_xc
u32 unk_xc
Unknown.
Definition: caps.h:54
CapsScreenShotDecoderFlag_EnableFancyUpsampling
@ CapsScreenShotDecoderFlag_EnableFancyUpsampling
See libjpeg-turbo do_fancy_upsampling.
Definition: caps.h:69
CapsUserIdList
UserIdList.
Definition: caps.h:173
CapsScreenShotAttribute::unk_x0
u32 unk_x0
Always set to 0 by official sw.
Definition: caps.h:39
CapsApplicationAlbumFileEntry::unk_x28
u64 unk_x28
Unknown.
Definition: caps.h:130
CapsAlbumFileDateTime::month
u8 month
Month.
Definition: caps.h:82
CapsApplicationAlbumEntry
ApplicationAlbumEntry.
Definition: caps.h:106
CapsAlbumFileDateTime
AlbumFileDateTime. This corresponds to each field in the Album entry filename, prior to the "-": "YYY...
Definition: caps.h:80
CapsAlbumContentsUsageFlag
CapsAlbumContentsUsageFlag
Definition: caps.h:147
AlbumImageOrientation
AlbumImageOrientation
ImageOrientation.
Definition: caps.h:12
CapsContentType_Screenshot
@ CapsContentType_Screenshot
Album screenshots.
Definition: caps.h:32
CapsApplicationAlbumFileEntry::entry
CapsApplicationAlbumEntry entry
CapsApplicationAlbumEntry
Definition: caps.h:128
CapsLoadAlbumScreenShotImageOutput::height
s64 height
Height. Official sw copies this to a s32 output field.
Definition: caps.h:191
CapsAlbumContentsUsage
Definition: caps.h:152
CapsAlbumUsage3
Definition: caps.h:164
CapsAlbumContentsUsageFlag_HasGreaterUsage
@ CapsAlbumContentsUsageFlag_HasGreaterUsage
Indicates that there are additional files not captured by the count/size fields of CapsAlbumContentsU...
Definition: caps.h:148
CapsScreenShotAttribute::unk_xc
u32 unk_xc
Always set to 1 by official sw.
Definition: caps.h:42
CapsAlbumCache::unk_x8
u64 unk_x8
Unknown.
Definition: caps.h:205
CapsAlbumContentsUsage::count
s64 count
Count.
Definition: caps.h:153
CapsAlbumFileDateTime::second
u8 second
Second.
Definition: caps.h:86
CapsScreenShotAttribute::unk_x8
u32 unk_x8
Always set to 0 by official sw.
Definition: caps.h:41
CapsApplicationAlbumEntry::hash
u64 hash
aes256 with hardcoded key over AlbumEntry.
Definition: caps.h:116
capsConvertApplicationAlbumFileEntryToApplicationAlbumEntry
static void capsConvertApplicationAlbumFileEntryToApplicationAlbumEntry(CapsApplicationAlbumEntry *out, CapsApplicationAlbumFileEntry *in)
Convert a CapsApplicationAlbumFileEntry to CapsApplicationAlbumEntry.
Definition: caps.h:222
CapsApplicationAlbumEntry::unk_x1f
u8 unk_x1f
Set to 1 by official software.
Definition: caps.h:121
capsGetShimLibraryVersion
u64 capsGetShimLibraryVersion(void)
Gets the ShimLibraryVersion.
BIT
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
AlbumReportOption_Enable
@ AlbumReportOption_Enable
Display the screenshot-taken Overlay notification.
Definition: caps.h:22
CapsAlbumStorage_Sd
@ CapsAlbumStorage_Sd
Sd.
Definition: caps.h:27
AlbumImageOrientation_Unknown2
@ AlbumImageOrientation_Unknown2
Unknown.
Definition: caps.h:15
CapsLoadAlbumScreenShotImageOutputForApplication::appdata
CapsApplicationData appdata
CapsApplicationData
Definition: caps.h:184
CapsContentType_ExtraMovie
@ CapsContentType_ExtraMovie
Videos recorded by the current host Application via grcCreateMovieMaker.
Definition: caps.h:34
CapsScreenShotAttributeForApplication::unk_x10
u32 unk_x10
Unknown.
Definition: caps.h:55
AlbumReportOption_Disable
@ AlbumReportOption_Disable
Don't display the screenshot-taken Overlay-applet notification.
Definition: caps.h:21
CapsAlbumFileContentsFlag_Movie
@ CapsAlbumFileContentsFlag_Movie
Query for Movie files.
Definition: caps.h:199
CapsAlbumFileDateTime::hour
u8 hour
Hour.
Definition: caps.h:84
AlbumImageOrientation_Unknown0
@ AlbumImageOrientation_Unknown0
Unknown. Default.
Definition: caps.h:13
CapsUserIdList::count
u8 count
Total userIDs.
Definition: caps.h:175
CapsAlbumFileDateTime::day
u8 day
Day of the month.
Definition: caps.h:83
u16
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
capsConvertApplicationAlbumEntryToApplicationAlbumFileEntry
static void capsConvertApplicationAlbumEntryToApplicationAlbumFileEntry(CapsApplicationAlbumFileEntry *out, CapsApplicationAlbumEntry *in)
Convert a CapsApplicationAlbumEntry to CapsApplicationAlbumFileEntry. Should only be used on [7....
Definition: caps.h:227
CapsAlbumContentsUsage::file_contents
u8 file_contents
CapsAlbumFileContents
Definition: caps.h:156
AlbumImageOrientation_Unknown3
@ AlbumImageOrientation_Unknown3
Unknown.
Definition: caps.h:16
CapsAlbumCache
AlbumCache.
Definition: caps.h:203
CapsApplicationAlbumEntry::size
u64 size
size of the entry
Definition: caps.h:115
CapsScreenShotAttributeForApplication::pad
u8 pad
Padding.
Definition: caps.h:52