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
This commit is contained in:
Caian Benedicto 2021-08-04 17:05:17 -03:00 committed by GitHub
parent a27986c311
commit ff8849671a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 156 additions and 66 deletions

View file

@ -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();
}