Page 1 of 3
Krater (PC)
Posted: Wed Jun 13, 2012 3:48 pm
by hunpatrik
Hello!
Is there anybody knows something about the files?
The data folder builds up from folders named 0 to 105
in folder 0:
files: 1,2,3,4,5...99
in folder 1:
files: 101,102,103...199
in folder 105:
files 10500,10501...10547
and some random named files. (for example: 3ff9e9c5f68b4235)
None of the files have attribute name.
Re: Krater (PC)
Posted: Sat Jun 16, 2012 8:36 pm
by hhrhhr
XX\XXYY - files without extension. for example:
krater\data\83\8364 - DDS DXT1 texture
krater\data\25\2589 - compiled Lua script (named scripts/settings/questlog.lua)
we can decompile scripts with any lua 5.1 decompiler (luadec or unlua), but need crop first 4 bytes.
files
3ff9e9c5f68b4235, 9e13b2414b41b842, 30d3ac7d103556ae, etc...
Code: Select all
long header = \x04\x00\x00\xf0;
long unpackedSize;
long zero; // \x00\x00\x00\x00
forever {
long zsize; // size of packed block
char data[zsize];
if (zsize < 0x10000) {
// zlib packed data, unpacked size is 0x10000
} else {
// not packed data, size is 0x10000
}
}
file
exploded_database.db
Code: Select all
long header; // \x03\x00\x00\x00;
long filesCount; // number of files XX\XXYY, 10545 in v1.0.3
for (i = 0; i < filesCount; i++) {
longlong resourceUnit;
longlong resourseName;
long langId; // 0-english localization, 1-french, 2-??, 4-german, 8-sweden...
long fileName; // number
long fffs; // \xFF\xFF\xFF\xFF
}
long footer; // \x08\x00\x00\x00
char footerData[64];
}
"unpacked" files
3ff9e9c5f68b4235, 9e13b2414b41b842, 30d3ac7d103556ae, etc...
Code: Select all
// header
long entries; // number or files
char headerData[64]; // equal to 'footerData[64]' from 'exploded_database.db'
char zeros[192]; // filled by zero
// list of ids
for (i = 0; i < entries; i++) {
longlong resourceUnit;
longlong resourseName;
}
// files
for (i = 0; i < entries; i++) {
longlong resourceUnit;
longlong resourseName;
long numLangs;
long zero; // \x00\x00\x00\x00
for (i=0; i<numLangs; i++) {
long landId[i];
long size[i];
long zero[i]; // \x00\x00\x00\x00
}
for (i = 0; i < numLangs; i++)
char entry[size[i]]; // nameless filedata
// copyEntryToFile();
}
}
font descriptors:
Code: Select all
// float - IEEE single
float size; // vertical height, px
float lineHeight; // distance in pixels between each line of text.
float base; // number of pixels from the absolute top of the line to the base of the characters
float textureWidth;
float textureHeight;
long glyphCount;
for (i = 0; i < glyphCount; i++) {
long glyphCode; // UTF8
float x; // left position of the character image in the texture
float y; // top ...
float width; // width of the character image in the texture
float height; // height ...
float xOffset; // how much the current position should be offset when copying the image from the texture to the screen
float yOffset; // ...
float xAdvance; // How much the current position should be advanced after drawing the character
}
known
resourcesUnit (hash):
Code: Select all
329EC6A0 C63842CD - DDS textures
9EFE0A91 6AAE7880 - font descriptors
A439F7FF E16B7399 - ogg files in one file
AD9C6D9E D1E5E77A - game engine packages
D30FB410 AB2B970D - localization
E217D12C FA8D4EA1 - compiled Lua scripts
hash generator (Qt code, from MurmurHash2, 64-bit versions, by Austin Appleby):
Code: Select all
quint64 MurmurHash64A (const void *key, quint32 len, quint32 seed = 0)
{
const quint64 m = 0xc6a4a7935bd1e995ULL;
const quint32 r = 47;
const quint64 *data = (const quint64 *)key;
const quint64 *end = (len >> 3) + data;
quint64 h = seed ^ (len * m);
while(data != end) {
quint64 k = *data++;
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
}
const quint8 *data2 = (const quint8 *)data;
switch(len & 7) {
case 7: h ^= quint64(data2[6]) << 48;
case 6: h ^= quint64(data2[5]) << 40;
case 5: h ^= quint64(data2[4]) << 32;
case 4: h ^= quint64(data2[3]) << 24;
case 3: h ^= quint64(data2[2]) << 16;
case 2: h ^= quint64(data2[1]) << 8;
case 1: h ^= quint64(data2[0]);
default: h *= m;
};
h ^= h >> r;
h *= m;
h ^= h >> r;
return h;
}
in localizations files used only 32-bit hash, for example:
Code: Select all
stringId = "tutorial_weapon_caption"
hash64 = MurmurHash64A(stringId, ...) // hash64 = 0x1d3be1796d7cc1bf
hash32 = (hash64 >> 32) // hash32 = 0x1d3be179
text = localizer(hash32) // text = "New weapon"
link to Google Docs with a lot of bms script.
Re: Krater (PC)
Posted: Sat Jun 16, 2012 9:30 pm
by hunpatrik
I'm only interested in lang files and font files if some chars are missing. If you find something interesting for me, please post it.

