diff --git a/Makefile.ctr b/Makefile.ctr index a300a04474..c7ef0cdaf8 100644 --- a/Makefile.ctr +++ b/Makefile.ctr @@ -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 := diff --git a/config.def.h b/config.def.h index 6fb3c5de4d..edf900917a 100644 --- a/config.def.h +++ b/config.def.h @@ -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; diff --git a/griffin/griffin.c b/griffin/griffin.c index 0862646f04..624b0b2613 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -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 diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index 0249cfe4e1..88861bf1c3 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -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) diff --git a/libretro-common/net/net_compat.c b/libretro-common/net/net_compat.c index 1d3ae1c5a9..a7155cc3a1 100644 --- a/libretro-common/net/net_compat.c +++ b/libretro-common/net/net_compat.c @@ -142,6 +142,13 @@ struct hostent *gethostbyname(const char *name) } int retro_epoll_fd; +#elif defined(_3DS) +#include +#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 } diff --git a/libretro-common/net/net_socket.c b/libretro-common/net/net_socket.c index 4b815990b7..0c960360bc 100644 --- a/libretro-common/net/net_socket.c +++ b/libretro-common/net/net_socket.c @@ -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;