Quote Originally Posted by testlelelala View Post
To be clear, i would add that the XXX header need to be "overwritten" to whatever is at the beginning, and NOT inserted if you "insert" you move the data and loose the original absolute offset position, and it won't work.
Yes, of course. I was doing it by
1) calculating the maximum header size that definitely doesn't overlap the subfile bodies (=max(offset_of_header[i] + header_size[i]))
2) copying the calculated amount of bytes starting from header XXX to offset 0.
Of course, we could do something more subtle like calculating the exact size of header XXX in each case. But it would require knowledge of IMG format much deeper than I have. I'm an absolute IMG-noob, as I said.