1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 20:25:47 +00:00

Merge pull request #5985 from meepingsnesroms/master

Basic networking for 3DS, bug fixes
This commit is contained in:
Twinaphex 2017-12-29 06:56:45 +01:00 committed by GitHub
commit ba8b5749ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 4 deletions

View File

@ -46,6 +46,9 @@ ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DHAVE_SOCKET_LEGACY
#-DHAVE_SSL -DMBEDTLS_SSL_DEBUG_ALL
#ssl is currently incompatible with griffin due to use of the "static" flag on repeating functions that will conflict when included in one file
else
HAVE_CC_RESAMPLER = 1
HAVE_MENU_COMMON = 1
@ -63,6 +66,10 @@ else
HAVE_XMB = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
HAVE_SOCKET_LEGACY = 1
HAVE_SSL = 1
include Makefile.common
BLACKLIST :=

View File

@ -264,7 +264,7 @@ static bool menu_show_help = true;
static bool menu_show_quit_retroarch = true;
static bool menu_show_reboot = true;
#if defined(HAVE_LAKKA) || defined(VITA)
#if defined(HAVE_LAKKA) || defined(VITA) || defined(_3DS)
static bool menu_show_core_updater = false;
#else
static bool menu_show_core_updater = true;

View File

@ -160,7 +160,7 @@ ACHIEVEMENTS
/*============================================================
MD5
============================================================ */
#if (defined(HAVE_CHEEVOS) && defined(HAVE_THREADS)) || (defined(HAVE_HTTPSERVER) && defined(HAVE_ZLIB))
#if defined(HAVE_CHEEVOS) || (defined(HAVE_HTTPSERVER) && defined(HAVE_ZLIB))
#include "../libretro-common/utils/md5.c"
#endif

View File

@ -87,6 +87,7 @@
#if defined(_3DS)
#include <3ds/svc.h>
#include <3ds/os.h>
#include <3ds/services/cfgu.h>
#endif
/* iOS/OSX specific. Lacks clock_gettime(), so implement it. */
@ -481,7 +482,25 @@ unsigned cpu_features_get_core_amount(void)
#elif defined(VITA)
return 4;
#elif defined(_3DS)
return 1;
u8 device_model = 0xFF;
CFGU_GetSystemModel(&device_model);/*(0 = O3DS, 1 = O3DSXL, 2 = N3DS, 3 = 2DS, 4 = N3DSXL, 5 = N2DSXL)*/
switch (device_model)
{
case 0:
case 1:
case 3:
/*Old 3/2DS*/
return 2;
case 2:
case 5:
/*New 3/2DS*/
return 4;
default:
/*Unknown Device Or Check Failed*/
return 1;
}
#elif defined(WIIU)
return 3;
#elif defined(_SC_NPROCESSORS_ONLN)

View File

@ -142,6 +142,13 @@ struct hostent *gethostbyname(const char *name)
}
int retro_epoll_fd;
#elif defined(_3DS)
#include <malloc.h>
#include <3ds/types.h>
#include <3ds/services/soc.h>
#define SOC_ALIGN 0x1000
#define SOC_BUFFERSIZE 0x100000
static u32* _net_compat_net_memory;
#elif defined(_WIN32)
int inet_aton(const char *cp, struct in_addr *inp)
{
@ -310,6 +317,15 @@ bool network_init(void)
return false;
#elif defined(WIIU)
socket_lib_init();
#elif defined(_3DS)
_net_compat_net_memory = (u32*)memalign(SOC_ALIGN, SOC_BUFFERSIZE);
if (_net_compat_net_memory == NULL)
return false;
//RARCH_LOG("Wifi Buffer at: [0x%08X]\n", (u32)_net_compat_net_memory);
Result ret = socInit(_net_compat_net_memory, SOC_BUFFERSIZE);//WIFI init
if (ret != 0)
return false;
//RARCH_LOG("Socket Status: [0x%08X]\n", (uint32_t)ret);
#else
signal(SIGPIPE, SIG_IGN); /* Do not like SIGPIPE killing our app. */
#endif
@ -342,6 +358,14 @@ void network_deinit(void)
}
#elif defined(GEKKO) && !defined(HW_DOL)
net_deinit();
#elif defined(_3DS)
socExit();
if(_net_compat_net_memory)
{
free(_net_compat_net_memory);
_net_compat_net_memory = NULL;
}
#endif
}

View File

@ -236,7 +236,7 @@ int socket_connect(int fd, void *data, bool timeout_enable)
{
struct addrinfo *addr = (struct addrinfo*)data;
#if !defined(_WIN32) && !defined(VITA) && !defined(WIIU)
#if !defined(_WIN32) && !defined(VITA) && !defined(WIIU) && !defined(_3DS)
if (timeout_enable)
{
struct timeval timeout;