From 535ad110e37cfbe59231d9e96f4019da21e05fa2 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Sat, 22 Apr 2023 05:34:03 +0100 Subject: [PATCH] VU-JIT: Backup non cached VI before writing to it when load != write --- pcsx2/x86/microVU_IR.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pcsx2/x86/microVU_IR.h b/pcsx2/x86/microVU_IR.h index 6632a699f5..62dc354bf9 100644 --- a/pcsx2/x86/microVU_IR.h +++ b/pcsx2/x86/microVU_IR.h @@ -1025,7 +1025,17 @@ public: // allocate a new register for writing to int x = findFreeGPR(viWriteReg); const xRegister32& gprX = xRegister32::GetInstance(x); + writeBackReg(gprX, true); + + // writeReg not cached, needs backing up + if (backup && gprMap[x].VIreg != viWriteReg) + { + xMOVZX(gprX, ptr16[&getVI(viWriteReg)]); + writeVIBackup(gprX); + backup = false; + } + if (zext_if_dirty) xMOVZX(gprX, xRegister16(i)); else