]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added bossReinit() and bossUnregisterStorage(). Updated comments for bossInit().
authoryellows8 <yellows8@users.noreply.github.com>
Tue, 27 Dec 2016 23:04:17 +0000 (18:04 -0500)
committeryellows8 <yellows8@users.noreply.github.com>
Tue, 27 Dec 2016 23:04:17 +0000 (18:04 -0500)
libctru/include/3ds/services/boss.h
libctru/source/services/boss.c

index 6d65906c31cc9a14a722ecddab9b27757133046c..aad3ce4210518083c2fdfefbb88d9261af77ff60 100644 (file)
@@ -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.
index cc1631da1eea9297c573c7bee361609f4941307d..26cd8999657d5c14a703788da623bce949d52fbe 100644 (file)
@@ -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;