예제 #1
0
        private static void svc_serverinfo(BitBuffer bb, TreeNode node)
        {
            var version = (short)bb.ReadBits(16);

            node.Nodes.Add("Version: " + version);
            node.Nodes.Add("Server count: " + (int)bb.ReadBits(32));
            node.Nodes.Add("SourceTV: " + bb.ReadBoolean());
            node.Nodes.Add("Dedicated: " + bb.ReadBoolean());
            node.Nodes.Add("Server client CRC: 0x" + bb.ReadBits(32).ToString("X8"));
            node.Nodes.Add("Max classes: " + bb.ReadBits(16));
            if (version < 18)
            {
                node.Nodes.Add("Server map CRC: 0x" + bb.ReadBits(32).ToString("X8"));
            }
            else
            {
                node.Nodes.Add("MD5 Hash: " + bb.ReadBits(128));
            }
            node.Nodes.Add("Current player count: " + bb.ReadBits(8));
            node.Nodes.Add("Max player count: " + bb.ReadBits(8));
            node.Nodes.Add("Interval per tick: " + bb.ReadSingle());
            node.Nodes.Add("Platform: " + (((char)bb.ReadBits(8)).ToString().ToUpper() == "W" ? "Windows":"Linux"));
            node.Nodes.Add("Game directory: " + bb.ReadString());
            node.Nodes.Add("Map name: " + bb.ReadString());
            node.Nodes.Add("Skybox name: " + bb.ReadString());
            node.Nodes.Add("Hostname: " + bb.ReadString());
            node.Nodes.Add("Has replay: " + bb.ReadBoolean()); // ???: protocol version
        }
예제 #2
0
        private static void svc_bspdecal(BitBuffer bb, TreeNode node)
        {
            var pos = bb.ReadVectorCoord();

            node.Nodes.Add("X: " + pos[0]);
            node.Nodes.Add("Y: " + pos[1]);
            node.Nodes.Add("Z: " + pos[2]);
            node.Nodes.Add("Decal texture index: " + bb.ReadBits(9));
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Entity index: " + bb.ReadBits(11));
                node.Nodes.Add("Model index: " + bb.ReadBits(12));
            }
            node.Nodes.Add("Low priority: " + bb.ReadBoolean());
        }
예제 #3
0
        private static void svc_sendtable(BitBuffer bb, TreeNode node)
        {
            node.Nodes.Add("Needs decoder: " + bb.ReadBoolean());
            var n = bb.ReadBits(16);

            node.Nodes.Add("Length in bits: " + n);
            bb.SeekBits(n);
        }
예제 #4
0
        private static void svc_packetentities(BitBuffer bb, TreeNode node)
        {
            node.Nodes.Add("Max entries: " + bb.ReadBits(11));
            var d = bb.ReadBoolean();

            node.Nodes.Add("Is delta: " + d);
            if (d)
            {
                node.Nodes.Add("Delta from: " + bb.ReadBits(32));
            }
            node.Nodes.Add("Baseline: " + bb.ReadBoolean());
            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.ReadBoolean());
            bb.SeekBits(b);
        }
예제 #5
0
        private static void svc_fixangle(BitBuffer bb, TreeNode node)
        {
            node.Nodes.Add("Relative: " + bb.ReadBoolean());
            var pos = bb.ReadVectorCoord();

            node.Nodes.Add("X: " + pos[0]);
            node.Nodes.Add("Y: " + pos[1]);
            node.Nodes.Add("Z: " + pos[2]);
        }
예제 #6
0
        private static void svc_updatestringtable(BitBuffer bb, TreeNode node)
        {
            node.Nodes.Add("Table ID: " + bb.ReadBits(5));
            node.Nodes.Add("Changed entries: " + (bb.ReadBoolean() ? bb.ReadBits(16) : 1));
            var b = bb.ReadBits(20);

            node.Nodes.Add("Length in bits: " + b);
            bb.SeekBits(b);
        }
예제 #7
0
        private static void svc_sounds(BitBuffer bb, TreeNode node)
        {
            var r = bb.ReadBoolean();

            node.Nodes.Add("Reliable: " + r);
            node.Nodes.Add("Number of sounds: " + (r ? 1 : bb.ReadBits(8)));
            var b = r ? bb.ReadBits(8) : bb.ReadBits(16);

            node.Nodes.Add("Length in bits: " + b);
            bb.SeekBits(b);
        }
예제 #8
0
        private static void ParseTables(BitBuffer bb, TreeNode node)
        {
            while (bb.ReadBoolean())
            {
                var needsdecoder = bb.ReadBoolean();
                var dtnode       = node.Nodes.Add(bb.ReadString());
                if (needsdecoder)
                {
                    dtnode.Text += "*";
                }

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

                for (var 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.SeekBits(64);
                            propnode.Text += " (" + bb.ReadBits(7) + " bits)";
                        }
                    }
                }
            }
        }
예제 #9
0
        private static void svc_createstringtable(BitBuffer bb, TreeNode node)
        {
            node.Nodes.Add("Table name: " + bb.ReadString());
            var m = bb.ReadBits(16);

            node.Nodes.Add("Max entries: " + m);
            node.Nodes.Add("Number of entries: " + bb.ReadBits((int)Math.Log(m, 2) + 1));
            var n = bb.ReadBits(20);

            node.Nodes.Add("Length in bits: " + n);
            var f = bb.ReadBoolean();

            node.Nodes.Add("Userdata fixed size: " + f);
            if (f)
            {
                node.Nodes.Add("Userdata size: " + bb.ReadBits(12));
                node.Nodes.Add("Userdata bits: " + bb.ReadBits(4));
            }

            // ???: this is not in Source 2007 netmessages.h/cpp it seems. protocol version?
            node.Nodes.Add("Compressed: " + bb.ReadBoolean());
            bb.SeekBits(n);
        }
예제 #10
0
        private static void svc_classinfo(BitBuffer bb, TreeNode node)
        {
            var n = bb.ReadBits(16);

            node.Nodes.Add("Number of server classes: " + n);
            var cc = bb.ReadBoolean();

            node.Nodes.Add("Create classes on client: " + cc);
            if (!cc)
            {
                while (n-- > 0)
                {
                    node.Nodes.Add("Class ID: " + bb.ReadBits((int)Math.Log(n, 2) + 1));
                    node.Nodes.Add("Class name: " + bb.ReadString());
                    node.Nodes.Add("Datatable name: " + bb.ReadString());
                }
            }
        }
예제 #11
0
 private 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.ReadBoolean());
 }
예제 #12
0
 private static void svc_setpause(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add(bb.ReadBoolean().ToString());
 }
예제 #13
0
        public static void ParseIntoTreeNode(byte[] data, TreeNode node)
        {
            var bb = new BitBuffer(data);

            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Command number: " + bb.ReadBits(32));
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Tick count: " + bb.ReadBits(32));
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Viewangle pitch: " + bb.ReadSingle());
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Viewangle yaw: " + bb.ReadSingle());
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Viewangle roll: " + bb.ReadSingle());
            }
            if (bb.ReadBoolean())
            {
                var xDiff = bb.ReadSingle();
                node.Nodes.Add("Foward move: " + xDiff);
                node.Nodes.Add("X velocity: " + xDiff / 0.015 + "ups");
            }
            if (bb.ReadBoolean())
            {
                var xDiff = bb.ReadSingle();
                node.Nodes.Add("Side move: " + xDiff);
                node.Nodes.Add("Y velocity: " + xDiff / 0.015 + "ups");
            }
            if (bb.ReadBoolean())
            {
                var xDiff = bb.ReadSingle();
                node.Nodes.Add("Foward move: " + xDiff);
                node.Nodes.Add("Z velocity: " + xDiff / 0.015 + "ups");
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Buttons: " + KeyInterop.KeyFromVirtualKey(Convert.ToInt32(bb.ReadBits(32))));
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Impulse: " + bb.ReadBits(8));
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Weaponselect: " + bb.ReadBits(11));
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Weapon subtype: " + bb.ReadBits(6));
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Mouse X: " + bb.ReadCoord());
            }
            if (bb.ReadBoolean())
            {
                node.Nodes.Add("Mouse Y: " + bb.ReadCoord());
            }
        }