diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | core.c | 11 | ||||
-rw-r--r-- | core.h | 1 | ||||
-rw-r--r-- | main.c | 20 | ||||
-rw-r--r-- | main.h | 1 | ||||
-rw-r--r-- | overrides.c | 2 | ||||
-rw-r--r-- | overrides/fake-08.h | 19 | ||||
-rw-r--r-- | patches/fake-08/0001-fix-resume-state.patch | 81 | ||||
-rw-r--r-- | patches/fake-08/1000-funkey-s-build.patch | 17 |
10 files changed, 150 insertions, 14 deletions
@@ -8,6 +8,7 @@ picoarch /beetle-pce-fast /bluemsx +/fake-08 /fbalpha2012 /fceumm /fmsx @@ -24,7 +24,7 @@ LDFLAGS = -lc -ldl -lgcc -lm -lSDL -lasound -lpng -lz -Wl,--gc-sections -flto CORES = beetle-pce-fast bluemsx fceumm fmsx gambatte gme gpsp mame2000 pcsx_rearmed picodrive quicknes smsplus-gx snes9x2002 snes9x2005 $(EXTRA_CORES) ifneq ($(platform), trimui) -CORES := $(CORES) snes9x2005_plus +CORES := $(CORES) fake-08 snes9x2005_plus endif beetle-pce-fast_REPO = https://github.com/libretro/beetle-pce-fast-libretro @@ -34,6 +34,12 @@ beetle-pce-fast_TYPES = pce,cue,ccd,chd,toc,m3u bluemsx_REPO = https://github.com/libretro/blueMSX-libretro bluemsx_TYPES = rom,ri,mx1,mx2,dsk,col,sg,sc,cas,m3u +fake-08_REPO = https://github.com/jtothebell/fake-08 +fake-08_BUILD_PATH = fake-08/platform/libretro +fake-08_MAKEFILE = Makefile +fake-08_CORE = fake08_libretro.so +fake-08_TYPES = p8,png + fbalpha2012_BUILD_PATH = fbalpha2012/svn-current/trunk fbalpha2012_MAKEFILE = makefile.libretro fbalpha2012_TYPES = zip @@ -371,6 +377,9 @@ bluemsx_ROM_DIR = /mnt/MSX bluemsx_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/dingux-msx.png bluemsx_ICON = dingux-msx +fake-08_NAME = fake-08 +fake-08_ROM_DIR = /mnt/PICO-8 + fbalpha2012_NAME = fba2012 fbalpha2012_ROM_DIR = /mnt/Arcade fbalpha2012_ICON_URL = https://raw.githubusercontent.com/MiyooCFW/gmenunx/master/assets/miyoo/skins/PixUI/icons/fba.png @@ -26,7 +26,6 @@ double frame_rate; double aspect_ratio; unsigned audio_buffer_size_override; int state_slot; -int resume_slot = -1; static char config_dir[MAX_PATH]; static char save_dir[MAX_PATH]; @@ -221,16 +220,6 @@ error: return ret; } -int state_resume(void) { - int ret = 0; - if (resume_slot != -1) { - state_slot = resume_slot; - ret = state_read(); - resume_slot = -1; - } - return ret; -} - unsigned disc_get_count(void) { if (disk_control_ext.get_num_images) return disk_control_ext.get_num_images(); @@ -41,7 +41,6 @@ extern double frame_rate; extern double aspect_ratio; extern unsigned audio_buffer_size_override; extern int state_slot; -extern int resume_slot; void config_file_name(char *buf, size_t len, config_type config_type); void save_relative_path(char *buf, size_t len, const char *basename); @@ -34,6 +34,7 @@ bool should_quit = false; unsigned current_audio_buffer_size; char core_name[MAX_PATH]; int config_override = 0; +int resume_slot = -1; static int last_screenshot = 0; static uint32_t vsyncs; @@ -228,6 +229,11 @@ void set_defaults(void) scale_filter = SCALE_FILTER_SMOOTH; } + if (!strcmp(core_name, "fake-08")) { + scale_size = SCALE_SIZE_ASPECT; + scale_filter = SCALE_FILTER_NEAREST; + } + if (!strcmp(core_name, "pcsx_rearmed") || !strcmp(core_name, "picodrive")) { scale_size = SCALE_SIZE_FULL; @@ -584,6 +590,18 @@ static void adjust_audio(void) { } } + +int state_resume(void) { + int ret = 0; + + if (resume_slot != -1) { + state_slot = resume_slot; + ret = state_read(); + resume_slot = -1; + } + return ret; +} + int main(int argc, char **argv) { char content_path[MAX_PATH]; #ifdef FUNKEY_S @@ -677,6 +695,7 @@ int main(int argc, char **argv) { } instant_play = false; + FK_InitInstantPlay(argc, argv); } #endif show_startup_message(); @@ -685,7 +704,6 @@ int main(int argc, char **argv) { #ifdef FUNKEY_S remove(autosave_path); remove_config(CONFIG_TYPE_AUTO); - FK_InitInstantPlay(argc, argv); #endif do { @@ -36,6 +36,7 @@ extern bool should_quit; extern unsigned current_audio_buffer_size; extern char core_name[MAX_PATH]; extern int config_override; +extern int resume_slot; #ifdef MMENU extern void* mmenu; diff --git a/overrides.c b/overrides.c index 576328a..2fe0111 100644 --- a/overrides.c +++ b/overrides.c @@ -1,6 +1,7 @@ #include "overrides.h" #include "overrides/beetle-pce-fast.h" #include "overrides/bluemsx.h" +#include "overrides/fake-08.h" #include "overrides/fceumm.h" #include "overrides/fmsx.h" #include "overrides/gambatte.h" @@ -19,6 +20,7 @@ static const struct core_override overrides[] = { beetle_pce_fast_overrides, bluemsx_overrides, + fake08_overrides, fceumm_overrides, fmsx_overrides, gambatte_overrides, diff --git a/overrides/fake-08.h b/overrides/fake-08.h new file mode 100644 index 0000000..8773958 --- /dev/null +++ b/overrides/fake-08.h @@ -0,0 +1,19 @@ +#include "overrides.h" + +me_bind_action fake08_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 }, + { "O ", 1 << RETRO_DEVICE_ID_JOYPAD_A }, + { "X ", 1 << RETRO_DEVICE_ID_JOYPAD_B }, + { "START ", 1 << RETRO_DEVICE_ID_JOYPAD_START }, + { NULL, 0 } +}; + +#define fake08_overrides { \ + .core_name = "fake-08", \ + .actions = fake08_ctrl_actions, \ + .action_size = array_size(fake08_ctrl_actions), \ +} diff --git a/patches/fake-08/0001-fix-resume-state.patch b/patches/fake-08/0001-fix-resume-state.patch new file mode 100644 index 0000000..b3d73bc --- /dev/null +++ b/patches/fake-08/0001-fix-resume-state.patch @@ -0,0 +1,81 @@ +diff --git a/platform/libretro/libretro.cpp b/platform/libretro/libretro.cpp +index 927ea8d4b8d1658a1d7521fe7e9abcbdede0ba5f..63a43f3f065344cdf45e0b10e5c9c089736695f2 100644 +--- a/platform/libretro/libretro.cpp ++++ b/platform/libretro/libretro.cpp +@@ -82,6 +82,46 @@ EXPORT void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audio_ + EXPORT void retro_set_input_poll(retro_input_poll_t cb) { input_poll_cb = cb; } + EXPORT void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; } + ++ ++static int frames = 0; ++static int defer_frames = 2; ++static void* deferred_data = NULL; ++static size_t deferred_size = 0; ++ ++static void free_deferred_data(void) { ++ if (deferred_size) { ++ if (log_cb) log_cb(RETRO_LOG_INFO, "Freed deferred save state.\n"); ++ free(deferred_data); ++ deferred_data = NULL; ++ deferred_size = 0; ++ } ++} ++ ++static void defer_unserialize(const void *data, size_t size) { ++ free_deferred_data(); ++ ++ if (data==NULL || size<=0) return; ++ ++ if (log_cb) log_cb(RETRO_LOG_INFO, "Deferred save state load.\n"); ++ ++ deferred_data = malloc(size); ++ memcpy(deferred_data, data, size); ++ deferred_size = size; ++} ++static void update_deferred(void) { ++ frames += 1; ++ ++ if (frames<defer_frames) return; ++ ++ if (deferred_size==0) return; ++ ++ retro_unserialize(deferred_data, deferred_size); ++ ++ if (log_cb) log_cb(RETRO_LOG_INFO, "Loaded deferred save state.\n"); ++ ++ free_deferred_data(); ++} ++ + EXPORT void retro_init() + { + retro_log_callback log; +@@ -132,6 +172,8 @@ EXPORT void retro_deinit() + if (log_cb) { + log_cb(RETRO_LOG_INFO, "Retro deinit called. tearing down\n"); + } ++ free_deferred_data(); ++ + //delete things created in init + _vm->CloseCart(); + _host->oneTimeCleanup(); +@@ -205,6 +247,8 @@ int flip = 0; + + EXPORT void retro_run() + { ++ if (frames<defer_frames) update_deferred(); ++ + //TODO: improve this so slower hardware can play 30fps games at full speed + if (_vm->getTargetFps() == 60 || frame % 2 == 0) + { +@@ -396,6 +440,11 @@ EXPORT bool retro_serialize(void *data, size_t size) + + EXPORT bool retro_unserialize(const void *data, size_t size) + { ++ if (frames<defer_frames) { ++ defer_unserialize(data,size); ++ return true; ++ } ++ + if (log_cb) { + log_cb(RETRO_LOG_INFO, "lua deserialize\n"); + } diff --git a/patches/fake-08/1000-funkey-s-build.patch b/patches/fake-08/1000-funkey-s-build.patch new file mode 100644 index 0000000..e5f5046 --- /dev/null +++ b/patches/fake-08/1000-funkey-s-build.patch @@ -0,0 +1,17 @@ +diff --git a/platform/libretro/Makefile b/platform/libretro/Makefile +index 420f9b7..b247ec0 100644 +--- a/platform/libretro/Makefile ++++ b/platform/libretro/Makefile +@@ -123,7 +123,11 @@ else ifeq ($(platform), miyoomini) + CXXFLAGS += -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve + fpic := -fPIC + SHARED := -shared -Wl,--version-script=link.T +- ++else ifeq ($(platform), classic_armv7_a7) ++ TARGET := $(TARGET_NAME)_libretro.so ++ CXXFLAGS += -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve ++ fpic := -fPIC ++ SHARED := -shared -Wl,--version-script=link.T + else ifeq ($(platform), gcw0) + TARGET := $(TARGET_NAME)_libretro_gcw0.so + CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc |