]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added some srv commands
authorfincs <fincs.alt1@gmail.com>
Wed, 6 May 2015 19:59:47 +0000 (21:59 +0200)
committerfincs <fincs.alt1@gmail.com>
Wed, 6 May 2015 19:59:47 +0000 (21:59 +0200)
libctru/include/3ds/srv.h
libctru/source/srv.c

index 961ddbe155e402ac7515c2cf3e5affd020e8f466..9fbe481bd4c8b9c1892fa1d8be4e5abf141d57a8 100644 (file)
@@ -4,6 +4,8 @@ Result srvInit();
 Result srvExit();
 Result srvRegisterClient();
 Result srvGetServiceHandle(Handle* out, const char* name);
+Result srvRegisterService(Handle* out, const char* name, int maxSessions);
+Result srvUnregisterService(const char* name);
 
 Result srvPmInit();
 Result srvRegisterProcess(u32 procid, u32 count, void *serviceaccesscontrol);
index 366eca66dd088687a71dd9c898a411340a03d6ef..53c0767d8a6b60deaff06f9c779ceca7d7b7e07f 100644 (file)
@@ -136,6 +136,34 @@ Result srvGetServiceHandle(Handle* out, const char* name)
        return cmdbuf[1];
 }
 
+Result srvRegisterService(Handle* out, const char* name, int maxSessions)
+{
+       u32* cmdbuf = getThreadCommandBuffer();
+       cmdbuf[0] = 0x30100;
+       strcpy((char*) &cmdbuf[1], name);
+       cmdbuf[3] = strlen(name);
+       cmdbuf[4] = maxSessions;
+       
+       Result rc;
+       if((rc = svcSendSyncRequest(g_srv_handle)))return rc;
+
+       *out = cmdbuf[3];
+       return cmdbuf[1];
+}
+
+Result srvUnregisterService(const char* name)
+{
+       u32* cmdbuf = getThreadCommandBuffer();
+       cmdbuf[0] = 0x400C0;
+       strcpy((char*) &cmdbuf[1], name);
+       cmdbuf[3] = strlen(name);
+       
+       Result rc;
+       if((rc = svcSendSyncRequest(g_srv_handle)))return rc;
+
+       return cmdbuf[1];
+}
+
 // Old srv:pm interface, will only work on systems where srv:pm was a port (<7.X)
 Result srvPmInit()
 {