From: notaz Date: Sun, 10 Dec 2023 21:54:53 +0000 (+0200) Subject: misc: avoid assertion failure when state save fails X-Git-Tag: r24~17 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=8338889c466f3dc392a7a83598a65dcac8cbcc38 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);