add_buffer(char* name,void* buffer,long size)
Adds a named buffer to the engine file system. If the engine afterwards
attempts to open a file with the given name, it reads out of the buffer
rather than loading the file from the hard disk. This allows to add a
user defined file resource system in an external language.
Parameters:
name - file name (max. 31 characters).
buffer - pointer to the buffer with the file content, or NULL
for removing the buffer from the file system.
size - size of the buffer in bytes
Remarks:
- Files that are accessed directly (streamed media files, DLL files, or files
accessed by file_open) can not be loaded from a named buffer.
- This instruction is intended for external languages and thus uses char* and
long rather than STRING* and var.
- The buffer must be allocated from the heap or by file_load(),
and must be freed when it is not used anymore (at application exit at least).
-
All buffers are removed through the add_new function.
Speed:
medium
Example:
void* pTerrain = file_load("terrain.hmp",NULL,&size);
add_buffer("terrain1.hmp",pTerrain,size);
See also:
add_folder, add_new
► latest
version online