aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs')
-rw-r--r--Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs b/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs
new file mode 100644
index 00000000..a478991b
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs
@@ -0,0 +1,42 @@
+using Ryujinx.HLE.HOS.Tamper.Conditions;
+using System.Collections.Generic;
+
+namespace Ryujinx.HLE.HOS.Tamper.Operations
+{
+ class ForBlock : IOperation
+ {
+ private ulong _count;
+ private Register _register;
+ private IEnumerable<IOperation> _operations;
+
+ public ForBlock(ulong count, Register register, IEnumerable<IOperation> operations)
+ {
+ _count = count;
+ _register = register;
+ _operations = operations;
+ }
+
+ public ForBlock(ulong count, Register register, params IOperation[] operations)
+ {
+ _count = count;
+ _register = register;
+ _operations = operations;
+ }
+
+ public void Execute()
+ {
+ for (ulong i = 0; i < _count; i++)
+ {
+ // Set the register and execute the operations so that changing the
+ // register during runtime does not break iteration.
+
+ _register.Set<ulong>(i);
+
+ foreach (IOperation op in _operations)
+ {
+ op.Execute();
+ }
+ }
+ }
+ }
+}