WerWolv / ImHex

šŸ” A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
37.42k stars 1.64k forks source link

[Bug] DDS pattern is incorrect #1744

Closed RunDevelopment closed 3 weeks ago

RunDevelopment commented 3 weeks ago

Operating System

Windows

What's the issue you encountered?

PixelFormatFlags in the pattern for DDS files is incorrect. This is the current pattern:

bitfield PixelFormatFlags {
  alphaPixels : 1;
  alpha       : 1;
  fourCC      : 1;
  padding     : 3;
  rgb         : 1; // 0x40
  padding     : 2;
  yuv         : 1; // 0x200
  padding     : 3;
  luminance   : 1; // 0x20000
  padding     : 17;
};

The bug is that the padding between yuv and luminance should be 7 and not 3. This can be seen by looking at the hex constants in the comments (count the zeros).

The correct version should be:

bitfield PixelFormatFlags {
  alphaPixels : 1;
  alpha       : 1;
  fourCC      : 1;
  padding     : 3;
  rgb         : 1; // 0x40
  padding     : 2;
  yuv         : 1; // 0x200
  padding     : 7;
  luminance   : 1; // 0x20000
  padding     : 13;
};

How can the issue be reproduced?

-

ImHex Version

1.34.0

ImHex Build Type

Installation type

MSI

Additional context?

I'm not sure whether this is the right place to report this issue.

sisco0 commented 3 weeks ago

@RunDevelopment The issue should be moved to this other repository, which is focused on ImHex Patterns: https://github.com/WerWolv/ImHex-Patterns/issues

sisco0 commented 3 weeks ago

I created the Pull Request to consider the current GIMP implementation for Direct-Draw Surface (DDS).

WerWolv commented 3 weeks ago

Merged šŸ‘ Thanks a lot for the effort

RunDevelopment commented 3 weeks ago

Thank you!