1
Scripting and Reverse Engineering / Re: FF8 Remaster new compression algorithm
« on: 2019-09-07 12:17:17 »
Hi,
it is LZ4 block
https://github.com/lz4/lz4/blob/master/doc/lz4_Block_format.md
To convert it to LZ4 file, you need add header (create LZ4 frame).
https://github.com/lz4/lz4/blob/master/doc/lz4_Frame_format.md
To convert 4ZL to valid LZ4 file:
04224D18 is LZ4 magic number
607073 is frame descriptor (minimal variant)
00000000 is end mark
Then LZ4 file can be decompressed:
it is LZ4 block
https://github.com/lz4/lz4/blob/master/doc/lz4_Block_format.md
To convert it to LZ4 file, you need add header (create LZ4 frame).
https://github.com/lz4/lz4/blob/master/doc/lz4_Frame_format.md
To convert 4ZL to valid LZ4 file:
Code: [Select]
remove first 12 bytes from 4ZL (remove header, now you have LZ4 Block)
add to start 7 bytes "04224D18607073" and 4 bytes "compressed block size" (4ZL file size - 12)
add to end 4 bytes "00000000"
Code: [Select]
04224D18607073 4B_BLOCKDATASIZE BLOCKDATA 00000000
04224D18 is LZ4 magic number
607073 is frame descriptor (minimal variant)
00000000 is end mark
Then LZ4 file can be decompressed:
Code: [Select]
lz4.exe -d "bgroad_6.fl.lz4" bgroad_6.txt
And result bgroad_6.txt have 38 lines