> i understand the .pal format, its quite easy thankfully. now i moved onto .shp files. i can read the header fine(NumImages,A,B,Width,Height,C), but when it comes to the offeset array, i have a problem. the format for the offsets are [Offest,RefOffset], and the format for Offset is [Offet,format]. can someone explain to me how to read these things?, i tried reading the file byte by byte, but i dont think that is how i am supposed to go about this.
After the first 8 bytes comes 24 bytes for each frame. These 24 bytes, are sort of headers for each frame, I guess you could call them that. Format is as follows:
FrameHeaders[frame][0] = x1
FrameHeaders[frame][1] = x1 >> 8
FrameHeaders[frame][2] = y1
FrameHeaders[frame][3] = y1 >> 8
FrameHeaders[frame][4] = x2 - x1
FrameHeaders[frame][5] = (x2 - x1) >> 8
FrameHeaders[frame][6] = y2 - y1
FrameHeaders[frame][7] = (y2 - y1) >> 8
These first bytes describe the dimensions of individual frames. The SHP as a whole has dimensions as described in the first 8 bytes, but each frame can be smaller as to clip out redundant BG. x1 is the left of the image, y1 the top, x2 the right, y1 the bottom. The bytes go from top to bottom, so although x2 > x1, y1 > y2.
FrameHeaders[frame][8] = ctype
Type of compression to use. Until you have a working setup, use 0x00, then you can worry about 0x03.
FrameHeaders[frame][9] = 0
FrameHeaders[frame][10] = 0
FrameHeaders[frame][11] = 0
FrameHeaders[frame][12] = 0
FrameHeaders[frame][13] = 0
FrameHeaders[frame][14] = sh
FrameHeaders[frame][15] = 0
FrameHeaders[frame][16] = 0
FrameHeaders[frame][17] = 0
FrameHeaders[frame][18] = 0
FrameHeaders[frame][19] = 0
If there's an odd number of frames, sh = 0x07. If there's an even number, the first half get 0x07, the rest 0x00.
FrameHeaders[frame][20] = offset
FrameHeaders[frame][21] = offset >> 8
FrameHeaders[frame][22] = offset >> 16
FrameHeaders[frame][23] = offset >> 24
Byte offset of the beggining of a frame.
I'm not sure what your questions was, but hopefully I covered it.
meselfs himself!
