From 802ff0a44626c8ac8e0057b7645f8a11d3657d42 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 18 Dec 2024 01:28:11 +0200 Subject: [PATCH] psxinterpreter: avoid excessive icache clearing --- libpcsxcore/psxinterpreter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index c19f1c21..7e732558 100644 --- a/libpcsxcore/psxinterpreter.c +++ b/libpcsxcore/psxinterpreter.c @@ -1243,7 +1243,8 @@ static void intNotify(enum R3000Anote note, void *data) { setupCop(psxRegs.CP0.n.SR); // fallthrough case R3000ACPU_NOTIFY_CACHE_ISOLATED: // Armored Core? - memset(&ICache, 0xff, sizeof(ICache)); + if (fetch == fetchICache) + memset(&ICache, 0xff, sizeof(ICache)); break; case R3000ACPU_NOTIFY_CACHE_UNISOLATED: break; @@ -1340,8 +1341,10 @@ void intApplyConfig() { // the dynarec may occasionally call the interpreter, in such a case the // cache won't work (cache only works right if all fetches go through it) - if (!Config.icache_emulation || psxCpu != &psxInt) + if (!Config.icache_emulation || psxCpu != &psxInt) { fetch = fetchNoCache; + memset(&ICache, 0xff, sizeof(ICache)); + } else fetch = fetchICache; -- 2.39.5