Unravel .KIT Files [REQUEST]
-
- Posts: 37
- Joined: Sat Feb 13, 2016 8:52 am
Unravel .KIT Files [REQUEST]
Hello,
I want to extract files from Unravel game, but I didn't find any tools for extract and repack. Can you please help me?
There are two examples of the files: https://mega.nz/#F!XUswVAQJ!F4k19KfxZNMwUsDZk7eQBA
THX
I want to extract files from Unravel game, but I didn't find any tools for extract and repack. Can you please help me?
There are two examples of the files: https://mega.nz/#F!XUswVAQJ!F4k19KfxZNMwUsDZk7eQBA
THX
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
The compressed files are splitted in chunks compressed with lz4 but only the first chunks can be decompressed, apparently they maintain the state for the other chunks but even in that way it doesn't work with some files (from file 0x3c0 on).
This script extracts only the compressed files with a size lower than 0x10000:
http://aluigi.org/bms/unravel.bms
This script extracts only the compressed files with a size lower than 0x10000:
http://aluigi.org/bms/unravel.bms
-
- Posts: 2
- Joined: Wed Feb 17, 2016 6:35 pm
Re: Unravel .KIT Files [REQUEST]
Thank you, Aluigi for the script.
I wanna localize this game to my language, but I'am totally amateur in this. Can you pls tell me, how and where to find text? I don't know, what is lz4 and things like this
I wanna localize this game to my language, but I'am totally amateur in this. Can you pls tell me, how and where to find text? I don't know, what is lz4 and things like this
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
lz4 is a compression algorithm.
You must NOT touch the files in the compressed folder, no problems for the others (probably you have to use a hex editor).
You must NOT touch the files in the compressed folder, no problems for the others (probably you have to use a hex editor).
-
- Posts: 37
- Joined: Sat Feb 13, 2016 8:52 am
Re: Unravel .KIT Files [REQUEST]
Thx Aluigi, but your script probably work only with "Unravel.kit" file. If I try extract Unravel.kit.0, error will appear: "You must open the small file with KIT extension"
Can you please create script to .0 files? Thx
Can you please create script to .0 files? Thx
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
You must open the KIT file because it contains the references to the 0 one.
-
- Posts: 2
- Joined: Wed Feb 17, 2016 6:35 pm
Re: Unravel .KIT Files [REQUEST]
Huh, I didn't find localization files. Can somebody help me?
-
- Posts: 37
- Joined: Sat Feb 13, 2016 8:52 am
Re: Unravel .KIT Files [REQUEST]
I think, that localization files are .txt files in compressed folder. Is there any way, how to decompress them?
-
- Posts: 72
- Joined: Fri Oct 09, 2015 1:41 am
Re: Unravel .KIT Files [REQUEST]
aluigi wrote:The compressed files are splitted in chunks compressed with lz4 but only the first chunks can be decompressed, apparently they maintain the state for the other chunks but even in that way it doesn't work with some files (from file 0x3c0 on).
This script extracts only the compressed files with a size lower than 0x10000:
http://aluigi.org/bms/unravel.bms
Anyone, have success with theses .kit files? I want to translate this game too...
-
- Posts: 233
- Joined: Sun Aug 24, 2014 5:26 pm
Re: Unravel .KIT Files [REQUEST]
I modified aluigi's script and now it extracts most of the files (big ones too). But some of them still can't be decompressed, so they are stored as is in "compressed\" directory, because i don't know what's wrong with them. Maybe this files need another type of lz4f header, but i don't know for sure and don't have much time now to investigate it.
After the main script this one can be used on files in "compressed\" directory. It will extract 299/412 files (if you extracted all kit archives), so almost all game files gonna be extracted properly and only 113 will remain compressed.
Code: Select all
get EXT extension
if EXT != "kit"
print "Error: you must open the small file with the KIT extension"
cleanexit
endif
comtype lz4f
get KIT_NAME filename
idstring "kit!"
get DUMMY long # 1
get DUMMY long # 1
get DUMMY long # 1
get INFO_OFF longlong
get FILES long
get DUMMY long
get DUMMY byte
get DUMMY long
savepos OFFSET
math OFFSET + INFO_OFF
goto OFFSET
math LAST_PAK = -1
for i = 0 < FILES
get FLAGS long
get PAK_NUM short
get OFFSET long
get ZERO short # maybe the 48bit part of OFFSET ?
get ZSIZE longlong
get SIZE longlong
getdstring DUMMY 20
get ZERO long
get DUMMY long
if PAK_NUM != LAST_PAK
string TMP p "%s.%d" KIT_NAME PAK_NUM
open FDSE TMP 1
math LAST_PAK = PAK_NUM
endif
set NAME OFFSET
string NAME p= "0x%08x" NAME
set PAK_NAME PAK_NUM
string PAK_NAME p= "%02x" PAK_NAME
string NAME += "_"
string NAME += PAK_NAME
if ZSIZE == SIZE
log "" OFFSET SIZE 1
else
xmath MEM_SIZE "ZSIZE + 11"
putvarchr MEMORY_FILE MEM_SIZE 0
log MEMORY_FILE 0 0
putVarChr MEMORY_FILE 0 0x184D2204 long
putVarChr MEMORY_FILE 4 0xC04040 threebyte
append
log MEMORY_FILE OFFSET ZSIZE 1
append
get MEM_SIZE asize MEMORY_FILE
putVarChr MEMORY_FILE MEM_SIZE 0 long
get MEM_SIZE asize MEMORY_FILE
putvarchr MEMORY_FILE2 SIZE 0
log MEMORY_FILE2 0 0
clog MEMORY_FILE2 0 MEM_SIZE SIZE MEMORY_FILE
get MEM_SIZE asize MEMORY_FILE2
if MEM_SIZE != 0
log NAME 0 MEM_SIZE MEMORY_FILE2
else
string COMP_NAME = "compressed/"
string COMP_NAME += NAME
log COMP_NAME OFFSET ZSIZE 1
endif
endif
next i
After the main script this one can be used on files in "compressed\" directory. It will extract 299/412 files (if you extracted all kit archives), so almost all game files gonna be extracted properly and only 113 will remain compressed.
Code: Select all
comtype lz4
get FILE_SIZE asize
putvarchr MEMORY_FILE FILE_SIZE 0
log MEMORY_FILE 0 0
append
do
get ZSIZE long
savepos OFFSET
log MEMORY_FILE OFFSET ZSIZE
math OFFSET += ZSIZE
goto OFFSET
while OFFSET < FILE_SIZE
append
get ZSIZE asize MEMORY_FILE
xmath SIZE "ZSIZE * 10"
get NAME filename
clog NAME 0 ZSIZE SIZE MEMORY_FILE
-
- Posts: 2
- Joined: Tue Dec 26, 2017 1:35 pm
Re: Unravel .KIT Files [REQUEST]
can i use the quickbms reimporter to repack the files?
i used the this unravel script with the reimporter and with the command line too "quickbms.exe -w -r script.bms archieve.pak output_folder" but it didint work
any help with the repack?
thx
i used the this unravel script with the reimporter and with the command line too "quickbms.exe -w -r script.bms archieve.pak output_folder" but it didint work
any help with the repack?
thx
-
- Posts: 233
- Joined: Sun Aug 24, 2014 5:26 pm
Re: Unravel .KIT Files [REQUEST]
Code: Select all
get EXT extension
if EXT != "kit"
print "Error: you must open the small file with the KIT extension"
cleanexit
endif
comtype lz4x
get KIT_NAME filename
idstring "kit!"
get DUMMY long
get DUMMY long
get DUMMY long
get INFO_OFF longlong
get FILES long
get DUMMY long
get DUMMY byte
get DUMMY long
savepos OFFSET
math OFFSET + INFO_OFF
goto OFFSET
math LAST_PAK = -1
for i = 0 < FILES
savepos MY_OFF
get FLAGS long
get PAK_NUM short
get OFFSET long
get ZERO short
get ZSIZE longlong
get SIZE longlong
getdstring DUMMY 20
get ZERO long
get DUMMY long
if PAK_NUM != LAST_PAK
string TMP p "%s.%d" KIT_NAME PAK_NUM
open FDSE TMP 1
math LAST_PAK = PAK_NUM
endif
set NAME OFFSET
string NAME p= "0x%08x" NAME
set PAK_NAME PAK_NUM
string PAK_NAME p= "%02x" PAK_NAME
string NAME += "_"
string NAME += PAK_NAME
if ZSIZE == SIZE
log NAME OFFSET SIZE 1
else
clog NAME OFFSET ZSIZE SIZE 1
endif
next i
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
Does that mean the working algorithm is just lz4x?
I lost all the updates about this topic so a recap is appreciated
I lost all the updates about this topic so a recap is appreciated
-
- Posts: 20
- Joined: Fri Jun 02, 2017 2:15 pm
Re: Unravel .KIT Files [REQUEST]
Hi guys,
I was able to extract all files using the following...
1. Compression is LZ4X
2. As some people have said, each compressed block can still reference buffer content from the previous block. In the lz4x.c code, you only need to modify the second half of decompress() to allow it to reference the previous block (see below between START OF CHANGE and END OF CHANGE - note that it's just psuedocode, it won't compile like this)...
3. On testing all the files in this game, I only ever needed to go back 1 block.
I don't know what the best way to implement this in QuickBMS is, but I'll leave that to the BMS experts.
watto
I was able to extract all files using the following...
1. Compression is LZ4X
2. As some people have said, each compressed block can still reference buffer content from the previous block. In the lz4x.c code, you only need to modify the second half of decompress() to allow it to reference the previous block (see below between START OF CHANGE and END OF CHANGE - note that it's just psuedocode, it won't compile like this)...
Code: Select all
int decompress()
{
int i;
#ifdef LZ4_MAGIC
uint magic;
myfread(&magic, 1, sizeof(magic), fin);
if (magic!=LZ4_MAGIC)
return 2;
#endif
int bsize;
while (myfread(&bsize, 1, sizeof(bsize), fin)>0)
{
#ifdef LZ4_MAGIC
if (bsize==LZ4_MAGIC)
continue;
#endif
if (bsize<0 || bsize>COMPRESS_BOUND
|| myfread(&buf[BLOCK_SIZE], 1, bsize, fin)!=bsize)
return 1;
int p=0;
int bp=0;
while (bp<bsize)
{
const int tag=get_byte();
if (tag>=16)
{
int run=tag>>4;
if (run==15)
{
for (;;)
{
const int c=get_byte();
run+=c;
if (c!=255)
break;
}
for ( i=0; i<run; i+=16)
copy128(p+i, BLOCK_SIZE+bp+i);
}
else
copy128(p, BLOCK_SIZE+bp);
p+=run;
bp+=run;
if (bp>=bsize)
break;
}
int s=p-get_byte();
s-=get_byte()<<8;
int len=tag&15;
if (len==15)
{
for (;;)
{
const int c=get_byte();
len+=c;
if (c!=255)
break;
}
}
len+=4;
if ((p-s)>=16)
{
for ( i=0; i<len; i+=16){ // START OF CHANGE
//copy128(p+i, s+i);
for (int j = 0; j < 16; j++) {
int readPos = s + i + j;
if (readPos < 0) {
// need to read from the previously-decoded buffer
int previousBufReadPos = previousBufferLength + readPos;
buf[p + i + j] = previousBuffer[previousBufReadPos];
}
else {
// read from the current buffer
buf[p + i + j] = buf[readPos];
}
}
}
p+=len;
}
else
{
while (len--) {
//buf[p++]=buf[s++];
if (s < 0) {
// need to read from the previously-decoded buffer
int previousBufReadPos = previousBufferLength + s;
buf[p++] = previousBuffer[previousBufReadPos];
s++;
}
else {
buf[p++] = buf[s++];
}
}
} // END OF CHANGE
}
if (bp!=bsize)
return 1;
myfwrite(buf, 1, p, fout);
}
return 0;
}
3. On testing all the files in this game, I only ever needed to go back 1 block.
I don't know what the best way to implement this in QuickBMS is, but I'll leave that to the BMS experts.
watto
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
Do you have a sample archive?
The original link is expired.
The original link is expired.
-
- Posts: 6
- Joined: Tue Jun 23, 2015 2:46 pm
Re: Unravel .KIT Files [REQUEST]
I would like to add polish language for the game. I would like to replace eglish text to polish.
I'm sending two examples files from the game. I am also asking for help in the reimport compressed file: 00000006.dat - uncompress: 0x00008c82_00 (english text file) to archive kit (Unravel.kit.0).
http://www.mediafire.com/file/al8ffkczo ... nravel.kit
http://www.mediafire.com/file/zgow61q4p ... avel.kit.0
I extract file - 00000006.dat using a script:
http://www.mediafire.com/file/15b8bqdot ... nravel.bms
http://www.mediafire.com/file/hkd77k77f ... 000006.dat
I extract file - 0x00008c82_00 using a script:
http://www.mediafire.com/file/5vnqr5bxb ... el_lz4.bms
http://www.mediafire.com/file/t9r5ah25k ... 0008c82_00
I don't reimprt 00000006.dat and 0x00008c82_00 using a above scripts. It would be better to reimport the unpacked file 0x00008c82_00.
I'm sending two examples files from the game. I am also asking for help in the reimport compressed file: 00000006.dat - uncompress: 0x00008c82_00 (english text file) to archive kit (Unravel.kit.0).
http://www.mediafire.com/file/al8ffkczo ... nravel.kit
http://www.mediafire.com/file/zgow61q4p ... avel.kit.0
I extract file - 00000006.dat using a script:
http://www.mediafire.com/file/15b8bqdot ... nravel.bms
http://www.mediafire.com/file/hkd77k77f ... 000006.dat
I extract file - 0x00008c82_00 using a script:
http://www.mediafire.com/file/5vnqr5bxb ... el_lz4.bms
http://www.mediafire.com/file/t9r5ah25k ... 0008c82_00
I don't reimprt 00000006.dat and 0x00008c82_00 using a above scripts. It would be better to reimport the unpacked file 0x00008c82_00.
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
I simply replaced lz4 with lz4x and it seems to work correctly.
I don't think there are invalid files for which is necessary that modification in lz4x.c, please let me know if that's really necessary.
Script 0.2:
http://aluigi.org/bms/unravel.bms
I don't think there are invalid files for which is necessary that modification in lz4x.c, please let me know if that's really necessary.
Script 0.2:
http://aluigi.org/bms/unravel.bms
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
Update: ok 00000006.v0_ is for sure corrupted from 0x10000, now I know that the modification is necessary
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Unravel .KIT Files [REQUEST]
The following is the patch for lz4x.c, correct, complete and tested
Code: Select all
513a514
> /*
524a526,528
> */
> while (len--)
> buf[p++] = (s<0) ? fout[s++] : buf[s++];