G40styBoy / Infinity-Blade-Save-Dumper

A tool that de-serializes and repackages Unencrypted Infinity Blade saves.
0 stars 0 forks source link

Deserialize Static Array Data Concisely #2

Open G40styBoy opened 1 month ago

G40styBoy commented 1 month ago

Thanks to Hox8, I have a new idea as to how I want to de serialize static arrays. This new method will make the de serialized data void of duplicate keys, which is apparent in the current version of the tool. Its overall much more readable for the user.

E.G

"NumConsumable": [
  {"Item":"TRA_Key_Small","Count":5},
  {"Item":"TRA_Key_Medium","Count":5},
  {"Item":"TRA_Key_Large","Count":5},
  {"Item":"TRA_GrabBag_Small","Count":2},
  {"Item":"TRA_GrabBag_Medium","Count":5},
  {"Item":"TRA_GrabBag_Large","Count":5},
  {"Item":"TRA_GrabBag_SmallGem","Count":3},
  {"Item":"TRA_GrabBag_MediumGem","Count":5},
  {"Item":"TRA_GrabBag_LargeGem","Count":5},
  {"Item":"TRA_Potion_HealthL","Count":5},
  {"Item":"TRA_World_1_Cactus","Count":20},
  {"Item":"TRA_World_2_Berries","Count":20},
  {"Item":"TRA_World_3_PinkPlant","Count":20},
  {"Item":"TRA_World_4_Reeds","Count":20},
  {"Item":"TRA_World_5_DesertBulb","Count":20},
  {"Item":"TRA_World_6_Mushroom","Count":20},
  {"Item":"TRA_World_7_Root","Count":20},
  {"Item":"TRA_World_8_Butterfly","Count":20},
  {"Item":"TRA_World_10_Cocoon","Count":20},
  {"Item":"TRA_World_11_Bones","Count":20}
],

Instead of

"NumConsumable": {"Item":"TRA_Key_Small","Count":5},
"NumConsumable": {"Item":"TRA_Key_Medium","Count":5},
"NumConsumable": {"Item":"TRA_Key_Large","Count":5},
"NumConsumable": {"Item":"TRA_GrabBag_Small","Count":2},
"NumConsumable": {"Item":"TRA_GrabBag_Medium","Count":5},
"NumConsumable": {"Item":"TRA_GrabBag_Large","Count":5},
"NumConsumable": {"Item":"TRA_GrabBag_SmallGem","Count":3},
"NumConsumable": {"Item":"TRA_GrabBag_MediumGem","Count":5},
"NumConsumable": {"Item":"TRA_GrabBag_LargeGem","Count":5},
"NumConsumable": {"Item":"TRA_Potion_HealthL","Count":5},
"NumConsumable": {"Item":"TRA_World_1_Cactus","Count":20},
"NumConsumable": {"Item":"TRA_World_2_Berries","Count":20},
"NumConsumable": {"Item":"TRA_World_3_PinkPlant","Count":20},
"NumConsumable": {"Item":"TRA_World_4_Reeds","Count":20},
"NumConsumable": {"Item":"TRA_World_5_DesertBulb","Count":20},
"NumConsumable": {"Item":"TRA_World_6_Mushroom","Count":20},
"NumConsumable": {"Item":"TRA_World_7_Root","Count":20},
"NumConsumable": {"Item":"TRA_World_8_Butterfly","Count":20},
"NumConsumable": {"Item":"TRA_World_10_Cocoon","Count":20},
"NumConsumable": {"Item":"TRA_World_11_Bones","Count":20}

Struct Example of New Format

  "Currency": [
    {
      "Current": 4117298,
      "TotalAcquired": -1903774695,
      "TotalFoundInWorld": -401628874,
      "TotalFromBattle": 1645740811
    },
    {
      "Current": 6150,
      "TotalAcquired": 379047,
      "TotalFromBattle": 334830
    }
  ],

Steps to accomplishing this:

Dumping Data

Repackaging Data

G40styBoy commented 3 weeks ago

As of today after refactoring UPropertyManager, this is the next task at hand.

G40styBoy commented 2 weeks ago

After many optimizations and refactoring, structs are now de-serialized concisely. Now I just need to pick a format for primitive types and de-serialize them in it.