Ejemplo n.º 1
0
        public TraceManager(DkmProcess process)
        {
            _process  = process;
            _pyrtInfo = process.GetPythonRuntimeInfo();

            _breakpointData                 = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <ArrayProxy <CliStructProxy <BreakpointData> > >("breakpointData");
            _currentBreakpointData          = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <ByteProxy>("currentBreakpointData");
            _breakpointDataInUseByTraceFunc = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <ByteProxy>("breakpointDataInUseByTraceFunc");
            _currentSourceLocation          = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <CliStructProxy <CurrentSourceLocation> >("currentSourceLocation");
            _stepKind           = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <Int32Proxy>("stepKind");
            _stepThreadId       = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <UInt64Proxy>("stepThreadId");
            _steppingStackDepth = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <Int32Proxy>("steppingStackDepth");

            var onBreakpointHit = _pyrtInfo.DLLs.DebuggerHelper.FindExportName("OnBreakpointHit", true);

            _onBreakpointHitBP = DkmRuntimeInstructionBreakpoint.Create(Guids.PythonTraceManagerSourceGuid, null, onBreakpointHit, false, null);
            _onBreakpointHitBP.Enable();

            var onStepComplete = _pyrtInfo.DLLs.DebuggerHelper.FindExportName("OnStepComplete", true);

            _onStepCompleteBP = DkmRuntimeInstructionBreakpoint.Create(Guids.PythonTraceManagerSourceGuid, null, onStepComplete, false, null);
            _onStepCompleteBP.Enable();

            var onStepFallThrough = _pyrtInfo.DLLs.DebuggerHelper.FindExportName("OnStepFallThrough", true);

            _onStepFallThroughBP = DkmRuntimeInstructionBreakpoint.Create(Guids.PythonTraceManagerSourceGuid, null, onStepFallThrough, false, null);
            _onStepFallThroughBP.Enable();

            WriteBreakpoints();
        }
        public static CommActorInfoView Deserialize(Stream bytes)
        {
            int mask = Int32Proxy.Deserialize(bytes);
            var view = new CommActorInfoView();

            view.AccessLevel = EnumProxy <MemberAccessLevel> .Deserialize(bytes);

            view.Channel = EnumProxy <ChannelType> .Deserialize(bytes);

            if ((mask & 1) != 0)
            {
                view.ClanTag = StringProxy.Deserialize(bytes);
            }

            view.Cmid = Int32Proxy.Deserialize(bytes);

            if ((mask & 2) != 0)
            {
                view.CurrentRoom = GameRoomViewProxy.Deserialize(bytes);
            }

            view.ModerationFlag = ByteProxy.Deserialize(bytes);

            if ((mask & 4) != 0)
            {
                view.ModInformation = StringProxy.Deserialize(bytes);
            }
            if ((mask & 8) != 0)
            {
                view.PlayerName = StringProxy.Deserialize(bytes);
            }

            return(view);
        }
Ejemplo n.º 3
0
    // Token: 0x0600156A RID: 5482 RVA: 0x000784A4 File Offset: 0x000766A4
    public void ReadPlayerPrefs(string pref)
    {
        byte[] bytes = Encoding.ASCII.GetBytes(WWW.UnEscapeURL(pref, Encoding.ASCII));
        using (MemoryStream memoryStream = new MemoryStream(bytes))
        {
            switch (ByteProxy.Deserialize(memoryStream))
            {
            case 0:
                this.Channel = KeyInputChannel.FromBytes(memoryStream);
                break;

            case 1:
                this.Channel = MouseInputChannel.FromBytes(memoryStream);
                break;

            case 2:
                this.Channel = AxisInputChannel.FromBytes(memoryStream);
                break;

            case 3:
                this.Channel = ButtonInputChannel.FromBytes(memoryStream);
                break;
            }
        }
    }
Ejemplo n.º 4
0
    // Token: 0x06001569 RID: 5481 RVA: 0x000783A0 File Offset: 0x000765A0
    public string GetPlayerPrefs()
    {
        string result;

        using (MemoryStream memoryStream = new MemoryStream())
        {
            if (this.Channel is KeyInputChannel)
            {
                ByteProxy.Serialize(memoryStream, 0);
                this.Channel.Serialize(memoryStream);
            }
            else if (this.Channel is MouseInputChannel)
            {
                ByteProxy.Serialize(memoryStream, 1);
                this.Channel.Serialize(memoryStream);
            }
            else if (this.Channel is AxisInputChannel)
            {
                ByteProxy.Serialize(memoryStream, 2);
                this.Channel.Serialize(memoryStream);
            }
            else if (this.Channel is ButtonInputChannel)
            {
                ByteProxy.Serialize(memoryStream, 3);
                this.Channel.Serialize(memoryStream);
            }
            else
            {
                ByteProxy.Serialize(memoryStream, byte.MaxValue);
            }
            result = WWW.EscapeURL(Encoding.ASCII.GetString(memoryStream.ToArray()), Encoding.ASCII);
        }
        return(result);
    }
Ejemplo n.º 5
0
        public unsafe TraceManagerLocalHelper(DkmProcess process, Kind kind)
        {
            _process  = process;
            _pyrtInfo = process.GetPythonRuntimeInfo();

            _traceFunc         = _pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("TraceFunc");
            _isTracing         = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <ByteProxy>("isTracing");
            _pyTracingPossible = _pyrtInfo.DLLs.Python.GetStaticVariable <UInt32Proxy>("_Py_TracingPossible");

            if (kind == Kind.StepIn)
            {
                var fieldOffsets = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <CliStructProxy <FieldOffsets> >("fieldOffsets");
                fieldOffsets.Write(new FieldOffsets(process, _pyrtInfo));

                var types = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <CliStructProxy <Types> >("types");
                types.Write(new Types(process, _pyrtInfo));

                var functionPointers = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <CliStructProxy <FunctionPointers> >("functionPointers");
                functionPointers.Write(new FunctionPointers(process, _pyrtInfo));

                var stringEquals = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <PointerProxy>("stringEquals");
                if (_pyrtInfo.LanguageVersion <= PythonLanguageVersion.V27)
                {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals27").GetPointer());
                }
                else
                {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals33").GetPointer());
                }

                foreach (var interp in PyInterpreterState.GetInterpreterStates(process))
                {
                    foreach (var tstate in interp.GetThreadStates())
                    {
                        RegisterTracing(tstate);
                    }
                }

                _handlers = new PythonDllBreakpointHandlers(this);
                LocalComponent.CreateRuntimeDllFunctionExitBreakpoints(_pyrtInfo.DLLs.Python, "new_threadstate", _handlers.new_threadstate, enable: true);

                foreach (var methodInfo in _handlers.GetType().GetMethods())
                {
                    var stepInAttr = (StepInGateAttribute)Attribute.GetCustomAttribute(methodInfo, typeof(StepInGateAttribute));
                    if (stepInAttr != null &&
                        (stepInAttr.MinVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion >= stepInAttr.MinVersion) &&
                        (stepInAttr.MaxVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion <= stepInAttr.MaxVersion))
                    {
                        var handler = (StepInGateHandler)Delegate.CreateDelegate(typeof(StepInGateHandler), _handlers, methodInfo);
                        AddStepInGate(handler, _pyrtInfo.DLLs.Python, methodInfo.Name, stepInAttr.HasMultipleExitPoints);
                    }
                }

                if (_pyrtInfo.DLLs.CTypes != null)
                {
                    OnCTypesLoaded(_pyrtInfo.DLLs.CTypes);
                }
            }
        }
Ejemplo n.º 6
0
 // Token: 0x0600132B RID: 4907 RVA: 0x0002185C File Offset: 0x0001FA5C
 private void MatchStartCountdown(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         byte countdown = ByteProxy.Deserialize(memoryStream);
         this.OnMatchStartCountdown(countdown);
     }
 }
Ejemplo n.º 7
0
 // Token: 0x06001336 RID: 4918 RVA: 0x00021B90 File Offset: 0x0001FD90
 private void PlayerRespawnCountdown(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         byte countdown = ByteProxy.Deserialize(memoryStream);
         this.OnPlayerRespawnCountdown(countdown);
     }
 }
Ejemplo n.º 8
0
 // Token: 0x06001326 RID: 4902 RVA: 0x000216FC File Offset: 0x0001F8FC
 private void PowerUpPicked(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         int  id   = Int32Proxy.Deserialize(memoryStream);
         byte flag = ByteProxy.Deserialize(memoryStream);
         this.OnPowerUpPicked(id, flag);
     }
 }
