PretendoNetwork / ddl-parser

Parse and build out DDL Parse Trees from WiiU/3DS dumps
3 stars 0 forks source link

[Bug]: `toJSON` doesn't save the element names #1

Open DaniElectra opened 3 months ago

DaniElectra commented 3 months ago

Checked Existing

What happened?

Upon checking a DDL tree exported as JSON, the name of each element isn't exported. This is problematic in those cases where a parse tree contains two elements which have the same fields inside, such as DDLRMC and DDLAction. This can be the case on Net-Z parse trees, where these elements are on the same layer, but are called in different ways.

What did you expect to happen?

The name of each element is exported on the JSON, maybe on a __type field.

Steps to reproduce?

  1. Lookup a game which has Net-Z parse trees
  2. Export those DDL parse trees to JSON with something like nex-documentation-generator
  3. The element names aren't present on the exported JSON

Other relevant information. (OPTIONAL)

No response

jonbarrow commented 3 months ago

Sounds good to me. Out of curiosity though, when would this be useful? Are we missing docs due to this, or is it just for completion sake?

DaniElectra commented 3 months ago

Inside DO you can either perform an Action or an RMC call. These are different types of calls as shown on the image below, and thus it is important to disstinguish them on documentation. However, since they have the same fields with the same names on ddl-parser, you can't tell the difference between them when exported as JSON.

imagen

This is an example use case, but it would also be nice to easily tell what element are we looking at inside the JSON