From e29b915536f0d8e4fca5b4691582b7bfabf1a0be Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 2 May 2016 00:18:39 +0200 Subject: [PATCH] Cleanups --- libretro-common/net/net_compat.c | 18 +++++++----------- netlogger.c | 9 ++------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/libretro-common/net/net_compat.c b/libretro-common/net/net_compat.c index 078d1d6589..15f9385f5c 100644 --- a/libretro-common/net/net_compat.c +++ b/libretro-common/net/net_compat.c @@ -188,28 +188,21 @@ bool network_init(void) sys_net_initialize_network(); #elif defined(VITA) SceNetInitParam initparam; - /* Init Net */ + if (sceNetShowNetstat() == PSP2_NET_ERROR_ENOTINIT) { _net_compat_net_memory = malloc(COMPAT_NET_INIT_SIZE); - initparam.memory = _net_compat_net_memory; - initparam.size = COMPAT_NET_INIT_SIZE; - initparam.flags = 0; + initparam.memory = _net_compat_net_memory; + initparam.size = COMPAT_NET_INIT_SIZE; + initparam.flags = 0; sceNetInit(&initparam); - //printf("sceNetInit(): 0x%08X\n", ret); - /* Init NetCtl */ sceNetCtlInit(); } - else - { - //printf("Net is already initialized.\n"); - } retro_epoll_fd = sceNetEpollCreate("epoll", 0); - //printf("Epoll %x\n",retro_epoll_fd); #else signal(SIGPIPE, SIG_IGN); /* Do not like SIGPIPE killing our app. */ #endif @@ -228,6 +221,7 @@ void network_deinit(void) #if defined(_WIN32) WSACleanup(); #elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) + cellNetCtlTerm(); sys_net_finalize_network(); cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); #elif defined(VITA) @@ -239,5 +233,7 @@ void network_deinit(void) free(_net_compat_net_memory); _net_compat_net_memory = NULL; } +#elif defined(GEKKO) && !defined(HW_DOL) + net_deinit(); #endif } diff --git a/netlogger.c b/netlogger.c index 3ac05fdd87..61b387b30d 100644 --- a/netlogger.c +++ b/netlogger.c @@ -65,8 +65,7 @@ static int network_interface_up(struct sockaddr_in *target, int index, *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); - - sceNetInetPton(PSP2_NET_AF_INET, ip_address, &target->sin_addr); + target->sin_addr = inet_aton(ip_address); #else #if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) @@ -116,11 +115,7 @@ static int network_interface_down(struct sockaddr_in *target, int *s) { int ret = socket_close(*s); -#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) - cellNetCtlTerm(); -#elif defined(GEKKO) && !defined(HW_DOL) - net_deinit(); -#endif + network_deinit(); if (net_memory) free(net_memory);