From 8b35fb80b404691559a1aaecf1f4173a49352fee Mon Sep 17 00:00:00 2001 From: RTA Date: Sun, 16 Mar 2025 12:46:31 +0100 Subject: [PATCH] Reset static device state on core unload to ensure input descriptors refresh --- shell/libretro/libretro.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/libretro/libretro.cpp b/shell/libretro/libretro.cpp index cc80eac56..70a301e2a 100644 --- a/shell/libretro/libretro.cpp +++ b/shell/libretro/libretro.cpp @@ -311,6 +311,9 @@ static void retro_keyboard_event(bool down, unsigned keycode, uint32_t character // Now comes the interesting stuff void retro_init() { + first_run = true; + memset(device_type, -1, sizeof(device_type)); + static bool emuInited; // Logging @@ -371,6 +374,7 @@ void retro_deinit() { INFO_LOG(COMMON, "retro_deinit"); first_run = true; + memset(device_type, -1, sizeof(device_type)); //When auto-save states are enabled this is needed to prevent the core from shutting down before //any save state actions are still running - which results in partial saves