aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneonloop2021-08-22 22:37:38 +0000
committerneonloop2021-08-22 22:37:38 +0000
commita2993b334dc5a03ad0a1e9368cebce354b72fae1 (patch)
tree07f81cfc5e565504755f30edc06f2ce2dea698b2
parentccb2de3943aca912a22b297562a9042dbff02609 (diff)
downloadpicoarch-a2993b334dc5a03ad0a1e9368cebce354b72fae1.tar.gz
picoarch-a2993b334dc5a03ad0a1e9368cebce354b72fae1.tar.bz2
picoarch-a2993b334dc5a03ad0a1e9368cebce354b72fae1.zip
Adds beetle-pce-fast core
-rw-r--r--.gitignore1
-rw-r--r--Makefile12
-rw-r--r--overrides.c2
-rw-r--r--overrides/beetle-pce-fast.h109
-rw-r--r--patches/beetle-pce-fast/0001-frameskip-interval.patch127
-rw-r--r--patches/beetle-pce-fast/1000-trimui-build.patch48
6 files changed, 297 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 599b9c5..32f8524 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ picoarch
/profile
/system
+/beetle-pce-fast
/fbalpha2012
/gambatte
/gpsp
diff --git a/Makefile b/Makefile
index c4cbed4..decb89d 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,10 @@ LDFLAGS = -lc -ldl -lgcc -lm -lSDL -lasound -lpng -lz -Wl,--gc-sections -flto
# EXTRA_CORES += fbalpha2012
# EXTRA_CORES += mame2003_plus
-CORES = gambatte gpsp mame2000 pcsx_rearmed snes9x2002 snes9x2005 $(EXTRA_CORES)
+CORES = beetle-pce-fast gambatte gpsp mame2000 pcsx_rearmed snes9x2002 snes9x2005 $(EXTRA_CORES)
+
+beetle-pce-fast_REPO = https://github.com/libretro/beetle-pce-fast-libretro
+beetle-pce-fast_CORE = mednafen_pce_fast_libretro.so
gambatte_REPO = https://github.com/libretro/gambatte-libretro
@@ -107,7 +110,7 @@ $(1):
$(1)_libretro.so: $(1)
cd $$($1_BUILD_PATH) && $$($1_MAKE) $(PROCS)
- cp $$($1_BUILD_PATH)/$(1)_libretro.so .
+ cp $$($1_BUILD_PATH)/$(if $($(1)_CORE),$($(1)_CORE),$(1)_libretro.so) $(1)_libretro.so
clean-$(1):
test ! -d $(1) || cd $$($1_BUILD_PATH) && $$($1_MAKE) clean
@@ -129,6 +132,11 @@ force-clean: clean
ifeq ($(platform), trimui)
+beetle-pce-fast_NAME = pce_fast
+beetle-pce-fast_ROM_DIR = PCE
+beetle-pce-fast_TYPES = pce,cue,ccd,chd,toc,m3u
+beetle-pce-fast_PAK_NAME = TurboGrafx-16
+
fbalpha2012_NAME = fba2012
fbalpha2012_ROM_DIR = ARCADE
fbalpha2012_TYPES = zip
diff --git a/overrides.c b/overrides.c
index 998110f..1f8f0d8 100644
--- a/overrides.c
+++ b/overrides.c
@@ -1,4 +1,5 @@
#include "overrides.h"
+#include "overrides/beetle-pce-fast.h"
#include "overrides/gambatte.h"
#include "overrides/gpsp.h"
#include "overrides/mame2000.h"
@@ -8,6 +9,7 @@
#include "util.h"
static const struct core_override overrides[] = {
+ beetle_pce_fast_overrides,
gambatte_overrides,
gpsp_overrides,
mame2000_overrides,
diff --git a/overrides/beetle-pce-fast.h b/overrides/beetle-pce-fast.h
new file mode 100644
index 0000000..a16b044
--- /dev/null
+++ b/overrides/beetle-pce-fast.h
@@ -0,0 +1,109 @@
+#include "overrides.h"
+
+static const struct core_override_option beetle_pce_fast_core_option_overrides[] = {
+ {
+ .key = "pce_fast_frameskip",
+ .info = "Skip frames to avoid audio crackling. Improves performance at the expense of visual smoothness.",
+ .default_value = "auto",
+ .options = {
+ [2] = {"auto_threshold", "Threshold"},
+ [3] = {"fixed_interval", "Fixed"},
+ }
+ },
+ {
+ .key = "pce_fast_frameskip_threshold",
+ .desc = "FS Threshold (%)",
+ .info = "When 'Frameskip' is set to 'Threshold', sets how low the audio buffer can get before frames will be skipped.",
+ },
+ {
+ .key = "pce_fast_frameskip_interval",
+ .desc = "FS Interval",
+ },
+ {
+ .key = "pce_hoverscan",
+ .desc = "Horiz. Overscan",
+ .info = "Modify the horizontal overscan. (352 Width Mode Only)",
+ },
+ {
+ .key = "pce_turbo_toggling",
+ .info = "Change III / IV to Toggle Turbo II / Toggle Turbo I",
+ },
+ {
+ .key = "pce_sound_channel_0_volume",
+ .desc = "Channel 0 Volume",
+ },
+ {
+ .key = "pce_sound_channel_1_volume",
+ .desc = "Channel 1 Volume",
+ },
+ {
+ .key = "pce_sound_channel_2_volume",
+ .desc = "Channel 2 Volume",
+ },
+ {
+ .key = "pce_sound_channel_3_volume",
+ .desc = "Channel 3 Volume",
+ },
+ {
+ .key = "pce_sound_channel_4_volume",
+ .desc = "Channel 4 Volume",
+ },
+ {
+ .key = "pce_sound_channel_5_volume",
+ .desc = "Channel 5 Volume",
+ },
+ {
+ .key = "pce_fast_cdimagecache",
+ .desc = "CD Cache (Restart)",
+ },
+ {
+ .key = "pce_ocmultiplier",
+ .desc = "Overclock (Restart)",
+ .info = "Overclock the emulated CPU by selected multiplier.",
+ },
+ {
+ .key = "pce_disable_softreset",
+ .desc = "Disable Soft Reset",
+ },
+ {
+ .key = "pce_mouse_sensitivity",
+ .blocked = true,
+ },
+ {
+ .key = "pce_turbo_toggle_hotkey",
+ .blocked = true,
+ },
+ { NULL }
+};
+
+me_bind_action beetle_pce_fast_ctrl_actions[] =
+{
+ { "UP ", 1 << RETRO_DEVICE_ID_JOYPAD_UP},
+ { "DOWN ", 1 << RETRO_DEVICE_ID_JOYPAD_DOWN },
+ { "LEFT ", 1 << RETRO_DEVICE_ID_JOYPAD_LEFT },
+ { "RIGHT ", 1 << RETRO_DEVICE_ID_JOYPAD_RIGHT },
+ { "I ", 1 << RETRO_DEVICE_ID_JOYPAD_A },
+ { "II ", 1 << RETRO_DEVICE_ID_JOYPAD_B },
+ { "III ", 1 << RETRO_DEVICE_ID_JOYPAD_Y },
+ { "IV ", 1 << RETRO_DEVICE_ID_JOYPAD_X },
+ { "V ", 1 << RETRO_DEVICE_ID_JOYPAD_L },
+ { "VI ", 1 << RETRO_DEVICE_ID_JOYPAD_R },
+ { "RUN ", 1 << RETRO_DEVICE_ID_JOYPAD_START },
+ { "SELECT ", 1 << RETRO_DEVICE_ID_JOYPAD_SELECT },
+ { "2 / 6 BTN", 1 << RETRO_DEVICE_ID_JOYPAD_L2 },
+ { NULL, 0 }
+};
+
+const struct core_override_fast_forward beetle_pce_fast_fast_forward = {
+ .type_key = "pce_fast_frameskip",
+ .type_value = "auto",
+ .interval_key = "pce_fast_frameskip_interval",
+};
+
+#define beetle_pce_fast_overrides { \
+ .core_name = "beetle-pce-fast", \
+ .fast_forward = &beetle_pce_fast_fast_forward, \
+ .actions = beetle_pce_fast_ctrl_actions, \
+ .action_size = array_size(beetle_pce_fast_ctrl_actions), \
+ .options = beetle_pce_fast_core_option_overrides \
+}
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