2013-11-17, 01:52 AM
Checking it out now.
If fileArray[n] = fileArray[n+2] then ...
If that first test came back positive, it checks again if 0x34-7 and 0x3C-F are identical
If fileArray[n+12] = fileArray[n+14] then ...
If those two tests come back positive, there's a fair chance it's a KFTIM. Then the tool just goes back and extracts/computes the info needed to build the TIM. For example the palette would be in fileArray[n+4] through fileArray[n+11] etc.
To scan for a regular TIM would be the same, but a little easier since they have the header tag "10000000".
(2013-11-15, 12:38 PM)TheStolenBattenberg link Wrote: Quite honestly, I have no idea how to make file seekers, I actually meant to ask you exactly how you did it for the KFtool.It's a bit difficult with the KFTIMs as I don't think they have a tag, but since data in PSX games is "aligned" in 4 byte chunks. You'll notice KFTIMs repeat bytes 0x0-3 at 0x8-B. So my tool reads the file being scanned into an array of 4 byte chunks, then compares each 4 byte chunk with the chunk that starts 4 bytes later to see if they're the same.
If fileArray[n] = fileArray[n+2] then ...
If that first test came back positive, it checks again if 0x34-7 and 0x3C-F are identical
If fileArray[n+12] = fileArray[n+14] then ...
If those two tests come back positive, there's a fair chance it's a KFTIM. Then the tool just goes back and extracts/computes the info needed to build the TIM. For example the palette would be in fileArray[n+4] through fileArray[n+11] etc.
To scan for a regular TIM would be the same, but a little easier since they have the header tag "10000000".