Resource Formats and Resolution - OpenKotOR/PyKotor GitHub Wiki

Resource formats and resolution

KotOR does not resolve resources by extension alone. The effective lookup key is a (ResRef, type ID) pair, and both PyKotor's registry model and the recovered engine routines treat those two values as the identity of a resource rather than as optional metadata attached after a filename match. [ResourceTuple, ResourceType] CExoResMan::Exists @ (/K1/k1_win_gog_swkotor.exe @ 0x00408bc0, /TSL/k2_win_gog_aspyr_swkotor2.exe @ 0x0061b830, /Other BioWare Engines/Aurora/nwmain.exe @ 0x14018f590) CResGFF::ReadFieldCResRef @ (/K1/k1_win_gog_swkotor.exe @ 0x00411e10, /TSL/k2_win_gog_aspyr_swkotor2.exe @ 0x00624fa0, /Other BioWare Engines/Aurora/nwmain.exe @ 0x1401a12d0)

This page deliberately mixes two different evidence classes and labels them accordingly. Runtime-behavior statements in the opening sections are restricted to claims that can be anchored in at least three binaries from the current Odyssey project; the large type-ID tables later in the page are explicitly registry-derived from PyKotor's ResourceType enum and its supported_engines metadata. [BiowareEngine, ResourceType] For the broader prose on precedence and localized-string behavior, see Concepts.

Resource resolution order

