How to pack BMP files in the .exe or into a single external file?

Started by
13 comments, last by Khatharr 11 years, 10 months ago
Instead of all the things people suggested, which strike me as bad ideas:
http://icculus.org/physfs/
You can use it to pack everything into a single ZIP file, and read them transparently at runtime.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement

Instead of all the things people suggested, which strike me as bad ideas:
http://icculus.org/physfs/
You can use it to pack everything into a single ZIP file, and read them transparently at runtime.

It would have a good compression ratio for bitmaps, but it is the slow method.
It depends on project requirements.

I would REALLY avoid this.


rwm5qw.png
[/quote]

Respect, bro! smile.png
I use resources but since it's windows only I would use an assembler's incbin feature to create a data OBJ file, dd all the symbols in a table and link the file with the exe. Inside the exe I'd dereference the array of pointers to the actual data.
In my project I made a small GDI based file collector/compressor which indexes, serializes and then deflates (using zlib) my project's resources. The project then has a namespace which reads the file, inflates it and then allows ready-to-use objects (textures, sounds, etc) to be generated on demand from the loaded data. Interestingly enough, the implementation of this system was a lot more simple than I had thought it would be. I ended up spending most of my time on the GDI utility, placing all the controls and making it look shiny.

You can see a slighty old version of my code here: http://www.gamedev.net/index.php?app=core&module=attach&section=attach&attach_id=8980

The resource packager has been changed slightly since then, but only in order to accommodate more resource types.

The relevant code is the 'RPAK' project within the solution and the 'RscStore' namespace in the main solution ('Bricks').

It's probably not something that you could just use for your own project, but if you look over it you should get the main thrust of it. The RPAK code is a little messy. Sorry.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement