Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:AGS asset library

From ReverseEngineering.wiki
Format
Magic CLIB 1A (head); CLIB 01 02 03 04 SIGE (tail)
Extensions .ags, ac2game.dat, agsgame.dat, appended to .exe
On this wiki Facts · Code · Notes · Topics

The packed data library of an Adventure Game Studio game (CLIB, also called MultiFileLib or MFL): a file starting with "CLIB" 0x1A and a version byte, or the same data appended to an executable and found through a 4+8 byte tail signature; versions 6, 10, 11, 15, 20, 21 and 30 exist.

Identification

MFLUtil::ReadSigsAndVersion (Common/data/multifilelib.cpp lines 143-209 at 01cc4c3) first reads 5 bytes at the start of the file and accepts "CLIB" 0x1A (the code also compares against a bare "CLIB"). If neither is found it looks for the 12-byte tail signature "CLIB" 01 02 03 04 "SIGE" at the end of the file; in front of that tail sit a 64-bit and a 32-bit view of the same field, the absolute offset of the library header. The reader tries the 64-bit offset first and, if the header signature is not at that offset, the 32-bit one. The byte after the header signature is the library version; the reader accepts only the versions in Fact:AGS asset library/enum/MFL versions and otherwise reports an unsupported version.

Table of contents

For versions 10 and above (multi-file) the next byte is the index of this file in the chain and must be 0 in the base file. Assets are then listed with a library index (LibUid), an offset and a size; assets with LibUid 0 live in the base file and get the appended-exe offset added. A game can be split into up to 256 data files (MaxMultiLibFiles, multifilelib.h line 62). Layouts per version are in Fact:AGS asset library/struct/Table of contents version 30 and Fact:AGS asset library/behavior/Older table of contents layouts.

Version 6 is the single-file layout: no file index byte; a password-modifier byte, a spare byte, a uint16 asset count, 13 bytes of password data, then 13-byte file names stored with the modifier added, uint32 sizes, 2 bytes per asset of flags and ratio, then the data in sequence.

Obfuscation

In versions 11, 20 and 21 the file names (and in 21 the whole table) are stored obfuscated with fixed constants in the engine source; the data of the assets themselves is not touched by this code. Version 30 stores the table in plain text. The constants are not reproduced on this wiki.

Writing

The current writer emits version 30 (WriteHeader/WriteV30, lines 399-431). The ender is a 64-bit offset followed by the tail signature for version 30 and a 32-bit offset for older versions (WriteEnder, lines 433-440).

Uses

The engine tests a candidate library for the main game by checking its table of contents for game28.dta or ac2game.dta, see Library:Adventure Game Studio.

Code & repositories

  • https://github.com/adventuregamestudio/ags @ 01cc4c3dafea4a5fc5804d887ca21975f738ce4e · license: Artistic-2.0 (declared by the contributor; GitHub's detector did not recognize License.txt)
    AGS engine and editor source: Common/ac/game_version.h, Common/game/main_game_file.cpp, Common/data/multifilelib.cpp, Common/game/room_version.h and room_file.cpp.
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-19; Note: the latest release ships binaries; the wiki links only the source, never the binaries