Skip to content

Commit

Permalink
Flush the current firmware before resetting
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTG committed Sep 21, 2023
1 parent 3605095 commit 3b445fb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<struct retro_game_info>& nds_info = retro::content::get_loaded_nds_info();
const NDSHeader* header = nds_info ? reinterpret_cast<const NDSHeader*>(nds_info->data) : nullptr;
melonds::InitConfig(header, melonds::screenLayout, melonds::input_state);

melonds::InitFlushFirmwareTask();

{
ZoneScopedN("NDS::Reset");
NDS::Reset();
Expand Down

0 comments on commit 3b445fb

Please sign in to comment.