Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Recommended Posts

Asphyxiator    2

I was looking in the game files for the sounds, and noticed that the sounds are inside a .kwad file, so naturally, I looked it up, but .kwad doesnt appear anywhere on the internet. If anyone could find a way of getting in, that would be great, as I want Incognita as my system sounds :)

 

  • Like 2

Share this post


Link to post
Share on other sites
x43x61x69    4

I was looking in the game files for the sounds, and noticed that the sounds are inside a .kwad file, so naturally, I looked it up, but .kwad doesnt appear anywhere on the internet. If anyone could find a way of getting in, that would be great, as I want Incognita as my system sounds :-)

 

It's a customized filesystem I believe, like the .wad files from the game "DOOM". Klei made it so it's natural if you didn't get anything from the net.

 

A quick look into the main binary does seem it has built-in AddResource(), MountResource() and etc... function. However it does not contain a extractor. If you are good at Lua, you might be able to pull the resources from the mounted virtual filesystems ("data") or instead dump them via a debugger while the game is running. Since they use MOAI to build this game, it might be similar to the FS design it offers but can't be sure. I'd like to know more about it too, but ain't no get time to poke around it.

 

I knew some Chinese did it during the beta in order to localize it, tho they didn't share the method online.

 

EDIT:

 

OK, seems binwalk can dump them after all but can't get "clean" files at the end. You might wanna try it yourself.

  • Like 1

Share this post


Link to post
Share on other sites

I read this thread and I thought I'd join in the hunt. I found something called the KleiResourceMgr in the Lua files that seems to handle the loading of the .kwad files. However, it's not defined in scripts.zip. I tried to find it in the .exe with a debugger, but I realized that I had no idea how to use a debugger. Hopefully someone else can pick up the torch, because I want those sounds too.

Share this post


Link to post
Share on other sites
x43x61x69    4

I read this thread and I thought I'd join in the hunt. I found something called the KleiResourceMgr in the Lua files that seems to handle the loading of the .kwad files. However, it's not defined in scripts.zip. I tried to find it in the .exe with a debugger, but I realized that I had no idea how to use a debugger. Hopefully someone else can pick up the torch, because I want those sounds too.

Yes it is in the main binary and I don't think a debugger would help on this matter if its a virtual system. (Called KleiFileSystem in the binary written with C++) You won't be able to dump clean files directly nor adding things to it via a debugger. You'd need to make your own pack/unpacker if the binary does not contain such methods for extracting its contents.

Share this post


Link to post
Share on other sites
Some1    26

This is something i've found on russian part of community. It seems to be a QuickBMS snippet:

goto 0x10get files longsavepos offsetxmath nametableoff "(files * 0x10) + 0x04 + offset"for i = 0 < files    get fullname basename    get null long    get filesize long    get fileoffset long    get type long    savepos tableoff    goto nametableoff    get namesize long    getdstring name namesize    savepos TMP    xmath pad "TMP % 0x4"    if pad != 0        xmath TMP "TMP + (0x4 - pad)"        goto TMP    endif    get unk long    string fullname + "/"    string fullname + name    savepos nametableoff    goto fileoffset    getdstring unk 0x20    get size long    get dummy longlong    get zsize long    savepos offset    if zsize != 0        clog fullname offset zsize size    else        log fullname fileoffset 0x30    endif    goto tableoffnext i

Not sure if it works, though.

Anyway, it can be useful to understand .kwad topology.

 

P.S. Hope, dev's pardon me for leaving it here.

Share this post


Link to post
Share on other sites

So with some fancy lua magic (read: calling a method on the KLEIResourceMgr), I managed to dump a list of the all the files and their offsets and sizes. I'm in the middle of manually extracting one now to see if it works. The file is called resources.txt, and to get it, you have to edit the main.lua. Open the file (wordpad is fine, you're not going to be doing any heavy coding) and look for an area where you have 4 lines in succession, with the code :

KLEIResourceMgr.MountPackage("sound.kwad", "data)

and so on. After that block, type:

KLEIResourceMgr.DumpToLog()

and save the file. Then run the game. Come back to the install folder, and you should find a handy list of all the files in the system and their sizes and offsets.

Share this post


Link to post
Share on other sites

So, I did manage to extract the opening cinematic, using the file list. I also tried to extract some textures, but they come in two formats, png, which are only 48 bytes each for all of them, and .tex, which are of the right size for textures. The pngs could not be extracted clean, and I assume they're not actual images due to their small size. The .tex seems to be a proprietary format from KLEI. I tried using an extractor I found on the Don't Starve forums for the same format, but the format of the file type seems to have changed since then, and it complains about invalid format, and refuses to load the files. However, the more standard formats, like the ogv the cinematic came in, do manage to extract, but only if you erase the first few bytes of the file, up to the Ogg signature of the .ogv format. This may be why binwalk couldn't extract the files. (I apologize for the double pos, but I couldn't seem to find an edit button.)

Share this post


Link to post
Share on other sites
x43x61x69    4

