예제 #1
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() + ")");
        }
예제 #2
0
        static void svc_serverinfo(BitBuffer bb, TreeNode node)
        {
            short version = (short)bb.ReadBits(16);

            node.Nodes.Add("Version: " + version);
            node.Nodes.Add("Server count: " + (int)bb.ReadBits(32));
            node.Nodes.Add("SourceTV: " + bb.ReadBool());
            node.Nodes.Add("Dedicated: " + bb.ReadBool());
            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
            {
                bb.Seek(128); // TODO: display out map md5 hash
            }
            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.ReadFloat());
            node.Nodes.Add("Platform: " + (char)bb.ReadBits(8));
            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.ReadBool()); // ???: protocol version
        }
예제 #3
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)";
                        }
                    }
                }
            }
        }
예제 #4
0
        static void net_setconvar(BitBuffer bb, TreeNode node)
        {
            var n = bb.ReadBits(8);

            while (n-- > 0)
            {
                node.Nodes.Add(bb.ReadString() + ": " + bb.ReadString());
            }
        }
예제 #5
0
        static void svc_classinfo(BitBuffer bb, TreeNode node)
        {
            var n = bb.ReadBits(16);

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

            node.Nodes.Add("Create classes on client: " + cc);
            if (!cc)
            {
                while (n-- > 0)
                {
                    node.Nodes.Add("Class ID: " + bb.ReadBits((uint)Math.Log(n, 2) + 1));
                    node.Nodes.Add("Class name: " + bb.ReadString());
                    node.Nodes.Add("Datatable name: " + bb.ReadString());
                }
            }
        }
예제 #6
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() + ")");
            }
        }
예제 #7
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);
        }
예제 #8
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);
            }
        }
예제 #9
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)";
                        }
                    }
                }
            }
        }
예제 #10
0
        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((uint)Math.Log(m, 2) + 1));
            var n = bb.ReadBits(20);

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

            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.ReadBool());
            bb.Seek(n);
        }
예제 #11
0
        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((uint)Math.Log(m, 2) + 1));
            var n = bb.ReadBits(20);
            node.Nodes.Add("Length in bits: " + n);
            var f = bb.ReadBool();
            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.ReadBool());
            bb.Seek(n);
        }
예제 #12
0
 static void svc_classinfo(BitBuffer bb, TreeNode node)
 {
     var n = bb.ReadBits(16);
     node.Nodes.Add("Number of server classes: " + n);
     var cc = bb.ReadBool();
     node.Nodes.Add("Create classes on client: " + cc);
     if (!cc)
         while (n-- > 0)
         {
             node.Nodes.Add("Class ID: " + bb.ReadBits((uint)Math.Log(n, 2) + 1));
             node.Nodes.Add("Class name: " + bb.ReadString());
             node.Nodes.Add("Datatable name: " + bb.ReadString());
         }
 }
예제 #13
0
 static void svc_serverinfo(BitBuffer bb, TreeNode node)
 {
     short version = (short)bb.ReadBits(16);
     node.Nodes.Add("Version: " + version);
     node.Nodes.Add("Server count: " + (int)bb.ReadBits(32));
     node.Nodes.Add("SourceTV: " + bb.ReadBool());
     node.Nodes.Add("Dedicated: " + bb.ReadBool());
     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
         bb.Seek(128); // TODO: display out map md5 hash
     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.ReadFloat());
     node.Nodes.Add("Platform: " + (char)bb.ReadBits(8));
     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.ReadBool()); // ???: protocol version
 }
예제 #14
0
 static void svc_print(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add(bb.ReadString());
 }
예제 #15
0
파일: Packet.cs 프로젝트: tritao/netdecode
        void svc_gameeventlist(BitBuffer bb, TreeNode node)
        {
            GameEvents.Clear();

            var numGameEvents = bb.ReadBits(9);

            node.Nodes.Add("Number of events: " + numGameEvents);
            var lengthBits = bb.ReadBits(20);
            node.Nodes.Add("Length in bits: " + lengthBits);

            for (var i = 0; i < numGameEvents; i++)
            {
                var id = bb.ReadBits(9);
                string name = bb.ReadString();

                var gameEvent = new DemoFile.GameEvent();
                gameEvent.Id = id;
                gameEvent.Name = name;

                var eventNode = node.Nodes.Add("[" + id + "] " + name);

                while (true)
                {
                    var entryType = bb.ReadBits(3);

                    if (entryType == 0)
                    {
                        // End of event description
                        break;
                    }

                    var entryName = bb.ReadString();
                    eventNode.Nodes.Add(entryName);

                    var entry = new DemoFile.GameEventEntry();
                    entry.Type = entryType;
                    entry.Name = entryName;

                    gameEvent.Entries.Add(entry);
                }

                GameEvents.Add(id, gameEvent);
            }
        }
예제 #16
0
 static void svc_getcvarvalue(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Cookie: 0x" + bb.ReadBits(32).ToString("X8"));
     node.Nodes.Add(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 svc_print(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add(bb.ReadString());
 }
예제 #19
0
 static void net_stringcmd(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Command: " + bb.ReadString());
 }
예제 #20
0
        void teamplay_broadcast_audio(BitBuffer bb, TreeNode node, uint lengthBits)
        {
            var team = (TFTeam)bb.ReadBits(8);
            var sound = bb.ReadString();

            AddItem("teamplay_broadcast_audio", "{0}: {1}", team.ToString(), sound);
        }
예제 #21
0
 static void net_stringcmd(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Command: " + bb.ReadString());
 }
예제 #22
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());
 }
