Users browsing this thread: 1 Guest(s)
[PS2] Need help figuring out what to do next!
#9
Hey there!
Bad news – I really can't wrap my head around it, I'm afraid :C

I've got samples for a compressed TIM2 file ("paktim" is just my nomenclature) extracted from the SCENEDAT and a legitimate, uncompressed counterpart TIM2 for it extracted from your save state. You can download them here.

The first eight bytes in the paktim are a header; 40 64 04 00 01 00 00 00 which should be read as two words, 00046440 00000001 which in turn just define the uncompressed size (0x46440 or 287808 bytes, which unsurprisingly is the file size of the legitimate TIM2 file) and the amount of files in the entry (1, which unsurprisingly is the ... uh, amount of files)


After that, you read a byte as the variable instruction.
Logical AND instruction with 0x1F and add 2 to it to get the variable amount.
Shift instruction right five times to get the variable method.

According to the method and amount, read bytes from the bytestream:
Method 7 is just "read amount bytes and write them to output".
Method 6 is "read 1 byte as surrogate and then repeat that byte exactly amount times to the output".
Method 0 is "repeat FF exactly amount times to the output".

The other methods are.... yeah, I dunno. Some methods look like they make sense but then the same method used later in the file does something completely different. I really can't figure out what the trick here is. Really hope someone else takes a look at this, it's driving me nuts!!

This is the TIM2 we're dealing with, for what it's worth.
[Image: 0013.png]
Once there was a way to get back homeward
Reply
Thanked by: Samevi


Messages In This Thread
RE: [PS2] Need help figuring out what to do next! - by Raccoon Sam - 12-06-2023, 07:26 AM

Forum Jump: