wut  v1.7.0
Wii U Toolchain
sl_cpp.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <coreinit/mcp.h>
5 #include <nn/result.h>
6 #include <wut.h>
7 
8 #ifdef __cplusplus
9 
10 namespace nn::sl {
11  typedef enum MediaType {
18 
19  typedef struct WUT_PACKED LaunchInfo {
20  uint64_t titleId;
23  char parameter[0x800];
25  WUT_CHECK_OFFSET(LaunchInfo, 0x00, titleId);
26  WUT_CHECK_OFFSET(LaunchInfo, 0x08, appType);
27  WUT_CHECK_OFFSET(LaunchInfo, 0x0C, mediaType);
28  WUT_CHECK_SIZE(LaunchInfo, 0x810);
29 
30  typedef struct WUT_PACKED LaunchInfoDatabaseEntry {
31  uint64_t id;
34  WUT_CHECK_SIZE(LaunchInfoDatabaseEntry, 0x818);
35  WUT_CHECK_OFFSET(LaunchInfoDatabaseEntry, 0x0, id);
36  WUT_CHECK_OFFSET(LaunchInfoDatabaseEntry, 0x8, launchInfo);
37 
38  // This struct has a variable length, the hash is always expected at the end
39  typedef struct WUT_PACKED LaunchInfoDatabaseHeader {
40  uint32_t version; // 1
41  uint32_t magic; // "LIDB"
42  uint32_t maxEntries;
43  uint32_t entryCount;
44  uint64_t currentId; // start at 0x1000000000000000
45  LaunchInfoDatabaseEntry entries[0]; // Dynamic, actually this array should be entries[maxEntries]
46  char sha1Hash[20];
48  WUT_CHECK_SIZE(LaunchInfoDatabaseHeader, 0x2C);
49  WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x0, version);
50  WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x4, magic);
51  WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x8, maxEntries);
52  WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0xC, entryCount);
53  WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x10, currentId);
54  WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x18, entries);
55  WUT_CHECK_OFFSET(LaunchInfoDatabaseHeader, 0x18, sha1Hash);
56 
57  struct WUT_PACKED IconInfo {
58  uint8_t data[65580]; // tga
59  char name[0x80];
60  };
61  WUT_CHECK_SIZE(IconInfo, 0x100ac);
62  WUT_CHECK_OFFSET(IconInfo, 0, data);
63  WUT_CHECK_OFFSET(IconInfo, 0x1002c, name);
64 
65  struct WUT_PACKED AccountUUID {
66  char uuid[10];
67  };
68  WUT_CHECK_SIZE(AccountUUID, 10);
69 
71  uint8_t b;
72  uint8_t g;
73  uint8_t r;
74  uint8_t a;
75  };
76  WUT_CHECK_SIZE(DRCImagePaletteColor, 4);
77  WUT_CHECK_OFFSET(DRCImagePaletteColor, 0, b);
78  WUT_CHECK_OFFSET(DRCImagePaletteColor, 1, g);
79  WUT_CHECK_OFFSET(DRCImagePaletteColor, 2, r);
80  WUT_CHECK_OFFSET(DRCImagePaletteColor, 3, a);
81 
82  struct DRCImagePalette {
84  };
85  WUT_CHECK_SIZE(DRCImagePalette, 0x400);
86  WUT_CHECK_OFFSET(DRCImagePalette, 0, values);
87 
88  struct WUT_PACKED TransferableInfo {
89  uint8_t numAccounts;
91  AccountUUID uuids[12];
92  WUT_PADDING_BYTES(0x48);
93  uint8_t isNetworkAccount[12];
94  uint8_t isPasswordCacheEnabled[12];
95  uint64_t titleIds[10];
96  uint8_t isOnDisc[10];
98  uint32_t serialId;
99  WUT_PADDING_BYTES(192);
100  struct {
101  DRCImagePalette palette;
102  uint8_t pixelIndex[206][412]; // index of color in palette
103  } accountSceneImage;
104  struct {
105  DRCImagePalette palette;
106  uint8_t pixelIndex[129][1630]; // index of color in palette
107  } quickStartScene1;
108  struct {
109  DRCImagePalette palette;
110  uint8_t pixelIndex[85][854]; // index of color in palette
111  } quickStartScene2;
112  struct {
113  DRCImagePalette palette; // this is actually unused. The quick start menu uses the button color palette for the main image as well.
114  uint8_t pixel[400][854]; // index of color in (button) palette
115  } killerNotificationMain;
116  struct {
117  DRCImagePalette palette;
118  uint8_t pixelIndex[160][487]; // index of color in palette
119  } killerNotificationButton;
120  };
121  WUT_CHECK_SIZE(TransferableInfo, 0xc1934);
122  WUT_CHECK_OFFSET(TransferableInfo, 0x00, numAccounts);
123  WUT_CHECK_OFFSET(TransferableInfo, 0x01, defaultAccountIndex);
124  WUT_CHECK_OFFSET(TransferableInfo, 0x02, uuids);
125  WUT_CHECK_OFFSET(TransferableInfo, 0xC2, isNetworkAccount);
126  WUT_CHECK_OFFSET(TransferableInfo, 0xCE, isPasswordCacheEnabled);
127  WUT_CHECK_OFFSET(TransferableInfo, 0xda, titleIds);
128  WUT_CHECK_OFFSET(TransferableInfo, 0x12a, isOnDisc);
129  WUT_CHECK_OFFSET(TransferableInfo, 0x134, killerNotificationsTitleId);
130  WUT_CHECK_OFFSET(TransferableInfo, 0x13C, serialId);
131  WUT_CHECK_OFFSET(TransferableInfo, 0x200, accountSceneImage);
132  WUT_CHECK_OFFSET(TransferableInfo, 0x15188, quickStartScene1);
133  WUT_CHECK_OFFSET(TransferableInfo, 0x48ae6, quickStartScene2);
134  WUT_CHECK_OFFSET(TransferableInfo, 0x5aa74, killerNotificationMain);
135  WUT_CHECK_OFFSET(TransferableInfo, 0xae4d4, killerNotificationButton);
136 
137  struct WUT_PACKED TitleInfo {
138  uint64_t titleId;
141  WUT_UNKNOWN_BYTES(0x10);
142  };
143  WUT_CHECK_SIZE(TitleInfo, 0x20);
144  WUT_CHECK_OFFSET(TitleInfo, 0x00, titleId);
145  WUT_CHECK_OFFSET(TitleInfo, 0x08, appType);
146  WUT_CHECK_OFFSET(TitleInfo, 0x0C, mediaType);
147 
148  struct WUT_PACKED TitleMetaInfo {
150  WUT_PADDING_BYTES(3);
151  };
152  WUT_CHECK_SIZE(TitleMetaInfo, 0x4);
153  WUT_CHECK_OFFSET(TitleMetaInfo, 0x00, isPreOrder);
154 
155  struct WUT_PACKED WhiteList {
156  MCPAppType titleTypes[50];
157  uint32_t titleTypeCount;
158  WUT_PADDING_BYTES(4);
159  uint64_t titleIds[50];
160  uint32_t titleIdCount;
161  };
162  WUT_CHECK_SIZE(WhiteList, 0x264);
163  WUT_CHECK_OFFSET(WhiteList, 0x00, titleTypes);
164  WUT_CHECK_OFFSET(WhiteList, 0xC8, titleTypeCount);
165  WUT_CHECK_OFFSET(WhiteList, 0xD0, titleIds);
166  WUT_CHECK_OFFSET(WhiteList, 0x260, titleIdCount);
167 
168  struct WUT_PACKED Account {
169  char uuid[0x10];
172  uint8_t age;
173  WUT_PADDING_BYTES(2);
174  uint32_t gender;
175  uint32_t simpleAddressId;
177  WUT_PADDING_BYTES(1);
178  uint16_t bday_year;
179  uint8_t bday_month;
180  uint8_t bday_day;
181  WUT_PADDING_BYTES(2);
182  };
183  WUT_CHECK_SIZE(Account, 0x28);
184  WUT_CHECK_OFFSET(Account, 0x00, uuid);
185  WUT_CHECK_OFFSET(Account, 0x10, isNetworkAccount);
186  WUT_CHECK_OFFSET(Account, 0x14, isPasswordCacheEnabled);
187  WUT_CHECK_OFFSET(Account, 0x15, age);
188  WUT_CHECK_OFFSET(Account, 0x18, gender);
189  WUT_CHECK_OFFSET(Account, 0x1C, simpleAddressId);
190  WUT_CHECK_OFFSET(Account, 0x20, isMailAddressValidated);
191  WUT_CHECK_OFFSET(Account, 0x22, bday_year);
192  WUT_CHECK_OFFSET(Account, 0x24, bday_month);
193  WUT_CHECK_OFFSET(Account, 0x25, bday_day);
194 
195  struct WUT_PACKED AccountInfo {
196  uint8_t account_index[12];
197  WUT_UNKNOWN_BYTES(4);
198  uint32_t num_of_accounts;
199  Account accounts[12];
200  };
201  WUT_CHECK_SIZE(AccountInfo, 0x1f4);
202  WUT_CHECK_OFFSET(AccountInfo, 0, account_index);
203  WUT_CHECK_OFFSET(AccountInfo, 0x10, num_of_accounts);
204  WUT_CHECK_OFFSET(AccountInfo, 0x14, accounts);
205 
206  struct WUT_PACKED Setting {
207  struct {
208  bool enabled;
209  bool pushEnabled;
210  bool adEnabled;
211  bool drcLedEnable;
212  uint16_t pushInterval;
213  WUT_PADDING_BYTES(2);
214  uint32_t pushTimeSlot;
215  } caffeine;
217  WUT_PADDING_BYTES(3);
219  uint32_t language;
220  uint32_t prodArea;
221  };
222  WUT_CHECK_SIZE(Setting, 0x1C);
223  WUT_CHECK_OFFSET(Setting, 0x0, caffeine.enabled);
224  WUT_CHECK_OFFSET(Setting, 0x01, caffeine.pushEnabled);
225  WUT_CHECK_OFFSET(Setting, 0x02, caffeine.adEnabled);
226  WUT_CHECK_OFFSET(Setting, 0x03, caffeine.drcLedEnable);
227  WUT_CHECK_OFFSET(Setting, 0x04, caffeine.pushInterval);
228  WUT_CHECK_OFFSET(Setting, 0x08, caffeine.pushTimeSlot);
229  WUT_CHECK_OFFSET(Setting, 0x0C, pushAutoDelivery);
230  WUT_CHECK_OFFSET(Setting, 0x10, edmStandbyModeLength);
231  WUT_CHECK_OFFSET(Setting, 0x14, language);
232  WUT_CHECK_OFFSET(Setting, 0x18, prodArea);
233 
235  WUT_UNKNOWN_BYTES(0x18);
236  };
237  WUT_CHECK_SIZE(KillerNotificationTransferRecord, 0x18);
238 
239  typedef enum Region {
242  REGION_EUR = 2
244 
249  };
250 
251  enum Language {
252  Japanese = 0,
253  English = 1,
254  French = 2,
255  German = 3,
256  Italian = 4,
257  Spanish = 5,
259  Korean = 7,
260  Dutch = 8,
262  Russian = 10,
264  };
265 
266  enum SeekOrigin {
267  SeekSet = 0
268  };
269 
270  void
271  GetDefaultDatabasePath(char *, int size, uint64_t titleId) asm("GetDefaultDatabasePath__Q2_2nn2slFPcUiUL");
272 
273  void
274  GetDefaultDatabasePath(char *, int size) asm("GetDefaultDatabasePath__Q2_2nn2slFPcUi");
275 
276  void
277  GetDefaultKillerNotificationTransferRecordPath(char *, int size, uint64_t titleId, const char *) asm("GetDefaultKillerNotificationTransferRecordPath__Q2_2nn2slFPcUiUL");
278 
279  void Initialize(MEMAllocFromDefaultHeapExFn, MEMFreeToDefaultHeapFn) asm("Initialize__Q2_2nn2slFPFUiT1_PvPFPv_v");
280 
281  void
282  Finalize() asm("Finalize__Q2_2nn2slFv");
283 
284  void
285  FinalizeForEcoProcess() asm("FinalizeForEcoProcess__Q2_2nn2slFv");
286 
287  void
288  InitializeForEcoProcess(MEMAllocFromDefaultHeapExFn allocFn, MEMFreeToDefaultHeapFn freeFn) asm("InitializeForEcoProcess__Q2_2nn2slFPFUiT1_PvPFPv_v");
289 
290 }; // namespace nn::sl
291 
292 #endif
MCPAppType
Definition: mcp.h:26
void(* MEMFreeToDefaultHeapFn)(void *ptr)
void *(* MEMAllocFromDefaultHeapExFn)(uint32_t size, int32_t alignment)
uint64_t titleId
Definition: sl_cpp.h:20
uint32_t language
Definition: sl_cpp.h:219
uint8_t age
Definition: sl_cpp.h:172
MediaType
Definition: sl_cpp.h:11
@ NN_SL_MEDIA_TYPE_USB
Definition: sl_cpp.h:15
@ NN_SL_MEDIA_TYPE_SLC
Definition: sl_cpp.h:13
@ NN_SL_MEDIA_TYPE_ODD
Definition: sl_cpp.h:14
@ NN_SL_MEDIA_TYPE_MLC
Definition: sl_cpp.h:12
@ NN_SL_MEDIA_TYPE_HFIO
Definition: sl_cpp.h:16
void FinalizeForEcoProcess() asm("FinalizeForEcoProcess__Q2_2nn2slFv")
uint8_t bday_day
Definition: sl_cpp.h:180
uint32_t prodArea
Definition: sl_cpp.h:220
void Finalize() asm("Finalize__Q2_2nn2slFv")
uint32_t simpleAddressId
Definition: sl_cpp.h:175
Language
Definition: sl_cpp.h:251
@ Russian
Definition: sl_cpp.h:262
@ German
Definition: sl_cpp.h:255
@ Japanese
Definition: sl_cpp.h:252
@ Italian
Definition: sl_cpp.h:256
@ Spanish
Definition: sl_cpp.h:257
@ English
Definition: sl_cpp.h:253
@ TraditionalChinese
Definition: sl_cpp.h:263
@ Dutch
Definition: sl_cpp.h:260
@ SimplifiedChinese
Definition: sl_cpp.h:258
@ Korean
Definition: sl_cpp.h:259
@ Portuguese
Definition: sl_cpp.h:261
@ French
Definition: sl_cpp.h:254
void GetDefaultKillerNotificationTransferRecordPath(char *, int size, uint64_t titleId, const char *) asm("GetDefaultKillerNotificationTransferRecordPath__Q2_2nn2slFPcUiUL")
uint32_t isNetworkAccount
Definition: sl_cpp.h:170
uint8_t isPasswordCacheEnabled
Definition: sl_cpp.h:171
bool pushAutoDelivery
Definition: sl_cpp.h:216
uint32_t gender
Definition: sl_cpp.h:173
uint8_t isMailAddressValidated
Definition: sl_cpp.h:176
DRCImagePaletteColor values[0x100]
Definition: sl_cpp.h:83
uint8_t bday_month
Definition: sl_cpp.h:179
Region
Definition: sl_cpp.h:239
@ REGION_USA
Definition: sl_cpp.h:241
@ REGION_JPN
Definition: sl_cpp.h:240
@ REGION_EUR
Definition: sl_cpp.h:242
struct nn::sl::LaunchInfo LaunchInfo
uint16_t bday_year
Definition: sl_cpp.h:177
uint32_t titleTypeCount
Definition: sl_cpp.h:157
uint64_t killerNotificationsTitleId
Definition: sl_cpp.h:97
struct nn::sl::LaunchInfoDatabaseEntry LaunchInfoDatabaseEntry
SeekOrigin
Definition: sl_cpp.h:266
@ SeekSet
Definition: sl_cpp.h:267
MediaType mediaType
Definition: sl_cpp.h:22
TransferMode
Definition: sl_cpp.h:245
@ TRANSFER_MODE_UNKWN_1
Definition: sl_cpp.h:246
@ TRANSFER_MODE_UNKWN_2
Definition: sl_cpp.h:247
@ TRANSFER_MODE_UNKWN_3
Definition: sl_cpp.h:248
uint32_t edmStandbyModeLength
Definition: sl_cpp.h:217
MCPAppType appType
Definition: sl_cpp.h:21
struct nn::sl::LaunchInfoDatabaseHeader LaunchInfoDatabaseHeader
void GetDefaultDatabasePath(char *, int size, uint64_t titleId) asm("GetDefaultDatabasePath__Q2_2nn2slFPcUiUL")
uint32_t titleIdCount
Definition: sl_cpp.h:160
uint32_t num_of_accounts
Definition: sl_cpp.h:197
void InitializeForEcoProcess(MEMAllocFromDefaultHeapExFn allocFn, MEMFreeToDefaultHeapFn freeFn) asm("InitializeForEcoProcess__Q2_2nn2slFPFUiT1_PvPFPv_v")
uint8_t defaultAccountIndex
Definition: sl_cpp.h:90
void Initialize(MEMAllocFromDefaultHeapExFn, MEMFreeToDefaultHeapFn) asm("Initialize__Q2_2nn2slFPFUiT1_PvPFPv_v")