예제 #23
0
 // do we even encounter these in demo files?
 static void net_disconnect(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Reason: " + bb.ReadString());
 }
예제 #24
0
 static void svc_voiceinit(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Codec: " + bb.ReadString());
     node.Nodes.Add("Quality: " + bb.ReadBits(8));
 }
예제 #25
0
        void HandleTextMsg(BitBuffer bb, TreeNode node, uint lengthBits)
        {
            var endBit = bb._pos + lengthBits;
            var destType = bb.ReadBits(8);

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

            var args = new List<string>();

            while (bb._pos < endBit)
            {
                var arg = bb.ReadString();
                args.Add(arg);
                if (!string.IsNullOrEmpty(arg))
                  textNode.Nodes.Add(arg);
            }

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

                string s;
                if (StringTable.LookupString(msg, args, out s))
                {
                    node.Nodes.Add("Full: " + s);
                    AddItem("TextMsg", s);
                }
            }
            else
            {
                AddItem("TextMsg", msg);
            }
        }
예제 #26
0
 static void svc_getcvarvalue(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Cookie: 0x" + bb.ReadBits(32).ToString("X8"));
     node.Nodes.Add(bb.ReadString());
 }
예제 #27
0
파일: Packet.cs 프로젝트: tritao/netdecode
        static void svc_createstringtable(BitBuffer bb, TreeNode node)
        {
            var tableName = bb.ReadString();
            node.Nodes.Add("Table name: " + tableName);

            var maxEntries = bb.ReadBits(16);
            node.Nodes.Add("Max entries: " + maxEntries);

            var numEntryBits = (uint)Math.Log(maxEntries, 2);
            var numEntries = bb.ReadBits(numEntryBits + 1);
            node.Nodes.Add("Number of entries: " + numEntries);

            var lengthBits = bb.ReadBits(20);
            node.Nodes.Add("Length in bits: " + lengthBits);

            var hasUserData = bb.ReadBool();
            node.Nodes.Add("Userdata fixed size: " + hasUserData);

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

            bool isCompressed = bb.ReadBool();
            node.Nodes.Add("Compressed: " + isCompressed);

            var endBit = bb._pos + lengthBits;

            if (isCompressed)
            {
                var table = new List<string>();
                for (uint e = 0; e < numEntries; ++e)
                {
                    uint originalLength = bb.ReadBits(32);
                    uint compressedLength = bb.ReadBits(32);

                    // struct lzss_header_t
                    // {
                    //     unsigned int id;
                    //     unsigned int actualSize; // always little endian
                    // };

                    var id = bb.ReadBits(32);
                    Debug.Assert(id == (('S' << 24) | ('S' << 16) | ('Z' << 8) | ('L')));

                    var actualSize = bb.ReadBits(32);

                    var compressedData = new List<byte>();
                    for (uint i = 0; i < compressedLength; ++i)
                    {
                        compressedData.Add((byte)bb.ReadBits(8));
                    }

                    //File.WriteAllBytes(e + "_c.dmp", compressedData.ToArray());

                    var decompressedData = LZSS.Decompress(compressedData.ToArray(), actualSize);
                    Debug.Assert(decompressedData.Length == actualSize);

                    //File.WriteAllBytes(e + "_u.dmp", decompressedData);

                    var dbb = new BitBuffer(decompressedData);

                    //var hasIndex = dbb.ReadBool();
                    //if (!hasIndex)
                    //{
                    //    var entryIndex = dbb.ReadBits(numEntryBits);
                    //}

                    //var substringCheck = bb.ReadBool();

                    //if (substringCheck)
                    //{

                    //}
                    //else
                    //{
                    //    var str = bb.ReadString();
                    //    table.Add(str);
                    //}

                    //var text = bb.ReadString();
                    bb.Seek(120);
                }
            }

            bb.Seek(lengthBits);
        }
예제 #28
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());
 }
예제 #29
0
 static void svc_voiceinit(BitBuffer bb, TreeNode node)
 {
     node.Nodes.Add("Codec: " + bb.ReadString());
     node.Nodes.Add("Quality: " + bb.ReadBits(8));
 }
예제 #30
0
 static void net_setconvar(BitBuffer bb, TreeNode node)
 {
     var n = bb.ReadBits(8);
     while (n-- > 0)
         node.Nodes.Add(bb.ReadString() + ": " + bb.ReadString());
 }
예제 #31
0
        void player_death(BitBuffer bb, TreeNode node, uint lengthBits)
        {
            long endBit = bb._pos + lengthBits;

            var userid = bb.ReadBits(16);
            var victim_entindex = bb.ReadBits(32);
            var inflictor_entindex = bb.ReadBits(32);
            var attacker = bb.ReadBits(16);
            var weapon = bb.ReadString();
            var weaponid = bb.ReadBits(16);
            var damagebits = bb.ReadBits(32);
            var customkill = bb.ReadBits(16);
            var assister = (short)bb.ReadBits(16);
            var weapon_logclassname = bb.ReadString();
            var stun_flags = bb.ReadBits(16);
            var death_flags = bb.ReadBits(16);
            var silent_kill = bb.ReadBool();
            var playerpenetratecount = bb.ReadBits(16);
            string assister_fallback;
            if (assister == -1)
                assister_fallback = bb.ReadString();
            else
            {
                var unk = bb.ReadBits(8);
            }

            if (bb._pos != endBit) Debugger.Break();

            //Console.WriteLine("[player_death]");
        }