diff --git a/libctru/include/3ds/services/boss.h b/libctru/include/3ds/services/boss.h index 6d65906..aad3ce4 100644 --- a/libctru/include/3ds/services/boss.h +++ b/libctru/include/3ds/services/boss.h @@ -46,11 +46,17 @@ typedef enum { /** * @brief Initializes BOSS. - * @param programID programID to use, 0 for the current process. Not used internally unless BOSSP is available. + * @param programID programID to use, 0 for the current process. Only used when BOSSP is available without *hax payload. * @param force_user When true, just use bossU instead of trying to initialize with bossP first. */ Result bossInit(u64 programID, bool force_user); +/** + * @brief Run the InitializeSession service cmd. This is mainly for changing the programID associated with the current BOSS session. + * @param programID programID to use, 0 for the current process. + */ +Result bossReinit(u64 programID); + /// Exits BOSS. void bossExit(void); @@ -65,6 +71,11 @@ Handle bossGetSessionHandle(void); */ Result bossSetStorageInfo(u64 extdataID, u32 boss_size, u8 mediaType); +/** + * @brief Unregister the content data storage location, which includes unregistering the BOSS-session programID with BOSS. + */ +Result bossUnregisterStorage(void); + /** * @brief Register a task. * @param taskID BOSS taskID. diff --git a/libctru/source/services/boss.c b/libctru/source/services/boss.c index cc1631d..26cd899 100644 --- a/libctru/source/services/boss.c +++ b/libctru/source/services/boss.c @@ -53,6 +53,11 @@ Result bossInit(u64 programID, bool force_user) return res; } +Result bossReinit(u64 programID) +{ + return bossipc_InitializeSession(programID); +} + void bossExit(void) { if (AtomicDecrement(&bossRefCount)) return; @@ -97,6 +102,18 @@ Result bossSetStorageInfo(u64 extdataID, u32 boss_size, u8 mediaType) return (Result)cmdbuf[1]; } +Result bossUnregisterStorage(void) +{ + Result ret = 0; + u32 *cmdbuf = getThreadCommandBuffer(); + + cmdbuf[0] = IPC_MakeHeader(0x3,0,0); // 0x30000 + + if(R_FAILED(ret = svcSendSyncRequest(bossHandle)))return ret; + + return (Result)cmdbuf[1]; +} + Result bossRegisterTask(const char *taskID, u8 unk0, u8 unk1) { Result ret = 0;