Command Sequences: Difference between revisions
m (Added note about command struct differing on separate branches. (integer/char)) |
Dimhotepus (talk | contribs) m (Describe why random memory data present in CmdSeq.wc file) |
||
Line 1: | Line 1: | ||
[[Category:File formats]] | [[Category:File formats]] | ||
The ''bin/CmdSeq.wc'' file defines the [[Hammer_Run_Map_Expert|expert compilation options]] for Hammer. There are two versions currently in use. All strings are fixed width, with a null character at the end of the used data. Hammer | The ''bin/CmdSeq.wc'' file defines the [[Hammer_Run_Map_Expert|expert compilation options]] for Hammer. There are two versions currently in use. All strings are fixed width, with a null character at the end of the used data. Hammer fills the remainder of the data with random memory contents of ''Sequence'' ''name'' buffer after terminating null. | ||
<source lang="cpp">struct Header | <source lang="cpp">struct Header | ||
Line 16: | Line 16: | ||
<source lang="cpp">struct Sequence | <source lang="cpp">struct Sequence | ||
{ | { | ||
char name[128]; | char name[128]; // null-terminated name and memory contents after it (till 128 byte) | ||
unsigned int command_count; // Number of commands | unsigned int command_count; // Number of commands | ||
Command commands[]; | Command commands[]; |
Latest revision as of 18:55, 19 December 2024
The bin/CmdSeq.wc file defines the expert compilation options for Hammer. There are two versions currently in use. All strings are fixed width, with a null character at the end of the used data. Hammer fills the remainder of the data with random memory contents of Sequence name buffer after terminating null.
struct Header
{
char signature[31]; // Worldcraft Command Sequences\r\n\x1a
float version;
unsigned int seq_count;
Sequence sequences[];
}
The signature contains "Worldcraft Command Sequences", followed by a carriage return, newline, and Control-Z (byte 26). The version is a floating-point number, 0.1
or 0.2
. This is followed by seq_count sequence structs, one for each compile preset defined:
struct Sequence
{
char name[128]; // null-terminated name and memory contents after it (till 128 byte)
unsigned int command_count; // Number of commands
Command commands[];
}
Each sequence contains a number of commands:
struct Command
{
char is_enabled; // 0/1, If command is enabled. NOTE: CS:GO's branch of hammer uses an integer value here instead of a character.
int special;
char executable[260]; // Name of EXE to run.
char args[260]; // Arguments for executable.
int is_long_filename; // Obsolete, but always set to true. Disables MS-DOS 8-char filenames.
int ensure_check; // Ensure file post-exists after compilation
char ensure_file[260]; // File to check exists.
int use_proc_win; // Use Process Window (ignored if exectuable = $game_exe).
// V 0.2+ only:
int no_wait; // Wait for keypress when done compiling.
}
If special is not 0, the executable is not used. Instead a builtin command is run:
Value | Command | Arguments |
---|---|---|
256 | Change Directory | Location
|
257 | Copy File | Source Destination
|
258 | Delete File | Path
|
259 | Rename File | Old New
|
VBSP, VRAD, VVIS or the game are normal commands using a replace parameter.
Replacement parameters
Commnand names and arguments can use a replacement syntax, following the form $var
. These arguments are quoted up until the first space after the parameter (so $file.$ext
is quoted in one piece, but $file $ext
will produce two sets of surrounding quotes).
Parameter | Result |
---|---|
$$
|
Literal $ sign. |
$file
|
Map filename. |
$ext
|
Extension of map (vmf, vmm). |
$path
|
Full path to folder containing the map, with no trailing slash. |
$exedir
|
Path to the location of the game EXE. |
$bspdir
|
Location to place BSPs in, set in Build Programs. |
$bsp_exe
|
Location of VBSP, set in Build Programs. |
$vis_exe
|
Location of VVIS, set in Build Programs. |
$light_exe
|
Location of VRAD, set in Build Programs. |
$game_exe
|
Location of the game executable, set in Build Programs. |
$gamedir
|
Folder containing Gameinfo.txt. |