From 5d165e6ef6b5cd79c1b8b20fbdf716d73fbebd1b Mon Sep 17 00:00:00 2001 From: neonloop Date: Tue, 10 Aug 2021 17:31:51 +0000 Subject: Renames core patch files First numbers for upstreamable patches. Later numbers for picoarch-specific patches. --- patches/snes9x2005/0001-frameskip-interval.patch | 104 +++++++++++++++++++++++ patches/snes9x2005/0001-trimui-support.patch | 46 ---------- patches/snes9x2005/0002-core-options.patch | 57 ------------- patches/snes9x2005/1000-frameskip-interval.patch | 104 ----------------------- patches/snes9x2005/1000-trimui-support.patch | 46 ++++++++++ patches/snes9x2005/1001-core-options.patch | 66 ++++++++++++++ 6 files changed, 216 insertions(+), 207 deletions(-) create mode 100644 patches/snes9x2005/0001-frameskip-interval.patch delete mode 100644 patches/snes9x2005/0001-trimui-support.patch delete mode 100644 patches/snes9x2005/0002-core-options.patch delete mode 100644 patches/snes9x2005/1000-frameskip-interval.patch create mode 100644 patches/snes9x2005/1000-trimui-support.patch create mode 100644 patches/snes9x2005/1001-core-options.patch (limited to 'patches/snes9x2005') diff --git a/patches/snes9x2005/0001-frameskip-interval.patch b/patches/snes9x2005/0001-frameskip-interval.patch new file mode 100644 index 0000000..0025b76 --- /dev/null +++ b/patches/snes9x2005/0001-frameskip-interval.patch @@ -0,0 +1,104 @@ +diff --git a/libretro.c b/libretro.c +index c368d8f..305adee 100644 +--- a/libretro.c ++++ b/libretro.c +@@ -57,13 +57,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; +@@ -341,6 +339,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; +@@ -414,7 +413,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; + } + +@@ -426,6 +425,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 = "catsfc_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 = "catsfc_overclock_cycles"; + var.value = NULL; + +@@ -531,7 +538,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 032cefd..14bf8d8 100644 +--- a/libretro_core_options.h ++++ b/libretro_core_options.h +@@ -71,9 +71,9 @@ struct retro_core_option_definition option_defs_us[] = { + "Frameskip", + "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.", + { +- { "disabled", NULL }, +- { "auto", "Auto" }, +- { "manual", "Manual" }, ++ { "disabled", NULL }, ++ { "auto", "Auto" }, ++ { "auto_threshold", "Threshold" }, + { NULL, NULL }, + }, + "disabled" +@@ -103,6 +103,26 @@ struct retro_core_option_definition option_defs_us[] = { + }, + "33" + }, ++ { ++ "catsfc_frameskip_interval", ++ "Frameskip Interval", ++ "The maximum number of frames that can be skipped before a new frame is rendered.", ++ { ++ { "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" ++ }, + { + "catsfc_overclock_cycles", + "Reduce Slowdown (Hack, Unsafe, Restart)", diff --git a/patches/snes9x2005/0001-trimui-support.patch b/patches/snes9x2005/0001-trimui-support.patch deleted file mode 100644 index 9424312..0000000 --- a/patches/snes9x2005/0001-trimui-support.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/Makefile b/Makefile -index b293853..5704da3 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 -+ LDFLAGS += -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/0002-core-options.patch b/patches/snes9x2005/0002-core-options.patch deleted file mode 100644 index 7f43e83..0000000 --- a/patches/snes9x2005/0002-core-options.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/libretro_core_options.h b/libretro_core_options.h -index 032cefd..b32864a 100644 ---- a/libretro_core_options.h -+++ b/libretro_core_options.h -@@ -57,7 +57,7 @@ struct retro_core_option_definition option_defs_us[] = { - { - "catsfc_VideoMode", - "Console Region", -- "Specify which region the system is from. 'PAL' is 50hz, 'NTSC' is 60hz. Games will run faster or slower than normal if the incorrect region is selected.", -+ "'PAL' is 50hz, 'NTSC' is 60hz. Games will run faster or slower than normal if the incorrect region is selected.", - { - { "auto", "Auto" }, - { "NTSC", NULL }, -@@ -69,19 +69,19 @@ struct retro_core_option_definition option_defs_us[] = { - { - "catsfc_frameskip", - "Frameskip", -- "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 crackling. Improves performance at the expense of visual smoothness.", - { - { "disabled", NULL }, - { "auto", "Auto" }, - { "manual", "Manual" }, - { NULL, NULL }, - }, -- "disabled" -+ "auto" - }, - { - "catsfc_frameskip_threshold", -- "Frameskip Threshold (%)", -- "When 'Frameskip' is set to 'Manual', specifies the audio buffer occupancy threshold (percentage) below which frames will be skipped. Higher values reduce the risk of crackling by causing frames to be dropped more frequently.", -+ "FS Threshold (%)", -+ "When 'Frameskip' is set to 'Threshold', sets how low the audio buffer can get before frames will be skipped.", - { - { "15", NULL }, - { "18", NULL }, -@@ -105,8 +105,8 @@ struct retro_core_option_definition option_defs_us[] = { - }, - { - "catsfc_overclock_cycles", -- "Reduce Slowdown (Hack, Unsafe, Restart)", -- "Many games for the SNES suffered from slowdown due to the weak main CPU. This option helps allievate that at the cost of possible bugs. COMPATIBLE: Reduce slowdown but keep as much game compatibility as much as possible. MAX: Reduce slowdown as much as possible but will break more games.", -+ "Overclock (Restart)", -+ "Alleviate normal SNES slowdown. Compatible keeps as much compatibility as possible. Max will reduce more slowdown but break more games.", - { - { "disabled", NULL }, - { "compatible", "Compatible" }, -@@ -117,7 +117,7 @@ struct retro_core_option_definition option_defs_us[] = { - }, - { - "catsfc_reduce_sprite_flicker", -- "Reduce Flickering (Hack, Unsafe)", -+ "Reduce Flicker", - "Raises sprite limit to reduce flickering in games.", - { - { "disabled", NULL }, diff --git a/patches/snes9x2005/1000-frameskip-interval.patch b/patches/snes9x2005/1000-frameskip-interval.patch deleted file mode 100644 index eb920c7..0000000 --- a/patches/snes9x2005/1000-frameskip-interval.patch +++ /dev/null @@ -1,104 +0,0 @@ -diff --git a/libretro.c b/libretro.c -index c368d8f..305adee 100644 ---- a/libretro.c -+++ b/libretro.c -@@ -57,13 +57,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; -@@ -341,6 +339,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; -@@ -414,7 +413,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; - } - -@@ -426,6 +425,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 = "catsfc_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 = "catsfc_overclock_cycles"; - var.value = NULL; - -@@ -531,7 +538,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 b32864a..b69d19a 100644 ---- a/libretro_core_options.h -+++ b/libretro_core_options.h -@@ -71,9 +71,9 @@ struct retro_core_option_definition option_defs_us[] = { - "Frameskip", - "Skip frames to avoid audio crackling. Improves performance at the expense of visual smoothness.", - { -- { "disabled", NULL }, -- { "auto", "Auto" }, -- { "manual", "Manual" }, -+ { "disabled", NULL }, -+ { "auto", "Auto" }, -+ { "auto_threshold", "Threshold" }, - { NULL, NULL }, - }, - "auto" -@@ -103,6 +103,26 @@ struct retro_core_option_definition option_defs_us[] = { - }, - "33" - }, -+ { -+ "catsfc_frameskip_interval", -+ "FS Interval", -+ "The maximum number of frames that can be skipped before a new frame is rendered.", -+ { -+ { "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" -+ }, - { - "catsfc_overclock_cycles", - "Overclock (Restart)", diff --git a/patches/snes9x2005/1000-trimui-support.patch b/patches/snes9x2005/1000-trimui-support.patch new file mode 100644 index 0000000..9424312 --- /dev/null +++ b/patches/snes9x2005/1000-trimui-support.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile b/Makefile +index b293853..5704da3 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 ++ LDFLAGS += -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/1001-core-options.patch b/patches/snes9x2005/1001-core-options.patch new file mode 100644 index 0000000..47a419c --- /dev/null +++ b/patches/snes9x2005/1001-core-options.patch @@ -0,0 +1,66 @@ +diff --git a/libretro_core_options.h b/libretro_core_options.h +index 14bf8d8..b69d19a 100644 +--- a/libretro_core_options.h ++++ b/libretro_core_options.h +@@ -57,7 +57,7 @@ struct retro_core_option_definition option_defs_us[] = { + { + "catsfc_VideoMode", + "Console Region", +- "Specify which region the system is from. 'PAL' is 50hz, 'NTSC' is 60hz. Games will run faster or slower than normal if the incorrect region is selected.", ++ "'PAL' is 50hz, 'NTSC' is 60hz. Games will run faster or slower than normal if the incorrect region is selected.", + { + { "auto", "Auto" }, + { "NTSC", NULL }, +@@ -69,19 +69,19 @@ struct retro_core_option_definition option_defs_us[] = { + { + "catsfc_frameskip", + "Frameskip", +- "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 crackling. Improves performance at the expense of visual smoothness.", + { + { "disabled", NULL }, + { "auto", "Auto" }, + { "auto_threshold", "Threshold" }, + { NULL, NULL }, + }, +- "disabled" ++ "auto" + }, + { + "catsfc_frameskip_threshold", +- "Frameskip Threshold (%)", +- "When 'Frameskip' is set to 'Manual', specifies the audio buffer occupancy threshold (percentage) below which frames will be skipped. Higher values reduce the risk of crackling by causing frames to be dropped more frequently.", ++ "FS Threshold (%)", ++ "When 'Frameskip' is set to 'Threshold', sets how low the audio buffer can get before frames will be skipped.", + { + { "15", NULL }, + { "18", NULL }, +@@ -105,7 +105,7 @@ struct retro_core_option_definition option_defs_us[] = { + }, + { + "catsfc_frameskip_interval", +- "Frameskip Interval", ++ "FS Interval", + "The maximum number of frames that can be skipped before a new frame is rendered.", + { + { "0", NULL }, +@@ -125,8 +125,8 @@ struct retro_core_option_definition option_defs_us[] = { + }, + { + "catsfc_overclock_cycles", +- "Reduce Slowdown (Hack, Unsafe, Restart)", +- "Many games for the SNES suffered from slowdown due to the weak main CPU. This option helps allievate that at the cost of possible bugs. COMPATIBLE: Reduce slowdown but keep as much game compatibility as much as possible. MAX: Reduce slowdown as much as possible but will break more games.", ++ "Overclock (Restart)", ++ "Alleviate normal SNES slowdown. Compatible keeps as much compatibility as possible. Max will reduce more slowdown but break more games.", + { + { "disabled", NULL }, + { "compatible", "Compatible" }, +@@ -137,7 +137,7 @@ struct retro_core_option_definition option_defs_us[] = { + }, + { + "catsfc_reduce_sprite_flicker", +- "Reduce Flickering (Hack, Unsafe)", ++ "Reduce Flicker", + "Raises sprite limit to reduce flickering in games.", + { + { "disabled", NULL }, -- cgit v1.2.3