From 6b24ca4632ebf79674719572cf9667d1df0b3f27 Mon Sep 17 00:00:00 2001 From: M4xw Date: Sat, 29 Sep 2018 19:25:45 +0200 Subject: [PATCH] [LIBNX] Add Static Dummy --- Makefile.libnx | 22 ++++++++++++++++------ cores/dynamic_dummy.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/Makefile.libnx b/Makefile.libnx index 739abd4788..e6b53a9c45 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -100,19 +100,24 @@ EXEFS_SRC := exefs_src #ROMFS := switch/romfs APP_TITLE := RetroArch -APP_VERSION := 1.0.0 +APP_VERSION := 1.7.5 APP_AUTHOR := libretro Team -NO_ICON := 1 +APP_ICON := pkg/libnx/retroarch.jpg #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd -CFLAGS := -g -Wall -O3 -ffast-math -ffunction-sections \ - $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h $(shell $(PORTLIBS)/bin/freetype-config --cflags) +CFLAGS := -g -Wall -O3 -ffast-math -ffunction-sections \ + $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h $(shell $(PORTLIBS)/bin/freetype-config --cflags) -CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DHAVE_FREETYPE +CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DHAVE_FREETYPE + +ifeq ($(strip $(HAVE_STATIC_DUMMY)),1) + HAVE_STATIC_DUMMY = 1 + CFLAGS += -DHAVE_STATIC_DUMMY=1 +endif # The following line works around an issue in newlib that produces a compilation # error in glm. It will be removed as soon as this issue is resolved. @@ -169,7 +174,12 @@ else endif #--------------------------------------------------------------------------------- -export OFILES := $(OBJ) libretro_libnx.a +export OFILES := $(OBJ) + +ifeq ($(strip $(HAVE_STATIC_DUMMY)),) + OFILES += libretro_libnx.a +endif + export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ diff --git a/cores/dynamic_dummy.c b/cores/dynamic_dummy.c index ad61faff97..21b8014a85 100644 --- a/cores/dynamic_dummy.c +++ b/cores/dynamic_dummy.c @@ -25,6 +25,34 @@ static uint16_t *dummy_frame_buf; +#if defined(HAVE_LIBNX) && defined(HAVE_STATIC_DUMMY) +void retro_init(void) { libretro_dummy_retro_init(); } +void retro_deinit(void) { libretro_dummy_retro_deinit(); } +unsigned retro_api_version(void) { return libretro_dummy_retro_api_version(); } +void retro_set_controller_port_device(unsigned port, unsigned device) { libretro_dummy_retro_set_controller_port_device(port, device); } +void retro_get_system_info(struct retro_system_info *info) { libretro_dummy_retro_get_system_info(info); } +void retro_get_system_av_info(struct retro_system_av_info *info) { retro_get_system_av_info(info); } +void retro_set_environment(retro_environment_t cb) { libretro_dummy_retro_set_environment(cb); } +void retro_set_audio_sample(retro_audio_sample_t cb) { libretro_dummy_retro_set_audio_sample(cb); } +void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { libretro_dummy_retro_set_audio_sample_batch(cb); } +void retro_set_input_poll(retro_input_poll_t cb) { libretro_dummy_retro_set_input_poll(cb); } +void retro_set_input_state(retro_input_state_t cb) { libretro_dummy_retro_set_input_state(cb); } +void retro_set_video_refresh(retro_video_refresh_t cb) { libretro_dummy_retro_set_video_refresh(cb); } +void retro_reset(void) { libretro_dummy_retro_reset(); } +void retro_run(void) { libretro_dummy_retro_run(); } +bool retro_load_game(const struct retro_game_info *info) { return libretro_dummy_retro_load_game(info); } +void retro_unload_game(void) { libretro_dummy_retro_unload_game(); } +unsigned retro_get_region(void) { return libretro_dummy_retro_get_region(); } +bool retro_load_game_special(unsigned type, const struct retro_game_info *info, size_t num) { return libretro_dummy_retro_load_game_special(type, info, num); } +size_t retro_serialize_size(void) { return libretro_dummy_retro_serialize_size(); } +bool retro_serialize(void *data, size_t size) { return libretro_dummy_retro_serialize(data, size); } +bool retro_unserialize(const void *data, size_t size) { return libretro_dummy_retro_unserialize(data, size); } +void *retro_get_memory_data(unsigned id) { return libretro_dummy_retro_get_memory_data(id); } +size_t retro_get_memory_size(unsigned id) { return libretro_dummy_retro_get_memory_size(id); } +void retro_cheat_reset(void) { libretro_dummy_retro_cheat_reset(); } +void retro_cheat_set(unsigned idx, bool enabled, const char *code) { libretro_dummy_retro_cheat_set(idx, enabled, code); } +#endif + void libretro_dummy_retro_init(void) { unsigned i;