Skip to content

Instantly share code, notes, and snippets.

@jilleb
Last active February 28, 2021 22:59
Show Gist options
  • Save jilleb/a94b30868f1e1933319415ebb8f5632d to your computer and use it in GitHub Desktop.
Save jilleb/a94b30868f1e1933319415ebb8f5632d to your computer and use it in GitHub Desktop.
010 editor coloring
// This code will give each byte (or short or long) a color, which represents the value.
// 010 editor will display a color in the hex view, which can help to identify
// some logical structure inside a binary file.
local int i;
local int color=0;
while (!FEof()){
FSeek(i);
if (size == 0){
ubyte data;
FSeek(i-1);
color = data + (data*0x100) + (data *0x10000); //will generate grayscale data)
SetBackColor(color);
SetForeColor(color);
FSeek(i);
ubyte test;
i = i+1;
} else if (size == 1){
ushort data;
FSeek(i-1);
color = data;
SetBackColor(color);
SetForeColor(color);
FSeek(i);
ushort test;
i = i+2;
} else if (size == 2){
ulong data;
FSeek(i-1);
color = data/256; // causes some loss of detail because of trying to put 4.294.967.295 values into 16.777.215 values...
SetBackColor(color);
SetForeColor(color);
FSeek(i);
ulong test;
i = i+4;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment