From ff8849671af5ac14fc9cc9d37da30f53d3f13d89 Mon Sep 17 00:00:00 2001 From: Caian Benedicto Date: Wed, 4 Aug 2021 17:05:17 -0300 Subject: Update TamperMachine and disable write-to-code prevention (#2506) * Enable write to memory and improve logging * Update tamper machine opcodes and improve reporting * Add Else support * Add missing private statement --- Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'Ryujinx.HLE/HOS/Tamper/Operations') diff --git a/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs b/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs index 0ba0f8c3..b7c5684e 100644 --- a/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs +++ b/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs @@ -6,27 +6,26 @@ namespace Ryujinx.HLE.HOS.Tamper.Operations class IfBlock : IOperation { private ICondition _condition; - private IEnumerable _operations; + private IEnumerable _operationsThen; + private IEnumerable _operationsElse; - public IfBlock(ICondition condition, IEnumerable operations) + public IfBlock(ICondition condition, IEnumerable operationsThen, IEnumerable operationsElse) { _condition = condition; - _operations = operations; - } - - public IfBlock(ICondition condition, params IOperation[] operations) - { - _operations = operations; + _operationsThen = operationsThen; + _operationsElse = operationsElse; } public void Execute() { - if (!_condition.Evaluate()) + IEnumerable operations = _condition.Evaluate() ? _operationsThen : _operationsElse; + + if (operations == null) { return; } - foreach (IOperation op in _operations) + foreach (IOperation op in operations) { op.Execute(); } -- cgit v1.2.3