kk49 / deca

Tool for modding APEX engine games (Generation Zero, theHunter, ...)
MIT License
101 stars 15 forks source link

Export ADF as JSON #164

Open rgr78 opened 1 month ago

rgr78 commented 1 month ago

Hi.

I was wondering if you could implement a new feature: export ADF files as JSON. Or, make the text export parseable as JSON.

For example, instead of

--------instances
instances   ed7e7e79    c5333160    equipment_ammo_bh_bow_arrow_420 152 128 00000098-00000118
# Structure AmmunitionTuning(0xC5333160), Data Offset: 152(0x00000098)
{
  ammunition_class:
    # Array of Structure AmmunitionClass(0x4BCCE369), Data Offset: 272(0x00000110), Info Offset: 152(0x00000098)
    [
      # Structure AmmunitionClass(0xF18AFACE), Data Offset: 272(0x00000110)
      {
        level:
          2  # uint08(0x0CA2821D), Data Offset: 272(0x00000110)
      }
      # Structure AmmunitionClass(0xF18AFACE), Data Offset: 273(0x00000111)
      {
        level:
          3  # uint08(0x0CA2821D), Data Offset: 273(0x00000111)
      }
      # Structure AmmunitionClass(0xF18AFACE), Data Offset: 274(0x00000112)
      {
        level:
          4  # uint08(0x0CA2821D), Data Offset: 274(0x00000112)
      }
      # Structure AmmunitionClass(0xF18AFACE), Data Offset: 275(0x00000113)
      {
        level:
          5  # uint08(0x0CA2821D), Data Offset: 275(0x00000113)
      }

Something like:

{
    "ammunition_class": [
        {
            "level": 2
        },
        {
            "level": 3
        },
        {
            "level": 4
        },
        {
            "level": 5
        }
    ]
}

It's mostly the lack of commas in the strings, and the colons on the arrays.

GrizzlyNZ commented 1 month ago

You could find / create a Python script to export a .JSON file from a .TXT format (Extracted as text from DECA).

ChatGPT could be a good tool to create this script for you :)