libnx  v4.8.0
pgl.h
Go to the documentation of this file.
1 /**
2  * @file pgl.h
3  * @brief PGL service IPC wrapper.
4  * @author SciresM
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../sf/service.h"
10 #include "../sf/tipc.h"
11 #include "../services/ncm_types.h"
12 #include "../services/pm.h"
13 
14 /// LaunchFlag
15 typedef enum {
16  PglLaunchFlag_None = 0,
17  PglLaunchFlag_EnableDetailedCrashReport = BIT(0),
18  PglLaunchFlag_EnableCrashReportScreenShotForProduction = BIT(1),
19  PglLaunchFlag_EnableCrashReportScreenShotForDevelop = BIT(2),
21 
22 /// SnapShotDumpType
23 typedef enum {
24  PglSnapShotDumpType_None = 0,
25  PglSnapShotDumpType_Auto = 1,
26  PglSnapShotDumpType_Full = 2,
28 
29 typedef struct {
30  u64 id; ///< Program Id
31  u32 version; ///< Version
32  u8 content_type; ///< NcmContentType
33  u8 id_offset; ///< Id Offset
34  u8 reserved_0E[2]; ///< Padding
36 
37 typedef union {
38  Service s;
39  TipcService t;
41 
42 /// Initialize pgl.
44 
45 /// Exit pgl.
46 void pglExit(void);
47 
48 /// Gets the Service object for the actual pgl service session. Requires < 12.0.0
50 
51 /// Gets the TipcService object for the actual pgl service session. Requires 12.0.0+
53 
54 Result pglLaunchProgram(u64 *out_pid, const NcmProgramLocation *loc, u32 pm_launch_flags, u8 pgl_launch_flags);
55 Result pglTerminateProcess(u64 pid);
56 Result pglLaunchProgramFromHost(u64 *out_pid, const char *content_path, u32 pm_launch_flags);
57 Result pglGetHostContentMetaInfo(PglContentMetaInfo *out, const char *content_path);
58 Result pglGetApplicationProcessId(u64 *out);
59 Result pglBoostSystemMemoryResourceLimit(u64 size);
60 Result pglIsProcessTracked(bool *out, u64 pid);
61 Result pglEnableApplicationCrashReport(bool en);
62 Result pglIsApplicationCrashReportEnabled(bool *out);
63 Result pglEnableApplicationAllThreadDumpOnCrash(bool en);
64 Result pglTriggerApplicationSnapShotDumper(PglSnapShotDumpType dump_type, const char *arg);
65 Result pglGetEventObserver(PglEventObserver *out);
66 
67 Result pglEventObserverGetProcessEvent(PglEventObserver *observer, Event *out);
68 Result pglEventObserverGetProcessEventInfo(PglEventObserver *observer, PmProcessEventInfo *out);
69 void pglEventObserverClose(PglEventObserver *observer);
Result pglInitialize(void)
Initialize pgl.
void pglExit(void)
Exit pgl.
TipcService * pglGetServiceSessionTipc(void)
Gets the TipcService object for the actual pgl service session. Requires 12.0.0+.
Service * pglGetServiceSessionCmif(void)
Gets the Service object for the actual pgl service session. Requires < 12.0.0.
PglSnapShotDumpType
SnapShotDumpType.
Definition: pgl.h:23
PglLaunchFlag
LaunchFlag.
Definition: pgl.h:15
Kernel-mode event structure.
Definition: event.h:13
ProgramLocation.
Definition: ncm_types.h:173
Definition: pgl.h:29
u32 version
Version.
Definition: pgl.h:31
u8 id_offset
Id Offset.
Definition: pgl.h:33
u64 id
Program Id.
Definition: pgl.h:30
u8 content_type
NcmContentType.
Definition: pgl.h:32
ProcessEventInfo.
Definition: pm.h:48
Service object structure.
Definition: service.h:14
tipc Service object structure
Definition: tipc.h:18
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
u32 Result
Function error code result type.
Definition: types.h:44
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
Definition: pgl.h:37