08-27-2017, 08:20 AM
Original post from FluffyQuack
I looked into the PAK format and I realized the "directory offset" is actually part of each PAK file. The BMS script even reads it, but it does nothing with it.
So here's a better way of extracting the PAK files which should be compatible with any PAK files Capcom adds to the game.
New BMS script (create a text file called sf5.bms and copy and paste this into it):
Copy and paste this into BAT file to easily extract all PAK files in one go:
You'll also need quickbms.exe and all the PAK files in the same directory for this to work.
Alternatively, just download this which has everything set up for extraction: SF5-extract (NEW)
NOTE: the original one is here, SF5-extract (obsolete because it fails on extracting pak0 which is over 4GB now)
Click below to see how to use the SF5-extract (from the download link above)
I looked into the PAK format and I realized the "directory offset" is actually part of each PAK file. The BMS script even reads it, but it does nothing with it.
So here's a better way of extracting the PAK files which should be compatible with any PAK files Capcom adds to the game.
New BMS script (create a text file called sf5.bms and copy and paste this into it):
Code:
# Unreal Engine 4 - Unreal Tournament 4 (script 0.4)
# Modified by FluffyQuack for better SF5 support
# script for QuickBMS http://quickbms.aluigi.org
# set your AES_KEY here as text or C string ("\x11\x22...")
set AES_KEY binary "_aS4mfZK8M5s5KWC2Lz2VsFnGKI7azgl"
goto -0x2c
idstring "\xe1\x12\x6f\x5a" # 0x5a6f12e1
get VERSION long
get OFFSET longlong
get SIZE longlong
getdstring HASH 20
goto OFFSET
#Acquire base name
get NAMESZ signed_long
math NAMESZ -= 9
getdstring DUMMY 9 #Skip the "..\..\..\" part of the filepath
getdstring BASENAME NAMESZ
get FILES long
for i = 0 < FILES
callfunction GET_NAME 1
savepos TMP_OFF
get OFFSET longlong
get ZSIZE longlong
get SIZE longlong
get ZIP long
if VERSION <= 1
get TSTAMP longlong
endif
getdstring HASH 20
math CHUNKS = 0
if VERSION >= 3
if ZIP != 0
get CHUNKS long
for x = 0 < CHUNKS
get CHUNK_OFFSET longlong
get CHUNK_END_OFFSET longlong
putarray 0 x CHUNK_OFFSET
putarray 1 x CHUNK_END_OFFSET
next x
endif
get ENCRYPTED byte
get CHUNK_SIZE long
endif
comtype copy # for AES
if ZIP & 1
comtype zlib
elif ZIP & 2
comtype gzip
endif
if CHUNKS > 0
putvarchr MEMORY_FILE SIZE 0
log MEMORY_FILE 0 0
append
for x = 0 < CHUNKS
getarray CHUNK_OFFSET 0 x
getarray CHUNK_END_OFFSET 1 x
math CHUNK_ZSIZE = CHUNK_END_OFFSET
math CHUNK_ZSIZE - CHUNK_OFFSET
if ENCRYPTED != 0
encryption aes AES_KEY "" 0 32
math CHUNK_ZSIZE x 32
endif
clog MEMORY_FILE CHUNK_OFFSET CHUNK_ZSIZE CHUNK_SIZE
next x
append
encryption "" ""
log NAME 0 SIZE MEMORY_FILE
else
# the file offset points to an entry containing
# the "same" OFFSET ZSIZE SIZE ZIP HASH ZERO fields,
# just an additional backup... so let's skip them
savepos BASE_OFF
math BASE_OFF - TMP_OFF
math OFFSET += BASE_OFF
if ENCRYPTED != 0
encryption aes AES_KEY "" 0 32
math ZSIZE x 32
endif
clog NAME OFFSET ZSIZE SIZE
encryption "" ""
endif
next i
startfunction GET_NAME
get NAMESZ signed_long
if NAMESZ >= 0
getdstring NAME NAMESZ
else
math NAMESZ n NAMESZ
math NAMESZ * 2
getdstring NAME NAMESZ
set NAME unicode NAME
endif
set TMP BASENAME
string TMP += NAME
set NAME TMP
endfunction
Copy and paste this into BAT file to easily extract all PAK files in one go:
Code:
for %%s in (*.pak) do quickbms -Y sf5.bms %%s out
You'll also need quickbms.exe and all the PAK files in the same directory for this to work.
Alternatively, just download this which has everything set up for extraction: SF5-extract (NEW)
NOTE: the original one is here, SF5-extract (obsolete because it fails on extracting pak0 which is over 4GB now)
Click below to see how to use the SF5-extract (from the download link above)
Show ContentSpoiler:
1. Obviously, download it first.
2. Then extract that downloaded file to your SFV Paks folder (usually it's "\Steam\SteamApps\common\StreetFighterV\StreetFighterV\Content\Paks") and run the "extract-all.bat", but before you double-click the bat file, you may want to read the step #2a below first.
-OPTIONAL BUT STRONGLY RECOMMENDED- 2a. Before you run the "extract-all.bat", you may want to move away the "pakchunk53-WindowsNoEditor.pak" file temporarily to somewhere else first, that way you save a lot of disk space by not unpacking that particular huge pak file as it only contains the game files for character story mode (afaik no one ever do mods for character story mode, so why wasting space and time to extract the file, right?). Anyway, if you decide to do this step #2a, don't forget to restore the "pakchunk53-WindowsNoEditor.pak" file back to its original place after you have done with step #3 below.
3. Wait until finish (it may take awhile because of the files are so many) and you see inside your pak folder there is new folder named "out". Now what you gonna do with the extracted files is depend on the two choices below (either 4a or 4b).
-IF YOU JUST WANT TO GET INTO MODDING ACTIVITIES- 4a. At this point, you only need to move the "out" folder to somewhere else and you are done.
or
-IF YOU WANT TO RUN THE GAME WITH FULLY UNPACKED FILES- 4b. open the "out" folder and move all its contents to SFV root folder (usually it's "\Steam\steamapps\common\StreetFighterV"), then go to the "\Steam\SteamApps\common\StreetFighterV\StreetFighterV\Content\Paks" folder and move out all pak files there to somewhere else. But before you proceed to try launching the game, don't do that yet as there is still additional (but very important) step to do.
See, one of the crucial requirements if you want to run the game with fully unpacked files is that you MUST NOT leave the "\Steam\SteamApps\common\StreetFighterV\StreetFighterV\Content\Paks" folder completely empty. It must have at least one pak file in there, that's why I strongly recommend to not extract the contents of "pakchunk53-WindowsNoEditor.pak" file (as written in step #2a above) because you can use it for the "not leaving the Paks folder completely empty" requirement. So just move the "pakchunk53-WindowsNoEditor.pak" file back to Paks folder again and now you are ready to run the game with fully unpacked files.
2. Then extract that downloaded file to your SFV Paks folder (usually it's "\Steam\SteamApps\common\StreetFighterV\StreetFighterV\Content\Paks") and run the "extract-all.bat", but before you double-click the bat file, you may want to read the step #2a below first.
-OPTIONAL BUT STRONGLY RECOMMENDED- 2a. Before you run the "extract-all.bat", you may want to move away the "pakchunk53-WindowsNoEditor.pak" file temporarily to somewhere else first, that way you save a lot of disk space by not unpacking that particular huge pak file as it only contains the game files for character story mode (afaik no one ever do mods for character story mode, so why wasting space and time to extract the file, right?). Anyway, if you decide to do this step #2a, don't forget to restore the "pakchunk53-WindowsNoEditor.pak" file back to its original place after you have done with step #3 below.
3. Wait until finish (it may take awhile because of the files are so many) and you see inside your pak folder there is new folder named "out". Now what you gonna do with the extracted files is depend on the two choices below (either 4a or 4b).
-IF YOU JUST WANT TO GET INTO MODDING ACTIVITIES- 4a. At this point, you only need to move the "out" folder to somewhere else and you are done.
or
-IF YOU WANT TO RUN THE GAME WITH FULLY UNPACKED FILES- 4b. open the "out" folder and move all its contents to SFV root folder (usually it's "\Steam\steamapps\common\StreetFighterV"), then go to the "\Steam\SteamApps\common\StreetFighterV\StreetFighterV\Content\Paks" folder and move out all pak files there to somewhere else. But before you proceed to try launching the game, don't do that yet as there is still additional (but very important) step to do.
See, one of the crucial requirements if you want to run the game with fully unpacked files is that you MUST NOT leave the "\Steam\SteamApps\common\StreetFighterV\StreetFighterV\Content\Paks" folder completely empty. It must have at least one pak file in there, that's why I strongly recommend to not extract the contents of "pakchunk53-WindowsNoEditor.pak" file (as written in step #2a above) because you can use it for the "not leaving the Paks folder completely empty" requirement. So just move the "pakchunk53-WindowsNoEditor.pak" file back to Paks folder again and now you are ready to run the game with fully unpacked files.