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 }
private static void net_setconvar(BitBuffer bb, TreeNode node) { var n = bb.ReadBits(8); while (n-- > 0) { node.Nodes.Add(bb.ReadString() + ": " + bb.ReadString()); } }
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()); } } }
private static void ParseClassInfo(BitBuffer bb, TreeNode node) { var classes = bb.ReadBits(16); for (var i = 0; i < classes; i++) { node.Nodes.Add("[" + bb.ReadBits(16) + "] " + bb.ReadString() + " (" + bb.ReadString() + ")"); } }
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)"; } } } } }
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); }
private static void net_stringcmd(BitBuffer bb, TreeNode node) { node.Nodes.Add("Command: " + bb.ReadString()); }
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()); }
// do we even encounter these in demo files? private static void net_disconnect(BitBuffer bb, TreeNode node) { node.Nodes.Add("Reason: " + bb.ReadString(1024)); }
private static void svc_getcvarvalue(BitBuffer bb, TreeNode node) { node.Nodes.Add("Cookie: 0x" + bb.ReadBits(32).ToString("X8")); node.Nodes.Add(bb.ReadString()); }
private static void svc_voiceinit(BitBuffer bb, TreeNode node) { node.Nodes.Add("Codec: " + bb.ReadString()); node.Nodes.Add("Quality: " + bb.ReadBits(8)); }
private static void svc_print(BitBuffer bb, TreeNode node) { node.Nodes.Add(bb.ReadString()); }