RE4LFS 1.2a, LFS packer/unpacker for RE4 UHD
Dec 13, 2021 0:45:58 GMT 10
Fullbuster23, albert, and 12 more like this
Post by emoose on Dec 13, 2021 0:45:58 GMT 10
Hi all, thanks to Albert for mentioning it on twitter I noticed there weren't any tools available for packing LFS files around, so had a look into making one.
A few hours later and I seemed to have something working, you can find more detailed info on this github thread: github.com/nipkownix/re4_tweaks/issues/20
Also noticed that the game seems to allow LFS chunks to be stored uncompressed, which none of the current LFS unpacking scripts seemed to handle (they all assume every chunk is compressed), so I also added an unpacking-mode to the tool with support for those weird chunks.
(I don't know if any of the vanilla game files make use of those chunks at all, but if they do then this tool should let you extract them properly)
The tool was tested by decompressing any original .LFS files included with vanilla game into non-LFS, and then using the tool to recompress to .LFS again, and comparing the result LFS to the original one - besides some minor packing byte differences it seems to recreate them fine
In my testing the compression can give some pretty good ratios, eg. reducing file size to 5% in best case, also tried compressing the latest public RE4HD release which shaved off around 10GB from my install, not too bad
Download
I've posted source code for the tool on my github here: github.com/emoose/re4-research
You can download a Win64 build of it from github.com/emoose/re4-research/releases/tag/1.2a (make sure to keep xcompress64.dll next to the re4lfs.exe)
Usage
The tool is a command-line app, you can either run it through command-prompt, drag+drop single files into it for them to be packed/unpacked, or run it inside a .BAT batch file to handle processing multiple files at once.
Here's an example bat file that shows how to compress all files of type *.pack into LFS files, just change the exe path inside here to the correct one, save the file as .bat next to some *.pack files, and running it should compress all the *.pack files into *.LFS files next to them.
Most file types used by RE4UHD can be compressed to LFS fine, on the github thread linked above I tried compressing every data file used by the game, there were a couple file types that the game didn't like to be compressed, but the majority can be compressed fine.
Here's a list of types that it doesn't seem to work with, if these are compressed game will fail to start/load properly:
Besides those any other filetypes seem safe to compress, but I'd still advise testing to make sure things still work as you expect.
If you have any questions/problems feel free to post here or on my github page!
A few hours later and I seemed to have something working, you can find more detailed info on this github thread: github.com/nipkownix/re4_tweaks/issues/20
Also noticed that the game seems to allow LFS chunks to be stored uncompressed, which none of the current LFS unpacking scripts seemed to handle (they all assume every chunk is compressed), so I also added an unpacking-mode to the tool with support for those weird chunks.
(I don't know if any of the vanilla game files make use of those chunks at all, but if they do then this tool should let you extract them properly)
The tool was tested by decompressing any original .LFS files included with vanilla game into non-LFS, and then using the tool to recompress to .LFS again, and comparing the result LFS to the original one - besides some minor packing byte differences it seems to recreate them fine
In my testing the compression can give some pretty good ratios, eg. reducing file size to 5% in best case, also tried compressing the latest public RE4HD release which shaved off around 10GB from my install, not too bad
Download
I've posted source code for the tool on my github here: github.com/emoose/re4-research
You can download a Win64 build of it from github.com/emoose/re4-research/releases/tag/1.2a (make sure to keep xcompress64.dll next to the re4lfs.exe)
Usage
The tool is a command-line app, you can either run it through command-prompt, drag+drop single files into it for them to be packed/unpacked, or run it inside a .BAT batch file to handle processing multiple files at once.
Usage: RE4LFS.exe [-f] <path/to/input/file> [path/to/output/file]
Output file path is optional, if not specified file will be output next to the input file
(either with .lfs extension added or removed)
If input path ends in .lfs the file will be decompressed, else will be compressed as .lfs
If output path exists you'll be prompted whether to overwrite or not
(use -f parameter to force overwriting without prompts)
Here's an example bat file that shows how to compress all files of type *.pack into LFS files, just change the exe path inside here to the correct one, save the file as .bat next to some *.pack files, and running it should compress all the *.pack files into *.LFS files next to them.
@echo off
FOR /r %%X IN (*.pack) DO (
"C:\path\to\re4lfs.exe" -f "%%X"
)
Most file types used by RE4UHD can be compressed to LFS fine, on the github thread linked above I tried compressing every data file used by the game, there were a couple file types that the game didn't like to be compressed, but the majority can be compressed fine.
Here's a list of types that it doesn't seem to work with, if these are compressed game will fail to start/load properly:
- *.SFD (movies)
- *.XWB/*.XSB/*.XGS (pretty much the whole BIO4\Snd\ folder)
- *.DCT (files inside BIO4\text\ folder)
- BIO4\test\Rocks.tga (game fails to start if this doesn't exist, so can't be replaced with .lfs version)
Besides those any other filetypes seem safe to compress, but I'd still advise testing to make sure things still work as you expect.
If you have any questions/problems feel free to post here or on my github page!