1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
/*
Vita Development Suite Libraries
*/
#ifndef _VDSUITE_USER_APPMGR_H
#define _VDSUITE_USER_APPMGR_H
#include_next <appmgr.h>
#include <stdint.h>
#include <display.h>
#include <fios2/fios2_types.h>
#include <gxm/constants.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SCE_APPMGR_LAUNCH_APP_FLAG_MODAL_DONT_SUSPEND 0x60000 // Do not suspend main app when modal app has been closed
typedef struct SceAppMgrLaunchAppOptParam {
SceSize size; //0x40
int launchFlags;
int unk_08;
SceUID appLaunchCB; //-1 if not used
SceUID getParamCB; //-1 if not used
SceUID appCloseCB; //-1 if not used
int unk_18; //seen: 0, 2, 3
int unk_1C;
char reserved[0x20];
} SceAppMgrLaunchAppOptParam;
#define SCE_APPMGR_APP_ATTRIB_FG 0x1
#define SCE_APPMGR_APP_ATTRIB_NONSUSPENDABLE 0x100
typedef struct SceAppMgrAppStatus {
SceUInt32 unk_0;
SceUInt32 launchMode;
SceUInt32 bgm_priority_or_status;
char appName[32];
SceUInt32 unk_2C;
SceUID appId;
SceUID processId;
SceBool isShellProcess;
SceBool isActive;
SceUInt32 unk_40;
SceUInt32 unk_44;
SceUInt32 appAttrib;
SceUInt32 unk_4C;
SceUInt32 unk_50;
SceUInt32 unk_54;
SceUInt32 unk_58;
SceUInt32 unk_5C;
SceUInt32 unk_60;
SceUInt32 unk_64;
SceUInt32 unk_68;
SceUInt32 unk_6C;
SceUInt32 unk_70;
SceUInt32 unk_74;
SceUInt32 unk_78;
SceUInt32 unk_7C;
} SceAppMgrAppStatus;
typedef struct SceAppMgrExecOptParam SceAppMgrExecOptParam; // Missing struct
#define SCE_APPMGR_BUDGET_MODE_MAIN 2 // Main LPDDR2 only
#define SCE_APPMGR_BUDGET_MODE_MAIN_PHYCONT 3 // Main and phycont or CDLG which is also contiguous
#define SCE_APPMGR_BUDGET_MODE_MAIN_PHYCONT_CDLG 4 // Main and phycont and CDLG
typedef struct SceAppMgrBudgetInfo {
// 0x00
SceSize size; //!< Sizes if 0x88 bytes
SceUInt32 mode; //!< Application budget mode
SceUInt32 unk_8;
SceUInt32 budgetMain; //!< Main LPDDR2 budget in bytes
// 0x10
SceUInt32 freeMain; //!< Free main LPDDR2 in bytes
SceUInt32 hasCdlg; //!< Has CDLG memory type in budget
SceUInt32 unk_14; //!< Non-zero if CDLG is used, otherwise 0
SceUInt32 budgetCdlg; //!< CDLG budget in bytes
// 0x20
SceUInt32 freeCdlg; //!< Free CDLG in bytes
SceUInt32 unk_24; //!< always 0
SceUInt32 unk_28; //!< Non-zero if phycont is used, otherwise 0
SceUInt32 budgetPhycont; //!< Phycont budget in bytes
// 0x30
SceUInt32 freePhycont; //!< Free phycont in bytes
SceUInt32 allow; //!< Some memory type?
SceUChar8 unk_38[0x20]; //!< Some memory type?
SceUInt32 unk_58;
SceUInt32 budgetCdram; //!< Cdram budget in bytes
// 0x60
SceUInt32 freeCdram; //!< Free Cdram in bytes
SceUChar8 reserved_64[0x24];
// 0x88
} SceAppMgrBudgetInfo;
typedef struct SceAppMgrTrcNotification {
int unk; //!< Set to 0
char message[0x3C]; //!< Must be null-terminated
} SceAppMgrTrcNotification;
/**
* Get Process ID by Title ID
*
* @param[out] pid - Process ID
* @param[in] name - Title ID
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrGetIdByName(SceUID *pid, const char *name);
/**
* Get Title ID by Process ID
*
* @param[in] pid - Process ID
* @param[out] name - Title ID
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrGetNameById(SceUID pid, char *name);
/**
* Destroy other apps
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrDestroyOtherApp(void);
/**
* Destroy an application by Title ID
*
* @param[in] name - Title ID of the application
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrDestroyAppByName(const char *name);
/**
* Destroy an application by Application ID
*
* @param[in] appId - Application ID of the application
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrDestroyAppByAppId(SceUID appId);
/**
* Get PID of an application for Shell
*
* @param[in] appId - Application ID of the application
*
* @return The PID on success, < 0 on error.
*/
SceUID sceAppMgrGetProcessIdByAppIdForShell(SceUID appId);
/**
* Get a list of running applications
*
* @param[out] appIds - Array of running application IDs
* @param[in] count - Max number of running applications to search
*
* @return Number of running applications.
*/
int sceAppMgrGetRunningAppIdListForShell(SceUID *appIds, int count);
/**
* Copies app param to an array
*
* @param[out] param - pointer to a 1024 byte location to store the app param
*
* @return 0 on success, < 0 on error.
*
* @note App param example: type=LAUNCH_APP_BY_URI&uri=psgm:play?titleid=NPXS10031
*/
int sceAppMgrGetAppParam(char *param);
/**
* Start an application by URI
*
* @param[in] flags - Must be 0x20000
* @param[in] uri - Uri to launch
*
* @return 0 on success, < 0 on error.
*
* @note If flags != 0x20000, Livearea is opened.
*/
int sceAppMgrLaunchAppByUri(int flags, const char *uri);
/**
* Start an application by Title ID
*
* @param[in] name - Title ID of the application
* @param[in] param - The params passed to the application which can be retrieved with ::sceAppMgrGetAppParam
* @param[in] optParam - Optional params
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrLaunchAppByName2(const char *name, const char *param, SceAppMgrLaunchAppOptParam *optParam);
/**
* Start an application by Title ID for Shell
*
* @param[in] name - Title ID of the application
* @param[in] param - The params passed to the application which can be retrieved with ::sceAppMgrGetAppParam
* @param[in] optParam - Optional params
*
* @return Application ID (?)
*/
SceUID sceAppMgrLaunchAppByName2ForShell(const char *name, const char *param, SceAppMgrLaunchAppOptParam *optParam);
/**
* Mount game data
*
* @param[in] path - ux0:app/TITLEID
* @param[in] unk1 - Unknown, set 0
* @param[in] unk2 - Unknown, set 0
* @param[in] mount_point - Mountpoint to use
*
* @return 0 on success, < 0 on error.
*
*/
int sceAppMgrGameDataMount(const char *path, int unk1, int unk2, const char *mount_point);
/**
* Mount application data
*
* @param[in] id - App data ID
* @param[in] mount_point - Mountpoint to use
*
* @return 0 on success, < 0 on error.
*
* @note id: 100 (photo0), 101 (friends), 102 (messages), 103 (near), 105 (music), 108 (calendar)
*/
int sceAppMgrAppDataMount(int id, const char *mount_point);
/**
* Mount application data by Title ID
*
* @param[in] id - App data ID
* @param[in] titleid - Application title ID
* @param[in] mount_point - Mountpoint to use
*
* @return 0 on success, < 0 on error.
*
* @note id: 106 (ad), 107 (ad)
*/
int sceAppMgrAppDataMountById(int id, const char *titleid, const char *mount_point);
/**
* Get application params from SFO descriptor
*
* @param[in] pid - Process ID
* @param[in] param - Param ID in the SFO descriptor
* @param[out] string - Param data
* @param[in] length - Length of the param data
*
* @return 0 on success, < 0 on error.
*
* @note param: 6 (contentid) 8 (category), 9 (stitle/title?), 10 (title/stitle?), 12 (titleid)
*/
int sceAppMgrAppParamGetString(int pid, int param, char *string, SceSize length);
/**
* Get device info
*
* @param[in] dev - Device to get info about
* @param[out] max_size - Capacity of the device
* @param[out] free_size - Free space of the device
*
* @return 0 on success, < 0 on error.
*
* @note dev: ux0:
*/
int sceAppMgrGetDevInfo(const char *dev, uint64_t *max_size, uint64_t *free_size);
/**
* Mount application data (PSPEmu)
*
* @param[in] id - App data ID
* @param[in] mount_point - Mountpoint to use
*
* @return 0 on success, < 0 on error.
*
* @note id: 400 (ad), 401 (ad), 402 (ad)
*/
int sceAppMgrMmsMount(int id, const char *mount_point);
/**
* Mount PSPEmu virtual memory stick
*
* @param[in] mount_point - Mountpoint to use
*
* @return 0 on success, < 0 on error.
*
* @note mount_point: ms
*/
int sceAppMgrPspSaveDataRootMount(const char *mount_point);
/**
* Mount working directory
*
* @param[in] id - Working directory ID
* @param[in] mount_point - Mountpoint to use
*
* @return 0 on success, < 0 on error.
*
* @note id: 200 (td), 201 (td), 203 (td), 204 (td), 206 (td)
*/
int sceAppMgrWorkDirMount(int id, const char *mount_point);
/**
* Mount working directory by Title ID
*
* @param[in] id - Working directory ID
* @param[in] titleid - Application Title ID
* @param[in] mount_point - Mountpoint to use
*
* @return 0 on success, < 0 on error.
*
* @note id: 205 (cache0), 207 (td)
*/
int sceAppMgrWorkDirMountById(int id, const char *titleid, const char *mount_point);
/**
* Unmount a mountpoint
*
* @param[in] mount_point - Mountpoint to unmount
*
* @return 0 on success, < 0 on error.
*
* @note Unmount app0: for example to enable write access to ux0:app/TITLEID
*/
int sceAppMgrUmount(const char *mount_point);
/**
* Convert vs0 path string to a new one usable by applications
*
* @param[in] path - Path to convert
* @param[in] mount_point - Mountpoint to use
* @param[in] unk - Unknown
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrConvertVs0UserDrivePath(char *path, char *mount_point, int unk);
/**
* Resolve a path to the corresponding true path (uses ::sceFiosKernelOverlayResolveSync underneath).
*
* @param[in] path - Path to convert (e.g. app0:)
* @param[out] resolved_path - True resolved path
* @param[in] resolved_path_size - size of the resolved_path buffer
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrGetRawPath(const char *path, char *resolved_path, int resolved_path_size);
/**
* Get the real/resolved path of app0: (where it's actually mounted)
*
* @param[in] appId - Use -2 for the current application
* @param[out] resolved_path - Buffer that will hold the resolved path.
*
* @return 0 on success.
*/
int sceAppMgrGetRawPathOfApp0ByAppIdForShell(int appId, char resolved_path[SCE_FIOS_OVERLAY_POINT_MAX]);
/**
* Get application memory budget info.
*
* @return 0 on success, < 0 on error.
*
*/
int sceAppMgrGetBudgetInfo(SceAppMgrBudgetInfo *info);
/**
* Send TRC notification. Only visible if TRC notifications are enabled.
*
* @param[in] notification - pointer to struct containing notification text
* @param[in] blocking - Will wait for semaphore if set to true, otherwise will poll semaphore.
*
* @return 0 on success, < 0 on error.
*/
int sceAppMgrSendNotificationRequest(SceAppMgrTrcNotification *notification, SceBool blocking);
/**
* Grows main memory budget of system mode app.
*
* @param[in] size - size to grow to
* @param[in] unk - set to 1
*/
int sceAppMgrGrowMemory(SceSize size, int unk);
/**
* Grows main memory budget of system mode app.
*
* @param[in] size - size to grow to
* @param[in] unk - set to 1
*/
int sceAppMgrGrowMemory3(SceSize size, int unk);
int sceAppMgrGetStatusByName(const char *name, SceAppMgrAppStatus *status);
int sceAppMgrCaptureFrameBufDMACByAppId(SceUID appId, SceDisplayFrameBuf *captureBuffer);
int sceAppMgrCaptureFrameBufIFTUByAppId(SceUID appId, SceDisplayFrameBuf *captureBuffer);
/**
* Shared Framebuffer
*/
typedef struct SceSharedFbInfo { // size is 0x58
void* frontBuffer; // cdram base
int memsize;
void* backBuffer; // cdram base
int unk_0C;
void *unk_10;
int unk_14;
int unk_18;
int unk_1C;
int unk_20;
int stride; // 960
int width; // 960
int height; // 544
SceGxmColorFormat colorFormat;
int curbuf;
int unk_38;
int unk_3C;
int unk_40;
int unk_44;
int owner;
int unk_4C;
int unk_50;
int unk_54;
} SceSharedFbInfo;
SceUID _sceSharedFbOpen(int index, SceUInt32 buildVersion);
static __inline__
SceUID sceSharedFbOpen(int index) {
return _sceSharedFbOpen(index, SCE_PSP2_SDK_VERSION);
}
int sceSharedFbClose(SceUID fbId);
int sceSharedFbBegin(SceUID fbId, SceSharedFbInfo *fbInfo);
int sceSharedFbEnd(SceUID fbId);
int sceSharedFbGetInfo(SceUID fbId, SceSharedFbInfo *fbInfo);
#ifdef __cplusplus
}
#endif
#endif /* _VDSUITE_USER_APPMGR_H */
|