Merge pull request #5879 from clienthax/ps3res

[PS3] Partial fix of networking
This commit is contained in:
Twinaphex 2017-12-10 00:00:03 +01:00 committed by GitHub
commit 7654e8e268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,6 +193,12 @@ int getaddrinfo_retro(const char *node, const char *service,
in_addr->sin_family = AF_INET;
in_addr->sin_port = inet_htons(strtoul(service, NULL, 0));
//sin_port seems to be the wrong endian for ps3
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
in_addr->sin_port = (in_addr->sin_port>>8) | (in_addr->sin_port<<8);
#endif
if (!node && (hints->ai_flags & AI_PASSIVE))
in_addr->sin_addr.s_addr = INADDR_ANY;
else if (node && isdigit(*node))
@ -204,7 +210,8 @@ int getaddrinfo_retro(const char *node, const char *service,
if (!host || !host->h_addr_list[0])
goto error;
in_addr->sin_addr.s_addr = inet_addr(host->h_addr_list[0]);
in_addr->sin_family = host->h_addrtype;
memcpy(&in_addr->sin_addr, host->h_addr, host->h_length);
}
else
goto error;