From 60adc382056d4272d38673e8045e11f2bca2338d Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:59:13 +0100 Subject: [PATCH] Latte: Add support for more fence conditions MEM_OP_GREATER is required by Injustice: Gods Among Us --- .../HW/Latte/Core/LatteCommandProcessor.cpp | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp b/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp index c928f89f..167911b6 100644 --- a/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp +++ b/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp @@ -475,18 +475,45 @@ LatteCMDPtr LatteCP_itWaitRegMem(LatteCMDPtr cmd, uint32 nWords) { uint32 fenceMemValue = _swapEndianU32(*fencePtr); fenceMemValue &= fenceMask; - if (compareOp == GPU7_WAIT_MEM_OP_GEQUAL) + if (compareOp == GPU7_WAIT_MEM_OP_LESS) { - // greater or equal - if (fenceMemValue >= fenceValue) + if (fenceMemValue < fenceValue) + break; + } + else if (compareOp == GPU7_WAIT_MEM_OP_LEQUAL) + { + if (fenceMemValue <= fenceValue) break; } else if (compareOp == GPU7_WAIT_MEM_OP_EQUAL) { - // equal if (fenceMemValue == fenceValue) break; } + else if (compareOp == GPU7_WAIT_MEM_OP_NOTEQUAL) + { + if (fenceMemValue != fenceValue) + break; + } + else if (compareOp == GPU7_WAIT_MEM_OP_GEQUAL) + { + if (fenceMemValue >= fenceValue) + break; + } + else if (compareOp == GPU7_WAIT_MEM_OP_GREATER) + { + if (fenceMemValue > fenceValue) + break; + } + else if (compareOp == GPU7_WAIT_MEM_OP_ALWAYS) + { + break; + } + else if (compareOp == GPU7_WAIT_MEM_OP_NEVER) + { + cemuLog_logOnce(LogType::Force, "Latte: WAIT_MEM_OP_NEVER encountered"); + break; + } else assert_dbg(); if (!stalls)