|
Documentation
|
||||||||||||||
|
CGapiVFSOverviewGapiVFS is a virtual file system to store images, sound files and other data files needed by the application. Files can be stored in folders and subfolders, and can be selectively compressed using zip-compression. You create VFS archives using the included VFSEdit application which is shown in the picture below.
This document has been updated for use with GapiDraw 4.0 or later.
CGapiVFS::CreateVFSCreates a virtual file system from a file or resource.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_INVALIDPARAMS RemarksYou create files containing a virtual file system with the tool VFSEdit, which is included with the GapiDraw distribution in the folder "misc\VFSEdit". Files stored in the virtual file system can be individually compressed with zip compression, and will be automatically decompressed when loaded. If you use a relative file position as a filename, CreateVFS will try to open the file relative to the current folder, not the folder in which your executable file is located. CGapiVFS::FreeVFSCloses the virtual file system and frees all allocated memory.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_OPENVFSFILES RemarksCGapiVFS::FreeVFS is automatically called in the CGapiVFS destructor. If the file system had opened files, CGapiVFS::FreeVFS will still close the virtual file system but will return GDERR_OPENVFSFILES. CGapiFileBuffer::OpenOpens a file from the virtual file system, decompresses it, and stores the expanded file in a new memory buffer.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_CORRUPTFILE RemarksThe pFilename string must start with a slash, '/', otherwise CGapiFileBuffer::Open will return GDERR_FILENOTFOUND. Also, use '/' to specify folders, such as '/myrootfolder/mysubfolder/myfile.bmp'. CGapiFileBuffer::CloseCloses the file buffer and frees all allocated memory.
Parameters
Return valuesNone RemarksCGapiFileBuffer::Close is automatically called in the CGapiFileBuffer destructor. CGapiFileBuffer::GetFileInfoReturns information on the CGapiFileBuffer.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_FILENOTOPEN CGapiFileBuffer::GetBufferUsed to retrieve a pointer to CGapiFileBuffer's internal memory buffer.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_FILENOTOPEN RemarksDo not attempt to manually free the memory buffer allocated by CGapiFileBuffer, instead call CGapiFileBuffer::Close to free the memory. CGapiFileStream::OpenOpens a file from the virtual file system and prepares it for streaming.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_CORRUPTFILE RemarksThe file path must start with a slash, '/', otherwise CGapiFileBuffer::Open will return GDERR_FILENOTFOUND. Relative search paths within the virtual file system is not allowed. Also, use '/' to specify folders, such as '/myrootfolder/mysubfolder/myfile.bmp'. If the file is compressed it will be decompressed in real time when CGapiFileStream::Read is called. CGapiFileStream::CloseCloses the file stream and frees the memory allocated for real-time decompression.
Parameters
Return valuesNone RemarksCGapiFileStream::Close is automatically called in the CGapiFileStream destructor. CGapiFileStream::GetFileInfoReturns information on the CGapiFileStream.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_FILENOTOPEN CGapiFileStream::IsEOFChecks to see if the file stream has reached the end of file.
Parameters
Return valuesReturns TRUE if the internal file offset equals the size of the file. CGapiFileStream::ReadReads a number of bytes from the file, automatically decompressing the data if necessary.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_CORRUPTFILE CGapiFileStream::ResetResets the position of the file to the start position.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_CORRUPTFILE CGapiFileStream::SeekChanges the current position in the file.
Parameters
Return valuesIf this method succeeds, the return value is GD_OK. If the method fails, the return value may be one of the following return values: GDERR_CORRUPTFILE CGapiFileStream::TellReturns the current offset in the file.
Parameters
Return valuesReturns the current file offset.
|