diff options
Diffstat (limited to 'doc/hl1-demofile-spec.txt')
-rw-r--r-- | doc/hl1-demofile-spec.txt | 193 |
1 files changed, 100 insertions, 93 deletions
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 |