mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-21 15:40:31 +00:00
Add vita environment (#22)
* vita: initial port * vita: implement events, enable input thread * vita: gethostbyname * vita: Enable audio * vita: Fix thread crash on discoonect process * vita: Handle cannot create thread * vita: now use newlib's socket apis * vita: Refactoring for moonlight-stream/moonlight-common-c * Fix review things https://github.com/moonlight-stream/moonlight-common-c/pull/22#pullrequestreview-2436093 - vita may not support IPv6; so add LC_ASSERT them. - define inet_ntop to sceNetInetNtop - guard about failure of sceKernelCreateMutex or sceKernelCreateCond - remove meanless macros https://github.com/moonlight-stream/moonlight-common-c/pull/22#pullrequestreview-2444677 - !*mutex to *mutex - remove useless LC_ASSERT then change to use inet_ntop in vita system not defined `sockaddr_in6`, so just use `sockaddr_in` instead this. https://github.com/moonlight-stream/moonlight-common-c/pull/22#pullrequestreview-2445642 - define sin6_addr
This commit is contained in:
committed by
Cameron Gutman
parent
293c6a7274
commit
ba27e97698
@@ -153,6 +153,7 @@ static void ClInternalConnectionTerminated(long errorCode)
|
||||
|
||||
static int resolveHostName(const char* host)
|
||||
{
|
||||
#ifndef __vita__
|
||||
struct addrinfo hints, *res;
|
||||
int err;
|
||||
|
||||
@@ -187,6 +188,21 @@ static int resolveHostName(const char* host)
|
||||
|
||||
freeaddrinfo(res);
|
||||
return 0;
|
||||
#else
|
||||
struct hostent *phost = gethostbyname(host);
|
||||
if (!phost) {
|
||||
Limelog("gethostbyname() failed for host %s\n", host);
|
||||
return -1;
|
||||
}
|
||||
struct sockaddr_in tmp = {0};
|
||||
tmp.sin_len = sizeof(tmp);
|
||||
tmp.sin_family = SCE_NET_AF_INET;
|
||||
memcpy(&tmp.sin_addr, phost->h_addr, phost->h_length);
|
||||
|
||||
memcpy(&RemoteAddr, &tmp, sizeof(tmp));
|
||||
RemoteAddrLen = sizeof(tmp);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Starts the connection to the streaming machine
|
||||
@@ -345,4 +361,4 @@ int LiStartConnection(const char* host, PSTREAM_CONFIGURATION streamConfig, PCON
|
||||
|
||||
Cleanup:
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user