Full prose (resource manager demands, KEY's role, override vs MOD/ERF/RIM): Concepts — Resource resolution order.

Operational summary:

  1. PyKotor exposes the top-level search layers as OVERRIDE, MODULES, and CHITIN, and its CHITIN branch explicitly checks both self._chitin and self._patch_erf. [SearchLocation, check_list(self._chitin) or check_list(self._patch_erf)]
  2. The recovered existence probe confirms that resource lookup is a typed table lookup, not a loose filename search. K1 routes CExoResMan::Exists through GetKeyEntry; TSL routes the same public probe through a less descriptive helper; Aurora exposes an override-first step by calling GetOverride and then FindKey on resident tables. CExoResMan::Exists @ (/K1/k1_win_gog_swkotor.exe @ 0x00408bc0, /TSL/k2_win_gog_aspyr_swkotor2.exe @ 0x0061b830, /Other BioWare Engines/Aurora/nwmain.exe @ 0x14018f590)
  3. The keyed-archive fallback is maintained as live state. CExoKeyTable::RebuildTable is present in all three binaries and rewires entries into lookup structures after table changes or reloads, which is the engine-side reason the KEY/BIF layer behaves like an indexed fallback rather than as ad hoc archive scanning. CExoKeyTable::RebuildTable @ (/K1/k1_win_gog_swkotor.exe @ 0x00410260, /TSL/k2_win_gog_aspyr_swkotor2.exe @ 0x006304a0, /Other BioWare Engines/Aurora/nwmain.exe @ 0x14018ccf0)
  4. This page therefore treats override, module capsules, and keyed archives as distinct layers, but only the override and keyed-table parts are directly anchored here at function scope. The more detailed prose about module precedence remains on Concepts, where the same distinction is scoped to the evidence currently recovered.

ResRef and resource type

ResRef is the base resource name. Resource type is the numeric discriminator that tells the engine what the bytes represent. PyKotor records that distinction directly in each ResourceTuple, which stores the numeric type_id, extension, broad category, storage family, and declared engine support rather than only a filename extension. [ResourceTuple, ResourceType]

The binary GFF decode path reinforces the same model. CResGFF::ReadFieldCResRef checks for field type 0xb, validates the serialized payload length, reads the leading name length byte, and then constructs a CResRef from the remaining bytes in K1, TSL, and Aurora. CResGFF::ReadFieldCResRef @ (/K1/k1_win_gog_swkotor.exe @ 0x00411e10, /TSL/k2_win_gog_aspyr_swkotor2.exe @ 0x00624fa0, /Other BioWare Engines/Aurora/nwmain.exe @ 0x1401a12d0)

The discrepancies are implementation-level rather than semantic. K1 reaches a CResRef constructor quickly after the field and size checks; TSL performs the same validation inside a larger x86 routine; Aurora exposes the final decode step as InitFromCharArray. CResGFF::ReadFieldCResRef @ (/K1/k1_win_gog_swkotor.exe @ 0x00411e10, /TSL/k2_win_gog_aspyr_swkotor2.exe @ 0x00624fa0, /Other BioWare Engines/Aurora/nwmain.exe @ 0x1401a12d0)

Use the tables on this page with the following reading rules:

  • Type ID is the canonical numeric value stored by containers and resource managers.
  • Contents tells you the storage family, which matters for whether a file is raw binary, text, GFF-backed, ERF-backed, or LIP-specific.
  • Engine support should be read as "known/declared support in the registry", not "confirmed retail usage in every shipped title". Some entries survive in the registry because KotOR tooling inherits broader Aurora/Odyssey lineage [BiowareEngine].

Language IDs (dialog.tlk, localization): Concepts — Language IDs.

Resource Type Identifiers

The type-ID catalog below is registry-derived. Its authoritative source is PyKotor's ResourceType enum and the attached supported_engines metadata, not the current reverse-engineering pass. [ResourceType, ResourceType classic range, ResourceType Odyssey extension block]

For KotOR specifically, the important structural split is that the inherited classic range and the Odyssey-only 3000+ extension block live in the same registry. That extension block includes several of the format families modders actually touch, including lyt, vis, rim, pth, lip, bwm, tpc, mdx, and bip. [LYT through MDX, BIP]

Common KotOR resource types

Resource Type ID Contents Engine support Typical use
2DA 0x07E1 binary table Aurora, Odyssey, Eclipse Gameplay tables, progression data, spell rows, appearances, and shared configuration
ARE 0x07DC GFF Aurora, Odyssey Area metadata
DLG 0x07ED GFF Aurora, Odyssey, Eclipse Dialog trees and conversation state
ERF / MOD / SAV / RIM 0x270D / 0x07DB / 0x0809 / 3002 container Aurora/Odyssey, Odyssey Capsule-style module, save, and shipped-area containers
GFF 0x07F5 GFF Aurora, Odyssey, Eclipse Structured binary payload family used by most UT*, DLG, GIT, IFO, JRL, GUI, and related resources
GIT / IFO 0x07E7 / 0x07DE GFF Aurora, Odyssey Module instance state and module metadata
LIP / BIP 3004 / 3028 lips Odyssey Lip-sync timing and related facial timing data
LYT / VIS / PTH 3000 / 3001 / 3003 plaintext / plaintext / GFF Odyssey Area layout, room visibility, and path data
MDL / MDX 0x07D2 / 3008 binary Aurora/Odyssey/Eclipse, Odyssey Model hierarchy plus mesh-sidecar data
NCS / NSS 0x07DA / 0x07D9 binary / plaintext Aurora, Odyssey Compiled and source NWScript
SSF / TLK 0x080C / 0x07E2 binary Aurora, Odyssey / Aurora, Odyssey, Eclipse Soundset-to-StrRef mappings and localized talk table strings
TPC / TGA / DDS / TXI 3007 / 0x0003 / 0x07F1 / 0x07E6 binary / binary / binary / plaintext Odyssey / shared / shared / Aurora, Odyssey Common texture payloads and texture metadata
UTC / UTI / UTP / UTD / UTM / UTW 0x07EB / 0x07E9 / 0x07FC / 0x07FA / 0x0803 / 0x080A GFF Aurora, Odyssey Creature, item, placeable, door, merchant, and waypoint templates
WOK / DWK / PWK / BWM 0x07E0 / 0x0804 / 0x0805 / 3005 binary Aurora, Odyssey / Odyssey Walkmesh family for areas, doors, placeables, and Odyssey binary walkmesh assets

The practical split is simple: most modders live in GFF resources, 2DA tables, scripts, talk tables, and models/textures, while engine and tool authors also need the Odyssey-specific 3000+ block because that is where layout, visibility, binary walkmesh, texture-container, and MDX sidecar types are declared [ResourceType 2000-2063 block, ResourceType 3000-3028 block].

Odyssey extension block (3000+)

These IDs are the biggest omission in many older KotOR summaries because they sit outside the classic Aurora range. In practice they cover exactly the kinds of assets that make Odyssey areas, rooms, visibility, lips, and texture/model sidecars work.

Extension Type ID Contents Typical KotOR role
LYT 3000 plaintext Area room/layout mapping
VIS 3001 plaintext Room-to-room visibility graph
RIM 3002 binary container Odyssey area/archive container
PTH 3003 GFF Path and waypoint-network data
LIP 3004 lips Lip-sync timing
bwm 3005 binary Odyssey binary walkmesh
txb 3006 binary Texture-related Odyssey helper type retained in the registry
TPC 3007 binary Primary Odyssey texture container
MDX 3008 binary Model mesh/geometry sidecar
rsv / sig 3009 / 3010 binary Registry placeholder Odyssey IDs with no current documented KotOR usage
mab 3011 binary Material-related binary type
qst2 / sto 3012 / 3013 GFF Odyssey quest/store-adjacent data types retained in the registry
hex 3015 binary Hex-grid related helper type
mdx2 / txb2 3016 / 3017 binary Secondary model/texture helper types
fsm / art / amp / cwa 3022 / 3023 / 3024 / 3025 binary / plaintext / binary / GFF State-machine, area-environment, brightness, and crowd-attribute helpers
bip 3028 lips Binary lip-sync companion type

All of those entries are declared as Odyssey-supported in the current registry, even when only a smaller subset is encountered in normal KotOR mod distribution workflows [LYT through BIP].

Legacy and cross-engine IDs that still matter in KotOR tooling

Some registry members survive because KotOR shares lineage with broader Aurora/Odyssey tooling, not because every title uses them equally. The most relevant examples are BMU, MPG, WMA, WMV, and XMV for audio/video payload families; HAK and NWM from Aurora container history; and BIK for Bink video. They are worth keeping documented because extraction tools, archive browsers, and cross-engine libraries need one registry that can reason about both KotOR and its neighboring BioWare formats [BMU-XMV, HAK-BIK, xoreos 0.0.6 release notes].

Extended classic registry table

All entries derive from PyKotor's ResourceType enum in type.py; each member's supported_engines field is the authoritative source for engine support [BiowareEngine, ResourceType members L209-L480]. Rows described as having "no known retail game files" are engine-registered types not observed in shipped KotOR archives.

Resource Name Type ID Description
RES 0x0000 Used for .res resources within the save game containers
BMP 0x0001 Bitmap image
MVE 0x0002 Movie/video file; Infinity-engine only — not present in KotOR [MVE]
TGA 0x0003 TarGA image format
WAV 0x0004 Wave audio file (see WAV File Format)
INI 0x0007 Configuration file (e.g., swkotor.ini, swkotor2.ini)
BMU 0x0008 Odyssey audio payload family; TSL commonly treats these as music-like assets rather than generic unknown data [BMU]
MPG 0x0009 MPEG video/audio-adjacent payload retained in the Odyssey registry [MPG]
TXT 0x000A Text file
WMA 0x000B Windows Media Audio; retained as an Odyssey-supported registry type [WMA]
WMV 0x000C Windows Media Video; retained as an Odyssey-supported registry type [WMV]
XMV 0x000D Xbox media/video type retained as an Odyssey-supported registry type [XMV]
PLH 0x07D0 Placeable header type; Odyssey-registered though no known retail KotOR game files of this type are shipped [PLH]
TEX 0x07D1 Texture type; Odyssey-registered though no known retail KotOR game files of this type are shipped [TEX]
MDL 0x07D2 3D model file (see MDL/MDX File Format)
THG 0x07D3 Unknown Odyssey-registered type; no known usage [THG]
FNT 0x07D5 Font file; Odyssey-registered though no known retail KotOR game files of this type are shipped [FNT]
Lua 0x07D7 Lua script source; Odyssey/Eclipse-registered though no known retail KotOR game files of this type are shipped [LUA]
SLT 0x07D8 Unknown Odyssey-registered type; no known usage [SLT]
NSS 0x07D9 NWScript source code (see NSS File Format)
NCS 0x07DA Compiled NWScript bytecode (see NCS File Format)
MOD 0x07DB Module ERF archive/container
ARE 0x07DC Area definition (see GFF-ARE)
SET 0x07DD Tileset; Odyssey-registered though no known retail KotOR game files of this type are shipped [SET]
IFO 0x07DE Module InFOrmation (see GFF-IFO)
BIC 0x07DF Character export data (GFF format); used in Aurora/Odyssey character exports and some save workflows [BIC]
WOK 0x07E0 Walkmesh (see BWM File Format)
2DA 0x07E1 Two-Dimensional Array data (see 2DA File Format)
TLK 0x07E2 Talk Table (Localized Strings, see TLK File Format)
TXI 0x07E6 TeXture Information
GIT 0x07E7 Game Instance Template (see GFF-GIT)
BTI 0x07E8 Blueprint Template Item. KotOR supports these but nobody uses them, use UTI instead.
UTI 0x07E9 item templates (see GFF-UTI)
BTC 0x07EA Blueprint Template Creature. KotOR supports these but nobody uses them, use UTC instead.
UTC 0x07EB Creature Template (see GFF-UTC)
DLG 0x07ED Dialogue/conversation (see GFF-DLG)
ITP 0x07EE ITP format (see Bioware-Aurora-PaletteITP).
BTT 0x07EF Blueprint Template Trigger. KotOR supports these but nobody uses them, use UTT instead.
UTT 0x07F0 Trigger Template (see GFF-UTT).
DDS 0x07F1 DirectDraw Surface Texture (see DDS File Format).
BTS 0x07F2 Sound template (BioWare), GFF (bts extension). BioWare-authored sound blueprint counterpart to the user-created uts.
UTS 0x07F3 Sound Template (see GFF-UTS).
LTR 0x07F4 Letter Format (see LTR File Format). Not used in KotOR
GFF 0x07F5 Generic file format (container, see GFF File Format)
FAC 0x07F6 Faction
BTE 0x07F7 Blueprint encounter
UTE 0x07F8 Encounter Template (see GFF-UTE)
BTD 0x07F9 Door template (BioWare), GFF. Rarely used directly; utd is the modder-facing equivalent.
UTD 0x07FA Door Template (see GFF-UTD)
BTP 0x07FB Blueprint placeable Not used in KotOR
UTP 0x07FC Placeable Template (see GFF-UTP)
DTF / DFT 0x07FD Default value file, INI format (.dtf / .dft extension). Used by area properties dialogs in the Aurora toolset. Not needed directly by modders.
GIC 0x07FE Game instance comments, GFF. Toolset-only — instance labels are stored in .gic separately from runtime .git data. Not processed by the game engine itself.
GUI 0x07FF User interface definition (see GFF-GUI)
CSS 0x0800 Conditional source script. Not used at runtime in KotOR.
CCS 0x0801 Conditional compiled script. Not used at runtime in KotOR.
BTM 0x0802 Blueprint merchant. KotOR supports these but nobody uses them, use UTM instead.
UTM 0x0803 Merchant/store template (see GFF-UTM)
DWK 0x0804 Door walkmesh (see BWM File Format)
PWK 0x0805 Placeable walkmesh (see BWM File Format)
BTG 0x0806 Random item generator template (BioWare), GFF.
UTG 0x0807 Random item generator template (user), GFF.
JRL 0x0808 Journal/quest log (see GFF-JRL)
SAV 0x0809 Save Game Containers (see ERF File Format)
UTW 0x080A Waypoint Template
4PC 0x080B Texture, custom 16-bit RGBA palette format. Odyssey-only type.
SSF 0x080C Sound Set Files (see SSF File Format)
HAK 0x080D Hak pak container. Not used in KotOR
NWM 0x080E Neverwinter Nights module (Not used in KotOR)
BIK 0x080F BInK video format
NDB 0x0810 Script debugger file. Generated by the Aurora toolset debugger; not used by the game engine.
PTM 0x0811 Plot instance/manager, GFF.
PTT 0x0812 Plot wizard blueprint, GFF.
NCM 0x0813 Registry placeholder type with no current documented BioWare usage.
MFX 0x0814 Registry placeholder type with no current documented BioWare usage.
MAT 0x0815 Material file. Used in later BioWare titles; not present in KotOR.
MDB 0x0816 BioWare geometry model (.mdb). Used in NWN2 / Dragon Age; not present in KotOR.
SAY 0x0817 Registry placeholder type with no current documented BioWare usage.
TTF 0x0818 TrueType font (.ttf). Used in some BioWare titles; not present in KotOR.
TTC 0x0819 Registry placeholder type with no current documented BioWare usage.
CUT 0x081A Cutscene, GFF. Not present in KotOR.
KA 0x081B Karma data, XML format. Not present in KotOR.
JPG 0x081C JPEG image. Eclipse engine only (Dragon Age).
ICO 0x081D Windows icon format. Eclipse engine only (Dragon Age).
OGG 0x081E Audio, Ogg Vorbis. Eclipse engine only (Dragon Age).
SPT 0x081F Tree data, SpeedTree format. Not present in KotOR.
SPW 0x0820 Registry placeholder type with no current documented BioWare usage.
WFX 0x0821 Woot effect class, XML format. Not present in KotOR.
UGM 0x0822 Registry placeholder type with no current documented BioWare usage.
QDB 0x0823 Quest database, GFF. Not present in KotOR.
QST 0x0824 Quest, GFF. Not present in KotOR.
NPC 0x0825 Registry placeholder type with no current documented BioWare usage.
SPN 0x0826 Registry placeholder type with no current documented BioWare usage.
UTX 0x0827 Registry placeholder type with no current documented BioWare usage.
MMD 0x0828 Registry placeholder type with no current documented BioWare usage.
SMM 0x0829 Registry placeholder type with no current documented BioWare usage.
UTA 0x082A Registry placeholder type with no current documented BioWare usage.
MDE 0x082B Registry placeholder type with no current documented BioWare usage.
MDV 0x082C Registry placeholder type with no current documented BioWare usage.
MDA 0x082D Registry placeholder type with no current documented BioWare usage.
MBA 0x082E Registry placeholder type with no current documented BioWare usage.
OCT 0x082F Registry placeholder type with no current documented BioWare usage.
BFX 0x0830 Registry placeholder type with no current documented BioWare usage.
PDB 0x0831 Registry placeholder type with no current documented BioWare usage.
TheWitcherSave 0x0832 The Witcher save file. Non-BioWare game; tracked in xoreos type registry.
PVS 0x0833 Registry placeholder type with no current documented BioWare usage.
CFX 0x0834 Registry placeholder type with no current documented BioWare usage.
LUC 0x0835 Script, LUA bytecode. Eclipse engine only (Dragon Age).
(reserved) 0x0836 Type ID 2102 is reserved/skipped in the xoreos registry.
PRB 0x0837 Registry placeholder type with no current documented BioWare usage.
CAM 0x0838 Campaign information, Aurora engine only. Not present in KotOR.
VDS 0x0839 Registry placeholder type with no current documented BioWare usage.
BIN 0x083A Registry placeholder type with no current documented BioWare usage.
WOB 0x083B Registry placeholder type with no current documented BioWare usage.
API 0x083C Registry placeholder type with no current documented BioWare usage.
Properties 0x083D Registry placeholder type for the .properties extension, with no current documented BioWare usage.
PNG 0x083E PNG image. Odyssey and Eclipse engine support.
ERF 0x270D Encapsulated Resource File (see ERF File Format)
BIF 0x270E Bioware Index File (container, see BIF File Format)
KEY 0x270F KEY table (BIF index, see KEY File Format)

For KotOR specifically, do not stop reading at 0x270F: the Odyssey-only 3000+ block above is part of the real resource landscape and includes some of the most important room/layout/visibility/model-sidecar types in the games [LYT through BIP].

File format index

File formats

See also