Game Development Reference
In-Depth Information
Figure 11.4. Post run report tool.
File logging component. The FileLog class must hook into all the file functions
used by the game. When a file I/O function is performed or completed, it is added
as a line to the activity log file. You will need to refer to your target platform's
documentation on how to hook the file logging into any file I/O completion call-
backs. This is so the log being generated is kept accurate. Listing 11.12 shows a
sample of the FileLog class being used.
// Hook into the platform ￿ s open file function.
FileHandle * FileSystem::open( const char * filename )
{
FileHandle * handle;
handle = PlatformFileSystemOpen( filename );
FileLog::log( File open:%s Handle ID: %x ,filename,handle);
}
// Wrap around the platform ￿ s read function. Pass in the file
// handle, destination address to read data to, amount of data
// to read in and a callback to call on the read ￿ s complection.
void FileSystem::read( FileHandle * handle, void * dst,
int amount, FileReadCallback * callback )
{
// In this example - when calling the platform ￿ s read
// function we also pass in our own callback which is called
// first when the read has completed.
handle = PlatformFileSystemRead( handle, dst, amount,
FileReadCompletionCallback,
callback );
 
Search WWH ::




Custom Search