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 }
static void svc_gameevent(BitBuffer bb, TreeNode node) { var b = bb.ReadBits(11); node.Nodes.Add("Length in bits: " + b); bb.Seek(b); }
static void svc_cmdkeyvalues(BitBuffer bb, TreeNode node) { var b = bb.ReadBits(32); node.Nodes.Add("Length in bits: " + b); bb.Seek(b); }
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); }
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); }
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); }
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); }
static void svc_sendtable(BitBuffer bb, TreeNode node) { node.Nodes.Add("Needs decoder: " + bb.ReadBool()); var n = bb.ReadBits(16); node.Nodes.Add("Length in bits: " + n); bb.Seek(n); }
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); }
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); }
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); }
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); }
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); }
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)"; } } } } }
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); }
static void svc_fixangle(BitBuffer bb, TreeNode node) { node.Nodes.Add("Relative: " + bb.ReadBool()); // TODO: handle properly bb.Seek(48); }
void svc_gameevent(BitBuffer bb, TreeNode node) { var lengthBits = bb.ReadBits(11); node.Nodes.Add("Length in bits: " + lengthBits); var gameEventId = bb.ReadBits(9); if (GameEvents.ContainsKey(gameEventId)) { var gameEvent = GameEvents[gameEventId]; node.Nodes.Add("Event: " + gameEvent.Name); if (GameEventHandlers.ContainsKey(gameEvent.Name)) { var handler = GameEventHandlers[gameEvent.Name]; handler(bb, node, lengthBits - 9); return; } AddItem("SVC_GameEvent", gameEvent.Name); } bb.Seek(lengthBits-9); }
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); }
void teamplay_round_win(BitBuffer bb, TreeNode node, uint lengthBits) { bb.Seek(lengthBits); //Console.WriteLine("[teamplay_round_win]"); }
void svc_usermessage(BitBuffer bb, TreeNode node) { var userMsgType = (TF2UserMessage)bb.ReadBits(8); node.Nodes.Add("Message type: " + userMsgType); var lengthBits = bb.ReadBits(11); node.Nodes.Add("Length in bits: " + lengthBits); if (UserMessageHandlers.ContainsKey(userMsgType)) { var handler = UserMessageHandlers[userMsgType]; handler(bb, node, lengthBits); } else { bb.Seek(lengthBits); } }
static void svc_crosshairangle(BitBuffer bb, TreeNode node) { // TODO: see above bb.Seek(48); }
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 }
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); }
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)"; } } } } }
void hltv_status(BitBuffer bb, TreeNode node, uint lengthBits) { //var clients = bb.ReadBits(16); bb.Seek(lengthBits); }