Users browsing this thread: 2 Guest(s)
iPhone sprite ripping
#22
Either that, or this is just a convenient or otherwise advantageous way of storing them. I do admit I don't see a reason not to use PNG though Tongue

This might not mean much to you, but I'll just put this here anyway. If not for anyone else, then for myself. Numbers preceded by "0x" are in hexadecimal and all values are little-endian unless stated otherwise.



Here's what I've figured out so far, from res_splash.bar. The image header contains info on how the images should be arranged, there are two in this particular file. These both start with 0xDF0539250100, as read in big-endian (0x0001253905DF in little-endian). After that comes a 16-bit unsigned integer, which designates the length of the following array (let's call it "arrayLength").

Now comes an array of "chunks", each chunk containing the coordinates and dimensions of a part of the image. The structure of each chunk goes like this:

1 byte - always 0x00, haven't seen anything else. Looks like some sort of separator.
16-bit unsigned integer - X coordinate
16-bit unsigned integer - Y coordinate
16-bit unsigned integer - width in pixels
16-bit unsigned integer - height in pixels

So there are [arrayLength] of these chunks. The X and Y coordinates are relative to the top-left of the image part.

After that come a bunch of bytes, whose meaning I have yet to discover. I don't know how to figure out the length either, however I can tell where it ends by finding the first part of the pixel data. In this file I can find that easily since the first colour in the pixel data should match the colour of the top-left pixel in the images I pieced together in my last post.

This pixel data is stored in 32-bit big-endian ARGB format (so that'd be BGRA when reading in little-endian). These are just like most image formats, you simply draw the pixels from left to right, row by row. You do this for each chunk, in the order the chunks are.
Again I'm not sure yet how to find out the length. I could probably multiply the dimensions for all the chunks, add them together, and multiply by 4, but there's probably a better way.



So yeah, that's what I've got so far. Theoretically it's already enough to get the images, but it really would be much better if I could figure out those bytes between the chunk array and pixel data. The first 5 bytes also look different in other files (e.g. res_chinatown_sprites.bar has 0xDF0531250100 instead of 0xDF0539250100) so that might have some significance as well.

I'm really glad how well this is going though!
You may have a fresh start any moment you choose, for this thing that we call "failure" is not the falling down, but the staying down. -Mary Pickford
Thanked by: jirachiband


Messages In This Thread
iPhone sprite ripping - by jirachiband - 10-30-2013, 01:15 PM
RE: iPhone sprite ripping - by Garamonde - 10-30-2013, 03:37 PM
RE: iPhone sprite ripping - by jirachiband - 10-30-2013, 04:38 PM
RE: iPhone sprite ripping - by jirachiband - 10-31-2013, 11:34 AM
RE: iPhone sprite ripping - by Raccoon Sam - 11-01-2013, 07:32 AM
RE: iPhone sprite ripping - by jirachiband - 11-01-2013, 02:25 PM
RE: iPhone sprite ripping - by Garamonde - 11-01-2013, 02:51 PM
RE: iPhone sprite ripping - by ThomasSpeedrunner - 11-01-2013, 03:20 PM
RE: iPhone sprite ripping - by jirachiband - 11-01-2013, 03:45 PM
RE: iPhone sprite ripping - by Garamonde - 11-01-2013, 04:08 PM
RE: iPhone sprite ripping - by jirachiband - 11-01-2013, 04:21 PM
RE: iPhone sprite ripping - by puggsoy - 11-01-2013, 04:40 PM
RE: iPhone sprite ripping - by jirachiband - 11-01-2013, 05:02 PM
RE: iPhone sprite ripping - by puggsoy - 11-01-2013, 06:40 PM
RE: iPhone sprite ripping - by jirachiband - 11-01-2013, 06:48 PM
RE: iPhone sprite ripping - by puggsoy - 11-01-2013, 06:53 PM
RE: iPhone sprite ripping - by jirachiband - 11-01-2013, 07:09 PM
RE: iPhone sprite ripping - by puggsoy - 11-01-2013, 08:20 PM
RE: iPhone sprite ripping - by jirachiband - 11-01-2013, 11:04 PM
RE: iPhone sprite ripping - by puggsoy - 11-02-2013, 02:59 AM
RE: iPhone sprite ripping - by jirachiband - 11-02-2013, 12:33 PM
RE: iPhone sprite ripping - by puggsoy - 11-03-2013, 04:41 AM
RE: iPhone sprite ripping - by jirachiband - 11-03-2013, 03:06 PM
RE: iPhone sprite ripping - by puggsoy - 11-04-2013, 06:23 PM
RE: iPhone sprite ripping - by jirachiband - 11-05-2013, 12:34 PM
RE: iPhone sprite ripping - by puggsoy - 11-05-2013, 05:30 PM
RE: iPhone sprite ripping - by jirachiband - 11-06-2013, 02:22 AM
RE: iPhone sprite ripping - by jirachiband - 11-06-2013, 06:28 PM
RE: iPhone sprite ripping - by puggsoy - 11-06-2013, 07:17 PM
RE: iPhone sprite ripping - by jirachiband - 11-07-2013, 07:38 PM
RE: iPhone sprite ripping - by jirachiband - 11-11-2013, 09:54 PM
RE: iPhone sprite ripping - by puggsoy - 11-11-2013, 10:41 PM
RE: iPhone sprite ripping - by jirachiband - 11-13-2013, 09:05 PM
RE: iPhone sprite ripping - by jirachiband - 11-27-2013, 04:15 PM
RE: iPhone sprite ripping - by puggsoy - 11-27-2013, 05:38 PM
RE: iPhone sprite ripping - by puggsoy - 01-19-2014, 10:54 PM

Forum Jump: