libctru v2.5.0
Loading...
Searching...
No Matches
pmapp.h
Go to the documentation of this file.
1/**
2 * @file pmapp.h
3 * @brief PM (Process Manager) application service.
4 */
5#pragma once
6
7#include <3ds/services/fs.h>
8#include <3ds/exheader.h>
9
10/// Launch flags for PM launch commands.
11enum {
12 PMLAUNCHFLAG_NORMAL_APPLICATION = BIT(0),
13 PMLAUNCHFLAG_LOAD_DEPENDENCIES = BIT(1),
14 PMLAUNCHFLAG_NOTIFY_TERMINATION = BIT(2),
15 PMLAUNCHFLAG_QUEUE_DEBUG_APPLICATION = BIT(3),
16 PMLAUNCHFLAG_TERMINATION_NOTIFICATION_MASK = 0xF0,
17 PMLAUNCHFLAG_FORCE_USE_O3DS_APP_MEM = BIT(8), ///< Forces the usage of the O3DS system mode app memory setting even if N3DS system mode is not "Legacy". Dev4 and Dev5 not supported. N3DS only.
18 PMLAUNCHFLAG_FORCE_USE_O3DS_MAX_APP_MEM = BIT(9), ///< In conjunction with the above, forces the 96MB app memory setting. N3DS only.
19 PMLAUNCHFLAG_USE_UPDATE_TITLE = BIT(16),
20};
21
22/// Initializes pm:app.
24
25/// Exits pm:app.
26void pmAppExit(void);
27
28/**
29 * @brief Gets the current pm:app session handle.
30 * @return The current pm:app session handle.
31 */
33
34/**
35 * @brief Launches a title.
36 * @param programInfo Program information of the title.
37 * @param launchFlags Flags to launch the title with.
38 */
39Result PMAPP_LaunchTitle(const FS_ProgramInfo *programInfo, u32 launchFlags);
40
41/**
42 * @brief Launches a title, applying patches.
43 * @param programInfo Program information of the title.
44 * @param programInfoUpdate Program information of the update title.
45 * @param launchFlags Flags to launch the title with.
46 */
47Result PMAPP_LaunchTitleUpdate(const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate, u32 launchFlags);
48
49/**
50 * @brief Gets a title's ExHeader Arm11CoreInfo and SystemInfo flags.
51 * @param[out] outCoreInfo Pointer to write the ExHeader Arm11CoreInfo to.
52 * @param[out] outSiFlags Pointer to write the ExHeader SystemInfo flags to.
53 * @param programInfo Program information of the title.
54 */
56
57/**
58 * @brief Sets the current FIRM launch parameters.
59 * @param size Size of the FIRM launch parameter buffer.
60 * @param in Buffer to retrieve the launch parameters from.
61 */
62Result PMAPP_SetFIRMLaunchParams(u32 size, const void* in);
63
64/**
65 * @brief Gets the current FIRM launch parameters.
66 * @param size Size of the FIRM launch parameter buffer.
67 * @param[out] out Buffer to write the launch parameters to.
68 */
70
71/**
72 * @brief Sets the current FIRM launch parameters.
73 * @param firmTidLow Low Title ID of the FIRM title to launch.
74 * @param size Size of the FIRM launch parameter buffer.
75 * @param in Buffer to retrieve the launch parameters from.
76 */
77Result PMAPP_LaunchFIRMSetParams(u32 firmTidLow, u32 size, const void* in);
78
79/**
80 * @brief Terminate most processes, to prepare for a reboot or a shutdown.
81 * @param timeout Time limit in ns for process termination, after which the remaining processes are killed.
82 */
84
85/**
86 * @brief Terminates the current Application
87 * @param timeout Timeout in nanoseconds
88 */
90
91/**
92 * @brief Terminates the processes having the specified titleId.
93 * @param titleId Title ID of the processes to terminate
94 * @param timeout Timeout in nanoseconds
95 */
97
98/**
99 * @brief Terminates the specified process
100 * @param pid Process-ID of the process to terminate
101 * @param timeout Timeout in nanoseconds
102 */
104
105/**
106 * @brief Unregisters a process
107 * @param tid TitleID of the process to unregister
108 */
110
111/**
112 * @brief Sets the APPLICATION cputime reslimit.
113 * @param cpuTime Reslimit value.
114 * @note cpuTime can be no higher than reslimitdesc[0] & 0x7F in exheader (or 80 if the latter is 0).
115 */
117
118/**
119 * @brief Gets the APPLICATION cputime reslimit.
120 * @param[out] cpuTime Pointer to write the reslimit value to.
121 */
123
NCCH extended header definitions.
Filesystem Services.
Result PMAPP_TerminateCurrentApplication(s64 timeout)
Terminates the current Application.
Result PMAPP_LaunchTitleUpdate(const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate, u32 launchFlags)
Launches a title, applying patches.
Result PMAPP_GetTitleExheaderFlags(ExHeader_Arm11CoreInfo *outCoreInfo, ExHeader_SystemInfoFlags *outSiFlags, const FS_ProgramInfo *programInfo)
Gets a title's ExHeader Arm11CoreInfo and SystemInfo flags.
Handle * pmAppGetSessionHandle(void)
Gets the current pm:app session handle.
Result PMAPP_GetAppResourceLimit(s64 *outCpuTime)
Gets the APPLICATION cputime reslimit.
Result PMAPP_UnregisterProcess(u64 tid)
Unregisters a process.
Result pmAppInit(void)
Initializes pm:app.
Result PMAPP_PrepareForReboot(s64 timeout)
Terminate most processes, to prepare for a reboot or a shutdown.
Result PMAPP_SetFIRMLaunchParams(u32 size, const void *in)
Sets the current FIRM launch parameters.
Result PMAPP_GetFIRMLaunchParams(void *out, u32 size)
Gets the current FIRM launch parameters.
Result PMAPP_TerminateProcess(u32 pid, s64 timeout)
Terminates the specified process.
Result PMAPP_TerminateTitle(u64 titleId, s64 timeout)
Terminates the processes having the specified titleId.
void pmAppExit(void)
Exits pm:app.
Result PMAPP_LaunchFIRMSetParams(u32 firmTidLow, u32 size, const void *in)
Sets the current FIRM launch parameters.
@ PMLAUNCHFLAG_FORCE_USE_O3DS_APP_MEM
Forces the usage of the O3DS system mode app memory setting even if N3DS system mode is not "Legacy"....
Definition pmapp.h:17
@ PMLAUNCHFLAG_FORCE_USE_O3DS_MAX_APP_MEM
In conjunction with the above, forces the 96MB app memory setting. N3DS only.
Definition pmapp.h:18
Result PMAPP_SetAppResourceLimit(s64 cpuTime)
Sets the APPLICATION cputime reslimit.
Result PMAPP_LaunchTitle(const FS_ProgramInfo *programInfo, u32 launchFlags)
Launches a title.
The CPU-related and memory-layout-related info of a title.
Definition exheader.h:132
The system info flags and remaster version of a title.
Definition exheader.h:74
Program information.
Definition fs.h:183
int64_t s64
64-bit signed integer
Definition types.h:29
#define BIT(n)
Creates a bitmask from a bit number.
Definition types.h:47
uint64_t u64
64-bit unsigned integer
Definition types.h:24
u32 Handle
Resource handle.
Definition types.h:41
s32 Result
Function result.
Definition types.h:42
uint32_t u32
32-bit unsigned integer
Definition types.h:23