From cee712105850ac3385cd0091a923438167433f9f Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:22:00 +0200 Subject: Move solution and projects to src --- src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs (limited to 'src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs') diff --git a/src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs b/src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs new file mode 100644 index 00000000..ef95fa2b --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Operations/ForBlock.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Ryujinx.HLE.HOS.Tamper.Operations +{ + class ForBlock : IOperation + { + private ulong _count; + private Register _register; + private IEnumerable _operations; + + public ForBlock(ulong count, Register register, IEnumerable 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(i); + + foreach (IOperation op in _operations) + { + op.Execute(); + } + } + } + } +} -- cgit v1.2.3