Jump to content
  • Advertisement
Sign in to follow this  
choffstein

Virtual File System question...

This topic is 4848 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I am contemplating how I would use resource files (not windows, but generic) in my game, so my data is hidden and zipped (gzip). Most tools I use (like FMOD) open from a file on the harddrive... So if everything is already stored in memory in a virtual file system, how would I go about passing them to these tools as if they were on the harddrive? How do normal games do it? Thanks! <3 visage

Share this post


Link to post
Share on other sites
Advertisement
Haven't used FMOD in years, so I don't know if its changed too much, but I do remember I was able to load stuff out of resource files (quake2 pak files) by writing and specifying the appropiate callback functions.

To handle resource files, there are typically 2 ways I've seen APIs/libraries support them:

+Load the file from memory. Your responsible for putting the file into RAM and you pass a pointer to an appropiate API/library function that loads the file.

+Pass a file pointer (FILE*) to the appropiate API/library function and specify callbacks that deal with seeking within the file. What's important here is that you correctly handle seeking to the beginning and/or end of the file since you can't simply seek to the beginning/end of the resource file.

If an API/library only supports taking a filename and loading the file itself, then (AFAIK) it's not possible to use the API/library with resource files.

Share this post


Link to post
Share on other sites
I basically do it how Catafriggm suggests. In my virtual filesystem class I wrote my own functions that act like FILE* stream. If you need some example code on how I went about it PM me and I'll gladly send you my class as reference. I only have the reading functions done so far though, i havent made any which will allow you to modify whats in the file. It's on my todo list. :D

Share this post


Link to post
Share on other sites
I'm not sure about licensing issues, but you could use a virtual disk driver like this one:

http://chitchat.at.infoseek.co.jp/vmware/vdk.html#top

Then you can use normal file handling functions instead of writing your own I/O subsystem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!