From e506386fc683b18c2e25a27e8c3f7a220a92e5e1 Mon Sep 17 00:00:00 2001 From: neonloop Date: Thu, 10 Feb 2022 15:46:51 +0000 Subject: Updates cores and moves to snes9x2005 fork --- .../beetle-pce-fast/0001-frameskip-interval.patch | 26 ++--- patches/mame2000/1000-trimui-build.patch | 20 +--- patches/snes9x2005/0001-frameskip-interval.patc_ | 107 +++++++++++++++++++++ patches/snes9x2005/0001-frameskip-interval.patch | 107 --------------------- patches/snes9x2005/1000-trimui-support.patc_ | 46 +++++++++ patches/snes9x2005/1000-trimui-support.patch | 46 --------- 6 files changed, 169 insertions(+), 183 deletions(-) create mode 100644 patches/snes9x2005/0001-frameskip-interval.patc_ delete mode 100644 patches/snes9x2005/0001-frameskip-interval.patch create mode 100644 patches/snes9x2005/1000-trimui-support.patc_ delete mode 100644 patches/snes9x2005/1000-trimui-support.patch (limited to 'patches') diff --git a/patches/beetle-pce-fast/0001-frameskip-interval.patch b/patches/beetle-pce-fast/0001-frameskip-interval.patch index c44a893..cdc6894 100644 --- a/patches/beetle-pce-fast/0001-frameskip-interval.patch +++ b/patches/beetle-pce-fast/0001-frameskip-interval.patch @@ -1,8 +1,8 @@ diff --git a/libretro.cpp b/libretro.cpp -index 508577f..c706d96 100644 +index 48fd03a..c0fe238 100644 --- a/libretro.cpp +++ b/libretro.cpp -@@ -1629,13 +1629,11 @@ static uint64_t audio_frames = 0; +@@ -1627,13 +1627,11 @@ static uint64_t audio_frames = 0; static unsigned frameskip_type = 0; static unsigned frameskip_threshold = 0; static uint16_t frameskip_counter = 0; @@ -17,7 +17,7 @@ index 508577f..c706d96 100644 static unsigned audio_latency = 0; static bool update_audio_latency = false; -@@ -1749,6 +1747,7 @@ void retro_init(void) +@@ -1747,6 +1745,7 @@ void retro_init(void) frameskip_type = 0; frameskip_threshold = 0; frameskip_counter = 0; @@ -25,7 +25,7 @@ index 508577f..c706d96 100644 retro_audio_buff_active = false; retro_audio_buff_occupancy = 0; retro_audio_buff_underrun = false; -@@ -1863,8 +1862,10 @@ static void check_variables(bool first_run) +@@ -1861,8 +1860,10 @@ static void check_variables(bool first_run) { if (strcmp(var.value, "auto") == 0) frameskip_type = 1; @@ -37,7 +37,7 @@ index 508577f..c706d96 100644 } /* Reinitialise frameskipping, if required */ -@@ -1878,6 +1879,13 @@ static void check_variables(bool first_run) +@@ -1876,6 +1877,13 @@ static void check_variables(bool first_run) if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) frameskip_threshold = strtol(var.value, NULL, 10); @@ -48,10 +48,10 @@ index 508577f..c706d96 100644 + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + frameskip_interval = strtol(var.value, NULL, 10); + - var.key = "pce_hoverscan"; + var.key = "pce_fast_hoverscan"; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) -@@ -2357,16 +2365,19 @@ void retro_run(void) +@@ -2355,16 +2363,19 @@ void retro_run(void) case 1: /* auto */ skip_frame = retro_audio_buff_underrun ? 1 : 0; break; @@ -74,15 +74,15 @@ index 508577f..c706d96 100644 skip_frame = 0; frameskip_counter = 0; diff --git a/libretro_core_options.h b/libretro_core_options.h -index 28d27c6..1fedbd4 100644 +index 4b1a0a7..0e664b9 100644 --- a/libretro_core_options.h +++ b/libretro_core_options.h -@@ -102,13 +102,14 @@ struct retro_core_option_v2_definition option_defs_us[] = { +@@ -97,13 +97,14 @@ struct retro_core_option_v2_definition option_defs_us[] = { "pce_fast_frameskip", "Frameskip", NULL, -- "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Manual' utilises the 'Frameskip Threshold (%)' setting.", -+ "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Auto (Threshold)' utilises the 'Frameskip Threshold (%)' setting. 'Fixed Interval' utilises the 'Frameskip Interval' setting.", +- "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Manual' utilizes the 'Frameskip Threshold (%)' setting.", ++ "Skip frames to avoid audio buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Auto (Threshold)' utilises the 'Frameskip Threshold (%)' setting. 'Fixed Interval' utilizes the 'Frameskip Interval' setting.", NULL, "video", { @@ -96,7 +96,7 @@ index 28d27c6..1fedbd4 100644 { NULL, NULL }, }, "disabled" -@@ -141,6 +142,28 @@ struct retro_core_option_v2_definition option_defs_us[] = { +@@ -136,6 +137,28 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "33" }, @@ -123,5 +123,5 @@ index 28d27c6..1fedbd4 100644 + "2" + }, { - "pce_hoverscan", + "pce_fast_hoverscan", "Horizontal Overscan (352 Width Mode Only)", diff --git a/patches/mame2000/1000-trimui-build.patch b/patches/mame2000/1000-trimui-build.patch index b02c1cc..6368afc 100644 --- a/patches/mame2000/1000-trimui-build.patch +++ b/patches/mame2000/1000-trimui-build.patch @@ -1,8 +1,8 @@ diff --git a/Makefile b/Makefile -index 4b0667a..34df34e 100644 +index 8112d85..8f3555e 100644 --- a/Makefile +++ b/Makefile -@@ -335,6 +335,26 @@ else ifeq ($(platform), gcw0) +@@ -321,6 +321,26 @@ else ifeq ($(platform), gcw0) DISABLE_ERROR_LOGGING := 1 CFLAGS += -march=mips32 -mtune=mips32r2 -mhard-float @@ -29,7 +29,7 @@ index 4b0667a..34df34e 100644 # Windows MSVC 2010 x64 else ifeq ($(platform), windows_msvc2010_x64) CC = cl.exe -@@ -522,6 +542,8 @@ endif +@@ -508,6 +528,8 @@ endif ifeq ($(DEBUG), 1) CFLAGS += -O0 -g @@ -38,17 +38,3 @@ index 4b0667a..34df34e 100644 else CFLAGS += -O2 -DNDEBUG endif -@@ -531,6 +553,13 @@ RM = rm -f - LIBS = -lm - OBJ = obj - -+ifeq ($(PROFILE), GENERATE) -+ CFLAGS += -fprofile-generate=./profile/mame2000 -+ LIBS += -lgcov -+else ifeq ($(PROFILE), APPLY) -+ CFLAGS += -fprofile-use -fprofile-dir=../profile/mame2000 -fbranch-probabilities -+endif -+ - ifeq ($(HAVE_RZLIB),) - ZLIB_INCLUDE := -Isrc/zlib - endif diff --git a/patches/snes9x2005/0001-frameskip-interval.patc_ b/patches/snes9x2005/0001-frameskip-interval.patc_ new file mode 100644 index 0000000..f1c431d --- /dev/null +++ b/patches/snes9x2005/0001-frameskip-interval.patc_ @@ -0,0 +1,107 @@ +diff --git a/libretro.c b/libretro.c +index 9b4599e..c768c42 100644 +--- a/libretro.c ++++ b/libretro.c +@@ -58,13 +58,11 @@ static int32_t samplerate = (((SNES_CLOCK_SPEED * 6) / (32 * ONE_APU_CYCLE))); + static unsigned frameskip_type = 0; + static unsigned frameskip_threshold = 0; + static uint16_t frameskip_counter = 0; ++static unsigned frameskip_interval = 0; + + static bool retro_audio_buff_active = false; + static unsigned retro_audio_buff_occupancy = 0; + static bool retro_audio_buff_underrun = false; +-/* Maximum number of consecutive frames that +- * can be skipped */ +-#define FRAMESKIP_MAX 30 + + static unsigned retro_audio_latency = 0; + static bool update_audio_latency = false; +@@ -345,6 +343,7 @@ void retro_deinit(void) + frameskip_type = 0; + frameskip_threshold = 0; + frameskip_counter = 0; ++ frameskip_interval = 0; + retro_audio_buff_active = false; + retro_audio_buff_occupancy = 0; + retro_audio_buff_underrun = false; +@@ -418,7 +417,7 @@ static void check_variables(bool first_run) + { + if (strcmp(var.value, "auto") == 0) + frameskip_type = 1; +- else if (strcmp(var.value, "manual") == 0) ++ else if (strcmp(var.value, "auto_threshold") == 0) + frameskip_type = 2; + } + +@@ -430,6 +429,14 @@ static void check_variables(bool first_run) + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + frameskip_threshold = strtol(var.value, NULL, 10); + ++ var.key = "snes9x_2005_frameskip_interval"; ++ var.value = NULL; ++ ++ frameskip_interval = 4; ++ ++ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) ++ frameskip_interval = strtol(var.value, NULL, 10); ++ + var.key = "snes9x_2005_overclock_cycles"; + var.value = NULL; + +@@ -535,7 +542,7 @@ void retro_run(void) + + if (skip_frame) + { +- if(frameskip_counter < FRAMESKIP_MAX) ++ if(frameskip_counter < frameskip_interval) + { + IPPU.RenderThisFrame = false; + frameskip_counter++; +diff --git a/libretro_core_options.h b/libretro_core_options.h +index 9b89154..41d5ff1 100644 +--- a/libretro_core_options.h ++++ b/libretro_core_options.h +@@ -87,9 +87,9 @@ struct retro_core_option_v2_definition option_defs_us[] = { + NULL, + NULL, + { +- { "disabled", NULL }, +- { "auto", "Auto" }, +- { "manual", "Manual" }, ++ { "disabled", NULL }, ++ { "auto", "Auto" }, ++ { "auto_threshold", "Threshold" }, + { NULL, NULL }, + }, + "disabled" +@@ -122,6 +122,29 @@ struct retro_core_option_v2_definition option_defs_us[] = { + }, + "33" + }, ++ { ++ "snes9x_2005_frameskip_interval", ++ "Frameskip Interval", ++ NULL, ++ "The maximum number of frames that can be skipped before a new frame is rendered.", ++ NULL, ++ NULL, ++ { ++ { "0", NULL }, ++ { "1", NULL }, ++ { "2", NULL }, ++ { "3", NULL }, ++ { "4", NULL }, ++ { "5", NULL }, ++ { "6", NULL }, ++ { "7", NULL }, ++ { "8", NULL }, ++ { "9", NULL }, ++ { "10", NULL }, ++ { NULL, NULL }, ++ }, ++ "4" ++ }, + { + "snes9x_2005_overclock_cycles", + "Reduce Slowdown (Hack, Unsafe, Restart)", diff --git a/patches/snes9x2005/0001-frameskip-interval.patch b/patches/snes9x2005/0001-frameskip-interval.patch deleted file mode 100644 index f1c431d..0000000 --- a/patches/snes9x2005/0001-frameskip-interval.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff --git a/libretro.c b/libretro.c -index 9b4599e..c768c42 100644 ---- a/libretro.c -+++ b/libretro.c -@@ -58,13 +58,11 @@ static int32_t samplerate = (((SNES_CLOCK_SPEED * 6) / (32 * ONE_APU_CYCLE))); - static unsigned frameskip_type = 0; - static unsigned frameskip_threshold = 0; - static uint16_t frameskip_counter = 0; -+static unsigned frameskip_interval = 0; - - static bool retro_audio_buff_active = false; - static unsigned retro_audio_buff_occupancy = 0; - static bool retro_audio_buff_underrun = false; --/* Maximum number of consecutive frames that -- * can be skipped */ --#define FRAMESKIP_MAX 30 - - static unsigned retro_audio_latency = 0; - static bool update_audio_latency = false; -@@ -345,6 +343,7 @@ void retro_deinit(void) - frameskip_type = 0; - frameskip_threshold = 0; - frameskip_counter = 0; -+ frameskip_interval = 0; - retro_audio_buff_active = false; - retro_audio_buff_occupancy = 0; - retro_audio_buff_underrun = false; -@@ -418,7 +417,7 @@ static void check_variables(bool first_run) - { - if (strcmp(var.value, "auto") == 0) - frameskip_type = 1; -- else if (strcmp(var.value, "manual") == 0) -+ else if (strcmp(var.value, "auto_threshold") == 0) - frameskip_type = 2; - } - -@@ -430,6 +429,14 @@ static void check_variables(bool first_run) - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) - frameskip_threshold = strtol(var.value, NULL, 10); - -+ var.key = "snes9x_2005_frameskip_interval"; -+ var.value = NULL; -+ -+ frameskip_interval = 4; -+ -+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) -+ frameskip_interval = strtol(var.value, NULL, 10); -+ - var.key = "snes9x_2005_overclock_cycles"; - var.value = NULL; - -@@ -535,7 +542,7 @@ void retro_run(void) - - if (skip_frame) - { -- if(frameskip_counter < FRAMESKIP_MAX) -+ if(frameskip_counter < frameskip_interval) - { - IPPU.RenderThisFrame = false; - frameskip_counter++; -diff --git a/libretro_core_options.h b/libretro_core_options.h -index 9b89154..41d5ff1 100644 ---- a/libretro_core_options.h -+++ b/libretro_core_options.h -@@ -87,9 +87,9 @@ struct retro_core_option_v2_definition option_defs_us[] = { - NULL, - NULL, - { -- { "disabled", NULL }, -- { "auto", "Auto" }, -- { "manual", "Manual" }, -+ { "disabled", NULL }, -+ { "auto", "Auto" }, -+ { "auto_threshold", "Threshold" }, - { NULL, NULL }, - }, - "disabled" -@@ -122,6 +122,29 @@ struct retro_core_option_v2_definition option_defs_us[] = { - }, - "33" - }, -+ { -+ "snes9x_2005_frameskip_interval", -+ "Frameskip Interval", -+ NULL, -+ "The maximum number of frames that can be skipped before a new frame is rendered.", -+ NULL, -+ NULL, -+ { -+ { "0", NULL }, -+ { "1", NULL }, -+ { "2", NULL }, -+ { "3", NULL }, -+ { "4", NULL }, -+ { "5", NULL }, -+ { "6", NULL }, -+ { "7", NULL }, -+ { "8", NULL }, -+ { "9", NULL }, -+ { "10", NULL }, -+ { NULL, NULL }, -+ }, -+ "4" -+ }, - { - "snes9x_2005_overclock_cycles", - "Reduce Slowdown (Hack, Unsafe, Restart)", diff --git a/patches/snes9x2005/1000-trimui-support.patc_ b/patches/snes9x2005/1000-trimui-support.patc_ new file mode 100644 index 0000000..96dcb78 --- /dev/null +++ b/patches/snes9x2005/1000-trimui-support.patc_ @@ -0,0 +1,46 @@ +diff --git a/Makefile b/Makefile +index b293853..bc220bd 100644 +--- a/Makefile ++++ b/Makefile +@@ -282,6 +282,20 @@ else ifeq ($(platform), gcw0) + FLAGS += -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float + FLAGS += -DFAST_LSB_WORD_ACCESS + ++else ifeq ($(platform), trimui) ++ TARGET := $(TARGET_NAME)_libretro.so ++ CC = $(CROSS_COMPILE)gcc ++ AR = $(CROSS_COMPILE)ar ++ SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined ++ CFLAGS += -fsingle-precision-constant -fno-PIC -flto ++ CFLAGS += -DLSB_FIRST -DFAST_ALIGNED_LSB_WORD_ACCESS -DRIGHTSHIFT_IS_SAR ++ CFLAGS += -std=c99 -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s -mtune=arm926ej-s ++ LDFLAGS += -flto ++ OPTIMIZE += -Ofast -DNDEBUG=1 ++ ifeq (,$(DEBUG)) ++ LDFLAGS += -s ++ endif ++ + # (armv7 a7, hard point, neon based) ### + # NESC, SNESC, C64 mini + else ifeq ($(platform), classic_armv7_a7) +@@ -570,10 +584,20 @@ endif + + ifeq ($(DEBUG),1) + FLAGS += -O0 -g ++else ifneq (,$(OPTIMIZE)) ++ FLAGS += $(OPTIMIZE) + else + FLAGS += -O2 -DNDEBUG + endif + ++ ++ifeq ($(PROFILE), GENERATE) ++ CFLAGS += -fprofile-generate=./profile/snes9x2005 ++ LIBS += -lgcov ++else ifeq ($(PROFILE), APPLY) ++ CFLAGS += -fprofile-use -fprofile-dir=../profile/snes9x2005 -fbranch-probabilities ++endif ++ + ifneq (,$(findstring msvc,$(platform))) + ifeq ($(DEBUG),1) + FLAGS += -MTd diff --git a/patches/snes9x2005/1000-trimui-support.patch b/patches/snes9x2005/1000-trimui-support.patch deleted file mode 100644 index 96dcb78..0000000 --- a/patches/snes9x2005/1000-trimui-support.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/Makefile b/Makefile -index b293853..bc220bd 100644 ---- a/Makefile -+++ b/Makefile -@@ -282,6 +282,20 @@ else ifeq ($(platform), gcw0) - FLAGS += -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float - FLAGS += -DFAST_LSB_WORD_ACCESS - -+else ifeq ($(platform), trimui) -+ TARGET := $(TARGET_NAME)_libretro.so -+ CC = $(CROSS_COMPILE)gcc -+ AR = $(CROSS_COMPILE)ar -+ SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined -+ CFLAGS += -fsingle-precision-constant -fno-PIC -flto -+ CFLAGS += -DLSB_FIRST -DFAST_ALIGNED_LSB_WORD_ACCESS -DRIGHTSHIFT_IS_SAR -+ CFLAGS += -std=c99 -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s -mtune=arm926ej-s -+ LDFLAGS += -flto -+ OPTIMIZE += -Ofast -DNDEBUG=1 -+ ifeq (,$(DEBUG)) -+ LDFLAGS += -s -+ endif -+ - # (armv7 a7, hard point, neon based) ### - # NESC, SNESC, C64 mini - else ifeq ($(platform), classic_armv7_a7) -@@ -570,10 +584,20 @@ endif - - ifeq ($(DEBUG),1) - FLAGS += -O0 -g -+else ifneq (,$(OPTIMIZE)) -+ FLAGS += $(OPTIMIZE) - else - FLAGS += -O2 -DNDEBUG - endif - -+ -+ifeq ($(PROFILE), GENERATE) -+ CFLAGS += -fprofile-generate=./profile/snes9x2005 -+ LIBS += -lgcov -+else ifeq ($(PROFILE), APPLY) -+ CFLAGS += -fprofile-use -fprofile-dir=../profile/snes9x2005 -fbranch-probabilities -+endif -+ - ifneq (,$(findstring msvc,$(platform))) - ifeq ($(DEBUG),1) - FLAGS += -MTd -- cgit v1.2.3