mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
Both formats expanded their packed channels with arithmetic that cannot reach the top of the 8-bit range. A4R4G4B4 used `nibble / 0xF * 255` in integer arithmetic. nibble / 15 is 0 for every nibble 0..14 and 1 only for 15, so all four channels - alpha included - snapped to 0 or 255. In practice every affected texture decoded to a single flat colour with binary alpha. Measured on a CustomDM dat set, distinct colours and distinct alpha levels per texture before -> after: 06007068 1 -> 14 colours, 1 -> 1 alpha 0600926C 1 -> 40 colours, 2 -> 15 alpha 0600926E 1 -> 54 colours, 2 -> 16 alpha 06009340 1 -> 70 colours, 2 -> 9 alpha 06006430 1 -> 1 colours, 2 -> 11 alpha 255 / 15 == 17 exactly, so multiplying the nibble by 17 maps 0..15 onto 0..255 with no rounding error. The alpha nibble is now masked for symmetry with the other three. R5G6B5 expanded with a bare left shift, mapping a 5-bit value onto 0,8,16..248 and a 6-bit value onto 0,4,8..252. Neither reaches 255, so a fully saturated white decoded to (248,252,248) - slightly dark and slightly green tinted, since green keeps one more bit. Replicating the high bits into the low ones spans the full range. Measured before -> after on four textures whose brightest pixel is white: 06006402, 06006404, 0600641D, 060096C0 (248,252,248) -> (255,255,255) and partial-range textures scale correspondingly, e.g. 06009694 (216,36,248) -> (222,36,255). Affects every consumer of ACE.DatLoader that renders or exports textures. |
||
|---|---|---|
| .. | ||
| Entity | ||
| FileTypes | ||
| ACE.DatLoader.csproj | ||
| BinaryReaderExtensions.cs | ||
| CellDatDatabase.cs | ||
| DatDatabase.cs | ||
| DatDatabaseHeader.cs | ||
| DatDatabaseType.cs | ||
| DatDatabaseTypeAttribute.cs | ||
| DatDirectory.cs | ||
| DatDirectoryHeader.cs | ||
| DatFile.cs | ||
| DatFileType.cs | ||
| DatFileTypeAttribute.cs | ||
| DatFileTypeExtensionAttribute.cs | ||
| DatFileTypeIdRangeAttribute.cs | ||
| DatManager.cs | ||
| DatReader.cs | ||
| DxtUtil.cs | ||
| IUnpackable.cs | ||
| LanguageDatDatabase.cs | ||
| PortalDatDatabase.cs | ||
| UnpackableExtensions.cs | ||