Exemple #1
0
        public VMSlot GetValue(EmuContext ctx, PointerType type)
        {
            object obj  = this.instance;
            bool   flag = this.field.DeclaringType.IsValueType && this.instance is IReference;

            if (flag)
            {
                obj = ((IReference)this.instance).GetValue(ctx, PointerType.OBJECT).ToObject(this.field.DeclaringType);
            }
            return(VMSlot.FromObject(this.field.GetValue(obj), this.field.FieldType));
        }
Exemple #2
0
        public unsafe VMSlot GetValue(EmuContext ctx, PointerType type)
        {
            bool           flag = this._ptr != null;
            TypedReference typedReference;

            if (flag)
            {
                *(&typedReference) = *(TypedReference *)this._ptr.Value;
            }
            else
            {
                *(TypedRef.PseudoTypedRef *)(&typedReference) = this._typedRef;
            }
            return(VMSlot.FromObject(TypedReference.ToObject(typedReference), __reftype(typedReference)));
        }
Exemple #3
0
        public unsafe void SetValue(EmuContext ctx, VMSlot slot, PointerType type)
        {
            bool flag = this.field.DeclaringType.IsValueType && this.instance is IReference;

            if (flag)
            {
                TypedReference obj;
                ((IReference)this.instance).ToTypedReference(ctx, (void *)(&obj), this.field.DeclaringType);
                this.field.SetValueDirect(obj, slot.ToObject(this.field.FieldType));
            }
            else
            {
                this.field.SetValue(this.instance, slot.ToObject(this.field.FieldType));
            }
        }
Exemple #4
0
        public unsafe void SetValue(EmuContext ctx, VMSlot slot, PointerType type)
        {
            bool           flag = this._ptr != null;
            TypedReference typedReference;

            if (flag)
            {
                *(&typedReference) = *(TypedReference *)this._ptr.Value;
            }
            else
            {
                *(TypedRef.PseudoTypedRef *)(&typedReference) = this._typedRef;
            }
            Type   typeFromHandle = __reftype(typedReference);
            object value          = slot.ToObject(typeFromHandle);

            Helpers.TypedReferenceHelpers.SetTypedRef(value, (void *)(&typedReference));
        }
Exemple #5
0
        internal EmuContext(RhydonContext ctx, MethodExport exp)
        {
            Export        = exp;
            MethodBody    = new List <KoiInstruction>();
            Stack         = new Stack <VMSlot>();
            Registers     = new VMSlot[16];
            Handlers      = new Dictionary <byte, KoiHandler>();
            VCallHandlers = new Dictionary <byte, VCallHandler>();

            Module      = ctx.Module;
            Reader      = ctx.Reader;
            Header      = ctx.Header;
            StartOffset = ctx.StartOffset;
            Constants   = ctx.Constants;
            Decompiled  = ctx.Decompiled;
            Logger      = ctx.Logger;
            Parameters  = ctx.Parameters;
        }
Exemple #6
0
 public void SetValue(EmuContext ctx, VMSlot slot, PointerType type)
 {
     throw new NotImplementedException();
 }