Title-defined function called by XACT to read data from disk.
typedef BOOL (__stdcall *XACT_READFILE_CALLBACK)( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped );
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get extended error information, call GetLastError.
This function is analogous to the system ReadFile function. When reading data from disk, the XACT engine calls the title's read file callback instead of the system ReadFile function. The advantage of registering a callback is that the title can manage XACT's disk input to prioritize it along with the game's other I/O.
The simplest implementation of this callback function is to call ReadFile and return its return value, but doing so provides no benefit. The title will want to extend or modify read behavior when registering this callback.
ReadFile sets the lpNumberOfBytesRead variable to zero before doing any work or error checking, so the title callback should do the same.
XACT makes extensive use of the HasOverlappedIoCompleted macro, which references the Internal member of the OVERLAPPED structure passed in lpOverlapped. Titles must properly set this flag to indicate the status of the overlapped operation. The HasOverlappedIoCompleted macro is defined as follows:
#define HasOverlappedIoCompleted( lpOverlapped ) ( (lpOverlapped)->Internal != STATUS_PENDING )
Header: Declared in Xact.h.