From a0e2a3db1deb4e2ba598363039a28515b8de84cb Mon Sep 17 00:00:00 2001 From: kd-11 Date: Fri, 30 Sep 2022 22:48:47 +0300 Subject: [PATCH] Fix underflow in ZCULL sync --- rpcs3/Emu/RSX/RSXZCULL.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/RSXZCULL.cpp b/rpcs3/Emu/RSX/RSXZCULL.cpp index bb31769679..0d41f26d0c 100644 --- a/rpcs3/Emu/RSX/RSXZCULL.cpp +++ b/rpcs3/Emu/RSX/RSXZCULL.cpp @@ -490,7 +490,8 @@ namespace rsx // Delete all statistics caches but leave the current one const u32 current_index = m_statistics_tag_id; - for (u32 index = current_index - 1; index != current_index;) + const u32 previous_index = (current_index + max_stat_registers - 1) % max_stat_registers; + for (u32 index = previous_index; index != current_index;) { if (m_statistics_map[index].flags == 0) {