Pattern Data

Visualize all patterns generated by the source code in the Pattern Editor View

The Pattern Data View

The Pattern Data View is a simple tree representation of the Patterns generated by the Pattern Language source code that has been executed in the Pattern Editor View. These two views work hand in hand. By default, the table in this view will be completely empty until any Pattern Language source code is executed and that code places any type into the loaded data throught the placement syntax.

Structure of the patterns

The table in the Pattern Data view consists of six columns:

  • Name: This column simply displays the name of this pattern. The name is either the name of the variable or a customized string set through the [[name("value")]] attribute.

  • Color: This column shows the color of this pattern as it's highlighted in the Hex Editor View. This color is usually selected from a repeating color pallette but can also be manually assigned using the [[color("RRGGBB")]] attribute.

  • Offset: This colum shows the start and end address of the pattern where it has been placed into the data.

  • Size: This column shows the size of the pattern.

  • Type: This column displays a formatted version of this pattern's Type name.

  • Value: This column is the most important one as it displays the value that this pattern has decoded from the data it was placed on.

Interacting with the patterns

Each line in the table correspons to one pattern that was generated. Simple patterns such as a u32 will stand on their own and simply display their decoded value. Other more complicated patterns such as custom struct types might have children that can be displayed. If a pattern has any children, an arrow icon appears to the left of their name. Clicking on the name will expand the tree view of that pattern and display its children.

Clicking anywhere else on the pattern will cause the Hex Editor View to jump to the address of this pattern and select it.

When bytes are being selected in the Hex Editor View, some of the names of the patterns might turn blue. This color indicates that the current selection in the Hex Editor View overlaps with this pattern or one of its children.

Modifying pattern values

Most built-in pattern types as well as custom types that have been attributed with the [[format_write]] attribute can be modifed by double clicking their Value field. Doing so will turn the Value field into a text box where the new value can be entered. Pressing the Enter key will cause the pattern to format the entered value and write the bytes back into the data where the pattern has been placed at.

Visualizers

Visualizers are a ImHex-specific extension to the Pattern Language. They allow you to visualize data in more advanced ways than by just using text and colors.

To use a visualizer, simply apply the [[hex::visualize("visualizer_name", params...)]] attribute to the type or varibale you want to visualize.

struct Coordinates {
    float latitude;
    float longitude;
} [[hex::visualize("coordinates", latitude, longitude)]];

The entry in the Value column will then turn into a Button that will open the visualizer popup with the specific visualization inside.

Available Visualizers

[[hex::visualize("line_plot", float_array)]]

This visualizer expects an array of 4 Byte float values and will visualize it using a Line Plot

Line Plot Visualizer

[[hex::visualize("scatter_plot", x_float_array, y_float_array)]]

This visualizer expects two arrays of 4 Byte float values and will visualize it as a Scatter Plot using the first array for the X Coordinates and the second array for the Y Coordinates. These two arrays need to have the same size.

Scatter Plot Visualizer

[[hex::visualize("image", pattern)]]

This visualizer expects any pattern that contains the bytes of an image (such as a struct, a byte array and so on) and will decode the data into the actual image data.

Supported formats are: JPG, PNG, TGA, BMP, PSD, GIF, HDR and PIC

Image Visualizet

[[hex::visualize("bitmap", pattern, width, height)]]

This visualizer expects any pattern that contains raw RGBA8 values in the form of RR GG BB AA, one byte per color channel as well as the width and height in pixels of the resulting image. It will draw these bytes as is.

Bitmap visualizer

[[hex::visualize("sound", pattern, num_channels, sample_rate)]]

This visualizer expects any pattern that contains all the bytes of a raw PCM audio stream, the number of channels that are being used and the sample rate. It allows you to convert this data to sound to listen to.

Sound Visualizer

[[hex::visualize("3d", vertices, indices)]]

This visualizer expects an array of 4-Byte float values containing the vertex coordinates of a model and an optional u32 array containing indices into the vertices array. null can be used for the indicies array if it shouldn't be used.

The visualizer takes this data and renders a 3D model out of it

3D Visualizer

[[hex::visualize("chunk_entropy", pattern, chunk_size)]]

This visualizer expects any pattern whose bytes will be split into chunks of the size specified by the chunk_size parameter. It will then display an entropy graph of these bytes

Enropy Visualizer

[[hex::visualize("hex_viewer", pattern)]]

This visualizer expects any pattern whose bytes will be displayed in a hex viewer similar to the one in the hex editor view. This is mainly useful for splitting out large chunks of bytes and looking at them individually or for debugging when getting patterns into the right format for other visualizers to work with.

Hex Viewer Visualizer

[[hex::visualize("coordinates", latitude, longitude)]]

This visualizer expects a latitude and longitude value in form of a floating point number and visualizes this coordinate on a map of our planet. It also allows for checking the internet for the approximate name / address of this location.

Coordinates Visualizer

Last updated