aboutsummaryrefslogtreecommitdiff
path: root/patches/beetle-pce-fast
diff options
context:
space:
mode:
authorneonloop2021-08-22 22:37:38 +0000
committerneonloop2021-08-22 22:37:38 +0000
commita2993b334dc5a03ad0a1e9368cebce354b72fae1 (patch)
tree07f81cfc5e565504755f30edc06f2ce2dea698b2 /patches/beetle-pce-fast
parentccb2de3943aca912a22b297562a9042dbff02609 (diff)
downloadpicoarch-a2993b334dc5a03ad0a1e9368cebce354b72fae1.tar.gz
picoarch-a2993b334dc5a03ad0a1e9368cebce354b72fae1.tar.bz2
picoarch-a2993b334dc5a03ad0a1e9368cebce354b72fae1.zip
Adds beetle-pce-fast core
Diffstat (limited to 'patches/beetle-pce-fast')
-rw-r--r--patches/beetle-pce-fast/0001-frameskip-interval.patch127
-rw-r--r--patches/beetle-pce-fast/1000-trimui-build.patch48
2 files changed, 175 insertions, 0 deletions
diff --git a/patches/beetle-pce-fast/0001-frameskip-interval.patch b/patches/beetle-pce-fast/0001-frameskip-interval.patch
new file mode 100644
index 0000000..c44a893
--- /dev/null
+++ b/patches/beetle-pce-fast/0001-frameskip-interval.patch
@@ -0,0 +1,127 @@
+diff --git a/libretro.cpp b/libretro.cpp
+index 508577f..c706d96 100644
+--- a/libretro.cpp
++++ b/libretro.cpp
+@@ -1629,13 +1629,11 @@ static uint64_t audio_frames = 0;
+ static unsigned frameskip_type = 0;
+ static unsigned frameskip_threshold = 0;
+ static uint16_t frameskip_counter = 0;
++static uint16_t 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 audio_latency = 0;
+ static bool update_audio_latency = false;
+@@ -1749,6 +1747,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;
+@@ -1863,8 +1862,10 @@ 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;
++ else if (strcmp(var.value, "fixed_interval") == 0)
++ frameskip_type = 3;
+ }
+
+ /* Reinitialise frameskipping, if required */
+@@ -1878,6 +1879,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);
+
++ var.key = "pce_fast_frameskip_interval";
++ var.value = NULL;
++ frameskip_interval = 2;
++
++ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
++ frameskip_interval = strtol(var.value, NULL, 10);
++
+ var.key = "pce_hoverscan";
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+@@ -2357,16 +2365,19 @@ void retro_run(void)
+ case 1: /* auto */
+ skip_frame = retro_audio_buff_underrun ? 1 : 0;
+ break;
+- case 2: /* manual */
++ case 2: /* auto_threshold */
+ skip_frame = (retro_audio_buff_occupancy < frameskip_threshold) ? 1 : 0;
+ break;
++ case 3: /* fixed_interval */
++ skip_frame = 1;
++ break;
+ default:
+ skip_frame = 0;
+ break;
+ }
+
+ if (!skip_frame ||
+- (frameskip_counter >= FRAMESKIP_MAX))
++ (frameskip_counter >= frameskip_interval))
+ {
+ skip_frame = 0;
+ frameskip_counter = 0;
+diff --git a/libretro_core_options.h b/libretro_core_options.h
+index 28d27c6..1fedbd4 100644
+--- a/libretro_core_options.h
++++ b/libretro_core_options.h
+@@ -102,13 +102,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.",
+ NULL,
+ "video",
+ {
+- { "disabled", NULL },
+- { "auto", "Auto" },
+- { "manual", "Manual" },
++ { "disabled", NULL },
++ { "auto", "Auto" },
++ { "auto_threshold", "Auto (Threshold)" },
++ { "fixed_interval", "Fixed Interval" },
+ { NULL, NULL },
+ },
+ "disabled"
+@@ -141,6 +142,28 @@ struct retro_core_option_v2_definition option_defs_us[] = {
+ },
+ "33"
+ },
++ {
++ "pce_fast_frameskip_interval",
++ "Frameskip Interval",
++ NULL,
++ "The maximum number of frames that can be skipped before a new frame is rendered.",
++ NULL,
++ NULL,
++ {
++ { "1", NULL },
++ { "2", NULL },
++ { "3", NULL },
++ { "4", NULL },
++ { "5", NULL },
++ { "6", NULL },
++ { "7", NULL },
++ { "8", NULL },
++ { "9", NULL },
++ { "10", NULL },
++ { NULL, NULL },
++ },
++ "2"
++ },
+ {
+ "pce_hoverscan",
+ "Horizontal Overscan (352 Width Mode Only)",
diff --git a/patches/beetle-pce-fast/1000-trimui-build.patch b/patches/beetle-pce-fast/1000-trimui-build.patch
new file mode 100644
index 0000000..93fc489
--- /dev/null
+++ b/patches/beetle-pce-fast/1000-trimui-build.patch
@@ -0,0 +1,48 @@
+diff --git a/Makefile b/Makefile
+index f52a3ae..ab0594a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -378,6 +378,22 @@ else ifeq ($(platform), retrofw)
+ CXXFLAGS += -std=c++11
+ CFLAGS += -std=gnu11
+
++# 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 -Wl,--version-script=link.T
++ LDFLAGS += -fno-PIC -flto
++ CXXFLAGS += -std=c++11
++ CFLAGS += -std=gnu11
++ CFLAGS += -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s -mtune=arm926ej-s -fno-PIC -flto
++ OPTIMIZE := -Ofast -DNDEBUG
++ ifeq (,$(DEBUG))
++ LDFLAGS += -s
++ endif
++
+ # Windows MSVC 2017 all architectures
+ else ifneq (,$(findstring windows_msvc2017,$(platform)))
+
+@@ -627,10 +643,20 @@ endif
+
+ ifeq ($(DEBUG),1)
+ FLAGS += -O0 -g
++else ifneq (,$(OPTIMIZE))
++ CFLAGS += $(OPTIMIZE)
++ CXXFLAGS += $(OPTIMIZE)
+ else
+ FLAGS += -O2 -DNDEBUG $(EXTRA_GCC_FLAGS)
+ endif
+
++ifeq ($(PROFILE), GENERATE)
++ CFLAGS += -fprofile-generate=./profile/beetle-pce-fast
++ LDFLAGS += -lgcov
++else ifeq ($(PROFILE), APPLY)
++ CFLAGS += -fprofile-use -fprofile-dir=../profile/beetle-pce-fast -fbranch-probabilities
++endif
++
+ ifneq (,$(findstring msvc,$(platform)))
+ ifeq ($(DEBUG), 1)
+ CFLAGS += -MTd