This is something i've found on russian part of community. It seems to be a QuickBMS snippet

 

Could you provide the link to that post?

Share this post


Link to post
Share on other sites

I tried extracting some of the sounds, but they're all in the .fsb format, which is used by FMOD. I tried using an FSB extractor on my test file, but it said the format was invalid. There might be some secondary processing going on there.

Share this post


Link to post
Share on other sites
Shirsh    129

So, I did manage to extract

Sound is sound, but could you share some *.tex file for further experimentation, please (I have evil plans to make some stuff like add different prisoners with different faces etc someday)?

some *.abld file would be even better though*

Share this post


Link to post
Share on other sites

The guards and other npcs, as well as the agents, are stored in a different format, with a .png and a .mdl. Haven't managed to decipher that yet. However, I did extract a GUI texture, named Program0016.tex. It's attached.

test.txt

It's in the .txt format so I can upload it. Just change the extension.

Share this post


Link to post
Share on other sites
Arc    7

If you want I could probably just give you the tool to generate the kwad files. And a description of the internal formats for the types of files in there.

  • Like 4

Share this post


Link to post
Share on other sites

Well that sort of ruins the fun of it. But seriously, I would appreciate that. I would also like to take this space to say thanks for the great game, though I haven't finished it yet, and my pride doesn't permit me to go any level below experienced.

Share this post


Link to post
Share on other sites
x43x61x69    4

If you want I could probably just give you the tool to generate the kwad files. And a description of the internal formats for the types of files in there.

 

Wish I'd read this earlier so I won't even need to start my own. :-)

 

Anyways here's a simple listing/extracting tool written in Python. (kinda pre-alpha stage):

 

https://github.com/x43x61x69/KWAD-Tool

 

movie.kwad can extract out playable .ogv files, but no idea how to handle those .tex/.png.

 

Guess we can all waiting for the official tool then.

Share this post


Link to post
Share on other sites

Kids these days, with their fancy devs. Back in my day, we had to code our games from scratch, uphill, both ways. And we liked it.

Share this post


Link to post
Share on other sites
x43x61x69    4

Kids these days, with their fancy devs. Back in my day, we had to code our games from scratch, uphill, both ways. And we liked it.

 

I still listen to vinyl records most of the time but I didn't blame MP3 or Spotify for their poor music quality.

 

People use all those latest tech and criticising present days are not helpful at all. If you don't like things as such, you can do your own. No one will stop you from doing that. But stop others while doing nothing is always not a good sign. Why not help us bring back your good old day experiences?

 

By studying the tools developer releases will give people insightful info about the mind behind the design, which is important as most of the majority can't code anymore. Some of the greatest game designers of our time started as a game modder.

 

“Others have seen what is and asked why. I have seen what could be and asked why not.” - Pablo Picasso.

Share this post


Link to post
Share on other sites
Some1    26

Kids these days, with their fancy devs. Back in my day, we had to code our games from scratch, uphill, both ways. And we liked it.

 

Yes, It was hard times. So many senselessly wasted efforts. Just imagine, we spend half of our free time into wheel reinventions, whereas now people can put all their potential into essential thins.

Share this post


Link to post
Share on other sites

 

I still listen to vinyl records most of the time but I didn't blame MP3 or Spotify for their poor music quality.

 

People use all those latest tech and criticising present days are not helpful at all. If you don't like things as such, you can do your own. No one will stop you from doing that. But stop others while doing nothing is always not a good sign. Why not help us bring back your good old day experiences?

 

By studying the tools developer releases will give people insightful info about the mind behind the design, which is important as most of the majority can't code anymore. Some of the greatest game designers of our time started as a game modder.

 

“Others have seen what is and asked why. I have seen what could be and asked why not.” - Pablo Picasso.

 

Because it's the internet, I guess my sarcasm didn't come through. I was being sarcastic. Sorry for any misunderstanding.

Share this post


Link to post
Share on other sites
Shirsh    129

If you want I could probably just give you the tool to generate the kwad files. And a description of the internal formats for the types of files in there.

Yes, do it please, if you can!

Share this post


Link to post
Share on other sites

No idea if this helps but the file structure seems to be something like this

Header: 32 bytes	Signature: KLEIPKG2 : 8 bytes	Data Length: 4 bytes	Version?: 4 bytes	File Count: 4 bytes	unknown int: 4 bytes	unknown int: 4 bytes	Data Offset: 4 bytes	Data: 	BLOB:		ID: BLOB : 4 bytes		Blob Type: 4 bytes		Length?: 4 bytes		Blob Data: variable size			KLEIBLOB:		Length: 4 bytes		Data: [Length] bytes

Share this post


Link to post
Share on other sites

I've already managed to extract the files, but most of them are in a propietary format or encrypted. Of special interest are the .fsbs, which are FMOD sound banks, though they are encrypted with a password. I've been trying to find it, but documentation on exactly how the process works is sparse, and there appear to be two methods of encryption, only one of which seems to be documented online.

Share this post


Link to post
Share on other sites