ace/Source/ACE.DatLoader/FileTypes
Zynerji acbced8b75
Fix 16-bit texture decode: A4R4G4B4 and R5G6B5 (#4480)
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.
2026-08-13 01:04:08 -04:00
..
ActionMap.cs DatReader - ActionMap (#4217) 2024-08-20 19:26:08 -04:00
Animation.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
BadData.cs Dat updates (#847) 2018-07-05 07:50:42 -05:00
CellLandblock.cs Improving /tele and minimap click teleporting (#1157) 2018-12-20 07:49:03 -05:00
CharGen.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
ChatPoseTable.cs Dat updates (#847) 2018-07-05 07:50:42 -05:00
ClothingTable.cs Layering (#2158) 2019-07-25 09:20:42 -07:00
CombatManeuverTable.cs more CMT fixes for players (#2946) 2020-04-18 16:15:29 -04:00
ContractTable.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
DbProperty.cs Added Dat structures and tests for UILayout and DbProperties (#4208) 2024-08-13 14:45:30 -04:00
DidMapper.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
DualDidMapper.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
EnumMapper.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
EnvCell.cs fix EnvCell header comment (#4049) 2023-09-24 02:58:02 -04:00
Environment.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
FileType.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
Font.cs Added three new dat FileTypes (#1106) 2018-11-28 23:52:14 -05:00
GeneratorTable.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
GfxObj.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
GfxObjDegradeInfo.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
Iteration.cs Add support for client DAT patching from server (#3979) 2023-06-09 13:15:10 -04:00
LandblockInfo.cs improve house root guid (#2889) 2020-04-08 00:43:03 -04:00
LanguageInfo.cs Fix DatLoader.Tests (#3191) 2020-09-01 19:59:47 -05:00
LanguageString.cs Fix LanguageString (#3196) 2020-09-02 07:12:57 -05:00
LayoutDesc.cs Added Dat structures and tests for UILayout and DbProperties (#4208) 2024-08-13 14:45:30 -04:00
MasterProperty.cs Added support for parsing MasterProperty, 0x39000001 in the client_portal.dat (#3970) 2023-04-10 05:45:09 -04:00
MotionTable.cs attack hook selects body part (#3441) 2021-05-22 15:54:18 -04:00
NameFilterTable.cs - Added MaximumSameCharactersInARow to dat NameFilterTable. (#4307) 2025-05-06 11:32:47 -04:00
Palette.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
PaletteSet.cs Fix GetPaletteID function (#1962) 2019-06-04 09:14:12 -07:00
ParticleEmitterInfo.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
PhysicsScript.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
PhysicsScriptTable.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
QualityFilter.cs Dat updates (#847) 2018-07-05 07:50:42 -05:00
RegionDesc.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
RenderTexture.cs Add DataCategory / TextureType to dat RenderTexture obj (#4308) 2025-05-06 11:32:58 -04:00
Scene.cs ACE.DatLoader improvements (#626) 2018-02-07 22:14:50 -06:00
SecondaryAttributeTable.cs Dat updates (#847) 2018-07-05 07:50:42 -05:00
SetupModel.cs Wire up support for RotationSpeed (#3745) 2021-11-28 13:11:36 -05:00
SkillTable.cs Fixing monster retired skill #s (#1817) 2019-04-28 01:30:45 -04:00
SoundTable.cs Some DatLoader updates (#1110) 2018-12-02 12:49:52 -05:00
SpellComponentsTable.cs AdjusSpell Words (#876) 2018-07-17 19:25:38 -05:00
SpellTable.cs Adding house deeds, purchase requirements w/ config options (#1426) 2019-02-07 16:39:30 -05:00
StringTable.cs Adding house deeds, purchase requirements w/ config options (#1426) 2019-02-07 16:39:30 -05:00
Surface.cs Improving DatLoader for third-party apps (#1092) 2018-11-22 01:33:17 -05:00
SurfaceTexture.cs Dat updates (#847) 2018-07-05 07:50:42 -05:00
TabooTable.cs ACE.DatLoader TabooTable added 2018-03-19 08:10:21 -05:00
Texture.cs Fix 16-bit texture decode: A4R4G4B4 and R5G6B5 (#4480) 2026-08-13 01:04:08 -04:00
UserBindingValue.cs DatReader - ActionMap (#4217) 2024-08-20 19:26:08 -04:00
Wave.cs Updating audio export (#1105) 2018-11-27 01:15:34 -05:00
XpTable.cs refactoring raise attribute/vital/skill, fixing security issues with them (#2483) 2019-12-05 02:54:58 -05:00