Hiding Resources in .DAT files

Started by
2 comments, last by L. Spiro 12 years, 8 months ago
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".)

Advertisement
.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.
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
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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement