Skip to main content

Module dds

Module dds 

Source
Expand description

DDS texture-container support. DDS (DirectDraw Surface) reader and writer.

This module provides container-level support for KotOR-era DDS files. Parsing and serialization are backed by ddsfile, but the public API is kept focused on D3D9-era headers and formats that KotOR actually uses.

§KotOR Notes

  • Reader support includes:
    • standard DDS containers (D3D9-era headers; canonical compressed formats are DXT1/DXT5).
    • a CResDDS prefix-header container variant used by vanilla resource paths.
  • Canonical KotOR compressed paths currently target DXT1 and DXT5.
  • Writer support currently emits standard DDS containers only.

§Two variants, told apart by the first four bytes

A standard DDS opens with the DDS magic and a 124-byte D3D9-era header. The CResDDS variant vanilla resource paths use has no magic at all: twenty bytes of proprietary prefix metadata sit where the header would be, and the surface payload follows directly. The prefix replaces the DDS header rather than preceding it.

Both are read and only the standard form is written. Emitting the prefixed variant would reproduce a container the engine reads and nothing else does. The prefix field map and the engine’s own read are in docs/src/formats/textures/dds.md.

Structs§

CResDdsHeader
Parsed CResDDS prefix metadata header.
Dds
In-memory DDS container.

Enums§

DdsBinaryError
Errors produced while parsing or serializing DDS data.
DdsSourceFlavor
DDS source container flavor.

Functions§

read_dds
Reads DDS data from a reader.
read_dds_from_bytes
Reads DDS data from bytes.
write_dds
Writes DDS data to a writer.
write_dds_to_vec
Serializes DDS data to a byte vector.

Type Aliases§

DdsCaps2
DDS caps2 bitflag re-export.
DdsD3dFormat
DDS D3D-format enum re-export.
DdsNewD3dParams
Constructor parameter set for D3D-style DDS creation.