laymanshex/README
2020-04-27 15:29:48 +02:00

54 lines
1.2 KiB
Plaintext

LaymansHex
==========
LaymansHex takes a (partial) file description and allows tinkering with
the values in a binary file. It thus serves as a sort of layman's
hex editor.
File description format
-----------------------
In EBNF:
```
description =
{ comment }
endianness
definition
{ definition }
.
comment = '#' { LETTER | DIGIT } '\n'.
endianness = ("little endian" | "big endian") '\n'.
definition = name ':' type '\n'.
name = { LETTER | DIGIT }.
type = ( "byte[" INTEGER "]" )
| int8 | int16 | int32 | int64
| uint8 | uint16 | uint32 | uint64
| float32 | float64
```
The name of a definition line can be left empty to ignore that particular value.
Portions of the binary file not covered be the file description are ignored.
Usage
-----
To get values: laymanshex FORMATFILE BINARY
To set values: laymanshex -set "key1=value1,key2=value2" FORMATFILE BINARY
Examples of format descriptions can be found in the [laymanshex-files repo](/laymanshex-files/).
TODO
----
There is no way to express offset values inside a file yet. Since this is
relatively common, I will add it at some point. Also: Repeated data limited by
marker or size field.