From 3b445fb3e4bee0a1d180b8ce2a01330e6b4d30eb Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Thu, 21 Sep 2023 17:18:03 -0400 Subject: [PATCH] Flush the current firmware before resetting --- src/libretro/libretro.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libretro/libretro.cpp b/src/libretro/libretro.cpp index 0b80a9b1..34d9a414 100644 --- a/src/libretro/libretro.cpp +++ b/src/libretro/libretro.cpp @@ -531,12 +531,22 @@ PUBLIC_SYMBOL void retro_reset(void) { // Flush all data before resetting melonds::file::reset(); melonds::sram::reset(); + retro::task::find([](retro::task::TaskHandle& task) { + if (task.Identifier() == melonds::flushTaskId) { + // If this is the flush task we want to cancel... + task.Cancel(); + return true; + } + return false; // Keep looking... + }); retro::task::check(); const optional& nds_info = retro::content::get_loaded_nds_info(); const NDSHeader* header = nds_info ? reinterpret_cast(nds_info->data) : nullptr; melonds::InitConfig(header, melonds::screenLayout, melonds::input_state); + melonds::InitFlushFirmwareTask(); + { ZoneScopedN("NDS::Reset"); NDS::Reset();