From 9b050a33e40cffa87e9385d73d5352c981e95982 Mon Sep 17 00:00:00 2001 From: Eladash Date: Mon, 28 Jun 2021 13:57:57 +0300 Subject: [PATCH] Fix HLE callbacks within context of HLE PPU stack variables --- rpcs3/Emu/Cell/PPUCallback.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/PPUCallback.h b/rpcs3/Emu/Cell/PPUCallback.h index 9410a8c35f..e971436a1e 100644 --- a/rpcs3/Emu/Cell/PPUCallback.h +++ b/rpcs3/Emu/Cell/PPUCallback.h @@ -170,10 +170,12 @@ namespace ppu_cb_detail { FORCE_INLINE static void call(ppu_thread& CPU, u32 pc, u32 rtoc, T... args) { + const u64 old_r1 = CPU.gpr[1]; + CPU.gpr[1] &= -16; // Ensure 16-byte alignment const bool stack = _bind_func_args<0, 0, 0, T...>(CPU, args...); CPU.gpr[1] -= stack ? FIXED_STACK_FRAME_SIZE : 0x70; // create reserved area CPU.fast_call(pc, rtoc); - CPU.gpr[1] += stack ? FIXED_STACK_FRAME_SIZE : 0x70; + CPU.gpr[1] = old_r1; } }; }