Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

TPC (Texture Pack Compressed)

TPC is the proprietary bundled texture format created by BioWare. It contains the raw DXT-compressed texture data, pre-computed mipmaps, and potentially appended TXI configuration data all in one blob.

At a Glance

PropertyValue
Extension(s).tpc
Magic SignatureNone
TypeCompressed Texture Pack
Rust ReferenceView rakata_formats::Tpc in Rustdocs

Data Model Structure

The rakata-formats crate provides a formally mapped Tpc container that completely shields you from managing pixel type bitmasks.

  • Pixel Enum Decoding: Instead of raw integer flag codes, calling known_pixel_format() instantly resolves the byte code into a robust TpcHeaderPixelFormat enumeration (e.g., Dxt1, Dxt5, Rgb, Greyscale).
  • Footer Management: Trailing TXI text is seamlessly maintained, and can be cleanly updated via .set_txi_text_strict().

Engine Audits & Decompilation

The following documents the engine’s exact load sequence for TPC textures mapped from swkotor.exe.

(Decompilation logic for this section was audited and verified via native Ghidra pipeline against swkotor.exe, explicitly pulling from CAuroraProcessedTexture::ReadProcessedTextureHeader at 0x0070f590.)

Pipeline EventGhidra Provenance & Engine Behavior
Format Byte MappingThe single header format byte acts as a strict bitmask. The engine explicitly checks bit0, bit1, and bit2 to generate internal format codes: 1, 3, and 4.
Compression DispatchThe runtime fundamentally ignores other variants. It strictly requires Code 3 to process 8-byte geometry chunks (standard S3TC DXT1) or Code 4 to process 16-byte chunks (standard S3TC DXT5).
Mipmap CalculationsRather than parsing explicit counts, the engine calculates mipmap storage dimensions by blindly right-shifting the base dimensions for each depth level without natively clamping the integer to 1. Because of this, extremely deep architectural mip levels can produce 0 geometry bytes!
OpenGL Hardware BindingWhen aggressively pushing the TPC bytes into OpenGL video memory, the engine natively maps Code 3 directly to OpenGL constant 0x83F0 (DXT1) and Code 4 straight to 0x83F3 (DXT5). Technically, there is zero branching logic to support native DXT3 (0x83F2) inside the vanilla engine’s parser.