Could you please tell me the internal layout in memory of the following two structs?
I am planning to implement loading from a virtual file system where the files might be in archives and want to keep this transparent to the user and therefore want to implement my own versions of the loading routines.
Thanks in advance
- kezz asked 14 years ago
You don’t have to format it in any special way. You have the files in your archive. You supply functions that open, close, read, seek and tell files from the archive. You give FMOD pointers to these functions and then FMOD calls those functions to do any file reading that it requires. You just give FMOD the block of file data that it asks for and FMOD will do the processing of the file data.
For example, your archive might contain a file called ‘explode.wav’. FMOD will call your open callback with ‘explode.wav’ as the parameter. Your archive routines locate the file called ‘explode.wav’ and return a handle to FMOD. This handle could any integer-sized value that uniquely identifies the open file ‘explode.wav’ in your archive. I usually use a pointer to a structure that contains information about the open file. FMOD will then call the read callback, passing it a pointer to read the data into, the size of the data it is expecting in bytes and the handle to the file that you returned from the open callback. You then just copy the said number of bytes from your archive to the data buffer provided by FMOD.
It depends on how your archive system works. Can it handle reading small sections of a large file contained in the archive? If so, then all your work is done for you. FMOD never asks for the entire file. It will ask you only for the section of the file that it requires at that time.
Please login first to submit.