示例#1
0
        static void ParseTables(BitBuffer bb, TreeNode node)
        {
            while (bb.ReadBool())
            {
                bool needsdecoder = bb.ReadBool();
                var dtnode = node.Nodes.Add(bb.ReadString());
                if (needsdecoder) dtnode.Text += "*";

                var numprops = bb.ReadBits(10);
                dtnode.Text += " (" + numprops + " props)";

                for (int i = 0; i < numprops; i++)
                {
                    var type = (SendPropType)bb.ReadBits(5);
                    var propnode = dtnode.Nodes.Add("DPT_" + type + " " + bb.ReadString());
                    var flags = (SendPropFlags)bb.ReadBits(16);

                    if (type == SendPropType.DataTable || (flags & SendPropFlags.EXCLUDE) != 0)
                        propnode.Text += " : " + bb.ReadString();
                    else
                    {
                        if (type == SendPropType.Array)
                            propnode.Text += "[" + bb.ReadBits(10) + "]";
                        else
                        {
                            bb.Seek(64);
                            propnode.Text += " (" + bb.ReadBits(7) + " bits)";
                        }
                    }
                }
            }
        }
示例#2
0
        static void ParseClassInfo(BitBuffer bb, TreeNode node)
        {
            var classes = bb.ReadBits(16);

            for (int i = 0; i < classes; i++)
                node.Nodes.Add("[" + bb.ReadBits(16) + "] " + bb.ReadString() + " (" + bb.ReadString() + ")");
        }
示例#3
0
        void HandleSayText(BitBuffer bb, TreeNode node, uint lengthBits)
        {
            var client = bb.ReadBits(8);
            var msg = bb.ReadString();
            var unk1 = bb.ReadBits(7);
            var unk2 = bb.ReadBool();

            AddItem("SayText", msg);
            node.Nodes.Add("Text: " + msg);
        }
示例#4
0
 /*
 static string ParseButtons(uint buttons)
 {
     string res = "(none)";
     // TODO: IMPLEMENT
     return res;
 }
 */
 public static void ParseIntoTreeNode(byte[] data, TreeNode node)
 {
     var bb = new BitBuffer(data);
     if (bb.ReadBool()) node.Nodes.Add("Command number: " + bb.ReadBits(32));
     if (bb.ReadBool()) node.Nodes.Add("Tick count: " + bb.ReadBits(32));
     if (bb.ReadBool()) node.Nodes.Add("Viewangle pitch: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Viewangle yaw: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Viewangle roll: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Foward move: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Side move: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Up move: " + bb.ReadFloat().ToString());
     if (bb.ReadBool()) node.Nodes.Add("Buttons: 0x" + bb.ReadBits(32).ToString("X8"));
     if (bb.ReadBool()) node.Nodes.Add("Impulse: " + bb.ReadBits(8));
     // TODO: weaponselect/weaponsubtype, mousedx/dy
 }
示例#5
0
        public static void Parse(byte[] data, TreeNode node)
        {
            var bb = new BitBuffer(data);

            while (bb.BitsLeft() > 6)
            {
                var type = bb.ReadBits(6);
                MsgHandler handler;
                if (Handlers.TryGetValue(type, out handler))
                {
                    var sub = new TreeNode(handler.Method.Name);
                    node.Nodes.Add(sub);
                    handler(bb, sub);
                }
                else
                {
                    node.Nodes.Add("unknown message type " + type).ForeColor = Color.Crimson;
                    break;
                }
            }
        }
示例#6
0
        void HandleSayText2(BitBuffer bb, TreeNode node, uint lengthBits)
        {
            var endBit = bb._pos + lengthBits;

            var client = bb.ReadBits(8);

            // 0 - raw text, 1 - sets CHAT_FILTER_PUBLICCHAT
            var isRaw = bb.ReadBits(8) != 0;

            // \x03 in the message for the team color of the specified clientid

            var kind = bb.ReadString();
            node.Nodes.Add("Kind: " + kind);

            var from = bb.ReadString();
            node.Nodes.Add("From: " + from);

            var msg = bb.ReadString();
            node.Nodes.Add("Text: " + msg);

            // This message can have two optional string parameters.
            var args = new List<string>();
            while (bb._pos < endBit)
            {
                var arg = bb.ReadString();
                args.Add(arg);
            }

            if (msg.StartsWith("#"))
                msg = msg.Substring(1);

            string s;
            if (StringTable.LookupString(kind, new List<string>() { from, msg }, out s))
            {
                s = CleanChatMessage(s);

                node.Nodes.Add("Full: " + s);
                AddItem(kind, s);
            }
        }
示例#7
0
 /*
 static string ParseButtons(uint buttons)
 {
     string res = "(none)";
     // TODO: IMPLEMENT
     return res;
 }
 */
 public static void ParseIntoTreeNode(byte[] data, TreeNode node)
 {
     var bb = new BitBuffer(data);
     if (bb.ReadBool()) node.Nodes.Add("Command number: " + bb.ReadBits(32));
     if (bb.ReadBool()) node.Nodes.Add("Tick count: " + bb.ReadBits(32));
     if (bb.ReadBool()) node.Nodes.Add("Viewangle pitch: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Viewangle yaw: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Viewangle roll: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Foward move: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Side move: " + bb.ReadFloat());
     if (bb.ReadBool()) node.Nodes.Add("Up move: " + bb.ReadFloat().ToString());
     if (bb.ReadBool()) node.Nodes.Add("Buttons: 0x" + bb.ReadBits(32).ToString("X8"));
     if (bb.ReadBool()) node.Nodes.Add("Impulse: " + bb.ReadBits(8));
     if (bb.ReadBool()) {
         node.Nodes.Add("Weaponselect: " + bb.ReadBits(11).ToString("X8"));
         if(bb.ReadBool()) node.Nodes.Add("Weaponsubtype: " + bb.ReadBits(11).ToString("X8"));
     }
     node.Nodes.Add("BITS LEFT: " + bb.BitsLeft());
     if (bb.ReadBool()) node.Nodes.Add("dx: " + bb.ReadBits(16)); //These are supposed to be shorts - not sure how to read 16 bit short
     if (bb.ReadBool()) node.Nodes.Add("dy: " + bb.ReadBits(16));
     // TODO: weaponselect/weaponsubtype, mousedx/dy
 }
示例#8
0
 static void svc_fixangle(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Relative: " + bb.ReadBool());
     // TODO: handle properly
     bb.Seek(48);
 }
示例#9
0
 static void svc_menu(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Menu type: " + bb.ReadBits(16));
     var b = bb.ReadBits(16);
     node.Nodes.Add("Length in bytes: " + b);
     bb.Seek(b << 3);
 }
示例#10
0
 static void svc_getcvarvalue(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Cookie: 0x" + bb.ReadBits(32).ToString("X8"));
     node.Nodes.Add(bb.ReadString());
 }
