Several fixes and improvements do NGC and Wii (#13698)

* Support new elf2dol path in Makefile.griffin

* Fix NULL pointer dereference when no core info is available

* Fix double include of different versions of libogc

* Move ngc and wii to Makefile.common

Resulting binary is 60K *smaller*. This is surprising but probably due to
less inlining happening

* gx_gfx: Fix hang on gfx initialization

* Remove sthread_isself on NGC/Wii

It relies on pthread_equal that is not there for either legacy pthreads
or normal pthreads on those platforms

* Wii networking

* Missing includes in split

* Network fixes

* Fix logging of non-format string as a format

* Support for gx netlogger

* Network fix

* Network fixes

* Network info

* gx: Move config files to app directory

Otherwise it clashes between wiiU and vWii version with unpredictable
effects
This commit is contained in:
Vladimir Serbinenko 2022-03-04 13:43:00 +01:00 committed by GitHub
parent 35312feab6
commit 4a53c6771c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 170 additions and 276 deletions

View File

@ -121,14 +121,20 @@ else ifeq ($(libogc_platform), 1)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
LD = $(DEVKITPPC)/bin/powerpc-eabi-ld$(EXE_EXT)
ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
# Check whether ELF2DOL executable exists
# (path has changed in more recent toolchains)
ifeq ("$(wildcard $(ELF2DOL))","")
ELF2DOL = $(DEVKITPRO)/tools/bin/elf2dol$(EXE_EXT)
endif
EXT_TARGET := $(TARGET_NAME)_$(platform).dol
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Iwii/libogc/include
INCLUDE += -I.
ifeq ($(EXTERNAL_LIBOGC), 1)
CFLAGS += -DEXTERNAL_LIBOGC
CXXFLAGS += -DEXTERNAL_LIBOGC
INCLUDE += -I$(DEVKITPRO)/libogc/include
ifeq ($(platform), ngc)
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/cube
@ -139,6 +145,7 @@ else ifeq ($(libogc_platform), 1)
else
CFLAGS += -DINTERNAL_LIBOGC
CXXFLAGS += -DINTERNAL_LIBOGC
INCLUDE += -Iwii/libogc/include
ifeq ($(platform), ngc)
LIBDIRS += -Lwii/libogc/libs/cube

View File

@ -63,16 +63,18 @@ ifeq ("$(wildcard $(ELF2DOL))","")
ELF2DOL = $(DEVKITPRO)/tools/bin/elf2dol$(EXE_EXT)
endif
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Iwii/libogc/include
INCLUDE += -I.
ifeq ($(EXTERNAL_LIBOGC), 1)
CFLAGS += -DEXTERNAL_LIBOGC
CXXFLAGS += -DEXTERNAL_LIBOGC
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/cube
INCLUDE += -I$(DEVKITPRO)/libogc/include
else
CFLAGS += -DINTERNAL_LIBOGC
CXXFLAGS += -DINTERNAL_LIBOGC
LIBDIRS += -Lwii/libogc/libs/cube
INCLUDE += -Iwii/libogc/include
endif
ifeq ($(GX_PTHREAD_LEGACY), 1)
@ -127,18 +129,31 @@ HAVE_RWAV := 1
RARCH_CONSOLE = 1
HAVE_CHEATS := 1
HAVE_CORE_INFO_CACHE := 1
HAVE_MENU_COMMON := 1
HAVE_MENU := 1
HAVE_BUILTINZLIB := 1
HAVE_STATIC_AUDIO_FILTERS := 1
HAVE_STATIC_VIDEO_FILTERS := 1
HAVE_XMB := 0
HAVE_OZONE := 0
HAVE_RGUI := 1
HAVE_MATERIALUI := 0
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(PLATCFLAGS) $(INCLUDE)
INCLUDE += -I./libretro-common/include \
-Ideps \
-Ideps/stb
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(PLATCFLAGS) $(INCLUDE)
OBJ = griffin/griffin.o $(PLATOBJS)
OBJ = $(PLATOBJS) audio/drivers/gx_audio.o gfx/drivers/gx_gfx.o input/drivers/gx_input.o frontend/drivers/platform_gx.o input/drivers_joypad/gx_joypad.o
ifeq ($(HAVE_GRIFFIN_CPP), 1)
OBJ += griffin/griffin_cpp.o
ifeq ($(EXTERNAL_LIBOGC), 0)
OBJ += wii/libogc/libfat/libfat.o wii/libogc/libfat/fatfile.o wii/libogc/libfat/file_allocation_table.o wii/libogc/libfat/cache.o wii/libogc/libfat/fatdir.o wii/libogc/libfat/partition.o wii/libogc/libfat/directory.o wii/libogc/libfat/filetime.o wii/libogc/libfat/disc.o
endif
include Makefile.common
CFLAGS += $(DEFINES)
ifeq ($(WANT_GLSLANG), 1)
OBJ += griffin/griffin_glslang.o
endif
@ -156,18 +171,10 @@ ifeq ($(HAVE_WIIUSB_HID), 1)
CFLAGS += -DHAVE_WIIUSB_HID -DHAVE_HID
endif
ifeq ($(HAVE_LIBRETRODB), 1)
CFLAGS += -DHAVE_LIBRETRODB
endif
ifeq ($(BIG_STACK),1)
CFLAGS += -DBIG_STACK
endif
ifeq ($(HAVE_RJPEG), 1)
CFLAGS += -DHAVE_RJPEG
endif
ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
endif
@ -181,66 +188,10 @@ ifeq ($(HAVE_ZLIB), 1)
CFLAGS += -I./libretro-common/include/compat/zlib
endif
ifeq ($(HAVE_RPNG), 1)
CFLAGS += -DHAVE_RPNG
endif
ifeq ($(HAVE_RBMP), 1)
CFLAGS += -DHAVE_RBMP
endif
ifeq ($(HAVE_RTGA), 1)
CFLAGS += -DHAVE_RTGA
endif
ifeq ($(HAVE_IMAGEVIEWER), 1)
CFLAGS += -DHAVE_IMAGEVIEWER
endif
ifeq ($(HAVE_BSV_MOVIE), 1)
CFLAGS += -DHAVE_BSV_MOVIE
endif
ifeq ($(HAVE_RUNAHEAD), 1)
CFLAGS += -DHAVE_RUNAHEAD
endif
ifeq ($(HAVE_7ZIP), 1)
CFLAGS += -DHAVE_7ZIP -D_7ZIP_ST
endif
ifeq ($(HAVE_SCREENSHOTS), 1)
CFLAGS += -DHAVE_SCREENSHOTS
endif
ifeq ($(HAVE_REWIND), 1)
CFLAGS += -DHAVE_REWIND
endif
ifeq ($(HAVE_AUDIOMIXER), 1)
CFLAGS += -DHAVE_AUDIOMIXER
endif
ifeq ($(HAVE_RWAV), 1)
CFLAGS += -DHAVE_RWAV
endif
ifeq ($(HAVE_OVERLAY), 1)
CFLAGS += -DHAVE_OVERLAY
endif
ifeq ($(HAVE_VIDEO_LAYOUT), 1)
CFLAGS += -DHAVE_VIDEO_LAYOUT
endif
ifeq ($(HAVE_NETWORKING), 1)
CFLAGS += -DHAVE_NETWORKING
endif
ifeq ($(HAVE_NETPLAYDISCOVERY), 1)
CFLAGS += -DHAVE_NETPLAYDISCOVERY
endif
ifeq ($(RARCH_CONSOLE), 1)
CFLAGS += -DRARCH_CONSOLE
endif
@ -251,50 +202,10 @@ endif
CFLAGS += -std=gnu99 -DHAVE_RGUI -DHAVE_MENU -DHAVE_GRIFFIN=1 -Wno-char-subscripts -DRARCH_INTERNAL
ifeq ($(HAVE_MATERIALUI), 1)
CFLAGS += -DHAVE_MATERIALUI
endif
ifeq ($(HAVE_XMB), 1)
CFLAGS += -DHAVE_XMB
endif
ifeq ($(HAVE_STB_FONT), 1)
CFLAGS += -DHAVE_STB_FONT
endif
ifeq ($(HAVE_LANGEXTRA), 1)
CFLAGS += -DHAVE_LANGEXTRA
endif
ifeq ($(HAVE_DSP_FILTER), 1)
CFLAGS += -DHAVE_DSP_FILTER
endif
ifeq ($(HAVE_VIDEO_FILTER), 1)
CFLAGS += -DHAVE_VIDEO_FILTER
endif
ifeq ($(HAVE_FILTERS_BUILTIN), 1)
CFLAGS += -DHAVE_FILTERS_BUILTIN
endif
ifeq ($(HAVE_THREADS), 1)
CFLAGS += -DHAVE_THREADS
endif
ifeq ($(HAVE_CONFIGFILE), 1)
CFLAGS += -DHAVE_CONFIGFILE
endif
ifeq ($(HAVE_PATCH), 1)
CFLAGS += -DHAVE_PATCH
endif
ifeq ($(HAVE_CHEATS), 1)
CFLAGS += -DHAVE_CHEATS
endif
ifeq ($(HAVE_RSOUND), 1)
CFLAGS += -DHAVE_RSOUND
endif
@ -303,30 +214,14 @@ ifeq ($(HAVE_GETOPT_LONG), 1)
CFLAGS += -DHAVE_GETOPT_LONG=1
endif
ifeq ($(HAVE_DYLIB), 1)
CFLAGS += -DHAVE_DYLIB
endif
ifeq ($(HAVE_NETWORK_CMD), 1)
CFLAGS += -DHAVE_NETWORK_CMD
endif
ifeq ($(HAVE_COMMAND), 1)
CFLAGS += -DHAVE_COMMAND
endif
ifeq ($(HAVE_STDIN_CMD), 1)
CFLAGS += -DHAVE_STDIN_CMD
endif
ifeq ($(HAVE_DYNAMIC), 1)
CFLAGS += -DHAVE_DYNAMIC
endif
ifeq ($(HAVE_CORE_INFO_CACHE), 1)
CFLAGS += -DHAVE_CORE_INFO_CACHE
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g -DDEBUG
else

View File

@ -6,6 +6,7 @@ HAVE_FILE_LOGGER = 0
HAVE_CC_RESAMPLER = 1
WHOLE_ARCHIVE_LINK = 0
BIG_STACK = 1
HAVE_NETWORKING = 1
PC_DEVELOPMENT_IP_ADDRESS = 255.255.255.255
PC_DEVELOPMENT_UDP_PORT = 3490
RARCH_CONSOLE = 0
@ -63,16 +64,18 @@ ifeq ("$(wildcard $(ELF2DOL))","")
ELF2DOL = $(DEVKITPRO)/tools/bin/elf2dol$(EXE_EXT)
endif
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Iwii/libogc/include
INCLUDE += -I.
ifeq ($(EXTERNAL_LIBOGC), 1)
CFLAGS += -DEXTERNAL_LIBOGC
CXXFLAGS += -DEXTERNAL_LIBOGC
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/wii
INCLUDE += -I$(DEVKITPRO)/libogc/include
else
CFLAGS += -DINTERNAL_LIBOGC
CXXFLAGS += -DINTERNAL_LIBOGC
LIBDIRS += -Lwii/libogc/libs/wii
INCLUDE += -Iwii/libogc/include
endif
ifeq ($(GX_PTHREAD_LEGACY), 1)
@ -100,6 +103,10 @@ LIBS += -lwiiuse -lbte
ifeq ($(USBGECKO), 1)
LIBS += -ldb
endif
ifeq ($(HAVE_LOGGER), 1)
LIBS += -lbba
endif
LIBS += -logc
@ -127,12 +134,25 @@ HAVE_REWIND := 1
HAVE_AUDIOMIXER := 1
HAVE_RWAV := 1
RARCH_CONSOLE = 1
HAVE_CHEATS := 1
HAVE_CORE_INFO_CACHE := 1
HAVE_MENU_COMMON := 1
HAVE_MENU := 1
HAVE_BUILTINZLIB := 1
HAVE_STATIC_AUDIO_FILTERS := 1
HAVE_STATIC_VIDEO_FILTERS := 1
#HAVE_LANGEXTRA := 1
HAVE_WIIUSB_HID := 1
HAVE_HID := 1
HAVE_RARCH_EXEC := 1
HAVE_CORE_INFO_CACHE := 1
HAVE_RSOUND := 0
HAVE_XMB := 0
HAVE_OZONE := 0
HAVE_RGUI := 1
HAVE_MATERIALUI := 0
CFLAGS += -DHAVE_SOCKET_LEGACY
APP_BOOTER_DIR = wii/app_booter
PLATOBJS := $(APP_BOOTER_DIR)/app_booter.binobj
@ -141,19 +161,23 @@ ifeq ($(USBGECKO), 1)
CFLAGS += -DUSBGECKO
endif
HAVE_CHEATS := 1
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(PLATCFLAGS) $(INCLUDE)
INCLUDE += -I./libretro-common/include \
-Ideps \
-Ideps/stb
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(PLATCFLAGS) $(INCLUDE)
OBJ = griffin/griffin.o $(PLATOBJS)
OBJ = $(PLATOBJS) audio/drivers/gx_audio.o gfx/drivers/gx_gfx.o input/drivers/gx_input.o frontend/drivers/platform_gx.o input/drivers_joypad/gx_joypad.o memory/wii/mem2_manager.o gfx/drivers/gx_gfx_vi_encoder.o frontend/drivers/platform_wii.o input/drivers_hid/wiiusb_hid.o
ifeq ($(HAVE_GRIFFIN_CPP), 1)
OBJ += griffin/griffin_cpp.o
ifeq ($(EXTERNAL_LIBOGC), 0)
OBJ += wii/libogc/libfat/libfat.o wii/libogc/libfat/fatfile.o wii/libogc/libfat/file_allocation_table.o wii/libogc/libfat/cache.o wii/libogc/libfat/fatdir.o wii/libogc/libfat/partition.o wii/libogc/libfat/directory.o wii/libogc/libfat/filetime.o wii/libogc/libfat/disc.o
endif
include Makefile.common
CFLAGS += $(DEFINES) -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" \
-DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) \
ifeq ($(WANT_GLSLANG), 1)
OBJ += griffin/griffin_glslang.o
endif
@ -163,28 +187,18 @@ ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
endif
CFLAGS += -DHAVE_SOCKET_LEGACY
ifeq ($(HAVE_KERNEL_PRX), 1)
CFLAGS += -DHAVE_KERNEL_PRX
endif
ifeq ($(HAVE_WIIUSB_HID), 1)
CFLAGS += -DHAVE_WIIUSB_HID -DHAVE_HID
endif
ifeq ($(HAVE_LIBRETRODB), 1)
CFLAGS += -DHAVE_LIBRETRODB
CFLAGS += -DHAVE_WIIUSB_HID
endif
ifeq ($(BIG_STACK),1)
CFLAGS += -DBIG_STACK
endif
ifeq ($(HAVE_RJPEG), 1)
CFLAGS += -DHAVE_RJPEG
endif
ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
endif
@ -198,66 +212,10 @@ ifeq ($(HAVE_ZLIB), 1)
CFLAGS += -I./libretro-common/include/compat/zlib
endif
ifeq ($(HAVE_RPNG), 1)
CFLAGS += -DHAVE_RPNG
endif
ifeq ($(HAVE_RBMP), 1)
CFLAGS += -DHAVE_RBMP
endif
ifeq ($(HAVE_RTGA), 1)
CFLAGS += -DHAVE_RTGA
endif
ifeq ($(HAVE_IMAGEVIEWER), 1)
CFLAGS += -DHAVE_IMAGEVIEWER
endif
ifeq ($(HAVE_BSV_MOVIE), 1)
CFLAGS += -DHAVE_BSV_MOVIE
endif
ifeq ($(HAVE_RUNAHEAD), 1)
CFLAGS += -DHAVE_RUNAHEAD
endif
ifeq ($(HAVE_7ZIP), 1)
CFLAGS += -DHAVE_7ZIP -D_7ZIP_ST
endif
ifeq ($(HAVE_SCREENSHOTS), 1)
CFLAGS += -DHAVE_SCREENSHOTS
endif
ifeq ($(HAVE_REWIND), 1)
CFLAGS += -DHAVE_REWIND
endif
ifeq ($(HAVE_AUDIOMIXER), 1)
CFLAGS += -DHAVE_AUDIOMIXER
endif
ifeq ($(HAVE_RWAV), 1)
CFLAGS += -DHAVE_RWAV
endif
ifeq ($(HAVE_OVERLAY), 1)
CFLAGS += -DHAVE_OVERLAY
endif
ifeq ($(HAVE_VIDEO_LAYOUT), 1)
CFLAGS += -DHAVE_VIDEO_LAYOUT
endif
ifeq ($(HAVE_NETWORKING), 1)
CFLAGS += -DHAVE_NETWORKING
endif
ifeq ($(HAVE_NETPLAYDISCOVERY), 1)
CFLAGS += -DHAVE_NETPLAYDISCOVERY
endif
ifeq ($(RARCH_CONSOLE), 1)
CFLAGS += -DRARCH_CONSOLE
endif
@ -268,50 +226,10 @@ endif
CFLAGS += -std=gnu99 -DHAVE_RGUI -DHAVE_MENU -DHAVE_GRIFFIN=1 -Wno-char-subscripts -DRARCH_INTERNAL
ifeq ($(HAVE_MATERIALUI), 1)
CFLAGS += -DHAVE_MATERIALUI
endif
ifeq ($(HAVE_XMB), 1)
CFLAGS += -DHAVE_XMB
endif
ifeq ($(HAVE_STB_FONT), 1)
CFLAGS += -DHAVE_STB_FONT
endif
ifeq ($(HAVE_LANGEXTRA), 1)
CFLAGS += -DHAVE_LANGEXTRA
endif
ifeq ($(HAVE_DSP_FILTER), 1)
CFLAGS += -DHAVE_DSP_FILTER
endif
ifeq ($(HAVE_VIDEO_FILTER), 1)
CFLAGS += -DHAVE_VIDEO_FILTER
endif
ifeq ($(HAVE_FILTERS_BUILTIN), 1)
CFLAGS += -DHAVE_FILTERS_BUILTIN
endif
ifeq ($(HAVE_THREADS), 1)
CFLAGS += -DHAVE_THREADS
endif
ifeq ($(HAVE_CONFIGFILE), 1)
CFLAGS += -DHAVE_CONFIGFILE
endif
ifeq ($(HAVE_PATCH), 1)
CFLAGS += -DHAVE_PATCH
endif
ifeq ($(HAVE_CHEATS), 1)
CFLAGS += -DHAVE_CHEATS
endif
ifeq ($(HAVE_RSOUND), 1)
CFLAGS += -DHAVE_RSOUND
endif
@ -320,22 +238,10 @@ ifeq ($(HAVE_GETOPT_LONG), 1)
CFLAGS += -DHAVE_GETOPT_LONG=1
endif
ifeq ($(HAVE_DYLIB), 1)
CFLAGS += -DHAVE_DYLIB
endif
ifeq ($(HAVE_NETWORK_CMD), 1)
CFLAGS += -DHAVE_NETWORK_CMD
endif
ifeq ($(HAVE_COMMAND), 1)
CFLAGS += -DHAVE_COMMAND
endif
ifeq ($(HAVE_STDIN_CMD), 1)
CFLAGS += -DHAVE_STDIN_CMD
endif
ifeq ($(HAVE_DYNAMIC), 1)
CFLAGS += -DHAVE_DYNAMIC
endif

View File

@ -2512,7 +2512,12 @@ bool core_info_list_get_display_name(
core_info_list_t *core_info_list,
const char *core_path, char *s, size_t len)
{
core_info_t *info = core_info_find_internal(
core_info_t *info;
if (!core_info_list)
return false;
info = core_info_find_internal(
core_info_list, core_path);
if (s &&

View File

@ -29,6 +29,11 @@
#include "../../config.h"
#endif
#include <retroarch_types.h>
#include <msg_hash.h>
#include <command.h>
#include <verbosity.h>
#if defined(HW_RVL) && !defined(IS_SALAMANDER)
#include <rthreads/rthreads.h>
#include "../../memory/wii/mem2_manager.h"
@ -162,6 +167,9 @@ static void frontend_gx_get_env(
{
char *last_slash = NULL;
char *device_end = NULL;
#if defined(HAVE_LOGGER) && !defined(IS_SALAMANDER)
logger_init();
#endif
#ifndef IS_SALAMANDER
/* This situation can happen on some loaders so we really need some
@ -241,7 +249,7 @@ static void frontend_gx_get_env(
"cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
/* User paths */
fill_pathname_join(g_defaults.path_config, g_defaults.dirs[DEFAULT_DIR_PORT],
fill_pathname_join(g_defaults.path_config, g_defaults.dirs[DEFAULT_DIR_CORE],
"retroarch.cfg", sizeof(g_defaults.path_config));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM], g_defaults.dirs[DEFAULT_DIR_PORT],
"system", sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));

View File

@ -29,6 +29,7 @@
#include <file/file_path.h>
#include <retro_miscellaneous.h>
#include <paths.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"

View File

@ -22,6 +22,7 @@
#include <ogcsys.h>
#include <libretro.h>
#include <verbosity.h>
#include <streams/interface_stream.h>
#ifdef HAVE_CONFIG_H
@ -327,9 +328,16 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
g_draw_done = false;
/* wait for next even field */
/* this prevents screen artifacts when switching
* between interlaced & non-interlaced modes */
do VIDEO_WaitVSync();
while (!VIDEO_GetNextField());
* between interlaced & non-interlaced modes.
*
* But move on if it takes over 3 frames as sometimes under dolphin
* this stays at constant value.
*/
for (i = 0; i < 3; i++) {
VIDEO_WaitVSync();
if (VIDEO_GetNextField())
break;
}
VIDEO_SetBlack(true);
VIDEO_Flush();

View File

@ -33,7 +33,9 @@
#include <retro_timers.h>
#include <compat/strl.h>
#if defined(_XBOX)
#ifdef GEKKO
#define gethostbyname net_gethostbyname
#elif defined(_XBOX)
/* TODO - implement h_length and h_addrtype */
struct hostent
{
@ -283,6 +285,12 @@ static int wiiu_net_cmpt_thread_entry(int argc, const char** argv) {
}
#endif
#if defined(GEKKO)
static char localip[16] = {0};
static char gateway[16] = {0};
static char netmask[16] = {0};
#endif
/**
* network_init:
*
@ -346,8 +354,7 @@ bool network_init(void)
retro_epoll_fd = sceNetEpollCreate("epoll", 0);
#elif defined(GEKKO)
char t[16];
if (if_config(t, NULL, NULL, TRUE, 10) < 0)
if (if_config(localip, netmask, gateway, true, 10) < 0)
return false;
#elif defined(WIIU)
socket_lib_init();

View File

@ -34,6 +34,8 @@
#include <winsock2.h>
#include <iphlpapi.h>
#include <ws2tcpip.h>
#elif defined (GEKKO) && !defined(WIIU)
#include <network.h>
#else
#include <arpa/inet.h>
#include <sys/socket.h>
@ -77,7 +79,7 @@ void net_ifinfo_free(net_ifinfo_t *list)
free(list->entries);
}
#if defined(HAVE_LIBNX) || defined(_3DS)
#if defined(HAVE_LIBNX) || defined(_3DS) || defined(GEKKO)
static void convert_ip(char *dst, size_t size, uint32_t ip, bool inverted)
{
unsigned char bytes[4];
@ -96,9 +98,37 @@ static void convert_ip(char *dst, size_t size, uint32_t ip, bool inverted)
bool net_ifinfo_new(net_ifinfo_t *list)
{
unsigned k = 0;
#if defined(HAVE_LIBNX) || defined(_3DS)
#if defined(GEKKO)
char hostname[128];
memset(list, 0, sizeof(net_ifinfo_t));
/* loopback */
list->entries = (struct net_ifinfo_entry*)
malloc(2 * sizeof(struct net_ifinfo_entry));
if (!list->entries)
goto error;
list->entries[0].name = strdup("lo");
list->entries[0].host = strdup("127.0.0.1");
list->entries[1].name = strdup("gekko");
convert_ip(hostname, sizeof(hostname), net_gethostip(), false);
list->entries[1].host = strdup(hostname);
list->size = 2;
return true;
/*
actual interface
can be wlan or eth (with a wiiu adapter)
so we just use "switch" as a name
*/
#elif defined(HAVE_LIBNX) || defined(_3DS)
uint32_t id;
#ifdef HAVE_LIBNX
Result rc;
#endif
char hostname[128];
struct net_ifinfo_entry *ptr = NULL;
@ -127,7 +157,7 @@ bool net_ifinfo_new(net_ifinfo_t *list)
can be wlan or eth (with a wiiu adapter)
so we just use "switch" as a name
*/
#if defined(_3DS)
#if defined(_3DS) || defined (GEKKO)
convert_ip(hostname, sizeof(hostname), gethostid(), true);
#else
rc = nifmGetCurrentIpAddress(&id);
@ -253,7 +283,7 @@ error:
#ifdef _WIN32
if (adapter_addresses)
free(adapter_addresses);
#elif !defined(HAVE_LIBNX) && !defined(_3DS)
#elif !defined(HAVE_LIBNX) && !defined(_3DS) && !defined(GEKKO)
freeifaddrs(ifaddr);
#endif
net_ifinfo_free(list);

View File

@ -27,6 +27,10 @@
#include <compat/msvc.h>
#endif
#ifdef GEKKO
#include <network.h>
#endif
#include <net/net_compat.h>
#include <net/net_socket.h>
@ -132,6 +136,9 @@ bool socket_set_block(int fd, bool block)
#elif defined(_WIN32)
u_long mode = !block;
return ioctlsocket(fd, FIONBIO, &mode) == 0;
#elif defined(GEKKO)
u32 set = block;
return net_ioctl(fd, FIONBIO, &set) >= 0;
#else
return fcntl(fd, F_SETFL, (fcntl(fd, F_GETFL) & ~O_NONBLOCK) | (block ? 0 : O_NONBLOCK)) == 0;
#endif
@ -236,8 +243,13 @@ bool socket_bind(int fd, void *data)
{
int yes = 1;
struct addrinfo *res = (struct addrinfo*)data;
#ifdef GEKKO
net_setsockopt(fd, SOL_SOCKET,
SO_REUSEADDR, (const char*)&yes, sizeof(int));
#else
setsockopt(fd, SOL_SOCKET,
SO_REUSEADDR, (const char*)&yes, sizeof(int));
#endif
if (bind(fd, res->ai_addr, res->ai_addrlen) < 0)
return false;
return true;
@ -247,7 +259,7 @@ int socket_connect(int fd, void *data, bool timeout_enable)
{
struct addrinfo *addr = (struct addrinfo*)data;
#if !defined(_WIN32) && !defined(VITA) && !defined(WIIU) && !defined(_3DS)
#if !defined(_WIN32) && !defined(VITA) && !defined(WIIU) && !defined(_3DS) && !defined(GEKKO)
if (timeout_enable)
{
struct timeval timeout;
@ -257,6 +269,16 @@ int socket_connect(int fd, void *data, bool timeout_enable)
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof timeout);
}
#endif
#if defined(GEKKO) && !defined(WIIU)
if (timeout_enable)
{
struct timeval timeout;
timeout.tv_sec = 4;
timeout.tv_usec = 0;
net_setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof timeout);
}
#endif
#if defined(WIIU)
int op = 1;
setsockopt(fd, SOL_SOCKET, SO_WINSCALE, &op, sizeof(op));

View File

@ -183,6 +183,4 @@ static INLINE int pthread_cond_destroy(pthread_cond_t *cond)
return LWP_CondDestroy(*cond);
}
extern int pthread_equal(pthread_t t1, pthread_t t2);
#endif

View File

@ -298,6 +298,7 @@ void sthread_join(sthread_t *thread)
free(thread);
}
#if !defined(GEKKO)
/**
* sthread_isself:
* @thread : pointer to thread object
@ -316,6 +317,7 @@ bool sthread_isself(sthread_t *thread)
return pthread_equal(pthread_self(),thread->id);
#endif
}
#endif
/**
* slock_new:

View File

@ -3,6 +3,7 @@
#include <unistd.h>
#include <ogc/machine/asm.h>
#include <ogc/machine/processor.h>
#include <ogc/lwp_heap.h>
#include <ogc/system.h>

View File

@ -62,7 +62,7 @@
/* Required for the Wii build, since we have
* to query the hardware for the actual display
* aspect ratio... */
#include "../../wii/libogc/include/ogc/conf.h"
#include <ogc/conf.h>
#endif
#if defined(GEKKO)

View File

@ -133,7 +133,7 @@
#define BYTES_TO_GB(bytes) (((bytes) / 1024) / 1024 / 1024)
#ifdef HAVE_NETWORKING
#if !defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX))
#if !defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX)) || defined(GEKKO)
#include <net/net_ifinfo.h>
#endif
#endif
@ -3484,7 +3484,7 @@ static unsigned menu_displaylist_parse_information_list(file_list_t *info_list)
#endif
#ifdef HAVE_NETWORKING
#ifndef HAVE_SOCKET_LEGACY
#if !defined (HAVE_SOCKET_LEGACY) || defined(GEKKO)
if (menu_entries_append_enum(info_list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETWORK_INFORMATION),
msg_hash_to_str(MENU_ENUM_LABEL_NETWORK_INFORMATION),
@ -6426,7 +6426,7 @@ unsigned menu_displaylist_build_list(
{
core_info_list_t *info_list = NULL;
core_info_get_list(&info_list);
if (info_list->info_count > 0)
if (info_list && info_list->info_count > 0)
{
if (menu_entries_append_enum(list,
msg_hash_to_str(
@ -6738,7 +6738,7 @@ unsigned menu_displaylist_build_list(
count++;
break;
case DISPLAYLIST_NETWORK_INFO:
#if defined(HAVE_NETWORKING) && !defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX))
#if defined(HAVE_NETWORKING) && (!defined(HAVE_SOCKET_LEGACY) && (!defined(SWITCH) || defined(SWITCH) && defined(HAVE_LIBNX)) || defined(GEKKO))
network_init();
{
net_ifinfo_t netlist;

View File

@ -90,6 +90,10 @@
#define HAVE_INET6 1
#endif
#ifdef GEKKO
#define setsockopt net_setsockopt
#endif
#ifdef TCP_NODELAY
#define SET_TCP_NODELAY(fd) \
{ \

View File

@ -5239,7 +5239,7 @@ bool retroarch_main_init(int argc, char *argv[])
strlcat(str_output, "\n", sizeof(str_output));
}
RARCH_LOG_OUTPUT(str_output);
RARCH_LOG_OUTPUT("%s", str_output);
}
{
char str_output[256];
@ -5261,7 +5261,7 @@ bool retroarch_main_init(int argc, char *argv[])
msg_hash_to_str(MSG_CAPABILITIES),
str);
#endif
RARCH_LOG_OUTPUT(str_output);
RARCH_LOG_OUTPUT("%s", str_output);
}
}

View File

@ -1472,7 +1472,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
snprintf(s, sizeof(s), "[Environ]: GET_VARIABLE: %s = \"%s\"\n",
var->key, var->value ? var->value :
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
RARCH_LOG(s);
RARCH_LOG("%s", s);
}
}