From da2a6ed0ad2aa61ba4f72cf56480509bbbf296a4 Mon Sep 17 00:00:00 2001 From: neonloop Date: Sun, 16 Jul 2023 17:13:40 +0000 Subject: Updates Makefile and core patches --- .gitignore | 3 + Makefile | 53 ++++++++----- .../dosbox-pure/0001-add-auto-cycle-limit.patch | 10 +-- .../fake-08/0001-add-missing-headers-gcc-13.patch | 88 ++++++++++++++++++++++ patches/pcsx_rearmed/1000-trimui-support.patch | 34 ++++----- 5 files changed, 147 insertions(+), 41 deletions(-) create mode 100644 patches/fake-08/0001-add-missing-headers-gcc-13.patch diff --git a/.gitignore b/.gitignore index 9f397bb..3c5c9f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ *.o *.so *.opk +*.zip +compile_commands.json picoarch +/.cache /pkg /profile /system diff --git a/Makefile b/Makefile index 81c21af..8f6839f 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ CFLAGS += -I./ -I./libretro-common/include/ $(shell $(SYSROOT)/usr/bin/sdl-c LDFLAGS = -lc -ldl -lgcc -lm -lSDL -lasound -lpng -lz -Wl,--gc-sections -flto # Unpolished or slow cores that build -# EXTRA_CORES += fbalpha2012 mame2003_plus prboom scummvm tyrquake +# EXTRA_CORES += mame2003_plus prboom scummvm tyrquake CORES = beetle-pce-fast bluemsx fceumm fmsx gambatte gme gpsp mame2000 pcsx_rearmed picodrive pokemini quicknes smsplus-gx snes9x2002 snes9x2005 $(EXTRA_CORES) @@ -155,18 +155,21 @@ CFLAGS += $(EXTRA_CFLAGS) SOFILES = $(foreach core,$(CORES),$(core)_libretro.so) +.PHONY: print-% print-%: @echo '$*=$($*)' +.PHONY: all all: $(BIN) cores libpicofe/.patched: - cd libpicofe && ($(foreach patch, $(sort $(wildcard patches/libpicofe/*.patch)), git apply -p1 < ../$(patch) &&) touch .patched) + cd libpicofe && ($(foreach patch, $(sort $(wildcard patches/libpicofe/*.patch)), patch --no-backup-if-mismatch --merge -p1 < ../$(patch) &&) touch .patched) reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1)) +.PHONY: clean-libpicofe clean-libpicofe: - test ! -f libpicofe/.patched || (cd libpicofe && ($(foreach patch, $(call reverse,$(sort $(wildcard patches/libpicofe/*.patch))), git apply -R -p1 < ../$(patch) &&) rm .patched)) + test ! -f libpicofe/.patched || (cd libpicofe && ($(foreach patch, $(call reverse,$(sort $(wildcard patches/libpicofe/*.patch))), patch -R --merge --no-backup-if-mismatch -p1 < ../$(patch) &&) rm .patched)) plat_trimui.o: plat_sdl.c plat_funkey.o: plat_sdl.c @@ -187,7 +190,7 @@ $1_MAKE = make $(and $($1_MAKEFILE),-f $($1_MAKEFILE)) platform=$(core_platform) $(1): git clone $(if $($1_REVISION),,--depth 1) --recursive $$($(1)_REPO) $(1) $(if $1_REVISION,cd $(1) && git checkout $($1_REVISION),) - (test ! -d patches/$(1)) || (cd $(1) && $(foreach patch, $(sort $(wildcard patches/$(1)/*.patch)), git apply -p1 < ../$(patch) &&) true) + (test ! -d patches/$(1)) || (cd $(1) && $(foreach patch, $(sort $(wildcard patches/$(1)/*.patch)), patch --merge --no-backup-if-mismatch -p1 < ../$(patch) &&) true) $(1)/$(1)_libretro.so: $(1) cd $$($1_BUILD_PATH) && $$($1_MAKE) $(PROCS) @@ -202,18 +205,23 @@ endef $(foreach core,$(CORES),$(eval $(call CORE_template,$(core)))) +.PHONY: cores cores: $(SOFILES) +.PHONY: clean-picoarch clean-picoarch: rm -f $(OBJS) $(BIN) rm -rf pkg rm -f *.opk +.PHONY: clean clean: clean-libpicofe clean-picoarch rm -f $(SOFILES) +.PHONY: clean-all clean-all: $(foreach core,$(CORES),clean-$(core)) clean +.PHONY: force-clean force-clean: clean rm -rf $(CORES) @@ -399,11 +407,11 @@ beetle-pce-fast_ICON = pce bluemsx_NAME = blueMSX bluemsx_ROM_DIR = /mnt/MSX -bluemsx_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/dingux-msx.png +bluemsx_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/dingux-msx.png bluemsx_ICON = dingux-msx dosbox-pure_ROM_DIR = /mnt/DOS -dosbox-pure_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/dosbox.png +dosbox-pure_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/dosbox.png dosbox-pure_ICON = dosbox fake-08_NAME = fake-08 @@ -413,7 +421,7 @@ fake-08_ICON = icon0 fbalpha2012_NAME = fba2012 fbalpha2012_ROM_DIR = /mnt/Arcade -fbalpha2012_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/fba.png +fbalpha2012_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/fba.png fbalpha2012_ICON = fba fceumm_ROM_DIR = /mnt/NES @@ -422,7 +430,7 @@ fceumm_ICON = nes fmsx_NAME = fMSX fmsx_ROM_DIR = /mnt/MSX -fmsx_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/dingux-msx.png +fmsx_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/dingux-msx.png fmsx_ICON = dingux-msx gambatte_ROM_DIR = /mnt/Game Boy @@ -431,7 +439,7 @@ gambatte_ICON = gb gme_ROM_DIR = /mnt/Music gme_TYPES = ay,gbs,gym,hes,kss,nsf,nsfe,sap,spc,vgm,vgz,zip -gme_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/gmu.png +gme_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/gmu.png gme_ICON = gmu gpsp_ROM_DIR = /mnt/Game Boy Advance @@ -439,16 +447,16 @@ gpsp_ICON_URL = https://raw.githubusercontent.com/FunKey-Project/FunKey-OS/maste gpsp_ICON = gba mame2000_ROM_DIR = /mnt/Arcade -mame2000_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/mame.png +mame2000_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/mame.png mame2000_ICON = mame mame2003_plus_NAME = mame2003+ mame2003_plus_ROM_DIR = /mnt/Arcade -mame2003_plus_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/mame.png +mame2003_plus_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/mame.png mame2003_plus_ICON = icon pcsx_rearmed_ROM_DIR = /mnt/PS1 -pcsx_rearmed_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/pcsx4all.png +pcsx_rearmed_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/pcsx4all.png pcsx_rearmed_ICON = pcsx4all picodrive_ROM_DIR = /mnt/Sega Genesis @@ -456,7 +464,7 @@ picodrive_ICON_URL = https://raw.githubusercontent.com/FunKey-Project/FunKey-OS/ picodrive_ICON = megadrive pokemini_ROM_DIR = /mnt/PokeMini -pokemini_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/pokemini.png +pokemini_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenu2x/gmenunx/assets/miyoo/skins/PixUI/icons/pokemini.png pokemini_ICON = pokemini quicknes_ROM_DIR = /mnt/NES @@ -511,7 +519,7 @@ picoarch-$(1).opk: $(BIN) $(1)_libretro.so mv $$($(1)_NAME).funkey-s.desktop .opkdata cp $(BIN) $(1)_libretro.so .opkdata $(if $($(1)_ICON_URL),cd .opkdata && curl -L $($(1)_ICON_URL) -O && mogrify -resize '32x32>' $($(1)_ICON).png,) - cd .opkdata && mksquashfs * ../picoarch-$(1).opk -all-root -no-xattrs -noappend -no-exports + cd .opkdata && mksquashfs * ../$$@ -all-root -no-xattrs -noappend -no-exports rm -r .opkdata endef @@ -529,13 +537,13 @@ StartupNotify=true Categories=emulators; endef -picoarch.opk: $(BIN) cores +picoarch.opk: $(BIN) $(SOFILES) mkdir -p .opkdata $(file >picoarch.funkey-s.desktop,$(picoarch_DESKTOP)) mv picoarch.funkey-s.desktop .opkdata cp $(BIN) $(SOFILES) .opkdata cd .opkdata && curl -L -O https://raw.githubusercontent.com/FunKey-Project/sdlretro/master/data/sdlretro_icon.png - cd .opkdata && mksquashfs * ../picoarch.opk -all-root -no-xattrs -noappend -no-exports + cd .opkdata && mksquashfs * ../$@ -all-root -no-xattrs -noappend -no-exports rm -r .opkdata define picoarch_lite_DESKTOP @@ -559,11 +567,18 @@ picoarch-lite.opk: $(BIN) mv picoarch.funkey-s.desktop .opkdata cp $(BIN) .opkdata cd .opkdata && curl -L -O https://raw.githubusercontent.com/FunKey-Project/sdlretro/master/data/sdlretro_icon.png - cd .opkdata && mksquashfs * ../picoarch-lite.opk -all-root -no-xattrs -noappend -no-exports + cd .opkdata && mksquashfs * ../$@ -all-root -no-xattrs -noappend -no-exports rm -r .opkdata picoarch-funkey-s.zip: picoarch.opk $(foreach core, $(CORES), picoarch-$(core).opk) - rm -f picoarch-funkey-s.zip - zip picoarch-funkey-s.zip README.funkey-s.md *.opk + rm -f $@ + zip $@ $^ + +cores-funkey-s.zip: $(SOFILES) + rm -f $@ + zip $@ $^ + +.PHONY: dist +dist: picoarch-lite.opk picoarch-funkey-s.zip cores-funkey-s.zip endif # platform=funkey-s diff --git a/patches/dosbox-pure/0001-add-auto-cycle-limit.patch b/patches/dosbox-pure/0001-add-auto-cycle-limit.patch index 69baeb9..f524ee6 100644 --- a/patches/dosbox-pure/0001-add-auto-cycle-limit.patch +++ b/patches/dosbox-pure/0001-add-auto-cycle-limit.patch @@ -1,10 +1,10 @@ diff --git a/dosbox_pure_libretro.cpp b/dosbox_pure_libretro.cpp -index 6a03631..dc4f70d 100644 +index af4c66f..bd59842 100644 --- a/dosbox_pure_libretro.cpp +++ b/dosbox_pure_libretro.cpp -@@ -451,15 +451,30 @@ void DBP_SetRealModeCycles() - (year > 1993 ? 60000 : // Pentium 90 MHz - Cycles1981to1993[year - 1981]))); // Matching speed for year +@@ -544,15 +544,30 @@ void DBP_SetRealModeCycles() + (year > 1999 ? 500000 : // Pentium III, 600 MHz and later + Cycles1981to1999[year - 1981]))); // Matching speed for year +#ifdef CYCLE_LIMIT + if (CPU_CycleMax > CYCLE_LIMIT) @@ -32,4 +32,4 @@ index 6a03631..dc4f70d 100644 +#endif } - static void DBP_UnlockSpeed(bool unlock, int start_frame_skip = 0, bool skip_once = false) + static bool DBP_NeedFrameSkip(bool in_emulation) diff --git a/patches/fake-08/0001-add-missing-headers-gcc-13.patch b/patches/fake-08/0001-add-missing-headers-gcc-13.patch new file mode 100644 index 0000000..9f0c638 --- /dev/null +++ b/patches/fake-08/0001-add-missing-headers-gcc-13.patch @@ -0,0 +1,88 @@ +diff --git a/platform/libretro/libretrohosthelpers.h b/platform/libretro/libretrohosthelpers.h +index e898bf3..4f0d1b2 100644 +--- a/platform/libretro/libretrohosthelpers.h ++++ b/platform/libretro/libretrohosthelpers.h +@@ -1,4 +1,5 @@ + #include ++#include + + void setInputState( + uint8_t kDown, +@@ -7,4 +8,4 @@ void setInputState( + int16_t mouseY, + uint8_t mouseBtnState); + +-void setCartDirectory(std::string dir); +\ No newline at end of file ++void setCartDirectory(std::string dir); +diff --git a/source/PicoRam.h b/source/PicoRam.h +index ff4c4e9..424ffa8 100644 +--- a/source/PicoRam.h ++++ b/source/PicoRam.h +@@ -1,5 +1,6 @@ + #pragma once + ++#include + #include + #include + +diff --git a/source/emojiconversion.cpp b/source/emojiconversion.cpp +index 2db1635..38b5534 100644 +--- a/source/emojiconversion.cpp ++++ b/source/emojiconversion.cpp +@@ -16,11 +16,11 @@ + // replacement before they actually remove the feature. + #define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING 1 + +- + #include + #include + #include + #include ++#include + #include + #include + #include +@@ -164,4 +164,4 @@ std::string charset::upper_to_emoji(std::string str) + } + + return charset::utf8_to_pico8(newstring); +-} +\ No newline at end of file ++} +diff --git a/source/fontdata.cpp b/source/fontdata.cpp +index 1fdda14..cef9b3f 100644 +--- a/source/fontdata.cpp ++++ b/source/fontdata.cpp +@@ -1,6 +1,7 @@ + + //taken from tac08: https://github.com/0xcafed00d/tac08 + #include ++#include + + const char* font_ss_str = R"(77700000000000000000000000000000000000000000000000700000700000007770000000000000707000000000000000000000000000007070000007000000 + 77700000777000007770000070700000707000007070000007700000770000007000000000700000777000000000000000000000000000007070000070700000 +@@ -406,4 +407,4 @@ uint8_t defaultFontBinaryData[2048] = { + 0, 14, 30, 8, 14, 0, 0, 0, // char 253 + 8, 4, 99, 16, 8, 0, 0, 0, // char 254 + 8, 16, 99, 4, 8, 0, 0, 0, // char 255 +-}; +\ No newline at end of file ++}; +diff --git a/source/stringToDataHelpers.h b/source/stringToDataHelpers.h +index dfa8336..3766d29 100644 +--- a/source/stringToDataHelpers.h ++++ b/source/stringToDataHelpers.h +@@ -1,9 +1,10 @@ + #pragma once + + #include ++#include + + void copy_string_to_sprite_memory(uint8_t sprite_data[128 * 64], std::string data); + + void copy_mini_label_to_sprite_memory(uint8_t sprite_data[128 * 64], std::string data, int labeloffset); + +-void copy_string_to_memory(uint8_t* sprite_flag_data, std::string data); +\ No newline at end of file ++void copy_string_to_memory(uint8_t* sprite_flag_data, std::string data); diff --git a/patches/pcsx_rearmed/1000-trimui-support.patch b/patches/pcsx_rearmed/1000-trimui-support.patch index 3076723..d751ac1 100644 --- a/patches/pcsx_rearmed/1000-trimui-support.patch +++ b/patches/pcsx_rearmed/1000-trimui-support.patch @@ -1,5 +1,5 @@ diff --git a/Makefile b/Makefile -index e694818..f0a1ba0 100644 +index ff8d1bb..8eef4a7 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ TARGET ?= pcsx @@ -12,10 +12,10 @@ index e694818..f0a1ba0 100644 ifeq ($(platform), $(filter $(platform), vita ctr)) CFLAGS += -O3 -DNDEBUG diff --git a/Makefile.libretro b/Makefile.libretro -index 7b9618e..6baefbd 100644 +index 069290c..692d998 100644 --- a/Makefile.libretro +++ b/Makefile.libretro -@@ -391,6 +391,27 @@ else ifeq ($(platform), rpi4_64) +@@ -394,6 +394,27 @@ else ifeq ($(platform), rpi4_64) fpic := -fPIC CFLAGS += -march=armv8-a+crc+simd -mtune=cortex-a72 -ftree-vectorize @@ -43,7 +43,7 @@ index 7b9618e..6baefbd 100644 # Classic Platforms #################### # Platform affix = classic__<µARCH> # Help at https://modmyclassic.com/comp -@@ -516,6 +537,13 @@ CFLAGS += $(fpic) +@@ -519,6 +540,13 @@ CFLAGS += $(fpic) MAIN_LDFLAGS += -shared MAIN_LDLIBS += $(LIBPTHREAD) $(LIBM) $(LIBDL) $(LIBZ) @@ -58,10 +58,10 @@ index 7b9618e..6baefbd 100644 ifeq ($(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h | grep __SIZEOF_LONG__ | awk '{print $$3}'),4) CFLAGS += -D_FILE_OFFSET_BITS=64 diff --git a/frontend/libretro.c b/frontend/libretro.c -index 3e74b23..b4a8385 100644 +index 938b8e5..dcc16ef 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c -@@ -3034,7 +3034,7 @@ void retro_init(void) +@@ -3057,7 +3057,7 @@ void retro_init(void) * we have to do this because cache misses and some IO penalties * are not emulated. Warning: changing this may break compatibility. */ Config.cycle_multiplier = CYCLE_MULT_DEFAULT; @@ -71,19 +71,19 @@ index 3e74b23..b4a8385 100644 #endif pl_rearmed_cbs.gpu_peops.iUseDither = 1; diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h -index 58e1b72..4d6ae43 100644 +index 4165237..c34008a 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h -@@ -206,7 +206,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { - #if defined(LIGHTREC) - " Currently doesn't work with Lightrec dynarec." - #endif +@@ -203,7 +203,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { + "PSX CPU Clock Speed", + NULL, + "Overclock or under-clock the PSX CPU. Try adjusting this if the game is too slow, too fast or hangs." -#if defined(HAVE_PRE_ARMV7) && !defined(_3DS) +#if defined(HAVE_PRE_ARMV7) && !defined(_3DS) && !defined(_TRIMUI) " Default is 50." #else " Default is 57." -@@ -288,7 +288,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { +@@ -285,7 +285,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { { "100", NULL }, { NULL, NULL }, }, @@ -92,7 +92,7 @@ index 58e1b72..4d6ae43 100644 "50", #else "57", -@@ -306,7 +306,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { +@@ -303,7 +303,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { { "enabled", NULL }, { NULL, NULL }, }, @@ -102,13 +102,13 @@ index 58e1b72..4d6ae43 100644 #else "enabled", diff --git a/frontend/main.c b/frontend/main.c -index fbff0f5..3b2abe4 100644 +index cf015a4..beaee12 100644 --- a/frontend/main.c +++ b/frontend/main.c -@@ -164,7 +164,7 @@ void emu_set_default_config(void) - spu_config.iVolume = 768; +@@ -165,7 +165,7 @@ void emu_set_default_config(void) spu_config.iTempo = 0; - spu_config.iUseThread = 1; // no effect if only 1 core is detected + // may cause issues, no effect if only 1 core is detected + spu_config.iUseThread = 0; -#if defined(HAVE_PRE_ARMV7) && !defined(_3DS) /* XXX GPH hack */ +#if defined(HAVE_PRE_ARMV7) && !defined(_3DS) && !defined(_TRIMUI) /* XXX GPH hack */ spu_config.iUseReverb = 0; -- cgit v1.2.3