Modder Base

Full Version: [Info] Script and batch files to extract the official pak files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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):
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:
Some files are missing from the latest version of the game
I do not see any meshes or texture files in Ibuki's skelmesh 1
I confirm that there is no 1, 2 folder in ryu's skelmesh  

[Image: 1_by_horamo-dbsb2am.jpg]


[Image: 2_by_horamo-dbsb2er.jpg]
@"hora"
That's because the SF5-extract uses the regular quickbms to extract all pak files, in the past the regular quickbms works well because all pak files are still below 4GB size, but now pak0 (the very first pak file) is over 4GB size so now you have to use the "quickbms_4gb_files" to extract it.
Okay

Thank you for answer
Excuse me, why did I complete the complete extract-all, Out folder only three folders, Youtube teaching should have three, Content folder, only three folders, it seems incomplete?

[Image: ej6xu16]
[Image: eepmazw]
@"qaz1973825"
Can't see your pics, but I think you can found the solution in the post below (the one separated two posts above yours)
http://modderbase.com/showthread.php?tid...79#pid2579
(01-07-2018, 03:05 AM)robhal Wrote: [ -> ]@"qaz1973825"
Can't see your pics, but I think you can found the solution in the post below (the one separated two posts above yours)
http://modderbase.com/showthread.php?tid...79#pid2579

Oh .... I have carefully read the solution in the post below, but I am very confused, I do not know where is the problem, I seem to use the same tool, but the folder is not the same? Picture can not see, So I recorded a video, can you help me to see where the problem lies? Or is my tool really have problems?

https://www.youtube.com/watch?v=C_uEiIEp...e=youtu.be
@"qaz1973825"
That's exactly your issue and the solution is that post I pointed to you. The content of "\StreetFighterV\Content" folder should be like this
[Image: Uh99sQM.jpg]

See, back when SFV was released in early days, the batch file "extract-all.bat" (which if you open it with Notepad, you can see it still uses "quickbms" command) worked well because all official game pak files were still under 4 GB size. But now that same batch file "extract-all.bat" will fail on extracting the "pakchunk0-WindowsNoEditor.pak" because currently it is bigger than 4 GB size. So the solution is either you can manually run the "quickbms_4gb_files.exe" to extract the "pakchunk0-WindowsNoEditor.pak" or download the archive below (it contains the same files as the original "SF5-extract.rar" from the first post, except that I has modified the batch file "extract-all.bat" a little by making it runs "quickbms_4gb_files" instead)
https://mega.nz/#!BNIxRKyB!I2uyqhvFcZO4Y...S0d0IT0v4Q

Please test the new batch file if you want, and if you can confirm it works correctly, I will replace the download link with the new one.
(01-08-2018, 09:02 AM)robhal                    Success!!!! T hank you so much, you are really very kind. Wrote: [ -> ]@“qaz1973825”
That's exactly your issue and the solution is that post I pointed to you. The content of "\StreetFighterV\Content" folder should be like this
[Image: Uh99sQM.jpg]

See, back when SFV was released in early days, the batch file "extract-all.bat" (which if you open it with Notepad, you can see it still uses "quickbms" command) worked well because all official game pak files were still under 4 GB size. But now that same batch file "extract-all.bat" will fail on extracting the "pakchunk0-WindowsNoEditor.pak" because currently it is bigger than 4 GB size. So the solution is either you can manually run the "quickbms_4gb_files.exe" to extract the "pakchunk0-WindowsNoEditor.pak" or download the archive below (it contains the same files as the original "SF5-extract.rar" from the first post, except that I has modified the batch file "extract-all.bat" a little by making it runs "quickbms_4gb_files" instead)
https://mega.nz/#!BNIxRKyB!I2uyqhvFcZO4Y...S0d0IT0v4Q

Please test the new batch file if you want, and if you can confirm it works correctly, I will replace the download link with the new one.


robhal : Success!!!! T hank you so much, you are really very kind.
@"robhal"

So did something change with the most recent update of SFV? Because extracting the files with the quickbms_4gb_files exe isn't getting everything anymore. The pakchunk0 file is now over 5 gigs, so I don't know if that matters.
@"addysun"
I just test extracting the pakchunk0 file again with the same quickbms_4gb_files (and the sf5.bms script) from this thread, and I can extract all files correctly. There are several reasons imo that maybe can result in failed extracting process:
1. Not enough disk space, all files in pak0 should be around 9 GB so you must have more than 9 GB free space in your HDD/SSD.
2. There is possibility that if your pak0 file is located in folder with very long path, the extracting process can fail because Windows can only handle up to 255 characters for folder/filename. So maybe you can try moving the pak0 file temporarily to the folder with shorter path (such as C:\SFV\) and try the extracting process again.
(03-13-2019, 03:15 PM)robhal Wrote: [ -> ]@"addysun"
I just test extracting the pakchunk0 file again with the same quickbms_4gb_files (and the sf5.bms script) from this thread, and I can extract all files correctly. There are several reasons imo that maybe can result in failed extracting process:
1. Not enough disk space, all files in pak0 should be around 9 GB so you must have more than 9 GB free space in your HDD/SSD.
2. There is possibility that if your pak0 file is located in folder with very long path, the extracting process can fail because Windows can only handle up to 255 characters for folder/filename. So maybe you can try moving the pak0 file temporarily to the folder with shorter path (such as C:\SFV\) and try the extracting process again.

Thanks! ill try those options.
Give it no tool who made us the life easyer ?
I dont understand what I need to do with the code and the bat part of the tutorial?

also when you said to your sfv folder does that mean I have to put extract all into my sfv folder?

Also how much time does the extract all take?
(09-30-2020, 04:53 PM)wadewatts34 Wrote: [ -> ]I dont understand what I need to do with the code and the bat part of the tutorial?

also when you said to your sfv folder does that mean I have to put extract all into my sfv folder?

Also how much time does the extract all take?

1st question: You don't have to do anything with the .bat files. You need them, but you don't have to touch them.

2nd question: No when you exact it, doesn't have to be in the folder that the game is located. It's similar(SIMILAR) to unzipping a file. The unzipped files can be placed anywhere, just like the extracted files.

3rd question: How long? Well if your extracting the whole game it can take a couple of hours, depending on how fast you computer is. My "normal" desktop, which is not very high end, took about 3-4 hours. If your just exacting 1 skin from a modder though, only a couple of seconds.
Pages: 1 2