Ejemplo n.º 9
0
        internal Operation(Peer peer, Packet packet)
        {
            Peer = peer;
            MemoryStream stream = new MemoryStream(packet.Data);

            ByteProxy.Deserialize(stream);
            OpCode = ByteProxy.Deserialize(stream);
            Data   = stream;
        }
Ejemplo n.º 10
0
 // Token: 0x06001337 RID: 4919 RVA: 0x00021BD4 File Offset: 0x0001FDD4
 private void PlayerRespawned(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         int     cmid     = Int32Proxy.Deserialize(memoryStream);
         Vector3 position = Vector3Proxy.Deserialize(memoryStream);
         byte    rotation = ByteProxy.Deserialize(memoryStream);
         this.OnPlayerRespawned(cmid, position, rotation);
     }
 }
Ejemplo n.º 11
0
        public static void Serialize(Stream stream, CommActorInfoView instance)
        {
            int mask = 0;

            using (var bytes = new MemoryStream())
            {
                EnumProxy <MemberAccessLevel> .Serialize(bytes, instance.AccessLevel);

                EnumProxy <ChannelType> .Serialize(bytes, instance.Channel);

                if (instance.ClanTag != null)
                {
                    StringProxy.Serialize(bytes, instance.ClanTag);
                }
                else
                {
                    mask |= 1;
                }

                Int32Proxy.Serialize(bytes, instance.Cmid);

                if (instance.CurrentRoom != null)
                {
                    GameRoomViewProxy.Serialize(bytes, instance.CurrentRoom);
                }
                else
                {
                    mask |= 2;
                }

                ByteProxy.Serialize(bytes, instance.ModerationFlag);

                if (instance.ModInformation != null)
                {
                    StringProxy.Serialize(bytes, instance.ModInformation);
                }
                else
                {
                    mask |= 4;
                }
                if (instance.PlayerName != null)
                {
                    StringProxy.Serialize(bytes, instance.PlayerName);
                }
                else
                {
                    mask |= 8;
                }

                Int32Proxy.Serialize(stream, ~mask);
                bytes.WriteTo(stream);
            }
        }
Ejemplo n.º 12
0
 // Token: 0x06001349 RID: 4937 RVA: 0x00022150 File Offset: 0x00020350
 private void EmitQuickItem(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         Vector3 origin       = Vector3Proxy.Deserialize(memoryStream);
         Vector3 direction    = Vector3Proxy.Deserialize(memoryStream);
         int     itemId       = Int32Proxy.Deserialize(memoryStream);
         byte    playerNumber = ByteProxy.Deserialize(memoryStream);
         int     projectileID = Int32Proxy.Deserialize(memoryStream);
         this.OnEmitQuickItem(origin, direction, itemId, playerNumber, projectileID);
     }
 }
Ejemplo n.º 13
0
 // Token: 0x06001344 RID: 4932 RVA: 0x00021FA0 File Offset: 0x000201A0
 private void QuickItemEvent(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         int  cmid           = Int32Proxy.Deserialize(memoryStream);
         byte eventType      = ByteProxy.Deserialize(memoryStream);
         int  robotLifeTime  = Int32Proxy.Deserialize(memoryStream);
         int  scrapsLifeTime = Int32Proxy.Deserialize(memoryStream);
         bool isInstant      = BooleanProxy.Deserialize(memoryStream);
         this.OnQuickItemEvent(cmid, eventType, robotLifeTime, scrapsLifeTime, isInstant);
     }
 }
Ejemplo n.º 14
0
        public static void Serialize(Stream stream, GameRoomDataView instance)
        {
            int mask = 0;

            using (var bytes = new MemoryStream())
            {
                Int32Proxy.Serialize(bytes, instance.ConnectedPlayers);
                Int32Proxy.Serialize(bytes, instance.GameFlags);
                EnumProxy <GameModeType> .Serialize(bytes, instance.GameMode);

                if (instance.Guid != null)
                {
                    StringProxy.Serialize(bytes, instance.Guid);
                }
                else
                {
                    mask |= 1;
                }

                BooleanProxy.Serialize(bytes, instance.IsPasswordProtected);
                BooleanProxy.Serialize(bytes, instance.IsPermanentGame);
                Int32Proxy.Serialize(bytes, instance.KillLimit);
                ByteProxy.Serialize(bytes, instance.LevelMax);
                ByteProxy.Serialize(bytes, instance.LevelMin);
                Int32Proxy.Serialize(bytes, instance.MapID);

                if (instance.Name != null)
                {
                    StringProxy.Serialize(bytes, instance.Name);
                }
                else
                {
                    mask |= 2;
                }

                Int32Proxy.Serialize(bytes, instance.Number);
                Int32Proxy.Serialize(bytes, instance.PlayerLimit);

                if (instance.Server != null)
                {
                    ConnectionAddressViewProxy.Serialize(bytes, instance.Server);
                }
                else
                {
                    mask |= 4;
                }

                Int32Proxy.Serialize(bytes, instance.TimeLimit);
                Int32Proxy.Serialize(stream, ~mask);
                bytes.WriteTo(stream);
            }
        }
