summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mszulecki2007-03-29 15:33:17 +0000
committerGravatar mszulecki2007-03-29 15:33:17 +0000
commit98aa493e54ee005e8e6a80d8e86050c78d3051b7 (patch)
treeb9388ca24d18efd2c68a7036d3d766a93b8bf2ed
parente6a38f4a8455b7cee3781bb09f4e4aabafcd2710 (diff)
downloadhl-demofile-spec-master.tar.gz
hl-demofile-spec-master.tar.bz2
Change servermessage indexing to hex and add more cstrike related game message structures.HEADmaster
git-svn-id: http://svn.sukimashita.com/repos/hldemo/trunk@7 e98d5eb1-5f28-0410-b569-d5a1ad2e6e54
-rw-r--r--doc/hl1-demofile-spec-cstrike.txt228
-rw-r--r--doc/hl1-demofile-spec.txt193
2 files changed, 279 insertions, 142 deletions
diff --git a/doc/hl1-demofile-spec-cstrike.txt b/doc/hl1-demofile-spec-cstrike.txt
index 86ec4d6..ee64f14 100644
--- a/doc/hl1-demofile-spec-cstrike.txt
+++ b/doc/hl1-demofile-spec-cstrike.txt
@@ -1,140 +1,270 @@
-{64} '', // Radio Command?
+1. List of known game messages:
+--------------------------------------------------------------------------------
+'HudText'
- uint8 uk_b1;
- uint8 uk_b2;
- char* uk_s1;
- uint8 uk_b3;
- uint8 uk_b4;
- uint8 uk_b5;
- char* uk_s2;
- char* playername;
- char* command;
+ uint8 message_length;
+ uint8 slot;
+ char* text;
-{} 'ScoreInfo',
+'SayText'
- uint8 entindex;
- sint16 frags;
- sint16 deaths;
+ uint8 message_length;
+ uint8 slot;
+ char* text;
+
+
+'TextMsg'
+
+ uint8 message_length;
+ uint8 slot;
+ char* text;
+ char* params[4];
+
+'ScoreInfo'
+
+ uint8 slot;
+ int16 frags;
+ int16 deaths;
uint16 uk_s1;
uint16 team_index;
+
+'TeamInfo'
+
+ uint8 message_length;
+ uint8 slot;
+ char* team_name;
+
+'TeamScore'
+
+ uint8 message_length;
+ char* team_name;
+ uint16 score;
+
+'DeathMsg'
+
+ uint8 uk_b1;
+ uint8 slot_killer;
+ uint8 slot_victim;
+ uint8 uk_b2; // Headshot indicator?
+ char* weapon;
+
+'Health'
+
+ uint8 health;
-{} 'Health',
+'StatusText'
- uint8 health;
+ uint8 message_length;
+ uint8 uk_b1;
+ char* status_text;
-{} 'FlashLight',
+'StatusValue'
- uint8 state; // 1/0 on/off
+ uint8 message_length;
+ uint8 value_index;
+ int16 value;
+
+'Flashlight'
+
+ uint8 state; // boolean on/off
uint8 flash_battery;
-{} 'CurWeapon', (67)
+'AmmoPickup'
+
+ uint8 ammo_index;
+ uint8 amount;
+
+'AmmoX'
+
+ uint8 ammo_index;
+ uint8 amount;
+
+'Battery'
+
+ int16 armorvalue;
+
+'Damage'
+
+ uint8 dmg_save;
+ uint8 dmg_take;
+ uint32 visibleDamageBits;
+ int16 damageorigin_x;
+ int16 damageorigin_y;
+ int16 damageorigin_z;
+
+'RoundTime'
+
+ int16 round_seconds;
+
+'BarTime'
+
+ uint16 bar_time;
+
+'Money'
+
+ uint32 money;
+ uint8 uk_b1; // Sign to use? 0:+money 1: -money?
+
+'InitHUD' // Empty
+'ResetHUD' // Empty
+'ScoreAttrib'
+
+ uint8 uk_b1;
+ uint8 uk_b2;
+
+'ClCorpse'
+
+ uint8 message_length;
+ char* model;
+
+'BombPickup' // Emtpy (?)
+'WeapPickup'
+
+ uint8 weapon;
+
+'ScreenFade'
+
+ float32 duration; // 7.9 Fixed point
+ float32 hold_time; // 7.9 Fixed point
+ uint16 fade_flags;
+ uint8 col_rgba[4]; // 4 bytes r,g,b,a color1 (fade color)
+
+2. Further game messages which are incomplete/not fully reversed/partly unknown:
+--------------------------------------------------------------------------------
+These messages are assigned with the newusermsg servermessage, thus you can add
+them to your dynamic table and (in most cases) skip them due to the
+default_msg_length field. Once their structure is know we can add them to the
+supported list and properly parse their information.
+
+'WeaponList'
+
+ uint8 message_length;
+ uint8 num_weapons;
+ Weapon* weaponlist[num_weapons];
+
+struct Weapon {
+ char* name;
+ uint8 ammo_type;
+ uint8 ammo_max;
+ uint8 ammo2_type;
+ uint8 ammo2_max;
+ uint8 bucket;
+ uint8 bucket_pos;
+ uint8 id;
+ uint8 flags;
+}
+
+'' (0x40) // Radio Command?
+
+ uint8 uk_b1;
+ uint8 uk_b2;
+ char* uk_s1;
+ uint8 uk_b3;
+ uint8 uk_b4;
+ uint8 uk_b5;
+ char* uk_s2;
+ char* playername;
+ char* command;
+
+'CurWeapon' (0x43)
uint8 uk_b1;
uint8 uk_b2;
uint8 uk_b3;
-{} '', (73)
+'' (0x49)
uint8 uk_b1;
uint8 uk_b2;
-{} 'SayText', (75)
+'SayText' (0x4b)
uint8 message_length;
uint8 slot;
uint8 uk_b1; // if slot!=0
char* uk_string;
-{} '', (76)
+'' (0x4c)
uint8 message_length;
uint8 slot;
uint8 uk_b1; // if slot!=0
char* uk_string;
-{} '', (77)
+'' (0x4d)
uint8 message_length;
uint8 slot;
uint8 uk_b1; // if slot!=0
char* uk_string;
- // Strings containing with # is some sort of command, also "#C1#C2"
+ // Strings containing # are some sort of command, also "#C1#C2"
-{} '', (78)
+'' (0x4e)
uint8 uk_b1;
char* weapon;
char[8] uk_b2;
-{} '', (87)
+'' (0x57)
uint8 uk_b1;
char* team;
char[9] uk_b2;
-{} 'ShowMenu', (96)
+'ShowMenu' (0x60)
uint8 message_length;
uint8[4] uk_b1;
char* uk_string; // #DCT_BuyItem
-{} 'SendAudio', (100)
+'SendAudio' (0x64)
uint8 message_length;
uint8 slot;
uint8 uk_b1;
char* uk_string; // %!MRAD_LOCKNLOAD
-{} 'RoundTime', (101)
-
- uint16 round_sec;
-
-{} 'Money', (102)
-
- uint32 money_amount;
- uint8 uk_b2; // ? Add 0 /Substract 1?
-
-{} 'StatusIcon', (107)
+'StatusIcon' (0x6b)
uint8 message_length;
uint8 uk_b1;
char* icon;
-{} 'StatusText', (107)
+'StatusText' (0x6b)
uint8 message_length;
uint8 uk_b1;
- char* uk_string; // message_length points to space after strings end \0 byte??
+ char* uk_string; // message_length points to space after strings null-byte??
uint8 uk_b2; // ?
uint8 uk_b3; // ?
-{} 'Radar', (112) // ?
+'Radar' (0x70) // ?
- char[8] uk_b1;
+ uint8 uk_b1[8];
-{} 'VGUIMenu', (114) // ?
+'VGUIMenu' (0x72) // ?
-{} 'WClose', (115)
+'WClose' (0x73)
uint8 message_length;
char* uk_string; // found aimbot stuff in here in some demos
-{} '', (118)
+'' (0x76)
uint8 message_length;
char* uk_string;
-{128} '', // ?
+'' (0x80) // ?
char* delta_name;
-{143} '', // ?
+'' (0x8f) // ?
-{217} '', // ?
+'' (0xd9) // ?
// usercmd_t - 440 bytes - skipped !OK!
-{249} '', // ? deltadata?
+'' (0xf9) // ? deltadata?
// ID: 43 - clientdata_t - 1332 >< 1346 bytes (next block unknown) - 1343 ?
// ID: 03 - entity_state_t - 1430 bytes - skipped !OK!
// ID: 03 - entity_state_player_t - 1314 bytes - count varies
diff --git a/doc/hl1-demofile-spec.txt b/doc/hl1-demofile-spec.txt
index 6946fba..1035852 100644
--- a/doc/hl1-demofile-spec.txt
+++ b/doc/hl1-demofile-spec.txt
@@ -31,6 +31,7 @@ DemoFile {
}
The biggest part of the demo file is made up by the macro for game data.
+Intel-byte order is used for any values.
Demofile Header
--------------------------------------------------------------------------------
@@ -59,11 +60,11 @@ Known network_version -> Half-Life version mappings:
struct DemoHeader
{
- char[8] magic;
+ char magic[8]; // 'HLDEMO'
uint32 demo_version;
uint32 network_version;
- char[260] map_name;
- char[260] game_dll;
+ char map_name[260];
+ char game_dll[260];
uint32 map_crc;
uint32 directory_offset {
uint32 dir_count; // 1 to 1024
@@ -86,7 +87,7 @@ demofile.
struct DemoDirectoryEntry
{
uint32 number;
- char[64] title;
+ char title[64];
uint32 flags;
int32 play;
float32 time;
@@ -150,16 +151,16 @@ struct DemoMacro_GameData
{
if(network_version = 42)
{
- uint8[560] extinfo;
+ uint8 extinfo[560];
}
else
if(network_version >= 45)
{
- uint8[220] extinfo;
+ uint8 extinfo[220];
uint16 recorded_resolution_width;
uint16 recorded_resolution_height;
uint16 recorded_resolution_depth;
- uint8[238] extinfo;
+ uint8 extinfo[238];
}
int32 chunklength; // size of following DemoServerMessage
@@ -176,45 +177,42 @@ struct DemoServerMessage
List of Server Messages and their structure:
-{0} 'bad',
-
-// Should never be encountered, otherwise stream is corrupt.
-
-{1} 'nop',
-{2} 'disconnect',
-{3} 'event',
+{0x00} 'bad', // Something is bad. This message should never appear.
+{0x01} 'nop', // No operation.
+{0x02} 'disconnect', // Disconnect from the server. Stops the game.
+{0x03} 'event', // Updates player state (health, armor, weapon, ...).
uint8 num_events;
- // ... excessive bit parsing
+ // TODO: Excessive bit parsing...
-{4} 'version',
+{0x04} 'version', // Deprecated, the 'serverinfo' message seems to be used
- uint32 version;
+ uint32 serverprotocol;
-{5} 'setview',
-{6} 'sound',
-{7} 'time',
+{0x05} 'setview', // Sets camera position to the origin of this entity.
+{0x06} 'sound',
+{0x07} 'time', // This is the time stamp of a block of messages.
float32 time;
-{8} 'print',
+{0x08} 'print', // The client prints the text in the top left corner of the screen.
char* text;
-{9} 'stufftext',
+{0x09} 'stufftext', // The client transfers the text to the console and runs it.
char* text;
-{10} 'setangle',
+{0x0a} 'setangle', // This message set the camera orientation.
- char[5] uk_b;
+ char uk_b[5];
-{11} 'serverinfo',
+{0x0b} 'serverinfo',
uint32 serverversion;
uint32 servercount;
uint32 server_crc;
- char[16] client_dll_crc;
+ char client_dll_crc[16];
uint8 maxclients;
uint8 playernum;
uint8 uk_b5;
@@ -224,67 +222,76 @@ List of Server Messages and their structure:
}
char* map1;
char* map2;
- uint8 extraflag;
+ uint8 extraflag; // Looks to be precache information
if(extraflag > 0) {
uint8 extralength;
char* extradata;
- char[16] lastdata;
+ char lastdata[16];
}
-{12} 'lightstyle',
+{0x0c} 'lightstyle', // This message defines a light style.
uint8 style_index; // 0 - 63
char* lightinfo;
-{13} 'updateuserinfo',
+{0x0d} 'updateuserinfo',
uint8 slot;
uint32 userid;
char* userinfo;
- char[16] uk_data;
+ char uk_data[16];
+
+{0x0e} 'deltadescription', // delta.lst
+
+ char* structure_name;
+
+ bit entry_count[16];
-{14} 'deltadescription',
+ entry entries[entry_count] {
+ bit length[3];
+ bit data[8][length];
+ }
- char* text;
- uint16 uk_i1;
+// Any bit reads need to be masked vs this bitmask:
+// (0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80)
// if text = 'entity_t' then
// skip constant data chunks due to no delta compression
// and read until "00 27" is found as MSGID 39, reseek and continue reading blocks
-{15} 'clientdata',
+{0x0f} 'clientdata',
uint8 slot;
uint32 userid;
char* userinfo;
-{16} 'stopsound',
+{0x10} 'stopsound',
uint16 uk_s1;
-{17} 'createstringtables',
-{18} 'updatestringtable',
-{19} 'entitymessage',
-{20} 'spawnstatic',
-{21} 'spawnbinary',
-{22} 'spawnbaseline',
-{23} 'temp_entity',
+{0x11} 'createstringtables',
+{0x12} 'updatestringtable',
+{0x13} 'entitymessage',
+{0x14} 'spawnstatic',
+{0x15} 'spawnbinary',
+{0x16} 'spawnbaseline',
+{0x17} 'temp_entity',
uint8 entity_event_type;
// Rest is the actual event, see common.h in HLSDK
-{24} 'setpause',
+{0x18} 'setpause',
uint8 state;
-{25} '',
-{26} '',
-{27} '',
-{28} '',
-{29} 'spawnstaticsound',
+{0x19} '',
+{0x1a} '',
+{0x1b} '',
+{0x1c} '',
+{0x1d} 'spawnstaticsound',
- uint16[3] org;
+ uint16 org[3];
uint16 sound_num;
uint8 vol;
uint8 atten;
@@ -292,50 +299,50 @@ List of Server Messages and their structure:
uint8 uk_b2;
uint8 uk_b3;
-{30} 'intermission',
-{31} '',
-{32} 'cdtrack',
+{0x1e} 'intermission',
+{0x1f} '',
+{0x20} 'cdtrack',
uint32 fromtrack;
uint32 totrack;
-{33} '',
-{34} '',
-{35} 'weaponanim',
+{0x21} '',
+{0x22} '',
+{0x23} 'weaponanim',
uint8 sequence_number;
uint8 weaponmodel_bodygroup;
-{36} '',
-{37} 'roomtype',
+{0x24} '',
+{0x25} 'roomtype',
sint16 room_type;
-{38} 'addangle',
+{0x26} 'addangle',
- float32[4] angles;
+ float32 angles[4];
-{39} 'newusermsg',
+{0x27} 'newusermsg' // Used to dynamically assign messages {0x40-0xFF}
- uint8 usermsg_id;
- uint8 default_msg_length;
- char* usermsg_description;
+ uint8 usermsg_id; // ServerMessage ID to assign
+ uint8 default_msg_length; // Default length of such msg
+ char* usermsg_description; // e.g.: 'SayText', 'Money'...
uint8 uk_b2;
-{40} '',
-{41} '',
-{42} '',
-{43} '',
-{44} '',
-{45} 'classinfo',
+{0x28} '',
+{0x29} '',
+{0x2a} '',
+{0x2b} '',
+{0x2c} '',
+{0x2d} 'classinfo',
uint8 subpacket;
-{46} '',
-{47} '',
-{48} '',
-{49} '',
-{50} 'hltv',
+{0x2e} '',
+{0x2f} '',
+{0x30} '',
+{0x31} '',
+{0x32} 'hltv',
uint8 stateflag;
@@ -346,7 +353,7 @@ List of Server Messages and their structure:
// HLTV_LISTEN 2
// tell client to listen to a multicast stream
-{51} 'director',
+{0x33} 'director',
uint8 command_length;
uint8 command_event;
@@ -363,7 +370,7 @@ List of Server Messages and their structure:
// DRC_CMD_MESSAGE 6 // send HUD centerprint
uint8 effect;
- uint8[4] col1_rgba;
+ uint8 col1_rgba[4];
float32 x;
float32 y;
// ushort 8.8 fadein time
@@ -408,29 +415,29 @@ List of Server Messages and their structure:
// DRC_FLAG_FINAL (1<<9) // is a final scene
// DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
- uint8[command_length-8] uk_data;
+ uint8 uk_data[command_length-8];
}
-{52} '',
-{53} '',
-{54} 'sendextrainfo',
+{0x34} '',
+{0x35} '',
+{0x36} 'sendextrainfo',
char* text;
uint8 uk_b;
-{55} '',
-{56} '',
-{57} '',
-{58} '',
-{59} '',
-{60} '',
-{61} '',
-{62} '',
-{63} '',
+{0x37} '',
+{0x38} '',
+{0x39} '',
+{0x3a} '',
+{0x3b} '',
+{0x3c} '',
+{0x3d} '',
+{0x3e} '',
+{0x3f} '',
--------------------------------------------------------------------------------
-{64-256}
-These server messages are dynamically indexed using message {39}'s usermsg_id
+{0x40-0xff}
+These server messages are dynamically indexed using message {0x27}'s usermsg_id
See hl1-demofile-spec-cstrike.txt
--------------------------------------------------------------------------------
@@ -456,7 +463,7 @@ next one.
uint32 uk_i1;
uint32 uk_i2;
float32 uk_f;
- char[72] data;
+ char data[72];
# 7 / Unknown