Reading from compressed archives

I want to put all the content of my programs in a compressed archive as its beginning is getting quite large. I know that in several libraries like zlib, but I don't know how to get them to do what I want to do:

  • Be able to load textures / models, etc. from a file, curlyly im using d3dx methods like D3DXCreateTextureFromFileEx. I really don't want to write my own image loaders for the different formats I need, so I need a way to be compatible with these d3d methods. I know they have a way to load from a file into memory, would it be wise to extract the file into memory and then load it?

  • Be able to use C ++ streams with files in a compressed archive, for example:
    std :: zipstream file ("data.zip:sounds/beep.wav", std :: ios :: in | std :: ios :: binary);

+1


source to share


3 answers


I would recommend looking at open source games (like quake3). Some of these are packaging resources and have working implementations of a "virtual filesystem" as Wilks noted. You can get some ideas.



+2


source


There is an article titled Programming the Virtual File System , archived in flipcode , that should provide what you need. If you have questions specific to this article, many former flipcodes members now frequent the forums at DevMaster.net .



0


source


There are ready-made libraries for this kind of thing. I'm afraid I don't know any names, but I suggest google for the keywords "virtual filesystem".

-1


source







All Articles