52 lines
1023 B
Plaintext
52 lines
1023 B
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 "key123=value123" FORMATFILE BINARY
|
|
|
|
|
|
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.
|