TGA (Truevision Targa)
TGA is the standard uncompressed image format utilized by the engine, typically reserved for UI elements, icons, or high-fidelity models that demand lossless alpha channels.
At a Glance
| Property | Value |
|---|---|
| Extension(s) | .tga |
| Magic Signature | Truevision Standard |
| Type | Uncompressed RGB/A Raster |
| Rust Reference | View rakata_formats::Tga in Rustdocs |
Data Model Structure
rakata-formats natively emulates the engine’s parsing logic. When evaluating a .tga file, Rakata ignores non-essential Truevision header flags (such as image_type and id_len) and strictly validates the payload against the engine’s natively supported pixel_depth thresholds.
Engine Audits & Decompilation
The following documents the engine’s exact load sequence for TGA textures mapped from swkotor.exe.
(Decompilation logic for this section was audited and verified via native Ghidra pipeline against swkotor.exe, explicitly pulling from ImageReadTGAHeader at 0x0045e2e0.)
| Pipeline Event | Ghidra Provenance & Engine Behavior |
|---|---|
| Header Stripping | Function: ImageReadTGAHeader (0x0045e2e0)The native engine parser is exceptionally loose. Standard Truevision fields such as image_type (offset +0x02), image_descriptor (offset +0x11 governing the origin bit), and the id_len field are completely ignored and never validated during a read sequence. |
| Depth Validation | Function: ImageReadTGAHeader (0x0045e2e0)The sole structural validation check performed before memory allocation dictates that the pixel_depth must strictly equal 8, 24, or 32. Any other depth integer triggers an immediate process failure. |
| Write Generation | Function: ImageWriteTGAThe engine’s in-memory rasterization is strictly top-left, but its canonical on-disk .tga format is entirely bottom-left. When saving screenshot files or extracting buffers to disk, the engine forcefully accommodates this by hardcoding image_type=2, id_len=0, and image_descriptor=0, explicitly triggering an ImageFlipY vertical inversion on the memory payload before pushing the image to disk. |