From: notaz Date: Sun, 10 Dec 2023 21:54:53 +0000 (+0200) Subject: misc: avoid assertion failure when state save fails X-Git-Tag: r24l~24 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b30da68d81276b8a684457b9865290c05c3ea438;p=pcsx_rearmed.git misc: avoid assertion failure when state save fails --- diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index e652cc48..0848c267 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -677,6 +677,10 @@ int SaveState(const char *file) { assert(!psxRegs.branching); assert(!psxRegs.cpuInRecursion); assert(!misc->magic); + + f = SaveFuncs.open(file, "wb"); + if (f == NULL) return -1; + misc->magic = MISC_MAGIC; misc->gteBusyCycle = psxRegs.gteBusyCycle; misc->muldivBusyCycle = psxRegs.muldivBusyCycle; @@ -687,9 +691,6 @@ int SaveState(const char *file) { misc->frame_counter = frame_counter; misc->CdromFrontendId = CdromFrontendId; - f = SaveFuncs.open(file, "wb"); - if (f == NULL) return -1; - psxCpu->Notify(R3000ACPU_NOTIFY_BEFORE_SAVE, NULL); SaveFuncs.write(f, (void *)PcsxHeader, 32);