From: notaz <notasas@gmail.com>
Date: Wed, 15 Jan 2025 23:06:43 +0000 (+0200)
Subject: misc: hard-reset cpu on hle change
X-Git-Tag: r25~55
X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e9d82d022f06cc8c005c64ec25383a5e10136ca;p=pcsx_rearmed.git

misc: hard-reset cpu on hle change
---

diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index 1fb045ce..34745add 100644
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -751,10 +751,10 @@ int LoadState(const char *file) {
 	void *f;
 	GPUFreeze_t *gpufP = NULL;
 	SPUFreeze_t *spufP = NULL;
+	boolean hle, oldhle;
 	int Size;
 	char header[32];
 	u32 version;
-	boolean hle;
 	int result = -1;
 
 	f = SaveFuncs.open(file, "rb");
@@ -768,6 +768,7 @@ int LoadState(const char *file) {
 		SysPrintf("incompatible savestate version %x\n", version);
 		goto cleanup;
 	}
+	oldhle = Config.HLE;
 	Config.HLE = hle;
 
 	if (Config.HLE)
@@ -826,6 +827,11 @@ int LoadState(const char *file) {
 	if (Config.HLE)
 		psxBiosCheckExe(biosBranchCheckOld, 0x60, 1);
 
+	if (Config.HLE != oldhle) {
+		// at least ari64 drc compiles differently so hard reset
+		psxCpu->Shutdown();
+		psxCpu->Init();
+	}
 	psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, NULL);
 
 	result = 0;