Ejemplo n.º 15
0
 // Token: 0x0600133F RID: 4927 RVA: 0x00021E04 File Offset: 0x00020004
 private void PlayerKilled(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         int     shooter     = Int32Proxy.Deserialize(memoryStream);
         int     target      = Int32Proxy.Deserialize(memoryStream);
         byte    weaponClass = ByteProxy.Deserialize(memoryStream);
         ushort  damage      = UInt16Proxy.Deserialize(memoryStream);
         byte    bodyPart    = ByteProxy.Deserialize(memoryStream);
         Vector3 direction   = Vector3Proxy.Deserialize(memoryStream);
         this.OnPlayerKilled(shooter, target, weaponClass, damage, bodyPart, direction);
     }
 }
Ejemplo n.º 16
0
        // Token: 0x0600134B RID: 4939 RVA: 0x00022220 File Offset: 0x00020420
        private void ChatMessage(byte[] _bytes)
        {
            using (MemoryStream memoryStream = new MemoryStream(_bytes))
            {
                int               cmid        = Int32Proxy.Deserialize(memoryStream);
                string            name        = StringProxy.Deserialize(memoryStream);
                string            message     = StringProxy.Deserialize(memoryStream);
                MemberAccessLevel accessLevel = EnumProxy <MemberAccessLevel> .Deserialize(memoryStream);

                byte context = ByteProxy.Deserialize(memoryStream);
                this.OnChatMessage(cmid, name, message, accessLevel, context);
            }
        }
Ejemplo n.º 17
0
 // Token: 0x06001348 RID: 4936 RVA: 0x000220DC File Offset: 0x000202DC
 private void EmitProjectile(byte[] _bytes)
 {
     using (MemoryStream memoryStream = new MemoryStream(_bytes))
     {
         int     cmid         = Int32Proxy.Deserialize(memoryStream);
         Vector3 origin       = Vector3Proxy.Deserialize(memoryStream);
         Vector3 direction    = Vector3Proxy.Deserialize(memoryStream);
         byte    slot         = ByteProxy.Deserialize(memoryStream);
         int     projectileID = Int32Proxy.Deserialize(memoryStream);
         bool    explode      = BooleanProxy.Deserialize(memoryStream);
         this.OnEmitProjectile(cmid, origin, direction, slot, projectileID, explode);
     }
 }
Ejemplo n.º 18
0
 public static PlayerMovement Deserialize(Stream bytes)
 {
     return(new PlayerMovement
     {
         HorizontalRotation = ByteProxy.Deserialize(bytes),
         KeyState = ByteProxy.Deserialize(bytes),
         MovementState = ByteProxy.Deserialize(bytes),
         Number = ByteProxy.Deserialize(bytes),
         Position = ShortVector3Proxy.Deserialize(bytes),
         Velocity = ShortVector3Proxy.Deserialize(bytes),
         VerticalRotation = ByteProxy.Deserialize(bytes)
     });
 }
Ejemplo n.º 19
0
 public static void Serialize(Stream stream, PlayerMovement instance)
 {
     using (var bytes = new MemoryStream())
     {
         ByteProxy.Serialize(bytes, instance.HorizontalRotation);
         ByteProxy.Serialize(bytes, instance.KeyState);
         ByteProxy.Serialize(bytes, instance.MovementState);
         ByteProxy.Serialize(bytes, instance.Number);
         ShortVector3Proxy.Serialize(bytes, instance.Position);
         ShortVector3Proxy.Serialize(bytes, instance.Velocity);
         ByteProxy.Serialize(bytes, instance.VerticalRotation);
         bytes.WriteTo(stream);
     }
 }
