diff --git a/blocks/cflow/InstructionEmulator.cs b/blocks/cflow/InstructionEmulator.cs index 7894bf49..4fe84729 100644 --- a/blocks/cflow/InstructionEmulator.cs +++ b/blocks/cflow/InstructionEmulator.cs @@ -23,7 +23,7 @@ using Mono.Cecil; using Mono.Cecil.Cil; namespace de4dot.blocks.cflow { - class InstructionEmulator { + public class InstructionEmulator { ValueStack valueStack = new ValueStack(); IList parameterDefinitions; IList variableDefinitions; @@ -31,6 +31,13 @@ namespace de4dot.blocks.cflow { List locals = new List(); int argBase; + public InstructionEmulator() { + } + + public InstructionEmulator(bool hasThis, bool initLocals, IList parameterDefinitions, IList variableDefinitions) { + init(hasThis, initLocals, parameterDefinitions, variableDefinitions); + } + public void init(bool hasThis, bool initLocals, IList parameterDefinitions, IList variableDefinitions) { this.parameterDefinitions = parameterDefinitions; this.variableDefinitions = variableDefinitions; @@ -201,6 +208,10 @@ namespace de4dot.blocks.cflow { return new UnknownValue(); } + public void push(Value value) { + valueStack.push(value); + } + public Value pop() { return valueStack.pop(); } diff --git a/blocks/cflow/Int32Value.cs b/blocks/cflow/Int32Value.cs index 7ca1dbba..b5ef5572 100644 --- a/blocks/cflow/Int32Value.cs +++ b/blocks/cflow/Int32Value.cs @@ -20,7 +20,7 @@ using System; namespace de4dot.blocks.cflow { - class Int32Value : Value { + public class Int32Value : Value { const uint NO_UNKNOWN_BITS = uint.MaxValue; public readonly int value; public readonly uint validMask; diff --git a/blocks/cflow/Int64Value.cs b/blocks/cflow/Int64Value.cs index b91211ef..54a78563 100644 --- a/blocks/cflow/Int64Value.cs +++ b/blocks/cflow/Int64Value.cs @@ -20,7 +20,7 @@ using System; namespace de4dot.blocks.cflow { - class Int64Value : Value { + public class Int64Value : Value { const ulong NO_UNKNOWN_BITS = ulong.MaxValue; public readonly long value; public readonly ulong validMask; diff --git a/blocks/cflow/Real8Value.cs b/blocks/cflow/Real8Value.cs index 8b5f3e6f..48d5bb88 100644 --- a/blocks/cflow/Real8Value.cs +++ b/blocks/cflow/Real8Value.cs @@ -18,7 +18,7 @@ */ namespace de4dot.blocks.cflow { - class Real8Value : Value { + public class Real8Value : Value { public readonly double value; public Real8Value(double value) diff --git a/blocks/cflow/Value.cs b/blocks/cflow/Value.cs index e68ef552..e5f8f6ea 100644 --- a/blocks/cflow/Value.cs +++ b/blocks/cflow/Value.cs @@ -18,7 +18,7 @@ */ namespace de4dot.blocks.cflow { - enum ValueType : byte { + public enum ValueType : byte { Unknown, Null, Boxed, @@ -28,13 +28,13 @@ namespace de4dot.blocks.cflow { String, } - enum Bool3 { + public enum Bool3 { Unknown = -1, False, True, } - abstract class Value { + public abstract class Value { public readonly ValueType valueType; public bool isUnknown() { @@ -70,7 +70,7 @@ namespace de4dot.blocks.cflow { } } - class UnknownValue : Value { + public class UnknownValue : Value { public UnknownValue() : base(ValueType.Unknown) { } @@ -80,7 +80,7 @@ namespace de4dot.blocks.cflow { } } - class NullValue : Value { + public class NullValue : Value { // There's only one type of null public static readonly NullValue Instance = new NullValue(); @@ -93,7 +93,7 @@ namespace de4dot.blocks.cflow { } } - class BoxedValue : Value { + public class BoxedValue : Value { public readonly Value value; public BoxedValue(Value value) @@ -106,7 +106,7 @@ namespace de4dot.blocks.cflow { } } - class StringValue : Value { + public class StringValue : Value { public readonly string value; public StringValue(string value)