Skip to content

Commit

Permalink
Several fixes and improvements do NGC and Wii (#13698)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
phcoder committed Mar 4, 2022
1 parent 35312fe commit 4a53c67
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 276 deletions.
9 changes: 8 additions & 1 deletion Makefile.griffin
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
145 changes: 20 additions & 125 deletions Makefile.ngc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4a53c67

Please sign in to comment.