(netlogger.c) Start using net_socket

This commit is contained in:
twinaphex 2016-05-02 00:05:33 +02:00
parent c2d6ecdc86
commit 3adbbc0bde
3 changed files with 14 additions and 16 deletions

View File

@ -37,7 +37,9 @@ PPU_SRCS = frontend/frontend_salamander.c \
ifeq ($(HAVE_LOGGER), 1) ifeq ($(HAVE_LOGGER), 1)
PPU_CFLAGS += -DHAVE_LOGGER PPU_CFLAGS += -DHAVE_LOGGER
PPU_SRCS += netlogger.c PPU_SRCS += netlogger.c \
libretro-common/net/net_compat.c \
libretro-common/net/net_socket.c
endif endif
PPU_TARGET = retroarch-salamander_ps3.elf PPU_TARGET = retroarch-salamander_ps3.elf

View File

@ -60,7 +60,9 @@ OBJ = frontend/frontend_salamander.o \
ifeq ($(HAVE_LOGGER), 1) ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DHAVE_LOGGER CFLAGS += -DHAVE_LOGGER
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
OBJ += logger/netlogger.o OBJ += logger/netlogger.o \
libretro-common/net/net_compat.o \
libretro-common/net/net_socket.o
endif endif
ifeq ($(HAVE_FILE_LOGGER), 1) ifeq ($(HAVE_FILE_LOGGER), 1)

View File

@ -25,6 +25,7 @@
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <net/net_compat.h> #include <net/net_compat.h>
#include <net/net_socket.h>
#include "verbosity.h" #include "verbosity.h"
@ -40,9 +41,9 @@ static int g_sid;
static struct sockaddr_in target; static struct sockaddr_in target;
static char sendbuf[4096]; static char sendbuf[4096];
#ifdef VITA #ifdef VITA
static void *net_memory = NULL;
#define NET_INIT_SIZE 512*1024 #define NET_INIT_SIZE 512*1024
#endif #endif
static void *net_memory = NULL;
static int network_interface_up(struct sockaddr_in *target, int index, static int network_interface_up(struct sockaddr_in *target, int index,
const char *ip_address, unsigned udp_port, int *s) const char *ip_address, unsigned udp_port, int *s)
@ -113,24 +114,17 @@ static int network_interface_up(struct sockaddr_in *target, int index,
static int network_interface_down(struct sockaddr_in *target, int *s) static int network_interface_down(struct sockaddr_in *target, int *s)
{ {
int ret = 0; int ret = socket_close(*s);
#if defined(_WIN32) && !defined(_XBOX360)
/* WinSock has headers from the stone age. */
ret = closesocket(*s);
#elif defined(__CELLOS_LV2__)
ret = socketclose(*s);
#elif defined(VITA)
if (net_memory)
free(net_memory);
sceNetSocketClose(*s);
#else
ret = close(*s);
#endif
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) #if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
cellNetCtlTerm(); cellNetCtlTerm();
#elif defined(GEKKO) && !defined(HW_DOL) #elif defined(GEKKO) && !defined(HW_DOL)
net_deinit(); net_deinit();
#endif #endif
if (net_memory)
free(net_memory);
return ret; return ret;
} }