Re: Krater (PC)
Posted: Sun Jun 17, 2012 1:28 am
by aluigi
the following unpacking script for quickbms is based on the info provided by hhrhhr, let me know if it works:
Code: Select all
get header long
get unpackedSize long
get zero long
savepos OFFSET
get PAK_SIZE asize
putvarchr MEMORY_FILE unpackedSize 0
log MEMORY_FILE 0 0
append
for OFFSET = OFFSET < PAK_SIZE
get zsize long
savepos OFFSET
if zsize < 0x10000
clog MEMORY_FILE OFFSET zsize 0x10000
else
log MEMORY_FILE OFFSET zsize
endif
math OFFSET += zsize
goto OFFSET
next
append
#get unpackedSize asize MEMORY_FILE
get NAME basename
string NAME += "_unpacked"
log NAME 0 unpackedSize MEMORY_FILE
Re: Krater (PC)
Posted: Sun Jun 17, 2012 2:22 am
by hhrhhr
it work, but MEMORY_FILE... the game has a files size of 100-300MB ;)
better use TEMPORARY_FILE, then at end of script something like this:
Code: Select all
open "." TEMPORARY_FILE 1
log name 0 unpackedSize 1
unpackedSize is always smaller then
ASIZE (which is a multiple of 64 KB)
hunpatrik wrote:I'm only interested in lang files and font files if some chars are missing
fonts are in: 6486, 6487, 6494, 6496, 6751-6803; just rename it to *.dds
if you change them, the most important thing that matched the size to bytes. i used the nvcompress utility and it did dds-file a few bytes smaller, so the game crashes. have to add some 0x00 to the end.
p.s.
2aluigi
is it possible to automatically delete the temporary file?
Re: Krater (PC)
Posted: Sun Jun 17, 2012 3:58 pm
by aluigi
eh no, the deletion of the temporary_file is asked to the final user.
instead of memory_file it's possible to use also directly the final file but every time the user must confirm the appending or press 'a' to do it automatically.
fixed the unpackedsize thing
Re: Krater (PC)
Posted: Sun Jun 17, 2012 6:29 pm
by hhrhhr
localization found:
6477 - (0x00) english
6478 - (0x01) french (Le service en ligne est désactivé sur votre compte ¾ en raison de paramètres de contrôle parental.)
6479 - (0x02) ???? (null)
6480 - (0x04) german (Onlinedienste für dein ¾-Konto wurden durch die Kindersicherungseinstellungen deaktiviert.)
6481 - (0x08) ???? (Onlinetjänsten är avstängd på ditt ¾-konto på grund av)
6482 - (0x10) polish? (Zepsuty filtr)
6483 - (0x20) ???? (null)
6484 - (0x40) ???? (Tu cuenta Вѕ tiene el servicio online desactivado por ajustes de control paterno.)
6485 - (0x80) ???? (Il servizio online non ГЁ abilitato sul tuo account Вѕ a causa delle impostazioni del filtro contenuti.)
only english strings is complete, all other is very limited or filled with zeros.
structure:
Code: Select all
long header; //AE F3 85 3E, crc/hash ??, same in all files
long stringsCount;
for (i = 0; i < stringsCount; i++) {
long stringID;
long stringOffset;
}
// zeroended strings data
// [EOF]
p.s.
filenames 6477 - 6485 may change in furute versions. they can be found in the
exploded_database.db by hash
D3 0F B4 10 AB 2B 97 0D 9A DB 11 66 F8 70 44 B6
(hash, 4-bytes flags, 4-bytes filename).
Re: Krater (PC)
Posted: Mon Jun 18, 2012 11:28 am
by hhrhhr
ok, now is packed ogg files (hash A439F7FFE16B7399):
Code: Select all
long numOggs;
long zero;
for (i = 0; i < numOggs; i++) {
long hash1; //
long hash2; // as filename
long offset; // absolute
long size; // head + ogg
}
// offset
long headSize; // 68
long oggSize;
char someHeaderData[60];
char oggData[oggSize]
// saveOggData(*oggData)
...
// repeat numOggs times
total number of oggs - 4358
Re: Krater (PC)
Posted: Mon Jun 18, 2012 2:18 pm
by hhrhhr
this is all what i have.
- script for ungzip 3ff9e9c5f68b4235, 9e13b2414b41b842, 30d3ac7d103556ae...
- example output: 3ff9e9c5f68b4235 -> 3ff9e9c5f68b4235.big
—
- script for unpack prevouis file
- example output: 3ff9e9c5f68b4235.big -> dir\file
directory names: _%hash1%_%hash2% (for known name write "textures", etc.)
filename: %hash3%_%hash4%_%langId% (only scripts has name)
—
- script for copy and sort files XX\XXYY use info from exploded_database.db (used as source)
- example output: 64\6477 -> localization\9adb1166_f87044b6_0.lang
—
- script for convert localization files (*.lang) to readable xml
- example output: 9adb1166_f87044b6_0.lang -> 9adb1166_f87044b6_0.xml
Code: Select all
<s id="004f425e">Tunnel Varg</s>
<s id="0096b2e6">Devil's pit ghast</s>
<s id="009b0253">Buffs Intelligence</s>
<s id="00af0e3b">of Programming</s>
- script for unpack ogg files (*.oggpak)
- example output: 6e4c394b_147c9ae5_0.oggpack -> dir\file
directory name: %source_name%
filename: %hash3%_%hash4%
all Lua scipts can be decompiled. i used Java decompiler
unluac from
http://sourceforge.net/projects/unluac, it failed only on 5 files.
luadec from
https://github.com/sztupy/luadec51 can decompile all, but have not a pretty look for variable names.
i try chage and compile its again (with Lua 5.1.4, 5.2 not supported), but size is changed.
by the way, everything from large archives of files in exactly the same files XX\XXYY. i deleted these archives and play without problems for several hours (but turned off the steam check). these archives is 610Mb of extra data.
p.s.
sorry for bad english.
Re: Krater (PC)
Posted: Mon Jun 18, 2012 6:44 pm
by kalleoskar
great news! now i need to learn how to try it haha
Re: Krater (PC)
Posted: Mon Jun 18, 2012 8:14 pm
by swuforce
Here tool for 6477 file:
http://www.sendspace.com/file/9e7mew
Rename the 46f4455f4676790b container, or the game wont load the file.
Im not playing the game so i hope this not causing crashes.
Update: Added exporter
Re: Krater (PC)
Posted: Mon Jun 18, 2012 10:16 pm
by lostprophet
Well, I injected the modified text file and renamed the file, the game works, but the texts won't load (at least on the Steam version).
Re: Krater (PC)
Posted: Tue Jun 19, 2012 3:15 am
by hhrhhr
swuforce wrote:Here english text and importer for 6477 file
new_6477 have a 2-bytes shift in text area, not equal to original 6477, have a smaller size and bigger index section.
and cannot be reimported again ;)
Re: Krater (PC)
Posted: Tue Jun 19, 2012 2:46 pm
by swuforce
lostprophet wrote:Well, I injected the modified text file and renamed the file, the game works, but the texts won't load (at least on the Steam version).
It creates "new_6477" file. Did you rename it to orig?
hhrhhr wrote:cannot be reimported again
You can import only to the original file.
Re: Krater (PC)
Posted: Tue Jun 19, 2012 4:43 pm
by lostprophet
swuforce wrote:lostprophet wrote:Well, I injected the modified text file and renamed the file, the game works, but the texts won't load (at least on the Steam version).
It creates "new_6477" file. Did you rename it to orig?
Oh, so that was my problem. So the reimport feature works, but the game was updated to 1.03 on Friday and it looks like they added extra lines. For example: in the Main menu, where the "Új játék indítása" (Start New Game equivalent in Hungarian) should be, now there is a random conversation from the game.
I can supply the freshest 6477 file, if you need it (or any other file from the game) in PM.
Awesome work swuforce!