From 9933ae0c6edad98a78b9d26f97e4086eb458c091 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 7 Sep 2014 19:27:26 +0800 Subject: [PATCH] netAdhocctlInited should be true when return success Update back new file Windows (?) build fix --- Core/HLE/proAdhoc.cpp | 3 +-- Core/HLE/proAdhoc.h | 8 ++++---- Core/HLE/sceNet.cpp | 1 - Core/HLE/sceNetAdhoc.cpp | 8 +++++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index d3bb420c0..eb2dea3fc 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -1456,7 +1456,6 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){ return iResult; } - // Prepare Login Packet SceNetAdhocctlLoginPacketC2S packet; packet.base.opcode = OPCODE_LOGIN; @@ -1563,7 +1562,7 @@ bool resolveMAC(SceNetEtherAddr * mac, uint32_t * ip) { bool validNetworkName(const SceNetAdhocctlGroupName * group_name) { // Result - int valid = true; + bool valid = true; // Name given if (group_name != NULL) { diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index ca17493df..bac22c100 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -1157,7 +1157,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhocid); /** * Broadcast MAC Check * @param addr To-be-checked MAC Address - * @return true if Broadcast MAC, false otherwise. + * @return true if Broadcast MAC or... 0 */ bool isBroadcastMAC(const SceNetEtherAddr * addr); @@ -1165,7 +1165,7 @@ bool isBroadcastMAC(const SceNetEtherAddr * addr); * Resolve IP to MAC * @param ip Peer IP Address * @param mac OUT: Peer MAC - * @return true on success, false otherwise. + * @return true on success */ bool resolveIP(uint32_t ip, SceNetEtherAddr * mac); @@ -1173,14 +1173,14 @@ bool resolveIP(uint32_t ip, SceNetEtherAddr * mac); * Resolve MAC to IP * @param mac Peer MAC Address * @param ip OUT: Peer IP - * @return true on success, false otherwise. + * @return true on success */ bool resolveMAC(SceNetEtherAddr * mac, uint32_t * ip); /** * Check whether Network Name contains only valid symbols * @param group_name To-be-checked Network Name - * @return true if valid, false otherwise. + * @return 1 if valid or... 0 */ bool validNetworkName(const SceNetAdhocctlGroupName * groupname); diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 10cf40335..45cdfdd60 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -29,7 +29,6 @@ #include "sceKernel.h" #include "sceKernelThread.h" #include "sceKernelMutex.h" -#include "sceNet.h" #include "sceUtility.h" #include "Core/HLE/proAdhoc.h" diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index aea44e8e7..73334dde3 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -243,8 +243,8 @@ static u32 sceNetAdhocctlInit(int stackSize, int prio, u32 productAddr) { friendFinderThread = std::thread(friendFinder); } - netAdhocctlInited = true; //needed for cleanup during AdhocctlTerm even when it failed to connect to Adhoc Server (since it's being faked as success) } + netAdhocctlInited = true; //needed for cleanup during AdhocctlTerm even when it failed to connect to Adhoc Server (since it's being faked as success) return 0; } @@ -297,7 +297,8 @@ static int sceNetAdhocPdpCreate(const char *mac, u32 port, int bufferSize, u32 u //return ERROR_NET_ADHOC_PORT_IN_USE; // Create Internet UDP Socket - int usocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + int usocket = (int)INVALID_SOCKET; + usocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); // Valid Socket produced if (usocket != INVALID_SOCKET) { // Change socket buffer size when necessary @@ -1679,7 +1680,8 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, // Valid Arguments if (bufsize > 0 && rexmt_int > 0 && rexmt_cnt > 0) { // Create Infrastructure Socket - int tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + int tcpsocket = (int)INVALID_SOCKET; + tcpsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); // Valid Socket produced if (tcpsocket > 0) {