-
Notifications
You must be signed in to change notification settings - Fork 3
VDFS interface
VDF_VIRTUAL
- allow to use the virtual file.
VDF_PHYSICAL
- allow to use the physical file.
VDF_PHYSICALFIRST
- allow the physical file first.
VDF_DEFAULT
- allow to use virtual and physical files.
long vdf_fopen( char* fullfname, long flags )
Open virtual or physical file to read.
fullfname
- full file name in the Gothic directories.
flags
- where is find the file.
return
- file handle.
⠀
long vdf_fclose( long handle )
Close file by handle.
handle
- handle of the file.
⠀
long vdf_fread( long handle, char* buffer, long size )
Read the file data.
handle
- handle of the file.
buffer
- where to copy data.
size
- length to read.
return
- count of readed bytes.
⠀
long vdf_fseek( long handle, long pos )
Change the read file position in the file.
handle
- handle of the file.
pos
- new file position.
return
- new file position.
⠀
long vdf_ftell( long handle )
Get the read file position in the file.
handle
- handle of the file.
return
- file position.
⠀
long vdf_fexists( char* fullfname, long flags )
Check file exists in the file system.
fullfname
- full file name in the Gothic directories.
flags
- where is find the file.
return
- true is exists, false if not.
⠀
long vdf_searchfile( char* filename, char* fullfilename )
Get full file names of all found files by name with |
separator.
filename
- searched file name.
fullfilename
- buffer.
return
- count of found files.
example:
char buffer[8192];
long count = vdf_searchfile( "SystemPack.ini", buffer );
if( count > 0 ) {
string firstFullFileName = string( buffer ).Split( "|" ).GetFirst();
Message::Info( firstFullFileName, count );
}
⠀
long vdf_ffilesize( long handle )
Get size of file in bytes.
handle
- handle of the file.
return
- size of the file.
⠀
long vdf_filelist_physical( char**& list )
Get full physical file names list.
list
- null list of the file.
return
- count of the files in the list
.
example:
char** fileList = Null;
long count = vdf_filelist_physical( fileList );
for( long i = 0; i < count; i++ ) {
cmd << fileList[i] << endl;
delete fileList[i];
}
delete[] fileList;
⠀
long vdf_filelist_virtual( char**& list )
Get full virtual file names list.
list
- null list of the file.
return
- count of the files in the list
.
example:
char** fileList = Null;
long count = vdf_filelist_virtual( fileList );
for( long i = 0; i < count; i++ ) {
cmd << fileList[i] << endl;
delete fileList[i];
}
delete[] fileList;
⠀
long vdf_getfilehandle( long handle, long& offset )
Get system file handle which used in this file.
handle
- file handle.
offset
- reserved.
return
- system file handle.
⠀
long vdf_unpackogg( char* fullname, long flags )
Convert (prepare) OGG to WAV in the background. Can be used to momental playing the big ogg file.
fullname
- name of the OGG file.
flags
- where is find the file.
return
- true if ok, false if inexists ogg.
⠀
long vdf_packogg( char* fullname, long flags )
Delete converted OGG file data from memory.
fullname
- name of the OGG file.
flags
- where is find the file.
return
- true if ok, false if inexists ogg.
⠀
long vdf_import(char* volname)
Import additional .vdf or .mod file to the system.
volname
- full path to the archive.
⠀
long vdf_set_unzip_multithreading(long allow)
Allow to use more than 1 threads in the unziping file process.
allow
- true - yes, false - no.
⠀
long vdf_updatephysicaltable()
Check all physical files and add new.
⠀
long vdf_getvolumename( char* fileName, char*& volumeName )
Get the .vdf or .mod name which contains the file.
fileName
- full file name.
volumeName
- empty buffer.
return
- name length of Invalid if file inexists or physical.
example:
char fileName[] = "_WORK\\DATA\\ANIMS\\_COMPILED\\HUM_BODY_BABE0.MDM";
char* volumeName = Null;
long nameLength = vdf_getvolumename( fileName, volumeName );
if( nameLength > 0 )
Message::Info( volumeName );
delete[] volumeName;
⠀
bool Test() {
char fullFileNamesList[8192];
long filesCount = vdf_searchfile( (char*)"SystemPack.ini", fullFileNamesList );
if( filesCount == 0 )
return false;
string firstFileName = string( fullFileNamesList ).Split( "|" ).GetFirst();
long fileHandle = vdf_fopen( firstFileName.ToChar(), VDF_DEFAULT );
if( fileHandle == Invalid )
return false;
long fileSize = vdf_ffilesize( fileHandle );
char* fileData = new char[fileSize];
long readed = vdf_fread( fileHandle, fileData, fileSize );
vdf_fclose( fileHandle );
string partOfFileData( fileData, 200 );
delete[] fileData;
Message::Box( partOfFileData );
return true;
}
- Introduction
- Project hierarchy
- Default functions
- Build options
-
Gothic API
- Base objects
- Models and visuals
- Static and interactive objects
- Animations
- Interface
- Scripts
- Worlds
- Renderer
- Other
- User API
-
Union API
- Hook
- Hook Functions
- Array
- ArraySorted
- Map
- MapArray
- String
- Unicode string
- UTF-8 converter
- RowString
- Console
- Logger
- Message
- Thread
- Event
- Semaphore
- ThreadLocker
- Crc checker
- Options
- Timer
- Union
- VDFS functions
- VirtualFile
- Hooks
- dynamic_cast patch