Added udsWaitConnectionStatusEvent(). Updated the udsConnectionStatus struct.

This commit is contained in:
yellows8 2016-04-06 13:02:26 -04:00
parent 72cb548cb0
commit 688b2649c5
2 changed files with 25 additions and 1 deletions

View 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.

View 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();