aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneonloop2023-01-25 07:11:45 +0000
committerneonloop2023-01-25 07:11:45 +0000
commitb90dbbdc967878dc461fefe78a8ef86886ae7a5a (patch)
tree183a1525c09243c03526df6503f409a76986f6c6
parent7c8e5f4c867fb6a3b9e99f495eea6ffc85d4dc34 (diff)
downloadpicoarch-b90dbbdc967878dc461fefe78a8ef86886ae7a5a.tar.gz
picoarch-b90dbbdc967878dc461fefe78a8ef86886ae7a5a.tar.bz2
picoarch-b90dbbdc967878dc461fefe78a8ef86886ae7a5a.zip
Moves emu action response out of retro_run
Avoids changes to emu state in the middle of a frame, caused problem with fba and maybe rare problems with other cores
-rw-r--r--main.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/main.c b/main.c
index d1a3ee1..e59f2fd 100644
--- a/main.c
+++ b/main.c
@@ -36,6 +36,7 @@ char core_name[MAX_PATH];
int config_override = 0;
int resume_slot = -1;
static int last_screenshot = 0;
+static emu_action eaction = EACTION_NONE;
static uint32_t vsyncs;
static uint32_t renders;
@@ -379,12 +380,11 @@ int remove_config(config_type config_type) {
return ret;
}
-void handle_emu_action(emu_action action)
-{
+static void perform_emu_action(void) {
static emu_action prev_action = EACTION_NONE;
- if (prev_action != EACTION_NONE && prev_action == action) return;
+ if (prev_action != EACTION_NONE && prev_action == eaction) return;
- switch (action)
+ switch (eaction)
{
case EACTION_NONE:
break;
@@ -475,7 +475,13 @@ void handle_emu_action(emu_action action)
break;
}
- prev_action = action;
+ prev_action = eaction;
+ eaction = EACTION_NONE;
+}
+
+void handle_emu_action(emu_action action) {
+ if (action != EACTION_NONE)
+ eaction = action;
}
void pa_log(enum retro_log_level level, const char *fmt, ...) {
@@ -710,6 +716,7 @@ int main(int argc, char **argv) {
count_fps();
adjust_audio();
current_core.retro_run();
+ perform_emu_action();
#ifdef FUNKEY_S
if (should_suspend) {
toggle_fast_forward(1);