aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs')
-rw-r--r--Ryujinx.HLE/HOS/Tamper/Operations/IfBlock.cs19
1 files changed, 9 insertions, 10 deletions
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<IOperation> _operations;
+ private IEnumerable<IOperation> _operationsThen;
+ private IEnumerable<IOperation> _operationsElse;
- public IfBlock(ICondition condition, IEnumerable<IOperation> operations)
+ public IfBlock(ICondition condition, IEnumerable<IOperation> operationsThen, IEnumerable<IOperation> 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<IOperation> operations = _condition.Evaluate() ? _operationsThen : _operationsElse;
+
+ if (operations == null)
{
return;
}
- foreach (IOperation op in _operations)
+ foreach (IOperation op in operations)
{
op.Execute();
}