diff --git a/libretro-common/net/net_compat.c b/libretro-common/net/net_compat.c index d9de1d8ceb..13fdbfff87 100644 --- a/libretro-common/net/net_compat.c +++ b/libretro-common/net/net_compat.c @@ -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;