The RenderWare file system manager provides a generic interface through which all RenderWare I/O operations are undertaken. This constitutes the first layer of the file system API. It supports multiple file systems, each representing one device type. In other words it is designed to provide a common file transfer interface for all hardware devices.
The file system manager is responsible for managing the registration of new file systems, and for providing a generic file interface. This generic interface is an ANSI-C compliant interface that allows any RenderWare file operations to be done via the file system toolkit. As an example, a successful file open operation will involve looking for a registered file system, and calling the open function of the file system found.
|
|
RtFSManagerClose closes the file system manager and frees all registered file systems. This function must be called when the application is about to be closed. |
|
||||||||||||||||||||
|
RtFSManagerFOpen opens a file in a file system that is determined by the device name attached to the file name.
This function will first try to get a file system device name from the file name specified. In the case where a corresponding file system is found (or a default file system has been registered), this function will look whether there are any available files in this file system. Remember that the maximum number of files a file system can concurrently handle is set during the file system initialization. If the file system still has any available file slots this function will then attempt to open the file.
This function can be used directly to open a file when a file needs to be opened in asynchronous mode. In this case, you can use the RtFileAccessFlag enumeration to specify the correct file access. You can mix these flags using the binary OR operator as shown below:
RtFileAccessFlag flags = 0; To use this function, make sure that you have registered at least one file system. The function will automatically attempt to look for a file system from the file name so make sure that either your file names include the device name, or that you have registered a default file system (see RtFSManagerSetDefaultFileSystem). Note that it is generally common place to open a separate thread and use the file system in synchronous mode. This function should therefore be used only in the case where a file needs to be opened directly in asynchronous mode, and when the use of the internal asynchronous I/O mode is desired.
|
|
|
RtFSManagerGetDefaultFileSystem gets the current default file system
|
|
|
RtFSManagerGetFileSystemFromFileName Gets a registered file system from a complete file name, i.e. a file name including the device name. This function will look for the colon character (":") as a device separator. Also note that this function will automatically return the default file system (should one have been registered) in the case where it fails to find the correct file system as specified by the device name appended to the file name passed.
|
|
|
RtFSManagerGetFileSystemFromName gets a file system from its unique name. This function will return a pointer to the registered file system which has the unique name fsName. Note that fsName is user defined, and corresponds to the fileSystemName passed during the OS specific file system initialization. If no file system is found, the function will trigger the error callback with an RTFSM_ERROR_NOFS error, should an error callback be specified.
|
|
|
RtFSManagerOpen opens and initializes the file system manager. This function performs all necessary operations to initialize the file system manager. This includes creating the file system manager, and installing a generic set of ANSI-C file functions to the standard RenderWare file interface. This function must be called first in order for any future file I/O operation to work through the file system toolkit.
|
|
|
RtFSManagerRegister registers a new file system with the file system manager. This function will perform some initial steps before actually registering the file system specified. It will first check whether the file system can be registered. This is done by checking whether the file system manager has reached its maximum capacity (which is specified during RtFSManagerOpen). If the maximum capacity has been reached, this function will return FALSE. However in the case where the manager can handle the new file system, this function will verify whether the unique name of the file system passed is not already in use. If that verification is successful, the function returns TRUE. In all other cases, it will return FALSE.
|
|
||||||||||||
|
RtFSManagerSetCallBack sets a specific callback for the file system manager. This specific callback is determined by the callback code passed.
|
|
|
RtFSManagerSetDefaultFileSystem sets a default file system.
The default file system is the file system that will be used as a last resort when trying to open a file. This means that when a file open operation is undertaken the manager will automatically try to use the default file system if no other valid file system, i.e. a file system corresponding to a possible device name specified in front of the file name to open, has been found. The file system manager allows you to set a default file system. This is particularly useful if your path names are relative or if you want to default any file I/O operations to a specific file system. Remember that when a file is opened, through the file system toolkit, a corresponding file system must be found. This means that if your paths are relative, they may not include any device name, and therefore a default file system must be registered in order for the open operation to be attempted.
|
|
|
RtFSManagerSyncAllFiles will synchronise all the files on all the registered file systems. |
|
|
RtFSManagerSyncAllFilesOnFileSystem will synchronise all the file on a particular file system, as well as trigger any callback for the current outstanding operations on the file within this file system.
|
|
|
RtFSManagerUnregister unregisters a specific file system from the file system manager.
This function checks that the file system passed is currently registered and, if it is, removes it from the list of file systems being managed by the file system manager. This will also involve freeing all memory associated with that file system. Should the file system specified be the default file system, this function will also reset the default file system to NULL. Note that if any files remain open when this function is called they will not be closed. In other words this function should not be called if the file system is still being used by any files. Should this be done it will result in an unpreditable behaviour, which will probably cause your program to crash.
|
|
|
RwFAsyncCancel cancels an asynchronous operation currently being undertaken on file handle "fptr".
|
|
|
RwFclose closes the file associated with the file pointer fptr (ANSI-C compliant).
|
|
|
RwFeof tests the end-of-file (EOF) indicator for the file specified by the file pointer "fptr" (ANSI-C compliant).
|
|
|
RwFexist checks whether a file specified by its name exists.
|
|
||||||||||||||||
|
RwFgets reads at most (maxLen - 1) characters from the file specified by the file pointer "fptr", and stores them in the string "buffer" (ANSI-C compliant).
|
|
||||||||||||
|
RwFopen opens a file. This is an ANSI-C compliant function allowing the use of standard file access flags, i.e. valid combinations of 'r', 'w', 'b', and 'a'. This function calls RtFSManagerFOpen.
|
|
||||||||||||
|
RwFputs writes the string pointed by "buffer" to the file specified by the file pointer "fptr" (ANSI-C compliant).
|
|
||||||||||||||||||||
|
RwFread reads "count" objects each of size "size" from the file associated with the file pointer "fptr", and stores the data read at the location given by "addr" (ANSI-C compliant).
|
|
||||||||||||||||
|
RwFseek sets the file position to the appropriate offset and from a specific origin (ANSI-C compliant). The new position (in bytes) is obtained by adding the offset "offset" to the position specified by "origin".
|
|
|
RwFtell returns the current position of the file specified by file pointer "fptr".
|
|
||||||||||||||||||||
|
RwFwrite writes "count" objects (obtained from the location given by the pointer "addr") each of size "size" from the file associated with the file pointer "fptr" (ANSI-C compliant).
|
© 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:47:10 2004.
Send Feedback