Ejemplo n.º 20
0
 //called by the thread calls HandleResponse function
 //thread safe if calling thread is the main thread
 protected override void OnEvent(byte OpCode, byte[] data)
 {
     switch (OpCode)
     {
     case 1:
         Console.WriteLine("Event 1");
         MemoryStream bytes = new MemoryStream(data);
         var          strin = StringProxy.Deserialize(bytes);
         ByteProxy.DeserializeArray(bytes);
         var omg = StringProxy.Deserialize(bytes);
         Console.WriteLine(strin);
         Console.WriteLine(omg);
         break;
     }
 }
Ejemplo n.º 21
0
        public static DamageEventView Deserialize(Stream bytes)
        {
            int mask     = Int32Proxy.Deserialize(bytes);
            var instance = new DamageEventView();

            instance.BodyPartFlag = ByteProxy.Deserialize(bytes);

            if ((mask & 1) != 0)
            {
                instance.Damage = DictionaryProxy <byte, byte> .Deserialize(bytes, ByteProxy.Deserialize, ByteProxy.Deserialize);
            }

            instance.DamageEffectFlag = Int32Proxy.Deserialize(bytes);
            instance.DamgeEffectValue = SingleProxy.Deserialize(bytes);
            return(instance);
        }
 // Token: 0x060012BF RID: 4799 RVA: 0x0002015C File Offset: 0x0001E35C
 public void SendUpdateKeyState(byte state)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         ByteProxy.Serialize(memoryStream, state);
         Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
         {
             {
                 this.__id,
                 memoryStream.ToArray()
             }
         };
         if (this.sendOperation != null)
         {
             this.sendOperation(14, customOpParameters, true, 0, false);
         }
     }
 }
Ejemplo n.º 23
0
 // Token: 0x060012D8 RID: 4824 RVA: 0x00020BC8 File Offset: 0x0001EDC8
 public void SendSwitchWeapon(byte weaponSlot)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         ByteProxy.Serialize(memoryStream, weaponSlot);
         Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
         {
             {
                 this.__id,
                 memoryStream.ToArray()
             }
         };
         if (this.sendOperation != null)
         {
             this.sendOperation(21, customOpParameters, true, 0, false);
         }
     }
 }
Ejemplo n.º 24
0
 private void TestServer()
 {
     Console.WriteLine("All text written, and entered will be sent to connected clients here onwards");
     while (true)
     {
         var msgstr = Console.ReadLine();
         if (msgstr == "dc")
         {
             DisconnectAll();
             continue;
         }
         using (MemoryStream stream = new MemoryStream())
         {
             ByteProxy.Serialize(stream, 1);
             StringProxy.Serialize(stream, msgstr);
             TestSendAll(stream.ToArray(), 0);
         }
     }
 }
Ejemplo n.º 25
0
 // Token: 0x060012E0 RID: 4832 RVA: 0x00020FF8 File Offset: 0x0001F1F8
 public void SendChatMessage(string message, byte context)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         StringProxy.Serialize(memoryStream, message);
         ByteProxy.Serialize(memoryStream, context);
         Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
         {
             {
                 this.__id,
                 memoryStream.ToArray()
             }
         };
         if (this.sendOperation != null)
         {
             this.sendOperation(29, customOpParameters, true, 0, false);
         }
     }
 }
Ejemplo n.º 26
0
 // Token: 0x060012C8 RID: 4808 RVA: 0x0002042C File Offset: 0x0001E62C
 public void SendIncreaseHealthAndArmor(byte health, byte armor)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         ByteProxy.Serialize(memoryStream, health);
         ByteProxy.Serialize(memoryStream, armor);
         Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
         {
             {
                 this.__id,
                 memoryStream.ToArray()
             }
         };
         if (this.sendOperation != null)
         {
             this.sendOperation(5, customOpParameters, true, 0, false);
         }
     }
 }
Ejemplo n.º 27
0
 // Token: 0x060012CC RID: 4812 RVA: 0x00020620 File Offset: 0x0001E820
 public void SendDirectHitDamage(int target, byte bodyPart, byte bullets)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         Int32Proxy.Serialize(memoryStream, target);
         ByteProxy.Serialize(memoryStream, bodyPart);
         ByteProxy.Serialize(memoryStream, bullets);
         Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
         {
             {
                 this.__id,
                 memoryStream.ToArray()
             }
         };
         if (this.sendOperation != null)
         {
             this.sendOperation(9, customOpParameters, true, 0, false);
         }
     }
 }
