diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.HLE/HOS/Tamper/Conditions | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Tamper/Conditions')
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs | 21 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs | 21 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs | 21 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs | 21 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs | 21 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs | 21 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/ICondition.cs | 7 | ||||
| -rw-r--r-- | src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs | 19 |
8 files changed, 152 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs new file mode 100644 index 00000000..ad5bd223 --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondEQ.cs @@ -0,0 +1,21 @@ +using Ryujinx.HLE.HOS.Tamper.Operations; + +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + class CondEQ<T> : ICondition where T : unmanaged + { + private IOperand _lhs; + private IOperand _rhs; + + public CondEQ(IOperand lhs, IOperand rhs) + { + _lhs = lhs; + _rhs = rhs; + } + + public bool Evaluate() + { + return (dynamic)_lhs.Get<T>() == (dynamic)_rhs.Get<T>(); + } + } +} diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs new file mode 100644 index 00000000..d9ad6d81 --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGE.cs @@ -0,0 +1,21 @@ +using Ryujinx.HLE.HOS.Tamper.Operations; + +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + class CondGE<T> : ICondition where T : unmanaged + { + private IOperand _lhs; + private IOperand _rhs; + + public CondGE(IOperand lhs, IOperand rhs) + { + _lhs = lhs; + _rhs = rhs; + } + + public bool Evaluate() + { + return (dynamic)_lhs.Get<T>() >= (dynamic)_rhs.Get<T>(); + } + } +} diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs new file mode 100644 index 00000000..262457da --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondGT.cs @@ -0,0 +1,21 @@ +using Ryujinx.HLE.HOS.Tamper.Operations; + +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + class CondGT<T> : ICondition where T : unmanaged + { + private IOperand _lhs; + private IOperand _rhs; + + public CondGT(IOperand lhs, IOperand rhs) + { + _lhs = lhs; + _rhs = rhs; + } + + public bool Evaluate() + { + return (dynamic)_lhs.Get<T>() > (dynamic)_rhs.Get<T>(); + } + } +} diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs new file mode 100644 index 00000000..fd488bc1 --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLE.cs @@ -0,0 +1,21 @@ +using Ryujinx.HLE.HOS.Tamper.Operations; + +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + class CondLE<T> : ICondition where T : unmanaged + { + private IOperand _lhs; + private IOperand _rhs; + + public CondLE(IOperand lhs, IOperand rhs) + { + _lhs = lhs; + _rhs = rhs; + } + + public bool Evaluate() + { + return (dynamic)_lhs.Get<T>() <= (dynamic)_rhs.Get<T>(); + } + } +} diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs new file mode 100644 index 00000000..744eb5dc --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondLT.cs @@ -0,0 +1,21 @@ +using Ryujinx.HLE.HOS.Tamper.Operations; + +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + class CondLT<T> : ICondition where T : unmanaged + { + private IOperand _lhs; + private IOperand _rhs; + + public CondLT(IOperand lhs, IOperand rhs) + { + _lhs = lhs; + _rhs = rhs; + } + + public bool Evaluate() + { + return (dynamic)_lhs.Get<T>() < (dynamic)_rhs.Get<T>(); + } + } +} diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs new file mode 100644 index 00000000..2709ad92 --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/CondNE.cs @@ -0,0 +1,21 @@ +using Ryujinx.HLE.HOS.Tamper.Operations; + +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + class CondNE<T> : ICondition where T : unmanaged + { + private IOperand _lhs; + private IOperand _rhs; + + public CondNE(IOperand lhs, IOperand rhs) + { + _lhs = lhs; + _rhs = rhs; + } + + public bool Evaluate() + { + return (dynamic)_lhs.Get<T>() != (dynamic)_rhs.Get<T>(); + } + } +} diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/ICondition.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/ICondition.cs new file mode 100644 index 00000000..f15ceffe --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/ICondition.cs @@ -0,0 +1,7 @@ +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + interface ICondition + { + bool Evaluate(); + } +} diff --git a/src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs b/src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs new file mode 100644 index 00000000..8d75a0e1 --- /dev/null +++ b/src/Ryujinx.HLE/HOS/Tamper/Conditions/InputMask.cs @@ -0,0 +1,19 @@ +namespace Ryujinx.HLE.HOS.Tamper.Conditions +{ + class InputMask : ICondition + { + private long _mask; + private Parameter<long> _input; + + public InputMask(long mask, Parameter<long> input) + { + _mask = mask; + _input = input; + } + + public bool Evaluate() + { + return (_input.Value & _mask) == _mask; + } + } +} |
