FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   Solving the BinkPack Problem [+Oggre] (https://fileforums.com/showthread.php?t=104981)

Masquerade 15-03-2022 10:05

Solving the BinkPack Problem [+Oggre]
 
TL;DR - Stop using FreeArc!

I am sure you will agree that at some point you will have found a game which contains bink videos that BPK can compress, but you get a CRC check error or broken file crash when you try to extract your archive.

The issue with this is that BPK is slightly bugged in that it can extract the files it compresses, but a couple of bytes will be incorrect which causes the crash with FreeArc. FreeArc checks each file it extracts to ensure that the CRC is the same as the file that was compressed.

Since the file that BPK unpacks is different in some places, you can easily just patch the extracted bink video to the original video.

I will demonstrate with a video from Forza Horizon 5 - the issue with this video is that CLS-BPK.DLL will get stuck when decoding and endlessly output to the file. But, by using the EXE version of bpk and a little HDIFFZ magic, we can now avoid all the issues and have a significantly smaller repack.

This works for oggre too! Use the EXE versions of both and ignore the CLS.

https://i.ibb.co/XCj6H3B/Capture.png

*.BINKDIFF = HDiffZ patch between original bink and tmp extracted bink from bugged BPK

*.BK2 = original video.

*.BPK = packed video.

*.TMP = tmp extracted bink from bugged BPK

KaktoR 15-03-2022 10:27

All binks I got so far were bpk bugs out keeps unpacking infinitely without any error message from arc.exe. Only installers telling me that something is wrong :(

https://i.imgur.com/hXFgZDq.png

But thanks anyway for this topic and especially for the information.

Masquerade 15-03-2022 10:33

Quote:

Originally Posted by KaktoR (Post 496210)
...

Can you upload the file? I tested on such a video that would endlessly unpack in the example above.

KaktoR 15-03-2022 10:46

Oh well, I didn't read your tldr.. All is clear now :)

L33THAK0R 16-03-2022 16:15

Fascinating stuff, will definitely test this method out, got a couple dozen repacks I put on hold due to "Oggre" failing to properly decompress with FreeArc, fingers crossed I can finally finish em now!

78372 19-03-2022 06:48

Can someone upload a small sample bik file that causes this error? Would like to test.

:( Sad8669 19-03-2022 07:03

It's been a while.

Here

P.S : i asked KaktoR once, while i was looking into bink files, he sent me this sample.

kj911 19-03-2022 11:40

Tested the "Kro001_ExoIntro_Drop.bik" file compressed with use various CLS-BPK dll's (91.5/227/663kB size) again and again from decompressing.

unarc.exe: Get "failed CRC check" error message, not decompressing the BIK file from archive.
Arc.exe: Process not finished and still in 100% and infinitely looping decompress the BIK file, writing to again and again in whole time.

Screen: https://i.kek.sh/qtDtatG5oGo.png

Infinitely extracted "Kro001_ExoIntro_Drop.bik" file sample from analyze: https://pixeldrain.com/u/sJHwUPKB

KaktoR 19-03-2022 12:24

Don't use the cls.

Use bink_pack.exe and bink_unpack.exe

kuyhaa 04-09-2022 23:49

i try this, but failed, what wrong with this ?

https://blogger.googleusercontent.co...at%20wrong.png

Hexagon123 04-09-2022 23:54

Quote:

Originally Posted by kuyhaa (Post 498188)
i try this, but failed, what wrong with this ?

https://blogger.googleusercontent.co...at%20wrong.png

You did it wrong, hdiffz (insert temp file) (insert original file) (insert diff file), then hpatchz (insert temp file) (insert diff file) (insert new file)

kuyhaa 05-09-2022 00:59

Quote:

Originally Posted by Hexagon123 (Post 498189)
You did it wrong, hdiffz (insert temp file) (insert original file) (insert diff file), then hpatchz (insert temp file) (insert diff file) (insert new file)

yeah, thanks,

hpatchz :D and hdiffz (insert temp file) (insert original file) (insert diff file)

KaktoR 05-09-2022 14:04

Maybe something is not clear enough, here is a example batch.

PS: You can delete echo and pause commands. I just made them to show the steps

Code:

@echo off
echo. Compress bink files
for /r %%f in (*.bik) do bink_pack "%%f" "%%~df%%~pf%%~nf.bpk_compressed
pause

echo. Unpack compressed file
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.tmp_for_patch_creation"
pause

echo. Create diff from original vs unpacked file
for /r %%f in (*.tmp_for_patch_creation) do hdiffz "%%f" "%%~df%%~pf%%~nf.bik" "%%~df%%~pf%%~nf.BinkDIFF"
pause

echo. Delete unpacked files ("*.tmp_for_patch_creation") which were just extracted for patch creation purposes, you no longer need them
del /Q /F /S "*.tmp_for_patch_creation"
pause

echo. ------------------------------------------------------------
echo. On this point you should exclude all "*.bik" files or move them to a backup dir (you can use robocopy for ease)
echo. because you only need to pack "*.bpk_compressed" and "BinkDIFF" files.
echo. Now you have to pack your game files like you normally would
echo. ------------------------------------------------------------
echo.
echo. ------------------------------------------------------------
echo. After installing with Setup or similar, app folder should contain
echo. "*.bpk_compressed" and "*.BinkDIFF" files instead of original "*.bik* files
echo. ------------------------------------------------------------

echo. Unpack compressed to "*.bik_bad_crc"
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.bik_bad_crc"
pause

echo. Patch "*.bik_bad_crc" back to original with "*.BinkDIFF" files ("input_file"" input_diff" "output_file")
for /r %%f in (*.bik_bad_crc) do hpatchz.exe "%%~df%%~pf%%~nf.bik_bad_crc" "%%~df%%~pf%%~nf.BinkDIFF" "%%~df%%~pf%%~nf.bik_good_crc"
pause

echo. Rename all file extensions from "*.bik_good_crc" to "*.bik"
ren "*.bik_good_crc" "*.bik"
pause

echo. Remove all temp files
del /Q /F /S "*.bik_bad_crc"
del /Q /F /S "*.BinkDIFF"
del /Q /F /S "*.bpk_compressed"
del /S "hdiffz.exe"
del /S "hpatchz.exe"
pause


kuyhaa 06-09-2022 04:24

Quote:

Originally Posted by KaktoR (Post 498201)
Maybe something is not clear enough, here is a example batch.

PS: You can delete echo and pause commands. I just made them to show the steps

Code:

@echo off
echo. Compress bink files
for /r %%f in (*.bik) do bink_pack "%%f" "%%~df%%~pf%%~nf.bpk_compressed
pause

echo. Unpack compressed file
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.tmp_for_patch_creation"
pause

echo. Create diff from original vs unpacked file
for /r %%f in (*.tmp_for_patch_creation) do hdiffz "%%f" "%%~df%%~pf%%~nf.bik" "%%~df%%~pf%%~nf.BinkDIFF"
pause

echo. Delete unpacked files ("*.tmp_for_patch_creation") which were just extracted for patch creation purposes, you no longer need them
del /Q /F /S "*.tmp_for_patch_creation"
pause

echo. ------------------------------------------------------------
echo. On this point you should exclude all "*.bik" files or move them to a backup dir (you can use robocopy for ease)
echo. because you only need to pack "*.bpk_compressed" and "BinkDIFF" files.
echo. Now you have to pack your game files like you normally would
echo. ------------------------------------------------------------
echo.
echo. ------------------------------------------------------------
echo. After installing with Setup or similar, app folder should contain
echo. "*.bpk_compressed" and "*.BinkDIFF" files instead of original "*.bik* files
echo. ------------------------------------------------------------

echo. Unpack compressed to "*.bik_bad_crc"
for /r %%f in (*.bpk_compressed) do bink_unpack "%%f" "%%~df%%~pf%%~nf.bik_bad_crc"
pause

echo. Patch "*.bik_bad_crc" back to original with "*.BinkDIFF" files ("input_file"" input_diff" "output_file")
for /r %%f in (*.bik_bad_crc) do hpatchz.exe "%%~df%%~pf%%~nf.bik_bad_crc" "%%~df%%~pf%%~nf.BinkDIFF" "%%~df%%~pf%%~nf.bik_good_crc"
pause

echo. Rename all file extensions from "*.bik_good_crc" to "*.bik"
ren "*.bik_good_crc" "*.bik"
pause

echo. Remove all temp files
del /Q /F /S "*.bik_bad_crc"
del /Q /F /S "*.BinkDIFF"
del /Q /F /S "*.bpk_compressed"
del /S "hdiffz.exe"
del /S "hpatchz.exe"
pause


help out, thanks kaktor


All times are GMT -7. The time now is 03:34.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com