示例#11
0
 static void svc_gameevent(BitBuffer bb, TreeNode node)
 {
     var b = bb.ReadBits(11);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#12
0
 static void svc_tempentities(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Number of entries: " + bb.ReadBits(8));
     var b = bb.ReadBits(17);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#13
0
 static void svc_crosshairangle(BitBuffer bb, TreeNode node)
 {
     // TODO: see above
     bb.Seek(48);
 }
示例#14
0
 static void svc_usermessage(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Message type: " + bb.ReadBits(8));
     var b = bb.ReadBits(11);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#15
0
 static void net_tick(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Tick: " + (int)bb.ReadBits(32));
     node.Nodes.Add("Host frametime: " + bb.ReadBits(16));
     node.Nodes.Add("Host frametime StdDev: " + bb.ReadBits(16));
 }
示例#16
0
 static void net_stringcmd(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Command: " + bb.ReadString());
 }
示例#17
0
 // do we even encounter these in demo files?
 static void net_disconnect(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Reason: " + bb.ReadString());
 }
示例#18
0
 static void net_file(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Transfer ID: " + bb.ReadBits(32));
     node.Nodes.Add("Filename: " + bb.ReadString());
     node.Nodes.Add("Requested: " + bb.ReadBool());
 }
示例#19
0
 static void svc_getcvarvalue(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Cookie: 0x" + bb.ReadBits(32).ToString("X8"));
     node.Nodes.Add(bb.ReadString());
 }
示例#20
0
 static void svc_prefetch(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Sound index: " + bb.ReadBits(13));
 }
示例#21
0
 static void svc_crosshairangle(BitBuffer bb, TreeNode node)
 {
     // TODO: see above
     bb.Seek(48);
 }
示例#22
0
 static void svc_setview(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Entity index: " + bb.ReadBits(11));
 }
示例#23
0
 static void svc_voiceinit(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Codec: " + bb.ReadString());
     node.Nodes.Add("Quality: " + bb.ReadBits(8));
 }
示例#24
0
 static void svc_fixangle(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Relative: " + bb.ReadBool());
     // TODO: handle properly
     bb.Seek(48);
 }
示例#25
0
 static void svc_setpause(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add(bb.ReadBool().ToString());
 }
示例#26
0
 static void svc_bspdecal(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Position: " + bb.ReadVecCoord());
     node.Nodes.Add("Decal texture index: " + bb.ReadBits(9));
     if (bb.ReadBool())
     {
         node.Nodes.Add("Entity index: " + bb.ReadBits(11));
         node.Nodes.Add("Model index: " + bb.ReadBits(12));
     }
     node.Nodes.Add("Low priority: " + bb.ReadBool());
 }
示例#27
0
 static void svc_print(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add(bb.ReadString());
 }
示例#28
0
 static void svc_entitymessage(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Entity index: " + bb.ReadBits(11));
     node.Nodes.Add("Class ID: " + bb.ReadBits(9));
     var b = bb.ReadBits(11);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#29
0
 static void net_file(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Transfer ID: " + bb.ReadBits(32));
     node.Nodes.Add("Filename: " + bb.ReadString());
     node.Nodes.Add("Requested: " + bb.ReadBool());
 }
示例#30
0
 static void svc_packetentities(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Max entries: " + bb.ReadBits(11));
     bool d = bb.ReadBool();
     node.Nodes.Add("Is delta: " + d);
     if (d)
         node.Nodes.Add("Delta from: " + bb.ReadBits(32));
     node.Nodes.Add("Baseline: " + bb.ReadBool());
     node.Nodes.Add("Updated entries: " + bb.ReadBits(11));
     var b = bb.ReadBits(20);
     node.Nodes.Add("Length in bits: " + b);
     node.Nodes.Add("Update baseline: " + bb.ReadBool());
     bb.Seek(b);
 }
示例#31
0
 static void net_stringcmd(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Command: " + bb.ReadString());
 }
示例#32
0
 static void svc_prefetch(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Sound index: " + bb.ReadBits(13));
 }
示例#33
0
 static void net_signonstate(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Signon state: " + bb.ReadBits(8));
     node.Nodes.Add("Spawn count: " + (int)bb.ReadBits(32));
 }
示例#34
0
 static void svc_gameeventlist(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Number of events: " + bb.ReadBits(9));
     var b = bb.ReadBits(20);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#35
0
 static void svc_sounds(BitBuffer bb, TreeNode node)
 {
     var r = bb.ReadBool();
     node.Nodes.Add("Reliable: " + r);
     node.Nodes.Add("Number of sounds: " + (r ? 1 : bb.ReadBits(8)));
     uint b = r ? bb.ReadBits(8) : bb.ReadBits(16);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#36
0
 static void svc_cmdkeyvalues(BitBuffer bb, TreeNode node)
 {
     var b = bb.ReadBits(32);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#37
0
 static void svc_setview(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Entity index: " + bb.ReadBits(11));
 }
示例#38
0
 // do we even encounter these in demo files?
 static void net_disconnect(BitBuffer bb, TreeNode node) 
 {
     node.Nodes.Add("Reason: " + bb.ReadString());
 }
示例#39
0
 static void svc_updatestringtable(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Table ID: " + bb.ReadBits(5));
     node.Nodes.Add("Changed entries: " + (bb.ReadBool() ? bb.ReadBits(16) : 1));
     var b = bb.ReadBits(20);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }
示例#40
0
 static void net_tick(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Tick: " + (int)bb.ReadBits(32));
     node.Nodes.Add("Host frametime: " + bb.ReadBits(16));
     node.Nodes.Add("Host frametime StdDev: " + bb.ReadBits(16));
 }
示例#41
0
 static void svc_voiceinit(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Codec: " + bb.ReadString());
     node.Nodes.Add("Quality: " + bb.ReadBits(8));
 }
示例#42
0
 static void net_setconvar(BitBuffer bb, TreeNode node)
 {
     var n = bb.ReadBits(8);
     while (n-- > 0)
         node.Nodes.Add(bb.ReadString() + ": " + bb.ReadString());
 }
示例#43
0
 static void svc_voicedata(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Client: " + bb.ReadBits(8));
     node.Nodes.Add("Proximity: " + bb.ReadBits(8));
     var b = bb.ReadBits(16);
     node.Nodes.Add("Length in bits: " + b);
     bb.Seek(b);
 }