From 6570ade09734d75797297cd6a0d7837771904038 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Wed, 6 Apr 2016 00:48:08 -0400 Subject: [PATCH] Disabled the debug prints for network-connecting and implemented udsEjectClient(). --- libctru/include/3ds/services/uds.h | 6 ++++++ libctru/source/services/uds.c | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libctru/include/3ds/services/uds.h b/libctru/include/3ds/services/uds.h index 7fcae7e..0e16f7d 100644 --- a/libctru/include/3ds/services/uds.h +++ b/libctru/include/3ds/services/uds.h @@ -270,3 +270,9 @@ Result udsDestroyNetwork(void); */ Result udsDisconnectNetwork(void); +/** + * @brief This can be used by the host to force-disconnect client(s). + * @param NetworkNodeID Target NetworkNodeID. UDS_BROADCAST_NETWORKNODEID can be used to disconnect all clients. + */ +Result udsEjectClient(u16 NetworkNodeID); + diff --git a/libctru/source/services/uds.c b/libctru/source/services/uds.c index 1bfddc4..02c564c 100644 --- a/libctru/source/services/uds.c +++ b/libctru/source/services/uds.c @@ -262,10 +262,10 @@ Result udsCreateNetwork(udsNetworkStruct *network, void* passphrase, size_t pass Result udsConnectNetwork(udsNetworkStruct *network, void* passphrase, size_t passphrase_size, udsBindContext *context, u16 recv_NetworkNodeID, udsConnectionType connection_type) { Result ret=0; - printf("connecting...\n");//Removing these prints caused connecting to fail. + //printf("connecting...\n");//Removing these prints caused connecting to fail. ret = udsipc_ConnectToNetwork(network, passphrase, passphrase_size, connection_type); if(R_FAILED(ret))return ret; - printf("bind...\n"); + //printf("bind...\n"); ret = udsBind(context, recv_NetworkNodeID); if(R_FAILED(ret))udsDisconnectNetwork(); @@ -308,6 +308,19 @@ static Result udsipc_Shutdown(void) return cmdbuf[1]; } +Result udsEjectClient(u16 NetworkNodeID) +{ + u32* cmdbuf=getThreadCommandBuffer(); + + cmdbuf[0]=IPC_MakeHeader(0x5,1,0); // 0x50040 + cmdbuf[1]=NetworkNodeID; + + Result ret=0; + if(R_FAILED(ret=svcSendSyncRequest(__uds_servhandle)))return ret; + + return cmdbuf[1]; +} + Result udsDestroyNetwork(void) { u32* cmdbuf=getThreadCommandBuffer();