Agent File Format (COB)

The Agent files are compound files containing several "chunks" of data. The file format is designed such that if a program is not designed to handle a specific type of data chunk, it can merely skip it.

The following chunk types are defined at the time of writing

"agnt" - Agent Chunks contain the Object information.

"file" - File chunks contain the resource files for the Object.

"auth" - Author chunks contain information relating to the Agent Files' Authors.

The agent file format is this:

BYTE[4]'c' 'o' 'b' '2'Header information

Where the CHUNK format is as follows

BYTE[4]ChunkTypeThe Chunk Type
LONGChunkSizeSize of chunk excluding header
BYTE[ChunkSize]DataThe Chunk Data

Thus for those programs which cannot understand any particular chunks, they can skip the correct number of bytes and continue processing.

There is an additional format for agent files, which allows them to be automatically compressed. ".cob.gz" files are normal agent files which have their data compressed by the gzip program. These files are smaller than normal COB files, and can be handled natively by Agent Injector Version 1.1 and above.

The Agent Chunks "agnt"
The agent chunks are very complex and contain a lot of information. The following definition is for a file dependency


WORDFileType0=Sprite (.s16) 1=Sound (.wav)
STRINGFileNameName of file (no path info.)


The following is the agent chunk

BYTE[4]'a' 'g' 'n' 't'
WORDQuantityRemaining0xffff = Infinite
LONGLastUsageTime of last use.
LONGReuseIntervalIn seconds.
BYTEUseByDayExpiry Date
BYTEUseByMonthExpiry Date
WORDUseByYearExpiry Date
LONGReserved1Must be zero
LONGReserved2Must be zero
LONGReserved3Must be zero
WORDThumbnailWidthDescribes agent thumbnail image for injector.
WORDThumbnailHeightDescribes agent thumbnail image for injector.
WORD[Width*Height]ThumbnailDescribes agent thumbnail image for injector.

Notes about Agent Chunks
An agent can only be injected if QuantityRemaining is non-zero and the LastUsage time is more than ReuseInterval seconds ago.

LastUsage is "the number of seconds elapsed since midnight (00:00:00), January 1, 1970, coordinated universal time".

File Dependencies state which files to check/install. Without them file chunks are entirely useless.

The Agent Thumbnail must be in 565 format.

File Chunks "file"
File chunks are used to include non-standard resources in the COB files. Their format is very simple and is as follows

BYTE[4]'f' 'i' 'l' 'e'
WORDFileType0=.s16, 1=.wav
LONGReservedMust be Zero.
LONGFileSizeSize of File
STRINGFileNameE.G. "foo1.s16"
BYTE[FileSize]DataThe file data itself.

Notes about Stored Sprite Files
If you include a sprite file (.s16) in your agent file, it is imperative that you store it in 565 format. If you do not, then problems will occur during injection.

Author Chunks "auth"
The author chunks contain a small amount of data allowing people to "sign" their agent files. They are not required by the injector. Here is the Author format:

BYTE[4]'a' 'u' 't' 'h'
BYTEDayCreatedCreation date of file
BYTEMonthCreatedCreation date of file
WORDYearCreatedCreation date of file