WerWolv / ImHex-Patterns

Hex patterns, include patterns and magic files for the use with the ImHex Hex Editor
https://github.com/WerWolv/ImHex
GNU General Public License v2.0
640 stars 168 forks source link

Fix bitfield PixelFormatFlags #259

Closed sisco0 closed 3 months ago

sisco0 commented 3 months ago

Solves https://github.com/WerWolv/ImHex/issues/1744

Pattern

PixelFormatFlags, which is part of DDS_PIXELFORMAT is an already present bitfield which requires of re-work. The following actions were performed over the given bitfield:

  1. Proper bitfield names were added instead of padding, adding a clear representation of each flag.
  2. Comments are added for each one of the bitfield elements.
  3. luminance field is now properly aligned.

For more information about the current re-worked bitfield, consult Direct-Draw Surface flags definition at GIMP.

Checklist

WerWolv commented 3 months ago

Thanks a lot! Is it important that the values of the padding fields are shown? padding is a special keyword otherwise that simply skips those bits without them being shown in the pattern data view.

sisco0 commented 3 months ago

Thank you for your kind review @WerWolv . I have now re-worked the current Pull Request with proper values after consulting GIMP repository. Only one padding is left, and that is presented at the end of the current bitfield with the name padding for not showing it.

sisco0 commented 3 months ago

I would re-factor the current Pull Request to contain a test, so ideally I could learn more from the repository structure and could provide evidence.

WerWolv commented 3 months ago

There's already a test file in the repo that the current pattern is being run on to make sure it runs correctly. But you can add some std::assert() calls to the pattern file to verify values if there's any good candidates

sisco0 commented 3 months ago

I attach graphic evidence of the file under test folder with positive results compared to current GIMP implementation in this comment: Evidence_Pixelformatflags