need help - repack bin file [kiniro no corda]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
bam_bam
Posts: 31
Joined: Thu Apr 21, 2016 1:06 pm

need help - repack bin file [kiniro no corda]

Post by bam_bam »

Hi, there.
I use this scipt to unpack some file.
but I need repack script.
I can't use reimport function, because some file size will change.
Could anyone help me? thanks.

original bin file :: https://www.dropbox.com/s/3ri189kl1bvz6mb
script :: http://aluigi.org/bms/kiniro_no_corda.bms
StreamThread
Posts: 54
Joined: Fri May 27, 2016 2:28 pm

Re: need help - repack bin file

Post by StreamThread »

Test script for repack .bin files. May not work correctly, so be careful.

Usage: As "input" select a *.bin file, what you want to repack. As "output" select folder with extracted and edited files. Make sure, what in output folder count of files should be same what was when extracted. And don't rename them. Script can packing any files, but obvious game will crash if something will wrong.
Repacked file will created in output folder with "_repacked" prefix.


In that type of archive uses CRC_32 checksumm's instead original filenames. With full filenames all would be easiest.


Code: Select all

log memory_file 0 0
log memory_file2 0 0
idstring "CDAR" 0
put 0x52414443 long memory_file
get VER long 0
put VER long memory_file
get FILES long 0
put FILES long memory_file
get DUMMY long 0
put DUMMY long memory_file
for i = 1 to FILES
    get NAME_CRC long 0
   put NAME_CRC long memory_file
next i
xmath mOffset "FILES * 12"
get mfSize asize memory_file
math mOffset + mfSize
for i = 1 to FILES
scanDir "." sNAME sSIZE
log memory_file3 0 0

open "." sNAME 1
comtype zlib_compress
clog memory_file3 0 sSize sSize 1
comtype zlib

get zSize asize memory_file3
if zSize >= sSize
append
log memory_file2 0 sSize 1
append
put mOffset long memory_file
math mOffset + sSize
put sSize long memory_file
put sSize long memory_file
else
append
log memory_file2 0 zSize memory_file3
append
put mOffset long memory_file
math mOffset + zSize
put sSize long memory_file
put zSize long memory_file
endif
next i

get tmpSize1 asize memory_file2
append
log memory_file 0 tmpSize1 memory_file2
append

get tmpSize2 asize memory_file
get fName filename 0
string fName + "_repacked"
log fName 0 tmpSize2 memory_file

bam_bam
Posts: 31
Joined: Thu Apr 21, 2016 1:06 pm

Re: need help - repack bin file

Post by bam_bam »

Thanks. It works perfectly in all respects.
I appreciate your kindness.