Join Date: Apr 2012
Liked 120 Times in 23 Posts
Mentioned: 27 Post(s)
Tagged: 0 Thread(s)
Resident evil 4 HD PS3 .LFS Discussion
I just create this new thread in order to get some help in my reverse engineering of the resident evil 4 HD format .LFS.
I'm now facing a problem when i want to edit some files of RE4 (like .esl for scripts of stages (Adding enemies, swapping), omake.esl for example)
This problem is because in the HD ver they use the new file archive .lfs also they added a .crc check so they make the file omake.esl now is omake.esl.lfs.crc, i have reversed the EBOOT (Executable ps3) so i now that .crc is not a File system or file extension because if you open omake01.esl.lfs.crc you can see the file with (ZLDR HEADER) so the .crc is just an extension to force a flag check of the file with .crc algorithms.
I uploaded three files of the game for example:
config.txt.crc (Totally a .txt file without any compresion or anything, just debug text) http://www.mediafire.com/?tpuaa8cg58286sh
f55a.tpl.crc (Texture files for the game) http://www.mediafire.com/?n5nkb56j5evofo1
Other sample .lfs emleon00.esl.lfs.crc http://www.mediafire.com/download.php?436tr7zor7ia7ul.
sample .lfs save_s.dat.lfs.crc http://www.mediafire.com/?mfq5emn5pamtuhm
You can see that .crc is not an FS or compression file, is just an extension (In the eboot is most like a FLAG to check .CRC) like you see (because if you open config.txt.crc you can open it with Notepad even because its just text).
I have a patch to disable .CRC32 CHECK but now i need to defeat the LFS compression algorithm.
So i want to deal with the REAL extension there on many files and is .LFS.
LFS have something with LZMA compression system and in the exec file you can see strings like:
[lfs] Decompression offset error.
[lfs] Critical error.
So it must be some sort of LZMA file the header like you see in the samples is 'ZLDR', i'm doing research in the game but i need help of more people with more knowledge.
In my Debugger i see the Game when load a .LFS file always check first header of file loaded and compare it to 'ZLDR' header and if is invalid (NOT EQUAL TO 'ZLDR') return this message "File Access Error: 1"
The game runs his own taskset to uncompress every .LFS file edgeLzmaTaskSet
I have reversed more about .LFS files and i know a little more about his Header right now.
For now: .LFS File Structure.
.LFS RE4 header:
0x0 size 4 bytes > magic 'ZLDR'
0x4 size 4 bytes > unknown
0x8 size 4 bytes > string 'segs'
0xC size 1 byte > kDecompressionType (Always '1' in these .LFS format RE4 HD)
'1' = kDecompressionType_EdgeLzma
0xD size 1 byte > File Version num (Commonly '5' in these .LFS format RE4 HD game)
0xE size 2 bytes > Number of compressed blocks.
0x10 size 4 bytes > Size of uncompressed archive
0x1C size 4 bytes > 'ZLDR' Header size
('ZLDR' Header size - 1) + 0x8 size 5 bytes > LZMA PROPERTIES (Example '5d''00''00''01''00')
The game use a dictionary size of 0x10000
An LZMA file have many of these elements and you can see that if you look on LZMA Header File format in google.
UPDATE: I have dumped now a file from RAM Memory on PS3 (with my dex) and is save_s.dat unpacked from save_s.dat.lfs and i upload there:
Like you can see the size is OK if we know the header of the .lfs and the compressed save_s.dat.lfs file was 186kb now uncompressed is 564kb.
Now searching, maybe we can make a tool to depack this lzma custom archives and some packer.
Thanks for any help and sorry because my language is not perfect.
Last edited by IngPereira; 01-16-2013 at 08:34 PM.