From b54c30613e5a4ade90aa81e832c90f9ab5307cb7 Mon Sep 17 00:00:00 2001 From: neonloop Date: Thu, 26 Jan 2023 00:59:49 +0000 Subject: Forces poll for input before reading Fixes arduous which reads input but never polls --- Makefile | 2 +- core.c | 10 ++++++++++ core.h | 1 + main.c | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6dc3659..bdb6e7e 100644 --- a/Makefile +++ b/Makefile @@ -525,7 +525,7 @@ Comment=Small screen libretro frontend Exec=picoarch %f Icon=sdlretro_icon SelectorBrowser=true -SelectorDir=/mnt/FunKey/.picoarch/cores +SelectorDir=/mnt/Libretro/cores SelectorFilter=so Terminal=false Type=Application diff --git a/core.c b/core.c index 34810a5..2f37a5a 100644 --- a/core.c +++ b/core.c @@ -34,6 +34,7 @@ static char system_dir[MAX_PATH]; static struct retro_disk_control_ext_callback disk_control_ext; static uint32_t buttons = 0; +static int polled = 0; static int core_load_game_info(struct content *content, struct retro_game_info *game_info) { struct retro_system_info info = {}; @@ -534,10 +535,14 @@ static void pa_input_poll(void) { handle_emu_action(which); buttons = actions[IN_BINDTYPE_PLAYER12]; + polled = 1; } static int16_t pa_input_state(unsigned port, unsigned device, unsigned index, unsigned id) { if (port == 0 && device == RETRO_DEVICE_JOYPAD && index == 0) { + if (!polled) + pa_input_poll(); + if (id == RETRO_DEVICE_ID_JOYPAD_MASK) return buttons; @@ -696,6 +701,11 @@ void core_apply_cheats(struct cheats *cheats) { } } +void core_run_frame(void) { + polled = 0; + current_core.retro_run(); +} + void core_unload_content(void) { sram_write(); diff --git a/core.h b/core.h index bc855d4..a267b6e 100644 --- a/core.h +++ b/core.h @@ -65,6 +65,7 @@ int core_open(const char *corefile); void core_load(void); int core_load_content(struct content *content); void core_apply_cheats(struct cheats *cheats); +void core_run_frame(void); void core_unload_content(void); const char **core_extensions(void); void core_unload(void); diff --git a/main.c b/main.c index db95db1..c14f2fb 100644 --- a/main.c +++ b/main.c @@ -698,7 +698,7 @@ int main(int argc, char **argv) { do { count_fps(); adjust_audio(); - current_core.retro_run(); + core_run_frame(); perform_emu_action(); #ifdef FUNKEY_S if (should_suspend) { -- cgit v1.2.3