From 56d553f10d92b97468537646bd7bb33f2c3caa7c Mon Sep 17 00:00:00 2001 From: eladash Date: Mon, 20 Aug 2018 15:13:35 +0300 Subject: [PATCH] Rsx: fix cmd jump over put register --- rpcs3/Emu/RSX/RSXThread.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index deb3d3a52c..bcd21f4323 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -648,8 +648,6 @@ namespace rsx continue; } - const u32 count = (cmd >> 18) & 0x7ff; - if ((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) == RSX_METHOD_OLD_JUMP_CMD) { u32 offs = cmd & 0x1ffffffc; @@ -734,6 +732,8 @@ namespace rsx continue; } + u32 count = (cmd >> 18) & 0x7ff; + //Validate the args ptr if the command attempts to read from it const u32 args_address = RSXIOMem.RealAddr(internal_get + 4); @@ -762,10 +762,11 @@ namespace rsx auto args = vm::ptr::make(args_address); u32 first_cmd = (cmd & 0xfffc) >> 2; - // Not sure if this is worth trying to fix, but if it happens, its bad - // so logging it until its reported - if (internal_get < put && ((internal_get + (count + 1) * 4) > put)) - LOG_ERROR(RSX, "Get pointer jumping over put pointer! This is bad!"); + // Stop command execution if put will be equal to get ptr during the execution itself + if (count * 4 + 4 > put - internal_get) + { + count = (put - internal_get) / 4 - 1; + } if (performance_counters.state != FIFO_state::running) {