]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added udsGetConnectionStatus().
authoryellows8 <yellows8@users.noreply.github.com>
Wed, 6 Apr 2016 16:46:08 +0000 (12:46 -0400)
committeryellows8 <yellows8@users.noreply.github.com>
Wed, 6 Apr 2016 16:46:08 +0000 (12:46 -0400)
libctru/include/3ds/services/uds.h
libctru/source/services/uds.c

index 8f0de88cea75272fd6a1495dadbb6da37ef2c403..e04388ff1e4d5291602e0ddac43e3a2c76be0adc 100644 (file)
@@ -27,6 +27,14 @@ typedef struct {
        u32 word_x24;
 } udsNodeInfo;
 
+/// Connection status struct.
+typedef struct {
+       u32 event_type;
+       u32 unk_x4[0x28>>2];
+       u8 id8;
+       u8 pad_x2d[3];
+} udsConnectionStatus;
+
 /// Network struct stored as big-endian.
 typedef struct {
        u8 host_macaddress[6];
@@ -291,6 +299,12 @@ Result udsUpdateNetworkAttribute(u16 bitmask, bool flag);
  */
 Result udsSetNewConnectionsBlocked(bool block, bool clients, bool spectators);
 
+/**
+ * @brief This loads the current ConnectionStatus struct.
+ * @param output Output ConnectionStatus struct.
+ */
+Result udsGetConnectionStatus(udsConnectionStatus *output);
+
 /**
  * @brief This loads a NodeInfo struct for the specified NetworkNodeID. The broadcast alias can't be used with this.
  * @param NetworkNodeID Target NetworkNodeID.
index 1f76fc6cf888cef13d98eb83a4097b897ce57211..788f15d7f303982d3597cc065066478f52f4c57f 100644 (file)
@@ -371,6 +371,24 @@ Result udsDisconnectNetwork(void)
        return cmdbuf[1];
 }
 
+Result udsGetConnectionStatus(udsConnectionStatus *output)
+{
+       u32* cmdbuf=getThreadCommandBuffer();
+
+       cmdbuf[0]=IPC_MakeHeader(0xB,0,0); // 0xB0000
+
+       Result ret=0;
+       if(R_FAILED(ret=svcSendSyncRequest(__uds_servhandle)))return ret;
+       ret = cmdbuf[1];
+
+       if(R_SUCCEEDED(ret))
+       {
+               if(output)memcpy(output, &cmdbuf[2], sizeof(udsConnectionStatus));
+       }
+
+       return ret;
+}
+
 Result udsGetNodeInformation(u16 NetworkNodeID, udsNodeInfo *output)
 {
        u32* cmdbuf=getThreadCommandBuffer();