tools/dumpnbt: Wanted feature tracker #47

Closed
opened 2022-08-15 14:21:17 +02:00 by BodgeMaster · 4 comments
  • Read NBT data from a file (or pipe/stdin?) and dump it to stdout
    • readable format for humans
    • XML
  • read XML into NBT
  • hex mode for values
  • hex mode for metadata
  • sorting
    • as input
    • alphabetically
    • alphabetically, compounds fist, lists second, rest by name (default)
    • alphabetically, compounds first, list second, rest by type in ascending order
      The order in which NBT is stored can matter, therefore sorting it doesn’t make sense.

Information that needs to be included in the human-readable format:

  • tree-like structure visualization
  • tag type
  • offset (position in the file)
  • tag header size (if applicable)
  • payload size (if applicable)
  • total size for end tag
  • length (if applicable)
  • content type (if applicable)
  • content / value

Could look something like this:

[0: Compound] :
|–Header: 3 bytes
|
|–[3: String] Test:
| |–Header: 7 bytes
| |–Payload: 24 bytes
| '–Content: This is a test string.
|
|–[34: 8 Bit Integer] Number:
| |–Header: 9 bytes
| |–Payload: 1 byte
| '–Value: 110
|
|–[44: Compound] another compound:
| |–Header: 20 bytes
| |
| |–[64: List] numbers:
| | |–Header: 14
| | |–Content Type: int 64
| | |–Length: 5
| | |
| | |–[64 Bit Integer]:
| | | |–Payload: 8 bytes
| | | '–Value: 386 515 432
| | |
| | |–[64 Bit Integer]:
| | | |–Payload: 8 bytes
| | | '–Value: 1 337
| | |
| | |–[64 Bit Integer]:
| | | |–Payload: 8 bytes
| | | '–Value: 3 456 029 568 145
| | |
| | |–[64 Bit Integer]:
| | | |–Payload: 8 bytes
| | | '–Value: 9 900 000
| | |
| | '–[64 Bit Integer]:
| |   |–Payload: 8 bytes
| |   '–Value: 80 386
| |
| |–[118: Float] pointy:
| | |–Header: 9 bytes
| | |–Payload: 4 bytes
| | '–Value: 3423.67746
| |
| '–[131: end]
|   '–Total: 1 byte
|
'–[132: end]
  '–Total: 1 byte
- [ ] Read NBT data from a file (or pipe/stdin?) and dump it to stdout - [x] readable format for humans - [ ] XML - [ ] read XML into NBT - [ ] hex mode for values - [ ] hex mode for metadata - ~~[ ] sorting~~ - ~~[ ] as input~~ - ~~[ ] alphabetically~~ - ~~[ ] alphabetically, compounds fist, lists second, rest by name (default)~~ - ~~[ ] alphabetically, compounds first, list second, rest by type in ascending order~~ The order in which NBT is stored can matter, therefore sorting it doesn’t make sense. Information that needs to be included in the human-readable format: - `tree`-like structure visualization - tag type - offset (position in the file) - tag header size (if applicable) - payload size (if applicable) - total size for end tag - length (if applicable) - content type (if applicable) - content / value Could look something like this: ``` [0: Compound] : |–Header: 3 bytes | |–[3: String] Test: | |–Header: 7 bytes | |–Payload: 24 bytes | '–Content: This is a test string. | |–[34: 8 Bit Integer] Number: | |–Header: 9 bytes | |–Payload: 1 byte | '–Value: 110 | |–[44: Compound] another compound: | |–Header: 20 bytes | | | |–[64: List] numbers: | | |–Header: 14 | | |–Content Type: int 64 | | |–Length: 5 | | | | | |–[64 Bit Integer]: | | | |–Payload: 8 bytes | | | '–Value: 386 515 432 | | | | | |–[64 Bit Integer]: | | | |–Payload: 8 bytes | | | '–Value: 1 337 | | | | | |–[64 Bit Integer]: | | | |–Payload: 8 bytes | | | '–Value: 3 456 029 568 145 | | | | | |–[64 Bit Integer]: | | | |–Payload: 8 bytes | | | '–Value: 9 900 000 | | | | | '–[64 Bit Integer]: | | |–Payload: 8 bytes | | '–Value: 80 386 | | | |–[118: Float] pointy: | | |–Header: 9 bytes | | |–Payload: 4 bytes | | '–Value: 3423.67746 | | | '–[131: end] | '–Total: 1 byte | '–[132: end] '–Total: 1 byte ```
BodgeMaster added the
TODO
label 2022-08-15 14:21:36 +02:00
BodgeMaster added this to the Basic development tools milestone 2022-08-15 14:21:41 +02:00
BodgeMaster added a new dependency 2022-08-15 20:40:30 +02:00
BodgeMaster removed a dependency 2022-08-15 20:40:36 +02:00
BodgeMaster added a new dependency 2022-08-15 20:40:49 +02:00
BodgeMaster added a new dependency 2022-08-15 20:40:57 +02:00

XML for the same data as above could look like this:

<compound>
  <string name="Test"> This is a test string. </string>
  <int8 name="Number"> 110 </int8>
  <compound name="another compound">
    <list name="numbers">
      <int64> 386515432 </int64>
      <int64> 1337 </int64>
      <int64> 3456029568145 </int64>
      <int64> 9900000 </int64>
      <int64> 80386 </int64>
    </list>
    <float name="pointy"> 3423.67746 </float>
  </compound>
</compound>
XML for the same data as above could look like this: ```xml <compound> <string name="Test"> This is a test string. </string> <int8 name="Number"> 110 </int8> <compound name="another compound"> <list name="numbers"> <int64> 386515432 </int64> <int64> 1337 </int64> <int64> 3456029568145 </int64> <int64> 9900000 </int64> <int64> 80386 </int64> </list> <float name="pointy"> 3423.67746 </float> </compound> </compound> ```

Working on a preliminary version right now so i can get away from online development tools (I have been trying to work offline without much success). This will require a full rewrite once the NBT library is fully in place but I kinda need this tool first to make the full NBT library. Watch out for ugly hacks ahead.

Working on a preliminary version right now so i can get away from online development tools (I have been trying to work offline without much success). This will require a full rewrite once the NBT library is fully in place but I kinda need this tool first to make the full NBT library. Watch out for ugly hacks ahead.

Turns out I have no fucking clue how to implement drawing the tree. :(

Turns out I have no fucking clue how to implement drawing the tree. :(

Just eliminating feature creep here...

Dumpnbt is for visualization which it is doing a fine job at. If we ever actually need XML support a dedicated issue for that can be filed later.

Hex output format has been made redundant bc baseconvert which allows for straight-forward number conversion.

Just eliminating feature creep here... Dumpnbt is for visualization which it is doing a fine job at. If we ever actually need XML support a dedicated issue for that can be filed later. Hex output format has been made redundant bc `baseconvert` which allows for straight-forward number conversion.
Sign in to join this conversation.
There is no content yet.