Sign in to follow this  
_Zac_

Hiding Resources in .DAT files

Recommended Posts

_Zac_    138
When most games are released you'll usually never find the resources (images, sounds, etc.) just out in the open when searching through the folders. When I looked at a Doujin game I downloaded they were all in a .dat file that was next to the original .exe. There was no easy way for me to extract the information from these files.

I was wondering how I could implement this. Are they like folder files or zip files? (I really don't know more about this topic other than "all the resources are packed into these .dat files and I want to know how to do the same".)

Share this post


Link to post
Share on other sites
polyfrag    2504
.pk3 files used in Quake 3 are just .zip files, I think. The .wad files are their own format.

You can use some library like zLib or something to zip/unzip your files and just change the extension.

Or you can write your own packer/unpacker that reads the structs and whatnot, recording what files you have and the length of each near the header of your pack file.

If you use something like PlaySound, which requires you to specify the filepath, then I guess you can unpack files to Windows' temporary directory, or just make them resources in the .exe.

Share this post


Link to post
Share on other sites
zacaj    667
If it is a zip like file, 7zip can auto detect it, without you playing with extensions. Just as likely, however, that they just made their own format

Share this post


Link to post
Share on other sites
L. Spiro    25638
If you want to do the same, you should also know the reasoning behind it.

Aside from compression, it helps protect their assets. Some of them use their own proprietary systems in order to make it more difficult for hackers to extract these resources.

If you don’t care to protect your assets, you can use an existing compression library such as zlib. Or you could layer an “encryption” over it by XOR’ing the result with some constant. It makes it harder to crack than just changing the file extension, at least.


By the way, even after you have unzipped their files, there is no guarantee that the file can be used by any existing tool besides their engine. Most companies make their own 3D file formats, or the 3D format is specific to the engine that was used with that game, etc.
You won’t get a model file that you can just load into Maya or 3D Studio Max.

Audio files are likely to be just .OGG; it is very rare for engines and companies to make new audio files.

But image files are easy to make proprietary, so you are not guaranteed to get a .BMP, .JPG, .TGA, .DDS, etc. You may have to do further decoding to get something meaningful.
Likewise, you can consider making your own image/model formats for your purposes before compressing them.


L. Spiro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this