summaryrefslogtreecommitdiff
path: root/include/kernel/kernel/proc_event.h
blob: 1d7a63eb571c13af5d74c5992605d53bf9ba9845 (plain) (blame)
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
/*
	Vita Development Suite Libraries
*/

#ifndef _VDSUITE_KERNEL_KERNEL_PROC_EVENT_H
#define _VDSUITE_KERNEL_KERNEL_PROC_EVENT_H

#include <scetypes.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct SceProcEventInvokeParam1 {
	SceSize size;                                     // SceProcEventInvokeParam1 struct size : 0x10
	int unk_0x04;
	int unk_0x08;
	int unk_0x0C;
} SceProcEventInvokeParam1;

typedef struct SceProcEventInvokeParam2 {
	SceSize size;                                     // SceProcEventInvokeParam2 struct size : 0x14
	SceUID pid;
	int unk_0x08;
	int unk_0x0C;
	int unk_0x10;
} SceProcEventInvokeParam2;

typedef struct SceProcEventHandler {
	SceSize size;                                                                               // SceProcEventHandler struct size : 0x1C
	int (* create)(SceUID pid, SceProcEventInvokeParam2 *a2, int a3);
	int (* exit)(SceUID pid, SceProcEventInvokeParam1 *a2, int a3);                             // current process exit
	int (* kill)(SceUID pid, SceProcEventInvokeParam1 *a2, int a3);                             // by SceShell
	int (* stop)(SceUID pid, int event_type, SceProcEventInvokeParam1 *a3, int a4);
	int (* start)(SceUID pid, int event_type, SceProcEventInvokeParam1 *a3, int a4);
	int (* switch_process)(int event_id, int event_type, SceProcEventInvokeParam2 *a3, int a4); // switch display frame?
} SceProcEventHandler;

/**
 * Register process event handler
 *
 * @param[in] name    - Name of handler
 * @param[in] handler - The pointer of handler
 * @param[in] a3      - unknown, set to 0
 *
 * @return uid on success, < 0 on error.
 */
SceUID sceKernelRegisterProcEventHandler(const char *name, const SceProcEventHandler *handler, int a3);

/**
 * Unregister process event handler
 *
 * @param[in] uid - ProcEvent uid
 *
 * @return uid on success, < 0 on error.
 */
int sceKernelUnregisterProcEventHandler(SceUID uid);

/**
 * Invoke process event handler
 *
 * @param[in] pid        - The ProccessId
 * @param[in] event_id   - event_id, [1, 2, 3, 4, 5, 0x10, 0x11]
 * @param[in] event_type - Various event types
 * @param[in] param      - The pointer of invoke parameter
 * @param[in] a5         - Unknown
 * @param[in] a6         - Unknown
 *
 * @return uid on success, < 0 on error.
 */
int sceKernelInvokeProcEventHandler(SceUID pid, int event_id, int event_type, void *param, void *a5, int a6);

#ifdef __cplusplus
}
#endif

#endif /* _VDSUITE_KERNEL_KERNEL_PROC_EVENT_H */