Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add definitions to vita #17

Open
wants to merge 2 commits into
base: moonlight
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
#define HAS_GETNAMEINFO 1
#endif
#elif defined(__vita__)
#ifdef HAS_POLL
#undef HAS_POLL
#ifndef HAS_POLL
#define HAS_POLL
#endif
#ifdef HAS_FCNTL
#undef HAS_FCNTL
#ifndef HAS_FCNTL
#define HAS_FCNTL
#endif
#ifdef HAS_IOCTL
#undef HAS_IOCTL
Expand All @@ -72,8 +72,8 @@
#ifndef HAS_INET_NTOP
#define HAS_INET_NTOP 1
#endif
#ifdef HAS_MSGHDR_FLAGS
#undef HAS_MSGHDR_FLAGS
#ifndef HAS_MSGHDR_FLAGS
#define HAS_MSGHDR_FLAGS 1
#endif
#ifndef HAS_SOCKLEN_T
#define HAS_SOCKLEN_T 1
Expand Down Expand Up @@ -156,6 +156,7 @@
#endif
#endif


#ifdef HAS_FCNTL
#include <fcntl.h>
#endif
Expand Down Expand Up @@ -750,9 +751,13 @@ enet_socket_receive (ENetSocket socket,

// Retrieve the local address that this traffic was received on
// to ensure we respond from the correct address/interface.

if (localAddress != NULL) {
#ifndef __vita__
for (struct cmsghdr *chdr = CMSG_FIRSTHDR(&msgHdr); chdr != NULL; chdr = CMSG_NXTHDR(&msgHdr, chdr)) {
#endif
#ifdef IP_PKTINFO

if (chdr->cmsg_level == IPPROTO_IP && chdr->cmsg_type == IP_PKTINFO) {
struct sockaddr_in *localAddr = (struct sockaddr_in*)&localAddress->address;

Expand All @@ -773,8 +778,9 @@ enet_socket_receive (ENetSocket socket,
localAddress->addressLength = sizeof(*localAddr);
break;
}
#endif

}
#endif
}

if (peerAddress != NULL) {
Expand Down