X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=libpcsxcore%2Fmisc.c;h=a07ab19ccc2457a223cf71a0edd0a4511ba3de6c;hb=02dbc8694f303728f19734328166a1c6dfef289c;hp=be501a2c028bcdc85510aaee8bacb4cd2ffeb144;hpb=ebed7428a3e7e817bb4befe7fdfc1f5681577e50;p=pcsx_rearmed.git diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index be501a2c..a07ab19c 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -603,6 +603,15 @@ static const char PcsxHeader[32] = "STv4 PCSX v" PCSX_VERSION; // If you make changes to the savestate version, please increment the value below. static const u32 SaveVersion = 0x8b410006; +static int drc_is_lightrec(void) +{ +#if defined(LIGHTREC) + return 1; +#else + return 0; +#endif +} + int SaveState(const char *file) { void *f; GPUFreeze_t *gpufP; @@ -615,6 +624,9 @@ int SaveState(const char *file) { new_dyna_before_save(); + if (drc_is_lightrec() && Config.Cpu != CPU_INTERPRETER) + lightrec_plugin_prepare_save_state(); + SaveFuncs.write(f, (void *)PcsxHeader, 32); SaveFuncs.write(f, (void *)&SaveVersion, sizeof(u32)); SaveFuncs.write(f, (void *)&Config.HLE, sizeof(boolean)); @@ -690,12 +702,8 @@ int LoadState(const char *file) { if (Config.HLE) psxBiosInit(); -#if defined(LIGHTREC) - if (Config.Cpu != CPU_INTERPRETER) - psxCpu->Clear(0, UINT32_MAX); //clear all - else -#endif - psxCpu->Reset(); + if (!drc_is_lightrec() || Config.Cpu == CPU_INTERPRETER) + psxCpu->Reset(); SaveFuncs.seek(f, 128 * 96 * 3, SEEK_CUR); SaveFuncs.read(f, psxM, 0x00200000); @@ -704,6 +712,9 @@ int LoadState(const char *file) { SaveFuncs.read(f, &psxRegs, offsetof(psxRegisters, gteBusyCycle)); psxRegs.gteBusyCycle = psxRegs.cycle; + if (drc_is_lightrec() && Config.Cpu != CPU_INTERPRETER) + lightrec_plugin_prepare_load_state(); + if (Config.HLE) psxBiosFreeze(0);