Binary VDF

From Valve Developer Community
Revision as of 10:34, 31 December 2023 by NOUG4AT (talk | contribs)
Jump to navigation Jump to search

Stub

This article or section is a stub. You can help by expanding it.

Binary VDF is a binary version of the text-based KeyValues format.

In C++, Binary VDF can be read using the function KeyValues::ReadAsBinary.

The format of Binary VDF is a simple repetition of a byte (type), a string (name), and the data based on the type byte. The file ends with one final byte with a value of 11 (0x0B).

The types are:

# Type Data Format
0 TYPE_NONE a nested Binary VDF document
1 TYPE_STRING a null-terminated byte string
2 TYPE_INT a 32-bit little-endian signed integer
3 TYPE_FLOAT a 32-bit little-endian IEEE-754 single-precision floating point number
4 TYPE_PTR a 32-bit pointer; not generally useful for applications of KeyValues that require serialization
5 TYPE_WSTRING a 16-bit little-endian signed integer representing the number of characters in the string (not including null terminator), followed by that many little-endian UCS-2 codepoints. (Note: Valve's implementation of KeyValues in Source SDK 2013 does not support this.)
6 TYPE_COLOR an RGBA8888 color, consisting of one byte each for red, green, blue, and alpha, in that order
7 TYPE_UINT64 a 64-bit little-endian unsigned integer
8 TYPE_COMPILED_INT_BYTE an 8-bit signed integer, converted to TYPE_INT when read. (Note: Valve's implementation of KeyValues in Source SDK 2013 does not support this.)
9 TYPE_COMPILED_INT_0 no data bytes; represents a TYPE_INT set to 0. (Note: Valve's implementation of KeyValues in Source SDK 2013 does not support this.)
10 TYPE_COMPILED_INT_1 no data bytes; represents a TYPE_INT set to 1. (Note: Valve's implementation of KeyValues in Source SDK 2013 does not support this.)
11 TYPE_NUMTYPES not actually a type; this "type" has no name or data and represents the end of a binary VDF document.