aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorneonloop2023-01-16 23:15:21 +0000
committerneonloop2023-01-16 23:15:21 +0000
commit9128b4e516438301cfcfa7f400d9a4b46bac73ac (patch)
treeba816259f09772867a16480178f27d7f928d3774 /patches
parent16b5618b17e11773a416ab377bdd3fcd4098520b (diff)
downloadpicoarch-9128b4e516438301cfcfa7f400d9a4b46bac73ac.tar.gz
picoarch-9128b4e516438301cfcfa7f400d9a4b46bac73ac.tar.bz2
picoarch-9128b4e516438301cfcfa7f400d9a4b46bac73ac.zip
Adds fake-08 core
Includes resume state patch from shauninman, thanks! https://github.com/shauninman/picoarch/blob/miniui-miyoomini/patches/fake-08/001-fix-resume-state.patch
Diffstat (limited to 'patches')
-rw-r--r--patches/fake-08/0001-fix-resume-state.patch81
-rw-r--r--patches/fake-08/1000-funkey-s-build.patch17
2 files changed, 98 insertions, 0 deletions
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