From d4d4bfd3d1f9cce8cde011436404cfa62a9e5165 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 29 Mar 2021 21:08:28 -0700 Subject: [PATCH] Core: Fix first event scheduling after loading savestate --- CHANGES | 1 + src/core/timing.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 945199227..9f9a5ab7f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ 0.10.0: (Future) Emulation fixes: + - Core: Fix first event scheduling after loading savestate - GBA Memory: Fix loading Thumb savestates when in ARM mode 0.9.0: (2021-03-28) diff --git a/src/core/timing.c b/src/core/timing.c index ddee6d332..4ac09a5a0 100644 --- a/src/core/timing.c +++ b/src/core/timing.c @@ -100,7 +100,10 @@ int32_t mTimingTick(struct mTiming* timing, int32_t cycles) { if (timing->reroot) { timing->root = timing->reroot; timing->reroot = NULL; - *timing->nextEvent = mTimingNextEvent(timing); + *timing->nextEvent = mTimingNextEvent(timing); + if (*timing->nextEvent <= 0) { + return mTimingTick(timing, 0); + } } return *timing->nextEvent; }