Ejemplo n.º 28
0
 void TestSpam()
 {
     new Thread(() =>
     {
         int i = 0;
         while (true)
         {
             using (MemoryStream stream = new MemoryStream())
             {
                 i++;
                 ByteProxy.Serialize(stream, 1);
                 StringProxy.Serialize(stream, "Hello world" + i);
                 ByteProxy.SerializeArray(stream, new byte[3000000]);
                 StringProxy.Serialize(stream, "over");
                 TestSendAll(stream.ToArray(), i);
             }
             Thread.Sleep(1000);
         }
     }).Start();
 }
Ejemplo n.º 29
0
 // Token: 0x060012C7 RID: 4807 RVA: 0x000203AC File Offset: 0x0001E5AC
 public void SendPowerUpPicked(int powerupId, byte type, byte value)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         Int32Proxy.Serialize(memoryStream, powerupId);
         ByteProxy.Serialize(memoryStream, type);
         ByteProxy.Serialize(memoryStream, value);
         Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
         {
             {
                 this.__id,
                 memoryStream.ToArray()
             }
         };
         if (this.sendOperation != null)
         {
             this.sendOperation(4, customOpParameters, true, 0, false);
         }
     }
 }
Ejemplo n.º 30
0
 // Token: 0x060012CD RID: 4813 RVA: 0x000206A4 File Offset: 0x0001E8A4
 public void SendExplosionDamage(int target, byte slot, byte distance, Vector3 force)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         Int32Proxy.Serialize(memoryStream, target);
         ByteProxy.Serialize(memoryStream, slot);
         ByteProxy.Serialize(memoryStream, distance);
         Vector3Proxy.Serialize(memoryStream, force);
         Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
         {
             {
                 this.__id,
                 memoryStream.ToArray()
             }
         };
         if (this.sendOperation != null)
         {
             this.sendOperation(10, customOpParameters, true, 0, false);
         }
     }
 }
Ejemplo n.º 31
0
        public unsafe TraceManagerLocalHelper(DkmProcess process, Kind kind) {
            _process = process;
            _pyrtInfo = process.GetPythonRuntimeInfo();

            _traceFunc = _pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("TraceFunc");
            _isTracing = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<ByteProxy>("isTracing");
            _pyTracingPossible = _pyrtInfo.DLLs.Python.GetStaticVariable<UInt32Proxy>("_Py_TracingPossible");

            if (kind == Kind.StepIn) {
                var fieldOffsets = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<CliStructProxy<FieldOffsets>>("fieldOffsets");
                fieldOffsets.Write(new FieldOffsets(process, _pyrtInfo));

                var types = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<CliStructProxy<Types>>("types");
                types.Write(new Types(process, _pyrtInfo));

                var functionPointers = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<CliStructProxy<FunctionPointers>>("functionPointers");
                functionPointers.Write(new FunctionPointers(process, _pyrtInfo));

                var stringEquals = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable<PointerProxy>("stringEquals");
                if (_pyrtInfo.LanguageVersion <= PythonLanguageVersion.V27) {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals27").GetPointer());
                } else {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals33").GetPointer());
                }

                foreach (var interp in PyInterpreterState.GetInterpreterStates(process)) {
                    foreach (var tstate in interp.GetThreadStates()) {
                        RegisterTracing(tstate);
                    }
                }

                _handlers = new PythonDllBreakpointHandlers(this);
                LocalComponent.CreateRuntimeDllFunctionExitBreakpoints(_pyrtInfo.DLLs.Python, "new_threadstate", _handlers.new_threadstate, enable: true);

                foreach (var methodInfo in _handlers.GetType().GetMethods()) {
                    var stepInAttr = (StepInGateAttribute)Attribute.GetCustomAttribute(methodInfo, typeof(StepInGateAttribute));
                    if (stepInAttr != null &&
                        (stepInAttr.MinVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion >= stepInAttr.MinVersion) &&
                        (stepInAttr.MaxVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion <= stepInAttr.MaxVersion)) {

                        var handler = (StepInGateHandler)Delegate.CreateDelegate(typeof(StepInGateHandler), _handlers, methodInfo);
                        AddStepInGate(handler, _pyrtInfo.DLLs.Python, methodInfo.Name, stepInAttr.HasMultipleExitPoints);
                    }
                }

                if (_pyrtInfo.DLLs.CTypes != null) {
                    OnCTypesLoaded(_pyrtInfo.DLLs.CTypes);
                }
            }
        }