wut  v1.7.0
Wii U Toolchain
mcp.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef int32_t MCPError;
15 
16 typedef struct MCPDevice MCPDevice;
17 typedef struct MCPDeviceList MCPDeviceList;
18 typedef struct MCPInstallInfo MCPInstallInfo;
22 typedef struct MCPSystemVersion MCPSystemVersion;
23 typedef struct MCPTitleListType MCPTitleListType;
24 
25 typedef enum MCPAppType
26 {
28  MCP_APP_TYPE_GAME_DLC = 0x0800000E,
29  MCP_APP_TYPE_BOOT1 = 0x10000009,
43  MCP_APP_TYPE_GAME = 0x80000000,
44  MCP_APP_TYPE_GAME_WII = 0x8000002E,
51  MCP_APP_TYPE_EMANUAL = 0xD0000003,
52  MCP_APP_TYPE_HOME_MENU = 0xD0000004,
54  MCP_APP_TYPE_BROWSER = 0xD0000006,
56  MCP_APP_TYPE_MIIVERSE = 0xD0000016,
57  MCP_APP_TYPE_ESHOP = 0xD0000017,
63 
64 typedef enum MCPDeviceType
65 {
66  MCP_DEVICE_TYPE_AUTO = 1, /* returns result for ODD, MLC and USB */
70  /* any value >= 5 is MCP_DEVICE_TYPE_AUTO */
72 
73 typedef enum MCPDeviceFlags
74 {
80 
81 typedef enum MCPInstallTarget
82 {
86 
87 typedef enum MCPRegion
88 {
96 
97 typedef enum MCPCompatAVFile
98 {
104 
105 struct WUT_PACKED MCPDevice
106 {
107  char type[8];
108  char unk0x08[128];
109  char filesystem[8];
110  char path[0x27F];
112  uint32_t uid;
113  uint32_t index;
114 };
115 WUT_CHECK_OFFSET(MCPDevice, 0x00, type);
116 WUT_CHECK_OFFSET(MCPDevice, 0x08, unk0x08);
117 WUT_CHECK_OFFSET(MCPDevice, 0x88, filesystem);
118 WUT_CHECK_OFFSET(MCPDevice, 0x90, path);
119 WUT_CHECK_OFFSET(MCPDevice, 0x30F, flags);
120 WUT_CHECK_OFFSET(MCPDevice, 0x313, uid);
121 WUT_CHECK_OFFSET(MCPDevice, 0x317, index);
122 WUT_CHECK_SIZE(MCPDevice, 0x31B);
123 
125 {
126  WUT_UNKNOWN_BYTES(0x27F);
127 };
128 WUT_CHECK_SIZE(MCPInstallInfo, 0x27F);
129 
130 struct WUT_PACKED MCPInstallProgress
131 {
132  uint32_t inProgress;
133  uint64_t tid;
134  uint64_t sizeTotal;
135  uint64_t sizeProgress;
136  uint32_t contentsTotal;
138 };
139 WUT_CHECK_OFFSET(MCPInstallProgress, 0x00, inProgress);
140 WUT_CHECK_OFFSET(MCPInstallProgress, 0x04, tid);
141 WUT_CHECK_OFFSET(MCPInstallProgress, 0x0C, sizeTotal);
142 WUT_CHECK_OFFSET(MCPInstallProgress, 0x14, sizeProgress);
143 WUT_CHECK_OFFSET(MCPInstallProgress, 0x1C, contentsTotal);
144 WUT_CHECK_OFFSET(MCPInstallProgress, 0x20, contentsProgress);
145 WUT_CHECK_SIZE(MCPInstallProgress, 0x24);
146 
148 {
149  WUT_UNKNOWN_BYTES(0x27F);
150 };
151 WUT_CHECK_SIZE(MCPInstallTitleInfo, 0x27F);
152 
153 struct WUT_PACKED MCPSysProdSettings
154 {
156  uint16_t eeprom_version;
157  WUT_PADDING_BYTES(2);
159  WUT_UNKNOWN_BYTES(4);
160  char ntsc_pal[5];
161 
163  char wifi_5ghz_country_code[4];
164 
167 
168  char code_id[8];
169  char serial_id[12];
170  WUT_UNKNOWN_BYTES(4);
171  char model_number[16];
172  uint32_t version;
173 };
174 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x00, product_area);
175 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x04, eeprom_version);
176 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x08, game_region);
177 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x10, ntsc_pal);
178 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x15, wifi_5ghz_country_code);
179 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x19, wifi_5ghz_country_code_revision);
180 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x1A, code_id);
181 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x22, serial_id);
182 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x32, model_number);
183 WUT_CHECK_OFFSET(MCPSysProdSettings, 0x42, version);
184 WUT_CHECK_SIZE(MCPSysProdSettings, 0x46);
185 
187 {
188  uint32_t major;
189  uint32_t minor;
190  uint32_t patch;
191  char region;
192 };
193 WUT_CHECK_OFFSET(MCPSystemVersion, 0x00, major);
194 WUT_CHECK_OFFSET(MCPSystemVersion, 0x04, minor);
195 WUT_CHECK_OFFSET(MCPSystemVersion, 0x08, patch);
196 WUT_CHECK_OFFSET(MCPSystemVersion, 0x0C, region);
197 WUT_CHECK_SIZE(MCPSystemVersion, 0x10);
198 
199 struct WUT_PACKED MCPTitleListType
200 {
201  uint64_t titleId;
202  uint32_t groupId;
203  char path[56];
205  uint16_t titleVersion;
206  uint64_t osVersion;
207  uint32_t sdkVersion;
208  char indexedDevice[10];
209  uint8_t unk0x60;
210 };
211 WUT_CHECK_OFFSET(MCPTitleListType, 0x00, titleId);
212 WUT_CHECK_OFFSET(MCPTitleListType, 0x08, groupId);
213 WUT_CHECK_OFFSET(MCPTitleListType, 0x0C, path);
214 WUT_CHECK_OFFSET(MCPTitleListType, 0x44, appType);
215 WUT_CHECK_OFFSET(MCPTitleListType, 0x48, titleVersion);
216 WUT_CHECK_OFFSET(MCPTitleListType, 0x4A, osVersion);
217 WUT_CHECK_OFFSET(MCPTitleListType, 0x52, sdkVersion);
218 WUT_CHECK_OFFSET(MCPTitleListType, 0x56, indexedDevice);
219 WUT_CHECK_OFFSET(MCPTitleListType, 0x60, unk0x60);
220 WUT_CHECK_SIZE(MCPTitleListType, 0x61);
221 
222 MCPError
224 
225 MCPError
226 MCP_Close(int handle);
227 
228 MCPError
229 MCP_DeviceList(int handle,
230  int *numDevices,
231  MCPDevice *outDeviceList,
232  uint32_t deviceListSizeInBytes);
233 
234 MCPError
236  int *numDevices,
237  MCPDevice *outDeviceList,
238  uint32_t deviceListSizeInBytes);
239 
240 MCPError
241 MCP_GetOwnTitleInfo(int32_t handle,
242  MCPTitleListType *titleInfo);
243 
244 MCPError
245 MCP_GetSysProdSettings(int32_t handle,
246  MCPSysProdSettings *settings);
247 
248 MCPError
249 MCP_GetSystemVersion(int32_t handle,
250  MCPSystemVersion *systemVersion);
251 
252 MCPError
253 MCP_GetTitleId(int32_t handle,
254  uint64_t *outTitleId);
255 
256 MCPError
257 MCP_GetTitleInfo(int32_t handle,
258  uint64_t titleId,
259  MCPTitleListType *titleInfo);
260 
261 MCPError
263  MCPInstallTarget device);
264 
265 MCPError
267  MCPInstallTarget *deviceOut);
268 
269 MCPError
271  int usb);
272 
273 MCPError
275  const char *path,
276  MCPInstallInfo *out);
277 
278 MCPError
280  const char *path,
281  MCPInstallTitleInfo *out);
282 
283 MCPError
285  MCPInstallProgress *installProgressOut);
286 
287 MCPError
289 
290 MCPError
291 MCP_TitleCount(int32_t handle);
292 
293 MCPError
294 MCP_TitleList(int32_t handle,
295  uint32_t *outTitleCount,
296  MCPTitleListType *titleList,
297  uint32_t titleListSizeBytes);
298 
299 MCPError
300 MCP_TitleListByAppType(int32_t handle,
301  MCPAppType appType,
302  uint32_t *outTitleCount,
303  MCPTitleListType *titleList,
304  uint32_t titleListSizeBytes);
305 
306 MCPError
307 MCP_TitleListByUniqueId(int32_t handle,
308  uint32_t uniqueId,
309  uint32_t *outTitleCount,
310  MCPTitleListType *titleList,
311  uint32_t titleListSizeBytes);
312 
313 MCPError
314 MCP_TitleListByDevice(int32_t handle,
315  const char *deviceName,
316  uint32_t *outTitleCount,
317  MCPTitleListType *titleList,
318  uint32_t titleListSizeBytes);
319 
320 MCPError
322  MCPDeviceType deviceType,
323  uint32_t *outTitleCount,
324  MCPTitleListType *titleList,
325  uint32_t titleListSizeBytes);
326 MCPError
328  MCPAppType appType,
329  const char *deviceName,
330  uint32_t *outTitleCount,
331  MCPTitleListType *titleList,
332  uint32_t titleListSizeBytes);
333 
334 MCPError
336  MCPAppType appType,
337  MCPDeviceType deviceType,
338  uint32_t *outTitleCount,
339  MCPTitleListType *titleList,
340  uint32_t titleListSizeBytes);
341 
342 MCPError
344  uint32_t uniqueId,
345  const char *indexedDevice,
346  uint8_t unk0x60,
347  MCPAppType appType,
348  uint32_t *outTitleCount,
349  MCPTitleListType *titleList,
350  uint32_t titleListSizeBytes);
351 
352 MCPError
353 MCP_UninstallTitleAsync(int32_t handle,
354  const char *path,
355  MCPInstallTitleInfo *out);
356 
357 MCPError
358 MCP_CompatLoadAVFile(int32_t handle,
359  void *ptr,
360  uint32_t *size,
361  MCPCompatAVFile file);
362 
370 MCPError
372 
379 MCPError
380 MCP_ChangeEcoSettings(int32_t handle,
381  uint32_t enable,
382  uint32_t maxOnTime,
383  uint16_t defaultOffTime);
384 
385 static inline const char*
387  switch (deviceType) {
389  return "auto";
390  case MCP_DEVICE_TYPE_ODD:
391  return "odd";
392  case MCP_DEVICE_TYPE_MLC:
393  return "mlc";
394  case MCP_DEVICE_TYPE_USB:
395  return "usb";
396  }
397  return "auto";
398 }
399 
400 #ifdef __cplusplus
401 }
402 #endif
403 
uint64_t titleId
Definition: mcp.h:201
uint32_t sdkVersion
Definition: mcp.h:207
char region
Definition: mcp.h:191
uint64_t osVersion
Definition: mcp.h:206
uint8_t wifi_5ghz_country_code_revision
5ghz_country_code_revision in xml
Definition: mcp.h:166
uint8_t unk0x60
Definition: mcp.h:209
uint32_t contentsTotal
Definition: mcp.h:136
uint16_t titleVersion
Definition: mcp.h:205
uint32_t uid
Definition: mcp.h:112
uint32_t inProgress
Definition: mcp.h:132
uint32_t patch
Definition: mcp.h:190
uint32_t minor
Definition: mcp.h:189
MCPRegion product_area
Definition: mcp.h:155
uint32_t index
Definition: mcp.h:113
MCPDeviceFlags flags
Definition: mcp.h:111
MCPRegion game_region
Definition: mcp.h:157
uint32_t major
Definition: mcp.h:188
uint32_t version
Definition: mcp.h:172
MCPAppType appType
Definition: mcp.h:204
uint64_t sizeTotal
Definition: mcp.h:134
uint64_t tid
Definition: mcp.h:133
uint64_t sizeProgress
Definition: mcp.h:135
uint32_t groupId
Definition: mcp.h:202
uint16_t eeprom_version
Definition: mcp.h:156
uint32_t contentsProgress
Definition: mcp.h:137
MCPError MCP_GetSystemVersion(int32_t handle, MCPSystemVersion *systemVersion)
static const char * MCP_GetDeviceNameByDeviceType(MCPDeviceType deviceType)
Definition: mcp.h:386
MCPError MCP_InstallGetTargetDevice(int handle, MCPInstallTarget *deviceOut)
MCPError MCP_TitleListByDeviceType(int32_t handle, MCPDeviceType deviceType, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_GetOwnTitleInfo(int32_t handle, MCPTitleListType *titleInfo)
MCPDeviceFlags
Definition: mcp.h:74
MCPError MCP_TitleListByUniqueIdAndIndexedDeviceAndAppType(int32_t handle, uint32_t uniqueId, const char *indexedDevice, uint8_t unk0x60, MCPAppType appType, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_ChangeEcoSettings(int32_t handle, uint32_t enable, uint32_t maxOnTime, uint16_t defaultOffTime)
Sets values to /storage_slc/sys/config/eco.xml.
MCPError MCP_CompatLoadAVFile(int32_t handle, void *ptr, uint32_t *size, MCPCompatAVFile file)
MCPCompatAVFile
Definition: mcp.h:98
MCPError MCP_TitleCount(int32_t handle)
MCPRegion
Definition: mcp.h:88
MCPError MCP_GetTitleInfo(int32_t handle, uint64_t titleId, MCPTitleListType *titleInfo)
MCPDeviceType
Definition: mcp.h:65
MCPError MCP_InstallSetTargetDevice(int handle, MCPInstallTarget device)
MCPError MCP_UninstallTitleAsync(int32_t handle, const char *path, MCPInstallTitleInfo *out)
MCPAppType
Definition: mcp.h:26
MCPInstallTarget
Definition: mcp.h:82
MCPError MCP_TitleListByAppAndDeviceType(int32_t handle, MCPAppType appType, MCPDeviceType deviceType, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_GetSysProdSettings(int32_t handle, MCPSysProdSettings *settings)
MCPError MCP_InstallSetTargetUsb(int handle, int usb)
MCPError MCP_FullDeviceList(int handle, int *numDevices, MCPDevice *outDeviceList, uint32_t deviceListSizeInBytes)
MCPError MCP_GetTitleId(int32_t handle, uint64_t *outTitleId)
struct MCPDeviceList MCPDeviceList
Definition: mcp.h:17
MCPError MCP_InstallGetProgress(int handle, MCPInstallProgress *installProgressOut)
MCPError MCP_Open()
MCPError MCP_InstallTitleAbort(int handle)
MCPError MCP_TriggerCrashLogCollection(int32_t handle)
Saves the current Cafe log to the SLC logs directory.
MCPError MCP_TitleListByUniqueId(int32_t handle, uint32_t uniqueId, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_InstallTitleAsync(int handle, const char *path, MCPInstallTitleInfo *out)
MCPError MCP_Close(int handle)
int32_t MCPError
Definition: mcp.h:14
MCPError MCP_TitleList(int32_t handle, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_TitleListByDevice(int32_t handle, const char *deviceName, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_TitleListByAppType(int32_t handle, MCPAppType appType, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_DeviceList(int handle, int *numDevices, MCPDevice *outDeviceList, uint32_t deviceListSizeInBytes)
MCPError MCP_TitleListByAppAndDevice(int32_t handle, MCPAppType appType, const char *deviceName, uint32_t *outTitleCount, MCPTitleListType *titleList, uint32_t titleListSizeBytes)
MCPError MCP_InstallGetInfo(int handle, const char *path, MCPInstallInfo *out)
@ MCP_DEVICE_FLAG_UNK_1
Definition: mcp.h:75
@ MCP_DEVICE_FLAG_UNK_2
Definition: mcp.h:76
@ MCP_DEVICE_FLAG_UNK_8
Definition: mcp.h:78
@ MCP_DEVICE_FLAG_UNK_4
Definition: mcp.h:77
@ MCP_COMPAT_AV_FILE_DEINT
Deinterlacer parameters.
Definition: mcp.h:102
@ MCP_COMPAT_AV_FILE_DMCU
DMCU firmware.
Definition: mcp.h:100
@ MCP_REGION_EUROPE
Definition: mcp.h:91
@ MCP_REGION_USA
Definition: mcp.h:90
@ MCP_REGION_TAIWAN
Definition: mcp.h:94
@ MCP_REGION_CHINA
Definition: mcp.h:92
@ MCP_REGION_KOREA
Definition: mcp.h:93
@ MCP_REGION_JAPAN
Definition: mcp.h:89
@ MCP_DEVICE_TYPE_MLC
Definition: mcp.h:68
@ MCP_DEVICE_TYPE_AUTO
Definition: mcp.h:66
@ MCP_DEVICE_TYPE_ODD
Definition: mcp.h:67
@ MCP_DEVICE_TYPE_USB
Definition: mcp.h:69
@ MCP_APP_TYPE_BOOT1
Definition: mcp.h:29
@ MCP_APP_TYPE_GAME_DLC
Definition: mcp.h:28
@ MCP_APP_TYPE_GAME_WII
Definition: mcp.h:44
@ MCP_APP_TYPE_SYSTEM_VERSION
Definition: mcp.h:34
@ MCP_APP_TYPE_SYSTEM_SETTINGS
Definition: mcp.h:49
@ MCP_APP_TYPE_SYSTEM_UPDATER
Definition: mcp.h:46
@ MCP_APP_TYPE_MIIVERSE_POST
Definition: mcp.h:55
@ MCP_APP_TYPE_MCP_TITLE_LIST
Definition: mcp.h:42
@ MCP_APP_TYPE_DRC_FIRMWARE
Definition: mcp.h:32
@ MCP_APP_TYPE_WAGONU_MIGRATION_LIST
Definition: mcp.h:40
@ MCP_APP_TYPE_SYSTEM_LIBRARIES
Definition: mcp.h:30
@ MCP_APP_TYPE_ESHOP
Definition: mcp.h:57
@ MCP_APP_TYPE_AMIIBO_SETTINGS
Definition: mcp.h:61
@ MCP_APP_TYPE_EXCEPTIONS_DATA
Definition: mcp.h:36
@ MCP_APP_TYPE_PATCH_MAP_DATA
Definition: mcp.h:39
@ MCP_APP_TYPE_AOC_OVERLAY
Definition: mcp.h:60
@ MCP_APP_TYPE_DRC_LANGUAGE
Definition: mcp.h:35
@ MCP_APP_TYPE_ERROR_DISPLAY
Definition: mcp.h:53
@ MCP_APP_TYPE_SYSTEM_MENU
Definition: mcp.h:45
@ MCP_APP_TYPE_CAFFEINE_TITLE_LIST
Definition: mcp.h:41
@ MCP_APP_TYPE_EMANUAL
Definition: mcp.h:51
@ MCP_APP_TYPE_GAME
Definition: mcp.h:43
@ MCP_APP_TYPE_DOWNLOAD_MANAGEMENT
Definition: mcp.h:59
@ MCP_APP_TYPE_HOME_MENU
Definition: mcp.h:52
@ MCP_APP_TYPE_CERT_STORE
Definition: mcp.h:38
@ MCP_APP_TYPE_MIIVERSE
Definition: mcp.h:56
@ MCP_APP_TYPE_ECO_PROCESS
Definition: mcp.h:50
@ MCP_APP_TYPE_BLUETOOTH_FIRMWARE
Definition: mcp.h:31
@ MCP_APP_TYPE_GAME_UPDATE
Definition: mcp.h:27
@ MCP_APP_TYPE_DRH_FIRMWARE
Definition: mcp.h:33
@ MCP_APP_TYPE_ACCOUNT_APPS
Definition: mcp.h:48
@ MCP_APP_TYPE_FRIEND_LIST
Definition: mcp.h:58
@ MCP_APP_TYPE_BROWSER
Definition: mcp.h:54
@ MCP_APP_TYPE_SYSTEM_APPS
Definition: mcp.h:47
@ MCP_APP_TYPE_SHARED_DATA
Definition: mcp.h:37
@ MCP_INSTALL_TARGET_MLC
Definition: mcp.h:83
@ MCP_INSTALL_TARGET_USB
Definition: mcp.h:84
Definition: mcp.h:106