I wanted to examine the textures of a game I like on mobile. As far as I understand, the game textures were made with cocos2d. I have reversed the textures of other 2D games before, but I could not do this, please help.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>frames</key>
<dict>
<key>npc_alisa_arrange_black_01.png</key>
<dict>
<key>frame</key>
<string>{{82,60},{22,32}}</string>
<key>offset</key>
<string>{-1,16}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{28,8},{22,32}}</string>
<key>sourceSize</key>
<string>{80,80}</string>
</dict>
<key>npc_alisa_arrange_black_02.png</key>
<dict>
<key>frame</key>
<string>{{74,188},{22,30}}</string>
<key>offset</key>
<string>{-1,15}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{28,10},{22,30}}</string>
<key>sourceSize</key>
<string>{80,80}</string>
</dict>
<key>npc_alisa_cooking_black_01.png</key>
<dict>
<key>frame</key>
<string>{{34,84},{22,36}}</string>
<key>offset</key>
<string>{-1,17}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{28,5},{22,36}}</string>
<key>sourceSize</key>
<string>{80,80}</string>
</dict>
<key>npc_alisa_cooking_black_02.png</key>
<dict>
<key>frame</key>
<string>{{66,2},{22,38}}</string>
<key>offset</key>
<string>{-1,18}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{28,3},{22,38}}</string>
<key>sourceSize</key>
<string>{80,80}</string>
</dict>
<key>npc_alisa_cooking_black_03.png</key>
<dict>
<key>frame</key>
<string>{{2,126},{22,36}}</string>
<key>offset</key>
<string>{-1,17}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{28,5},{22,36}}</string>
<key>sourceSize</key>
<string>{80,80}</string>
</dict>
I tried with classic textureunpackers but I was not successful. Normally they open easily but I keep getting errors.
If you hex-dump your PNG file, it looks like this:
The "file magic" (a.k.a. signature) of a PNG file is:
so the first byte is corrupted. You can either edit it with a hex-editor, or if you are a dinosaur like me, use
xxdto dump it in plain ASCII, then usesedto change the first byte from00to89and then re-assemble the binary PNG from plain ASCII:That looks like this:
If you try and use that file, you'll get an error because the
lengthfield of theIHDRchunk is set to50 00 00 0dwhich is an enormous number which will make PNG readers try and read 1342177293 bytes ofIHDRand fall off the end of the file. The correct length of anIHDRis 13 bytes, so it should be00 00 00 0d. So, I get out trusty oldxxdandsedand change that too:Note that if you don't have/like
xxdandsed, you can use a hex editor. This is not an endorsement, and I have no affiliation, but there is a fairly decent online one here which means you don't have to install anything on your machine and it works for hapless Windows users too.