(Vita) Update net and netlogger

This commit is contained in:
Sergi Granell 2015-08-30 16:12:45 +02:00
parent cd781ff4b5
commit 7e86e2158d
2 changed files with 24 additions and 5 deletions

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
@ -51,6 +51,16 @@
#include <network.h>
#elif defined(VITA)
#include <psp2/net/net.h>
#include <psp2/net/netctl.h>
#define sockaddr_in SceNetSockaddrIn
#define sockaddr SceNetSockaddr
#define sendto sceNetSendto
#define MSG_DONTWAIT PSP2_NET_MSG_DONTWAIT
#else
#include <sys/select.h>
#include <sys/types.h>
@ -112,7 +122,7 @@ static INLINE bool isagain(int bytes)
#ifdef _XBOX
#define socklen_t int
#ifndef h_addr
#ifndef h_addr
#define h_addr h_addr_list[0] /* for backward compatibility */
#endif

View File

@ -44,11 +44,20 @@ static char sendbuf[4096];
static int network_interface_up(struct sockaddr_in *target, int index,
const char *ip_address, unsigned udp_port, int *s)
{
int ret = 0;
(void)index;
#if defined(VITA)
*s = sceNetSocket("RA_netlogger", PSP2_NET_AF_INET, PSP2_NET_SOCK_DGRAM, 0);
target->sin_family = PSP2_NET_AF_INET;
target->sin_port = sceNetHtons(udp_port);
target->sin_len = 8;
sceNetInetPton(PSP2_NET_AF_INET, ip_address, &target->sin_addr);
#else
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
int ret = 0;
int state, timeout_count = 10;
ret = cellNetCtlInit();
if (ret < 0)
@ -85,7 +94,7 @@ static int network_interface_up(struct sockaddr_in *target, int index,
#endif
inet_pton(AF_INET, ip_address, &target->sin_addr);
#endif
return 0;
}