[PS3] Partial fix of networking

This commit is contained in:
clienthax 2017-12-07 22:20:02 +00:00
parent d6daf2f573
commit a565ba0149

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;