aboutsummaryrefslogtreecommitdiff
path: root/patches/picodrive
diff options
context:
space:
mode:
authorneonloop2021-10-22 15:04:42 +0000
committerneonloop2021-10-22 15:04:42 +0000
commitc0c7ccbc14a81fc2bc0c3a14c403e0ab54087290 (patch)
tree1a12e2d5a7a42ce1170e29965cf3e4357664f7c3 /patches/picodrive
parent4ed343911dd50c564d76e3d44f807cc64820310b (diff)
downloadpicoarch-c0c7ccbc14a81fc2bc0c3a14c403e0ab54087290.tar.gz
picoarch-c0c7ccbc14a81fc2bc0c3a14c403e0ab54087290.tar.bz2
picoarch-c0c7ccbc14a81fc2bc0c3a14c403e0ab54087290.zip
Adds picodrive core
Diffstat (limited to 'patches/picodrive')
-rw-r--r--patches/picodrive/0001-frameskip-interval.patch113
-rw-r--r--patches/picodrive/1000-trimui-build.patch42
2 files changed, 155 insertions, 0 deletions
diff --git a/patches/picodrive/0001-frameskip-interval.patch b/patches/picodrive/0001-frameskip-interval.patch
new file mode 100644
index 0000000..bfc9b39
--- /dev/null
+++ b/patches/picodrive/0001-frameskip-interval.patch
@@ -0,0 +1,113 @@
+diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c
+index 3574c32..ac96c4f 100644
+--- a/platform/libretro/libretro.c
++++ b/platform/libretro/libretro.c
+@@ -137,13 +137,11 @@ char **g_argv;
+ 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 60
+
+ static unsigned audio_latency = 0;
+ static bool update_audio_latency = false;
+@@ -1926,7 +1924,7 @@ static void update_variables(bool first_run)
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
+ 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;
+ }
+
+@@ -1936,6 +1934,12 @@ static void update_variables(bool first_run)
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+ frameskip_threshold = strtol(var.value, NULL, 10);
+
++ frameskip_interval = 4;
++ var.key = "picodrive_frameskip_interval";
++ var.value = NULL;
++ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
++ frameskip_interval = strtol(var.value, NULL, 10);
++
+ old_vout_format = vout_format;
+ var.value = NULL;
+ var.key = "picodrive_renderer";
+@@ -2041,7 +2045,7 @@ void retro_run(void)
+ break;
+ }
+
+- if (!PicoIn.skipFrame || (frameskip_counter >= FRAMESKIP_MAX)) {
++ if (!PicoIn.skipFrame || (frameskip_counter >= frameskip_interval)) {
+ PicoIn.skipFrame = 0;
+ frameskip_counter = 0;
+ } else
+@@ -2211,6 +2215,7 @@ void retro_init(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;
+diff --git a/platform/libretro/libretro_core_options.h b/platform/libretro/libretro_core_options.h
+index 23ca416..2512eac 100644
+--- a/platform/libretro/libretro_core_options.h
++++ b/platform/libretro/libretro_core_options.h
+@@ -203,11 +203,11 @@ struct retro_core_option_definition option_defs_us[] = {
+ {
+ "picodrive_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 buffer under-run (crackling). Improves performance at the expense of visual smoothness. 'Auto' skips frames when advised by the frontend. 'Threshold' utilises the 'Frameskip Threshold (%)' setting.",
+ {
+- { "disabled", NULL },
+- { "auto", "Auto" },
+- { "manual", "Manual" },
++ { "disabled", NULL },
++ { "auto", "Auto" },
++ { "auto_threshold", "Threshold" },
+ { NULL, NULL },
+ },
+ "disabled"
+@@ -215,7 +215,7 @@ struct retro_core_option_definition option_defs_us[] = {
+ {
+ "picodrive_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.",
++ "When 'Frameskip' is set to 'Threshold', 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.",
+ {
+ { "15", NULL },
+ { "18", NULL },
+@@ -237,6 +237,25 @@ struct retro_core_option_definition option_defs_us[] = {
+ },
+ "33"
+ },
++ {
++ "picodrive_frameskip_interval",
++ "Frameskip Interval",
++ "The maximum number of frames that can be skipped before a new frame is rendered.",
++ {
++ { "1", NULL },
++ { "2", NULL },
++ { "3", NULL },
++ { "4", NULL },
++ { "5", NULL },
++ { "6", NULL },
++ { "7", NULL },
++ { "8", NULL },
++ { "9", NULL },
++ { "10", NULL },
++ { NULL, NULL },
++ },
++ "3"
++ },
+ {
+ "picodrive_renderer",
+ "Renderer",
diff --git a/patches/picodrive/1000-trimui-build.patch b/patches/picodrive/1000-trimui-build.patch
new file mode 100644
index 0000000..6e21ae7
--- /dev/null
+++ b/patches/picodrive/1000-trimui-build.patch
@@ -0,0 +1,42 @@
+diff --git a/Makefile.libretro b/Makefile.libretro
+index 919e0c1..e3bcd36 100644
+--- a/Makefile.libretro
++++ b/Makefile.libretro
+@@ -517,6 +517,23 @@ else ifeq ($(platform), miyoo)
+ LOW_MEMORY = 1
+ NO_ARM_ASM = 1
+
++# TRIMUI
++else ifeq ($(platform), trimui)
++ TARGET := $(TARGET_NAME)_libretro.so
++ CC = $(CROSS_COMPILE)gcc
++ CXX = $(CROSS_COMPILE)g++
++ AR = $(CROSS_COMPILE)ar
++ SHARED := -shared -Wl,--no-undefined
++ DONT_COMPILE_IN_ZLIB = 1
++ CFLAGS += -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s -D__GCW0__
++ CFLAGS += -fno-PIC -flto
++ LDFLAGS += -flto
++ HAVE_ARMv6 = 0
++ LOW_MEMORY = 1
++ ifeq (,$(DEBUG))
++ LDFLAGS += -s
++ endif
++
+ # Windows MSVC 2017 all architectures
+ else ifneq (,$(findstring windows_msvc2017,$(platform)))
+ NO_GCC := 1
+@@ -720,6 +737,13 @@ else
+ endif
+ endif
+
++ifeq ($(PROFILE), GENERATE)
++ CFLAGS += -fprofile-generate=./profile/$(TARGET_NAME)
++ LDFLAGS += -lgcov
++else ifeq ($(PROFILE), APPLY)
++ CFLAGS += -fprofile-use -fprofile-dir=../profile/$(TARGET_NAME) -fbranch-probabilities
++endif
++
+ ifneq (,$(findstring msvc,$(platform)))
+ OBJOUT = -Fo
+ LINKOUT = -out: