From 909467d97d7ebd5918e426a27b7fb2e3e6b4ac15 Mon Sep 17 00:00:00 2001 From: neonloop Date: Sun, 28 Nov 2021 17:59:28 +0000 Subject: Updates cores picodrive now supports GG --- Makefile | 2 +- overrides/picodrive.h | 28 ++++++++++ patches/gpsp/1000-trimui-build.patch | 70 ++----------------------- patches/picodrive/0001-frameskip-interval.patch | 40 +++++++------- 4 files changed, 55 insertions(+), 85 deletions(-) diff --git a/Makefile b/Makefile index b7852d6..873e460 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,7 @@ mame2003_plus_TYPES = zip mame2003_plus_PAK_NAME = Arcade (MAME 2003-plus) picodrive_ROM_DIR = MD -picodrive_TYPES = bin,gen,smd,md,32x,cue,iso,chd,sms,m3u,68k,sgd +picodrive_TYPES = bin,gen,smd,md,32x,cue,iso,chd,sms,gg,m3u,68k,sgd picodrive_PAK_NAME = Genesis pcsx_rearmed_ROM_DIR = PS diff --git a/overrides/picodrive.h b/overrides/picodrive.h index 31618da..aa1dc30 100644 --- a/overrides/picodrive.h +++ b/overrides/picodrive.h @@ -1,6 +1,30 @@ #include "overrides.h" static const struct core_override_option picodrive_core_option_overrides[] = { + { + .key = "picodrive_region", + .info = "Specify which region the system is from. 'PAL'/'Europe' is 50hz while 'NTSC'/'US' is 60hz." + }, + { + .key = "picodrive_smsmapper", + .desc = "SMS ROM Mapping", + }, + { + .key = "picodrive_renderer", + .info = "Specify video rendering method. 'Good' and 'Fast' are incompatible with games that rely on mid-frame palette/sprite updates.", + }, + { + .key = "picodrive_sound_rate", + .desc = "Sample Rate", + }, + { + .key = "picodrive_smsfm", + .desc = "SMS FM Sound", + }, + { + .key = "picodrive_dacnoise", + .desc = "FM DAC Noise", + }, { .key = "picodrive_overscan", .info = "Crop out the potentially random glitchy video output that would have been hidden by the TV bezel." @@ -22,6 +46,10 @@ static const struct core_override_option picodrive_core_option_overrides[] = { .desc = "FS Threshold (%)", .info = "When 'Frameskip' is set to 'Threshold', sets how low the audio buffer can get before frames will be skipped.", }, + { + .key = "picodrive_sprlim", + .info = "Removes the original sprite-per-scanline hardware limit. This reduces flickering but can cause visual glitches during special effects.", + }, { .key = "picodrive_aspect", .blocked = true, diff --git a/patches/gpsp/1000-trimui-build.patch b/patches/gpsp/1000-trimui-build.patch index ecf9623..31007c8 100644 --- a/patches/gpsp/1000-trimui-build.patch +++ b/patches/gpsp/1000-trimui-build.patch @@ -1,10 +1,10 @@ diff --git a/Makefile b/Makefile -index ecefd12..91fc859 100644 +index a0ed865..95c1438 100644 --- a/Makefile +++ b/Makefile -@@ -451,6 +451,20 @@ else ifeq ($(platform), rs90) +@@ -470,6 +470,20 @@ else ifeq ($(platform), miyoo) HAVE_DYNAREC := 1 - CPU_ARCH := mips + CPU_ARCH := arm +else ifeq ($(platform), trimui) + TARGET := $(TARGET_NAME)_libretro.so @@ -23,7 +23,7 @@ index ecefd12..91fc859 100644 # Windows else TARGET := $(TARGET_NAME)_libretro.dll -@@ -477,7 +491,14 @@ endif +@@ -491,7 +505,14 @@ endif ifeq ($(DEBUG), 1) OPTIMIZE := -O0 -g else @@ -39,65 +39,3 @@ index ecefd12..91fc859 100644 endif DEFINES := -DHAVE_STRINGS_H -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DINLINE=inline -Wall -diff --git a/arm/arm_stub.S b/arm/arm_stub.S -index cb68726..6593cf2 100644 ---- a/arm/arm_stub.S -+++ b/arm/arm_stub.S -@@ -79,8 +79,26 @@ _##symbol: - #define IOREG_OFF 0x8D00 - - --#define extract_u16(rd, rs) \ -+#if __ARM_ARCH >= 6 -+#define extract_u16(rd, rs) ;\ - uxth rd, rs -+#else -+#define extract_u16(rd, rs) ;\ -+ bic rd, rs, #0xff000000 ;\ -+ bic rd, rd, #0x00ff0000 -+#endif -+ -+#if __ARM_ARCH >= 6 -+#define sat_u4(rd, rs, shift) ;\ -+ usat rd, #4, rs, shift -+#else -+#define sat_u4(rd, rs, shift) ;\ -+ mov rd, rs, shift ;\ -+ bic rd, rd, rd, asr #31 ;\ -+ sub rd, rd, #15 ;\ -+ and rd, rd, rd, asr #31 ;\ -+ add rd, rd, #15 -+#endif - - @ Will load the register set from memory into the appropriate cached registers. - @ See arm_emit.h for listing explanation. -@@ -538,7 +556,7 @@ return_to_main: - #define execute_store_builder(store_type, str_op, str_op16, load_op, tnum) ;\ - ;\ - defsymbl(execute_store_u##store_type) ;\ -- usat r2, #4, r0, asr #24 /* r2 contains [0-15] */;\ -+ sat_u4(r2, r0, asr #24) /* r2 contains [0-15] */;\ - add r2, r2, #((STORE_TBL_OFF + 16*4*tnum) >> 2) /* add table offset */;\ - ldr pc, [reg_base, r2, lsl #2] /* load handler addr */;\ - nop ;\ -@@ -627,7 +645,7 @@ execute_store_builder(32, str, str, ldr, 2) - @ This is a store that is executed in a strm case (so no SMC checks in-between) - - defsymbl(execute_store_u32_safe) -- usat r2, #4, r0, asr #24 -+ sat_u4(r2, r0, asr #24) - add r2, r2, #((STORE_TBL_OFF + 16*4*3) >> 2) - ldr pc, [reg_base, r2, lsl #2] - nop -@@ -772,9 +790,9 @@ lookup_pc_arm: - defsymbl(execute_load_##load_type) ;\ - .if albits >= 1 ;\ - ror r1, r0, #(albits) /* move alignment bits to MSB */;\ -- usat r1, #4, r1, asr #(24-albits) /* r1 contains [0-15] */;\ -+ sat_u4(r1, r1, asr #(24-albits)) /* r1 contains [0-15] */;\ - .else ;\ -- usat r1, #4, r0, asr #24 /* r1 contains [0-15] */;\ -+ sat_u4(r1, r0, asr #24) /* r1 contains [0-15] */;\ - .endif ;\ - add r1, r1, #((STORE_TBL_OFF + 16*4*tnum) >> 2) /* add table offset */;\ - ldr pc, [reg_base, r1, lsl #2] /* load handler addr */;\ diff --git a/patches/picodrive/0001-frameskip-interval.patch b/patches/picodrive/0001-frameskip-interval.patch index bfc9b39..29b4b24 100644 --- a/patches/picodrive/0001-frameskip-interval.patch +++ b/patches/picodrive/0001-frameskip-interval.patch @@ -1,5 +1,5 @@ diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c -index 3574c32..ac96c4f 100644 +index 3c0f726..84aa5f1 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -137,13 +137,11 @@ char **g_argv; @@ -17,7 +17,7 @@ index 3574c32..ac96c4f 100644 static unsigned audio_latency = 0; static bool update_audio_latency = false; -@@ -1926,7 +1924,7 @@ static void update_variables(bool first_run) +@@ -1982,7 +1980,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; @@ -26,20 +26,19 @@ index 3574c32..ac96c4f 100644 frameskip_type = 2; } -@@ -1936,6 +1934,12 @@ static void update_variables(bool first_run) +@@ -1991,6 +1989,11 @@ static void update_variables(bool first_run) + var.value = NULL; 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) +@@ -2099,7 +2102,7 @@ void retro_run(void) break; } @@ -48,7 +47,7 @@ index 3574c32..ac96c4f 100644 PicoIn.skipFrame = 0; frameskip_counter = 0; } else -@@ -2211,6 +2215,7 @@ void retro_init(void) +@@ -2284,6 +2287,7 @@ void retro_init(void) frameskip_type = 0; frameskip_threshold = 0; frameskip_counter = 0; @@ -57,15 +56,17 @@ index 3574c32..ac96c4f 100644 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 +index 9cd2f85..d2ebede 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[] = { - { +@@ -340,13 +340,13 @@ struct retro_core_option_v2_definition option_defs_us[] = { "picodrive_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. 'Threshold' utilises the 'Frameskip Threshold (%)' setting.", + NULL, + "performance", { - { "disabled", NULL }, - { "auto", "Auto" }, @@ -76,23 +77,26 @@ index 23ca416..2512eac 100644 { NULL, NULL }, }, "disabled" -@@ -215,7 +215,7 @@ struct retro_core_option_definition option_defs_us[] = { - { +@@ -355,7 +355,7 @@ struct retro_core_option_v2_definition option_defs_us[] = { "picodrive_frameskip_threshold", "Frameskip Threshold (%)", + NULL, - "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.", + NULL, + "performance", { - { "15", NULL }, - { "18", NULL }, -@@ -237,6 +237,25 @@ struct retro_core_option_definition option_defs_us[] = { +@@ -379,6 +379,28 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "33" }, + { + "picodrive_frameskip_interval", + "Frameskip Interval", ++ NULL, + "The maximum number of frames that can be skipped before a new frame is rendered.", ++ NULL, ++ "performance", + { + { "1", NULL }, + { "2", NULL }, @@ -109,5 +113,5 @@ index 23ca416..2512eac 100644 + "3" + }, { - "picodrive_renderer", - "Renderer", + "picodrive_sprlim", + "No Sprite Limit", -- cgit v1.2.3