]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added udsWaitConnectionStatusEvent(). Updated the udsConnectionStatus struct.
authoryellows8 <yellows8@users.noreply.github.com>
Wed, 6 Apr 2016 17:02:26 +0000 (13:02 -0400)
committeryellows8 <yellows8@users.noreply.github.com>
Wed, 6 Apr 2016 17:02:26 +0000 (13:02 -0400)
libctru/include/3ds/services/uds.h
libctru/source/services/uds.c

index e04388ff1e4d5291602e0ddac43e3a2c76be0adc..208235e5ed527900b208627a2381f6bfc63f8f45 100644 (file)
@@ -29,7 +29,7 @@ typedef struct {
 
 /// Connection status struct.
 typedef struct {
-       u32 event_type;
+       u32 status;
        u32 unk_x4[0x28>>2];
        u8 id8;
        u8 pad_x2d[3];
@@ -305,6 +305,14 @@ Result udsSetNewConnectionsBlocked(bool block, bool clients, bool spectators);
  */
 Result udsGetConnectionStatus(udsConnectionStatus *output);
 
+/**
+ * @brief Waits for the ConnectionStatus event to occur, or checks if the event was signalled. This event is signalled when the data from udsGetConnectionStatus() was updated internally.
+ * @return Always true. However if wait=false, this will return false if the event wasn't signalled.
+ * @param nextEvent Whether to discard the current event and wait for the next event.
+ * @param wait When true this will not return until the event is signalled. When false this checks if the event was signalled without waiting for it.
+ */
+bool udsWaitConnectionStatusEvent(bool nextEvent, bool wait);
+
 /**
  * @brief This loads a NodeInfo struct for the specified NetworkNodeID. The broadcast alias can't be used with this.
  * @param NetworkNodeID Target NetworkNodeID.
index 788f15d7f303982d3597cc065066478f52f4c57f..70d1a744993cdb903b363b993ea5dfa6bd2bfdd6 100644 (file)
@@ -389,6 +389,22 @@ Result udsGetConnectionStatus(udsConnectionStatus *output)
        return ret;
 }
 
+bool udsWaitConnectionStatusEvent(bool nextEvent, bool wait)
+{
+       bool ret = true;
+       u64 delayvalue = U64_MAX;
+
+       if(!wait)delayvalue = 0;
+
+       if(nextEvent)svcClearEvent(__uds_connectionstatus_event);
+
+       if(svcWaitSynchronization(__uds_connectionstatus_event, delayvalue)!=0 && !wait)ret = false;
+
+       if(!nextEvent)svcClearEvent(__uds_connectionstatus_event);
+
+       return ret;
+}
+
 Result udsGetNodeInformation(u16 NetworkNodeID, udsNodeInfo *output)
 {
        u32* cmdbuf=getThreadCommandBuffer();