@wood5568
I checked the file and found that there were indeed some Type2 compressions that were not decompressed correctly, which has now been fixed.
If there are still unsupported formats, you can upload samples.
For the PS2 version, I used dynamic debugging and static analysis assistance. If the arcade version only uploads ELF, I may not be lucky enough to find the relevant decompression code.
.dat is a container of TIM2 compressed files. You need to repackage the modified TIM2 file as .dat, and then use aluigi's txr script to re-import the .dat.
I am here to provide a quickbms script to unpack .dat.
The script has the same effect as my program "-o" mode unpacking(only unpack without decompression), and it is only used for re-importing here.
When you finish modifying the TIM2 file, you need to insert 4 bytes into the header of the TIM2 file. The first byte is the compression type, write 0, and the last 3 bytes are the file size is big-endian storage.
For example, 01 00 08 60. Compression type 1, decompression size 0x860. But we need to change the compression type to 0. Then change the decompression size to the file size because there is no compression.
Then rename the file according to the corresponding index name to the name after unpacking my program or quickbms. Then replace the corresponding file. Then re-import the file to .dat.
But whether it works, I think you need to test first.
Code: Select all
#Quickbms script
#Wangan Midnight PS2 .dat unpack
get numFiles long
xmath maxIndex "numFiles - 1"
for i = 0 < numFiles
get OFFSET long
savepos nextOfs
if i != maxIndex
get SIZE long
math SIZE - OFFSET
else
get SIZE asize
math SIZE - OFFSET
endif
goto offset
get CmpType byte
goto nextOfs
string NAME p "%d.cmp%d" i CmpType
log NAME OFFSET SIZE
next i
---------------------------------------
Hi @ aluigi
Type 1 is a variant of LZSS
Type 2 is a variant of RLE.
I have not verified the other types.
I uploaded the source code, you can check it out.
I think re-compression is also feasible. Type2 is a variant of RLE encoding.
I think it should be possible to modify the compression source code to achieve compression.