1. Computing

Building a Resource Manager

By December 20, 2012

Follow me on:

In the Empire game, there are a number of files needed to run the game. Apart from Empire.exe and six SDL/ttf dlls, there are three gifs, a couple of .txt files and a .ttf font. For now I'll leave the dlls but the remaining files I'd like to package all these files up into one big compressed file.

Does anyone know if there are any open source apps for creating a resource file this way, and a C (or C++) library to call to extract the information? If not I guess I'll have to write one for the next tutorial.

Comments
December 20, 2012 at 7:24 pm
(1) Brian says:

What about using a .zip file? Doing so may allow the benefits of both a single resource file and compression. Although I don’t have any personal experience or knowlege of a zip API, you might find something helpful via:
http://stackoverflow.com/questions/4296918/how-to-extract-zip-file-in-c-sharp
Or, perhaps:
http://stackoverflow.com/questions/876626/windows-api-to-extract-zip-files

December 21, 2012 at 1:41 pm
(2) John Bandela says:

Take a look at PhysicsFS

http://www.icculus.org/physfs/

I think it may be what you are looking for. It is licensed under zlib license.

December 21, 2012 at 1:43 pm
(3) John Bandela says:
December 22, 2012 at 9:28 am
(4) Turgut Hakki Ozdemir says:

If you mean “read-only” or “most of the time read-only” data by resource file, and don’t need a full blown vfs, use a zip file. The file format is quite easy to learn and expand (If you need to break compability). And with the help of ZLIB (And unless my memory fails me) it took me about 3-4 days to write a zip reader/writer from scratch. I did not support all features of course but it can read any zip file i throw at it.

December 22, 2012 at 10:31 pm
(5) Brian says:

I found a link to this ZIP right here on cplus.about

http://zipstorer.codeplex.com/

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.