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.
How to pack BMP files in the .exe or into a single external file?
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 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§ion=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.
You can see a slighty old version of my code here: http://www.gamedev.net/index.php?app=core&module=attach§ion=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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement