Mod package spec 0.1
Status: draft for public review. Spec 0.x may change between versions. Spec 1.0 freezes with Halogen v1.0.
This document is licensed under CC-BY-4.0. The JSON Schema is licensed under MIT.
Halogen is not affiliated with or endorsed by the rights holders of the game.
1 Overview
A mod package is a zip file with the extension .hlmod. It holds a manifest, mod.toml, and full replacement files for game assets. A package never holds original game files.
Each replacement names its asset by an asset ID: the place of the asset in the game’s own data. The asset ID never depends on a name or an export path. Each replacement also records the original hash of the asset it replaces. A reader rejects a replacement when the game’s asset has a different hash.
Spec 0.1 allows textures only.
The words MUST, MUST NOT, SHOULD, and MAY have the meaning given in RFC 2119.
2 Container
- The package MUST be a zip file. Zip64 is allowed.
- Each entry MUST use one of these compression methods: stored (0), Deflate (8), or zstd (93). Writers SHOULD use zstd. Writers SHOULD use Deflate only for compatibility with tools that cannot read zstd.
- Preview images SHOULD be stored without compression. PNG data is already compressed.
- Entries MUST NOT be encrypted.
- Entries MUST NOT be symbolic links.
- Entry data MUST NOT overlap.
- Each entry name MUST appear once.
- Each entry name MUST be valid UTF-8 and MUST be a safe path (section 2.1).
- The declared uncompressed size of each entry MUST equal its real size.
2.1 Safe paths
A safe path:
- is not empty and is at most 160 bytes long;
- is relative: it does not start with
/and contains no drive letter; - uses
/as the only separator and contains no\; - has no empty segment, and no
.or..segment; - contains no control characters and none of
< > : " | ? *; - has no segment that ends with a dot or a space;
- has no segment whose name before the first dot is a reserved Windows device name:
CON,PRN,AUX,NUL,COM0toCOM9,LPT0toLPT9, and the superscript formsCOM¹,COM²,COM³,LPT¹,LPT²,LPT³, in any letter case.
Two entries MUST NOT have names that differ only in letter case.
The 160-byte limit leaves room for the mod store prefix under the Windows path length limit.
3 Layout
mod.toml the manifest (required)
README.md description for users (optional)
files/<any path>.dds replacement files (at least one)
preview/<name>.png preview images (optional, no subfolders)
files/MAY contain subfolders.- A file in
files/MUST have the extension.dds, in any letter case. deltas/is reserved for a later spec. A package MUST NOT contain it.- A package MUST NOT contain any other entry.
- Folder entries are allowed for
files/, its subfolders, andpreview/.
4 Manifest
mod.toml is a TOML 1.0 file in UTF-8. It is at most 1 MiB.
Example:
spec = "0.1"
id = "author.cool-texture-pack"
name = "Cool texture pack"
version = "1.2.0"
authors = ["author"]
license = "CC-BY-4.0"
description = "Replaces 12 street textures."
target = "leonida-xbox"
target_version = "1.0.2.1"
layout = 1
tags = ["textures", "world"]
[requires]
"other.mod-id" = ">=1.0.0"
[conflicts]
"another.mod-id" = "*"
[[file]]
asset = "x64/levels/city.rpf:0x1a2b3c00:3"
path = "files/street_01.dds"
name = "street_01"
original_sha256 = "<64 hex characters>"
sha256 = "<64 hex characters>"
4.1 Top-level fields
| Field | Type | Required | Rules |
|---|---|---|---|
spec | string | yes | The spec version. "0.1" for this document. |
id | string | yes | Mod ID (section 4.3). |
name | string | yes | 1 to 100 characters, not only white space. |
version | string | yes | A Semantic Versioning 2.0.0 version, for example 1.2.0 or 2.0.0-beta.1. |
authors | array of strings | yes | At least one. No empty names. |
license | string | yes | The license of the package content, at most 200 characters. An SPDX expression is recommended. |
description | string | no | 1 to 10,000 characters. |
target | string | yes | Game target ID (section 4.4). |
target_version | string | yes | A game version of the target (section 4.4). |
layout | integer | yes | Asset ID layout of the target (section 4.4). |
tags | array of strings | no | At most 20. Each is 1 to 32 characters of a-z, 0-9, and -, and starts with a letter or digit. No duplicates. |
features | array of strings | no | Required features (section 7). Spec 0.1 defines none. |
requires | table | no | Mods this mod needs (section 4.5). |
conflicts | table | no | Mods this mod cannot be used with (section 4.5). |
file | array of tables | yes | One [[file]] table per replacement file. At least one. |
delta | Reserved. MUST NOT be present. |
4.2 [[file]] fields
| Field | Type | Required | Rules |
|---|---|---|---|
asset | string | yes | The asset ID of the replaced asset (section 5). |
path | string | yes | The entry path of the replacement file. A safe path inside files/ with the extension .dds. |
name | string | no | A display name, 1 to 100 characters. |
original_sha256 | string | yes | The original hash of the replaced asset (section 5.1). 64 lower-case hex characters. |
sha256 | string | yes | SHA-256 of the replacement file. 64 lower-case hex characters. |
Rules:
- Every file in
files/has exactly one[[file]]entry, and every entry names a file in the package. - Two entries MUST NOT name the same path. Paths are compared without letter case.
- Two entries MUST NOT name the same asset ID.
sha256MUST NOT equaloriginal_sha256.
4.3 Mod IDs
A mod ID has two or more segments joined by .. Each segment uses a-z, 0-9, and -, and starts with a letter or digit. The whole ID is at most 64 characters.
The first segment is the author prefix. A hosting service MAY reserve a prefix for the account that first publishes with it. Example: author.cool-texture-pack.
4.4 Targets
A target is one build of the game. Spec 0.1 defines one target:
target | target_version | layout | Game |
|---|---|---|---|
leonida-xbox | 1.0.2.1 | 1 | GTA VI, Xbox Series build 1.0.2.1, run by Leonida |
layout is Halogen’s own number, not a value from the game or from Leonida. It versions how a target’s asset IDs are formed. A new way to form container paths or offsets for a target gets a new layout number.
4.5 Dependencies
requires and conflicts map mod IDs to version requirements. A requirement uses the syntax of Cargo, for example "1.2", ">=1.0.0, <2.0.0", or "*" for any version.
- A mod MUST NOT name itself.
- A mod ID MUST NOT be in both tables.
5 Asset IDs
An asset ID names an asset by its place in the game’s data:
<container>:<offset>:<entry>
containeris the path of the archive or texture store, relative to the game folder. It uses/as the separator. Each segment usesa-z,0-9,_,-, and., and is not.or...offsetis the start of the resource in the container:0xfollowed by 1 to 16 lower-case hex digits, with no leading zeros. Zero is0x0.entryis the index of the asset inside the resource, for example a texture in a texture dictionary: a decimal number from 0 to 4,294,967,295, with no leading zeros.- The whole ID is at most 512 bytes.
Example: x64/levels/city.rpf:0x1a2b3c00:3.
Only this canonical form is valid, so one asset has exactly one ID string. Tools compare IDs as strings.
5.1 Original hash
The original hash of an asset is the SHA-256 of its native entry bytes, exactly as stored in the container. It is not the hash of an exported or converted file.
A reader MUST reject a replacement when the game’s asset has a different original hash. This is the compatibility check: a package made for one game version cannot be applied to another by mistake.
How a target forms its offsets, entries, and native entry bytes is part of its layout (section 4.4). Section 5.2 defines layout 1 of leonida-xbox.
5.2 Layout 1 of leonida-xbox
All integers are little-endian.
Texture pools (.ttpf files, magic RDS5). A pool is a virtual address space cut into chunks, with a catalog of textures.
offsetis the start of the texture’s allocation in the pool’s address space: the base field of its 16-byte catalog record times 4096.entryis the texture’s index in the catalog.- The native entry bytes are, in order: the texture’s 16-byte catalog record, its 8-byte asset key (eight zero bytes when the catalog has none), and the stored bytes of every chunk that covers the allocation, in address order. A chunk’s stored bytes are its bytes in the file, without the zero padding after them. Nothing is decompressed, so a texture stored with BCPack has an original hash too.
RPF9 archives (.rpf files, magic 9FPR). Resources are found by carving, because the table of contents is encrypted.
offsetis the file position of the first zlib stream of the resource.entryis the index of the asset inside the resource, for example a texture in a texture dictionary. A resource that holds one asset uses entry 0.- The native entry bytes are, in order: the entry as a 4-byte unsigned integer, and the stored bytes of every zlib stream of the resource, in file order. A stream’s stored bytes include its zlib header and Adler-32 trailer, and not the zero padding between streams.
The resource’s streams are the stream at offset and the streams that directly follow it (a gap of less than 16 zero bytes). When the resource’s page map gives its system and graphics page counts, it has exactly that many streams. Otherwise a following stream belongs to it when the stream before decoded to a multiple of 65,536 bytes, or when the following stream does not begin a resource of its own.
6 Textures
A replacement texture is a DDS file with the DX10 extended header.
6.1 File rules
Checked without the game:
- The file starts with the
DDSmagic, a 124-byteDDS_HEADER, and a 20-byteDDS_HEADER_DXT10. The pixel format has the FourCC flag and the FourCCDX10. - The resource dimension is
TEXTURE2D. Cube maps (TEXTURECUBEflag, square faces) and texture arrays are allowed. 1D and 3D textures are not allowed in 0.1. - Width and height are 1 to 16384. The array size is 1 to 2048.
- The mip count is between 1 and the full chain for the size. A mip count of 0 means 1.
- The DXGI format is a concrete format from the table in section 6.3. Typeless formats are not allowed, because they hide the sRGB flag.
- BC2 is not allowed in 0.1.
- The file length is exactly the header plus the pixel data. Pixel data is tightly packed: for each array element and face, every mip from the largest to the smallest. Block-compressed mips use whole 4x4 blocks. There are no trailing bytes.
6.2 Rules checked against the game
A validator with access to the game (halogen validate --game <dir>) also checks:
- The asset ID names a texture in the game.
- The original hash matches (section 5.1).
- Width and height equal the original’s.
- The DXGI format equals the original’s. A BCPack original is replaced with the matching plain BCn format.
- The sRGB flag equals the original’s.
- The mip count equals the original’s native mip count, taken from the resource header. Exported DDS files often have fewer mips than the native chain, so the native count is the reference.
- The original is not BC2.
- The file is not identical to the original.
The package stores the final DDS. A runtime does no encoding at play time.
6.3 DXGI formats
| Kind | Formats |
|---|---|
| Block-compressed, 8 bytes per block | BC1_UNORM, BC1_UNORM_SRGB, BC4_UNORM, BC4_SNORM |
| Block-compressed, 16 bytes per block | BC3_UNORM, BC3_UNORM_SRGB, BC5_UNORM, BC5_SNORM, BC6H_UF16, BC6H_SF16, BC7_UNORM, BC7_UNORM_SRGB |
| 16 bytes per pixel | R32G32B32A32_FLOAT |
| 8 bytes per pixel | R16G16B16A16_FLOAT, R16G16B16A16_UNORM, R32G32_FLOAT |
| 4 bytes per pixel | R8G8B8A8_UNORM, R8G8B8A8_UNORM_SRGB, R8G8B8A8_SNORM, B8G8R8A8_UNORM, B8G8R8A8_UNORM_SRGB, B8G8R8X8_UNORM, B8G8R8X8_UNORM_SRGB, R10G10B10A2_UNORM, R11G11B10_FLOAT, R9G9B9E5_SHAREDEXP, R16G16_FLOAT, R16G16_UNORM, R32_FLOAT |
| 2 bytes per pixel | R8G8_UNORM, R16_FLOAT, R16_UNORM, B5G6R5_UNORM, B5G5R5A1_UNORM, B4G4R4A4_UNORM |
| 1 byte per pixel | R8_UNORM, A8_UNORM |
7 Compatibility
specnames the spec version. A reader MUST reject a spec version it does not know. In spec 0.x, every version is a different format.- From spec 1.0 on, a 1.x reader reads every 1.y package. New 1.y versions add only optional fields or new required features.
- A reader MUST ignore unknown optional fields. A validator SHOULD warn about them, because they are often typing errors.
featureslists features the package needs. A reader MUST reject a package that names a feature it does not know, with a message that names the feature. This is how a later spec adds something that old readers must not ignore.- Asset ID patterns for audio, shaders, and models are reserved for later specs. Deltas (
deltas/,[[delta]]) are reserved for a later spec.
8 Limits
These are the defaults of halogen validate. A host MAY set its own.
| Limit | Default |
|---|---|
| Package file size | 500 MiB |
| Total uncompressed size | 2048 MiB |
| Number of files | 10,000 |
mod.toml size | 1 MiB |
9 Writers
halogen pack writes packages this way. Other writers SHOULD do the same.
mod.tomlis the first entry. The other entries follow in byte order of their names.- Every entry has the timestamp 1980-01-01 00:00:00 and Unix permissions 0644. The same input then always gives the same package bytes.
- Textures and the manifest use zstd at level 3, or Deflate at level 6 with
--compat. Previews are stored.
A project folder has the same layout as a package. In a project, sha256 fields MAY be left out; pack fills them in and keeps the rest of mod.toml unchanged, comments included. Other files in a project folder are left out of the package, with a warning.
A project MAY also hold sources/: the files that replacement files were made from, such as the PNG image a DDS file was converted from, at the replacement’s path inside files/ with the source’s extension (files/city/sign.dds from sources/city/sign.png). pack leaves sources/ out of the package without a warning, and validate does not report it in a project. A package MUST NOT contain it.
A [[file]] entry MAY name a file that a project does not have yet. validate reports it as file-missing, and pack refuses the project until the file is there. Tools use this for a replacement that is planned but not made.
10 Validation codes
halogen validate reports each problem with a stable code. --json prints the same data for tools.
| Code | Meaning |
|---|---|
archive-invalid | The file is not a readable zip. |
archive-compression | An entry uses a compression method other than stored, Deflate, or zstd. |
archive-encrypted | An entry is encrypted. |
archive-overlap | Entry data overlaps. |
archive-symlink | An entry is a symbolic link. |
entry-duplicate | An entry name appears twice. |
entry-unexpected | An entry is not part of the layout. A warning in a project folder. |
entry-size | An entry’s real size differs from its declared size. |
limit-package-size, limit-unpacked-size, limit-file-count | A limit from section 8 is exceeded. |
path-unsafe | A path breaks the rules of section 2.1. |
path-collision | Two paths differ only in letter case. |
manifest-missing | There is no mod.toml. |
manifest-syntax | mod.toml is not valid UTF-8 TOML. |
field-missing, field-type, field-invalid | A manifest field is missing, has the wrong type, or has a bad value. |
field-unknown | Warning: an unknown field is ignored. |
spec-unknown | The spec version is not known. |
feature-unknown | A required feature is not known. |
target-unknown, target-version-unknown, layout-unknown | The target, its version, or its layout is not known. |
dependency-invalid | A requires or conflicts entry is bad. |
delta-reserved | The package uses deltas/ or [[delta]]. |
file-unlisted | A file in files/ has no [[file]] entry. |
file-missing | A [[file]] entry names a file that is not in the package. |
file-listed-twice | Two [[file]] entries name the same path. |
asset-id-invalid | An asset ID is not in canonical form. |
asset-listed-twice | Two [[file]] entries name the same asset. |
not-texture | A file is not a .dds file. |
dds-invalid | The DDS header breaks a rule of section 6.1. |
dds-bc2 | A BC2 texture, or a BC2 original. |
dds-length | The DDS file length is not exactly the header plus the pixel data. |
hash-invalid | A hash is not 64 lower-case hex characters. |
hash-mismatch | A file’s SHA-256 differs from its sha256 field. |
identical-to-original | A file’s SHA-256 equals its original_sha256. |
preview-invalid | A preview is not a PNG image. |
game-asset-missing | With --game: the asset ID names no texture in the game. |
game-hash-mismatch | With --game: the game’s original hash differs. |
game-size-mismatch, game-format-mismatch, game-srgb-mismatch, game-mip-mismatch | With --game: the texture does not match the original. |
game-identical | With --game: the file is identical to the original texture. |
game-unavailable | With --game: the game’s data could not be read. |
io | A read or write failed. |
11 Changes
- 0.1 (2026-11): first version. Textures only.
- 0.1, revision 2 (2026-11): adds section 5.2, which defines how layout 1 of
leonida-xboxforms asset IDs and original hashes for texture pools and RPF9 archives. Manifests do not change. - 0.1, revision 3 (2026-11): a project’s
sources/folder, and entries for replacements not made yet (section 9). Packages do not change.