HexEdit
HexEdit copied to clipboard
Templates: overlay (sub)fields and datadriven selection of highlighting
I'm trying to work with Matlab binary files, whose format is described in this PDF: https://www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf The format can be little endian or big endian, depending if bytes 126-127 (0-based) are 0x494D or 0x4D49, and this changes bytes position. I'm stuck with the following problems:
- each "element" is preceded by a tag, decomposable into two fields of 4 or 2 bytes each depending on the two MSBs of the first 4 bytes read as an uint32 (tag is 2x4 bytes if these are zero or 2x2 bytes if these are not); note that MSBs position depends on file endinanness. I'm not capable of coding this into templates
- the very same problem exists with "array flags": the LSB defines how to interpret the following data and the second LSB some flags: how can tell HexEdit "read this field as uint32, then subfield # 1 is !!(this & 0x0800), subfield # 2 is (this & 0xFF), etc."?