mrmacete / r2-ggpack

Suite of radare2 plugins to read and manipulate the ggpack data files used by Thimbleweed Park game
MIT License
21 stars 0 forks source link

cannot parse dictionary at <address> #2

Closed rpelorosso closed 6 years ago

rpelorosso commented 6 years ago

I couldn't reopen the previous one as I wasn't the one who closed it.

@mrmacete I'm sorry I had to create this again :( Although the commit fixes the issues with sym.Vista.wimpy, I've found that there are still a couple of files than can't be extracted, such as:

[0x00000000]> s sym.ReyesAnimation.json
[0x0464a016]> =!pDj
gg_value_carve: unsupported type 1
gg_value_carve: error on array item 0
gg_hash_carve: could not carve value
gg_value_carve: error on array item 0
gg_hash_carve: could not carve value
gg_value_carve: error on array item 60
gg_hash_carve: could not carve value
cannot parse dictionary at 0x464a016
[0x0464a016]> 

Please let me know if you need any more information, and of course, grazie mille! :)

mrmacete commented 6 years ago

hey! no problem at all.

to figure out what type ids correspond to, it's necessary to go into the game executable, reverse that part and figure it out ;)

i'll take a look into type 1, then. Feel free to do the same if you're into reversing.

mrmacete commented 6 years ago

it turns out type 1 is the NULL object, i'm on it!

mrmacete commented 6 years ago

added support for NULL type here, plus fixed a small regression: https://github.com/mrmacete/r2-ggpack/commit/203ad791da2bddb0d2e4325705e2293c2e802479

please confirm it works for you and feel free to close this one ;)

rpelorosso commented 6 years ago

That's so amazing, thank you @mrmacete ! sym.ReyesAnimation.json can be extracted now :) There's seems to be a regression, however, as sheets from Texture Packer seem to have problems while exporting, for example:

[0x00000000]> s sym.RansomePickingBerriesSheet.json
[0x04529b24]> =!pDj
gg_hash_unserialize: wrong signature 0x7266227b
cannot parse dictionary at 0x4529b24
[0x04529b24]> s sym.CassieSheet.json
[0x004be3a1]> =!pDj
gg_hash_unserialize: wrong signature 0x7266227b
cannot parse dictionary at 0x4be3a1
[0x004be3a1]> s sym.CassieSheet.png
[0x004c278a]> =!pDj
gg_hash_unserialize: wrong signature 0x474e5089
cannot parse dictionary at 0x4c278a

thank you so much!

mrmacete commented 6 years ago

oh, that's not a regression, because =!pDj is only for GGDictionary types (i.e. wimpy files).

for other types i suggest you to explore standard r2 printing / dumping commands, just type p? to see them (all printing commands start with p).

For example:

[0x00000000]> s sym.CassieSheet.json
[0x004be388]> psz 17385~{}
Do you want to print 1936 lines? (y/N)
{
  "frames": {
    "breach_mid_body1": {
      "frame": {
        "x": 857,
        "y": 2,
        "w": 26,
        "h": 49
      },
      "rotated": false,
      "trimmed": true,
      "spriteSourceSize": {
        "x": 22,
        "y": 46,
        "w": 26,
        "h": 49
      },
      "sourceSize": {
        "w": 64,
        "h": 100
      },
[...]

or

[0x004be388]> s sym.CassieSheet.png
[0x004c2771]> px
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x004c2771  8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
0x004c2781  0000 0494 0000 0075 0806 0000 0018 fdbb  .......u........
0x004c2791  7100 0000 0970 4859 7300 000b 1300 000b  q....pHYs.......
0x004c27a1  1301 009a 9c18 0000 2000 4944 4154 78da  ........ .IDATx.
0x004c27b1  ecbd 7d74 5455 9637 fcbb 0d0e 3681 c6d8  ..}tTU.7....6...
0x004c27c1  241d 2060 1003 8949 6ba0 6d42 cb47 5328  $. `...Ik.mB.GS(
0x004c27d1  195a 455d 41cc a0d2 8328 5f6f dbc9 303e  .ZE]A....(_o..0>
0x004c27e1  cf34 c165 260d ab81 99f5 b4bc a036 202d  .4.e&........6 -
0x004c27f1  d27e 4007 5ac6 119d 9726 9268 204e a24e  .~@.Z....&.h N.N
0x004c2801  1269 8a54 1281 0885 4987 48e4 1158 388f  .i.T....I.H..X8.
0x004c2811  3cf7 fda3 722e a74e dd8f 733f cebd b792  <...r..N..s?....
0x004c2821  da6b d5ba a94a d5d9 fbee b3cf adbb 7ff5  .k...J..........
0x004c2831  dbfb 0009 4948 4212 9290 8424 2421 0949  ....IHB....$$!.I
0x004c2841  4842 1292 9084 2424 2109 4948 4212 9290  HB....$$!.IHB...
0x004c2851  8424 2421 0949 4842 1292 9084 2424 2109  .$$!.IHB....$$!.
0x004c2861  4948 4212 224a 2437 956d 9eb0 512e 6e59  IHB."J$7.m..Q.nY

if you're going to write stuff to files type w? and wt? to see what radare2 offer, and / or you can use the dump scripts provided in this repo.

rpelorosso commented 6 years ago

You are right! My bad! Sorry for the noise. In fact, this:

[0x004be3a1]> f~sym.CassieSheet.json
0x004be3a1 17385 sym.CassieSheet.json
[0x004be3a1]> s sym.CassieSheet.json
[0x004be3a1]> wtf sym.CassieSheet.json 1738
Dumped 1738 bytes from 0x004be3a1 into sym.CassieSheet.json

Works like a charm. It looks then, that everything is working fine. I'm closing this Issue. Thank you so much! :D

mrmacete commented 6 years ago

bella! ;)