diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 8c5b90e034..cd42fd392c 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -2356,23 +2356,23 @@ bool resolveMAC(SceNetEtherAddr* mac, uint32_t* ip, u16* port_offset) { return false; } -bool validNetworkName(const SceNetAdhocctlGroupName * group_name) { +bool validNetworkName(const char *data) { // Result bool valid = true; // Name given - if (group_name != NULL) { + if (data != NULL) { // Iterate Name Characters for (int i = 0; i < ADHOCCTL_GROUPNAME_LEN && valid; i++) { // End of Name - if (group_name->data[i] == 0) break; + if (data[i] == 0) break; // Not a digit - if (group_name->data[i] < '0' || group_name->data[i] > '9') { + if (data[i] < '0' || data[i] > '9') { // Not 'A' to 'Z' - if (group_name->data[i] < 'A' || group_name->data[i] > 'Z') { + if (data[i] < 'A' || data[i] > 'Z') { // Not 'a' to 'z' - if (group_name->data[i] < 'a' || group_name->data[i] > 'z') { + if (data[i] < 'a' || data[i] > 'z') { // Invalid Name valid = false; } diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index fc353ec341..862126cc46 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -1469,7 +1469,7 @@ bool resolveMAC(SceNetEtherAddr* mac, uint32_t* ip, u16* port_offset = nullptr); * @param group_name To-be-checked Network Name * @return 1 if valid or... 0 */ -bool validNetworkName(const SceNetAdhocctlGroupName * groupname); +bool validNetworkName(const char *data); // Convert Matching Event Code to String const char* getMatchingEventStr(int code); diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index a23f08819e..7b6dc2cd1a 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -2751,12 +2751,11 @@ int sceNetAdhocctlGetPeerInfo(const char *mac, int size, u32 peerInfoAddr) { return ERROR_NET_ADHOCCTL_NOT_INITIALIZED; } -int NetAdhocctl_Create(const char* groupName) { - const SceNetAdhocctlGroupName* groupNameStruct = (const SceNetAdhocctlGroupName*)groupName; +int NetAdhocctl_Create(const char *groupName) { // Library initialized if (netAdhocctlInited) { // Valid Argument - if (validNetworkName(groupNameStruct)) { + if (validNetworkName(groupName)) { // FIXME: When tested with JPCSP + official prx files it seems when adhocctl in a connected state (ie. joined to a group) attempting to create/connect/join/scan will return a success (without doing anything?) if ((adhocctlState == ADHOCCTL_STATE_CONNECTED) || (adhocctlState == ADHOCCTL_STATE_GAMEMODE)) { // TODO: Need to test this on games that doesn't use Adhocctl Handler too (not sure if there are games like that tho) @@ -2771,12 +2770,11 @@ int NetAdhocctl_Create(const char* groupName) { isAdhocctlNeedLogin = true; // Set Network Name - if (groupNameStruct != NULL) - parameter.group_name = *groupNameStruct; - - // Reset Network Name - else + if (groupName) { + truncate_cpy((char *)parameter.group_name.data, sizeof(parameter.group_name.data), groupName); + } else { memset(¶meter.group_name, 0, sizeof(parameter.group_name)); + } // Set HUD Connection Status //setConnectionStatus(1); @@ -2841,7 +2839,7 @@ int sceNetAdhocctlCreate(const char *groupName) { int sceNetAdhocctlConnect(const char* groupName) { char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; if (groupName) - memcpy(grpName, groupName, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated + strncpy(grpName, groupName, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated INFO_LOG(Log::sceNet, "sceNetAdhocctlConnect(%s) at %08x", grpName, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; diff --git a/Core/HLE/sceNetInet.cpp b/Core/HLE/sceNetInet.cpp index c89c95f7c0..0b45635f4a 100644 --- a/Core/HLE/sceNetInet.cpp +++ b/Core/HLE/sceNetInet.cpp @@ -592,7 +592,7 @@ int sceNetInetPoll(void *fds, u32 nfds, int timeout) { // timeout in miliseconds } static int sceNetInetSelect(int maxfd, u32 readFdsPtr, u32 writeFdsPtr, u32 exceptFdsPtr, u32 timeoutPtr) { - WARN_LOG_ONCE(sceNetInetSelect, Log::sceNet, "UNTESTED sceNetInetSelect(%i, %08x, %08x, %08x, %08x)", maxfd, readFdsPtr, writeFdsPtr, exceptFdsPtr, timeoutPtr); + DEBUG_LOG(Log::sceNet, "sceNetInetSelect(%i, %08x, %08x, %08x, %08x)", maxfd, readFdsPtr, writeFdsPtr, exceptFdsPtr, timeoutPtr); const auto sceNetInet = SceNetInet::Get(); if (!sceNetInet) { return hleLogError(Log::sceNet, ERROR_NET_INET_CONFIG_INVALID_ARG, "Inet Subsystem Not Running - Use sceNetInetInit"); @@ -627,7 +627,7 @@ static int sceNetInetSelect(int maxfd, u32 readFdsPtr, u32 writeFdsPtr, u32 exce ERROR_LOG(Log::sceNet, "%s: Received error from select() %i: %s", __func__, error, strerror(error)); } - INFO_LOG(Log::sceNet, "%s: select() returned %i", __func__, ret); + DEBUG_LOG(Log::sceNet, "%s: select() returned %i", __func__, ret); return hleDelayResult(ret, "TODO: unhack", 500); }