libctru v2.5.0
Loading...
Searching...
No Matches
boss.h
Go to the documentation of this file.
1/**
2 * @file boss.h
3 * @brief BOSS service, see also: https://www.3dbrew.org/wiki/BOSS_Services
4 */
5#pragma once
6
7/// BOSS context.
8typedef struct
9{
10 u32 property[0x7];
11
12 char url[0x200];
13
14 u32 property_x8;
15 u8 property_x9;
16
17 u8 property_xa[0x100];
18
19 u8 property_xb[0x200];
20
21 char property_xd[0x360];//Additonal optional HTTP request headers.
22
23 u32 property_xe;
24
25 u32 property_xf[0xc>>2];
26
27 u8 property_x10;
28 u8 property_x11;
29 u8 property_x12;
30 u32 property_x13;
31 u32 property_x14;
32
33 u8 property_x15[0x40];
34
35 u32 property_x16;
36
37 u32 property_x3b;
38
39 u8 property_x3e[0x200];
41
42/// BOSS task status.
43typedef enum {
44 BOSSTASKSTATUS_STARTED = 0x2,
45 BOSSTASKSTATUS_ERROR = 0x7,
47
48/// Type values for bossGetNsDataHeaderInfo().
49typedef enum {
50 bossNsDataHeaderInfoType_ContentSize = 0x3 /// Size of the content.
52
53/// Size of the output data for bossGetNsDataHeaderInfo().
54typedef enum {
55 bossNsDataHeaderInfoTypeSize_ContentSize = 0x4 ///Type2
57
58/**
59 * @brief Initializes BOSS.
60 * @param programID programID to use, 0 for the current process. Only used when BOSSP is available without *hax payload.
61 * @param force_user When true, just use bossU instead of trying to initialize with bossP first.
62 */
63Result bossInit(u64 programID, bool force_user);
64
65/**
66 * @brief Run the InitializeSession service cmd. This is mainly for changing the programID associated with the current BOSS session.
67 * @param programID programID to use, 0 for the current process.
68 */
70
71/// Exits BOSS.
72void bossExit(void);
73
74/// Returns the BOSS session handle.
76
77/**
78 * @brief Set the content data storage location.
79 * @param extdataID u64 extdataID, must have the high word set to the shared-extdata value when it's for NAND.
80 * @param boss_size Probably the max size in the extdata which BOSS can use.
81 * @param mediaType Roughly the same as FS mediatype.
82 */
83Result bossSetStorageInfo(u64 extdataID, u32 boss_size, u8 mediaType);
84
85/**
86 * @brief Unregister the content data storage location, which includes unregistering the BOSS-session programID with BOSS.
87 */
89
90/**
91 * @brief Register a task.
92 * @param taskID BOSS taskID.
93 * @param unk0 Unknown, usually zero.
94 * @param unk1 Unknown, usually zero.
95 */
96Result bossRegisterTask(const char *taskID, u8 unk0, u8 unk1);
97
98/**
99 * @brief Send a property.
100 * @param PropertyID PropertyID
101 * @param buf Input buffer data.
102 * @param size Buffer size.
103 */
104Result bossSendProperty(u16 PropertyID, const void* buf, u32 size);
105
106/**
107 * @brief Deletes the content file for the specified NsDataId.
108 * @param NsDataId NsDataId
109 */
111
112/**
113 * @brief Gets header info for the specified NsDataId.
114 * @param NsDataId NsDataId
115 * @param type Type of data to load.
116 * @param buffer Output buffer.
117 * @param size Output buffer size.
118 */
119Result bossGetNsDataHeaderInfo(u32 NsDataId, u8 type, void* buffer, u32 size);
120
121/**
122 * @brief Reads data from the content for the specified NsDataId.
123 * @param NsDataId NsDataId
124 * @param offset Offset in the content.
125 * @param buffer Output buffer.
126 * @param size Output buffer size.
127 * @param transfer_total Optional output actual read size, can be NULL.
128 * @param unk_out Optional unknown output, can be NULL.
129 */
130Result bossReadNsData(u32 NsDataId, u64 offset, void* buffer, u32 size, u32 *transfer_total, u32 *unk_out);
131
132/**
133 * @brief Starts a task soon after running this command.
134 * @param taskID BOSS taskID.
135 */
136Result bossStartTaskImmediate(const char *taskID);
137
138/**
139 * @brief Similar to bossStartTaskImmediate?
140 * @param taskID BOSS taskID.
141 */
142Result bossStartBgImmediate(const char *taskID);
143
144/**
145 * @brief Deletes a task by using CancelTask and UnregisterTask internally.
146 * @param taskID BOSS taskID.
147 * @param unk Unknown, usually zero?
148 */
149Result bossDeleteTask(const char *taskID, u32 unk);
150
151/**
152 * @brief Returns task state.
153 * @param taskID BOSS taskID.
154 * @param inval Unknown, normally 0?
155 * @param status Output status, see bossTaskStatus.
156 * @param out1 Output field.
157 * @param out2 Output field.
158 */
159Result bossGetTaskState(const char *taskID, s8 inval, u8 *status, u32 *out1, u8 *out2);
160
161/**
162 * @brief This loads the current state of PropertyID 0x0 for the specified task.
163 * @param taskID BOSS taskID.
164 */
165Result bossGetTaskProperty0(const char *taskID, u8 *out);
166
167/**
168 * @brief Setup a BOSS context with the default config.
169 * @param bossContext BOSS context.
170 * @param seconds_interval Interval in seconds for running the task automatically.
171 * @param url Task URL.
172 */
173void bossSetupContextDefault(bossContext *ctx, u32 seconds_interval, const char *url);
174
175/**
176 * @brief Sends the config stored in the context. Used before registering a task.
177 * @param bossContext BOSS context.
178 */
180
Result bossGetTaskProperty0(const char *taskID, u8 *out)
This loads the current state of PropertyID 0x0 for the specified task.
Result bossGetTaskState(const char *taskID, s8 inval, u8 *status, u32 *out1, u8 *out2)
Returns task state.
bossNsDataHeaderInfoTypes
Type values for bossGetNsDataHeaderInfo().
Definition boss.h:49
void bossSetupContextDefault(bossContext *ctx, u32 seconds_interval, const char *url)
Setup a BOSS context with the default config.
Result bossSendContextConfig(bossContext *ctx)
Sends the config stored in the context.
Result bossInit(u64 programID, bool force_user)
Initializes BOSS.
Result bossReadNsData(u32 NsDataId, u64 offset, void *buffer, u32 size, u32 *transfer_total, u32 *unk_out)
Reads data from the content for the specified NsDataId.
Result bossUnregisterStorage(void)
Unregister the content data storage location, which includes unregistering the BOSS-session programID...
void bossExit(void)
Exits BOSS.
bossTaskStatus
BOSS task status.
Definition boss.h:43
Result bossStartTaskImmediate(const char *taskID)
Starts a task soon after running this command.
Result bossSetStorageInfo(u64 extdataID, u32 boss_size, u8 mediaType)
Set the content data storage location.
Result bossDeleteTask(const char *taskID, u32 unk)
Deletes a task by using CancelTask and UnregisterTask internally.
Result bossDeleteNsData(u32 NsDataId)
Deletes the content file for the specified NsDataId.
Result bossGetNsDataHeaderInfo(u32 NsDataId, u8 type, void *buffer, u32 size)
Gets header info for the specified NsDataId.
Result bossSendProperty(u16 PropertyID, const void *buf, u32 size)
Send a property.
Result bossReinit(u64 programID)
Run the InitializeSession service cmd.
Result bossRegisterTask(const char *taskID, u8 unk0, u8 unk1)
Register a task.
bossNsDataHeaderInfoTypeSizes
Size of the output data for bossGetNsDataHeaderInfo().
Definition boss.h:54
Handle bossGetSessionHandle(void)
Returns the BOSS session handle.
Result bossStartBgImmediate(const char *taskID)
Similar to bossStartTaskImmediate?
BOSS context.
Definition boss.h:9
uint64_t u64
64-bit unsigned integer
Definition types.h:24
uint8_t u8
would be nice if newlib had this already
Definition types.h:21
int8_t s8
8-bit signed integer
Definition types.h:26
u32 Handle
Resource handle.
Definition types.h:41
s32 Result
Function result.
Definition types.h:42
uint16_t u16
16-bit unsigned integer
Definition types.h:22
uint32_t u32
32-bit unsigned integer
Definition types.h:23