#include <revolution/dvd.h> s32 DVDRead(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset);
| fileInfo | Information about the file associated by calling the DVDOpen function in advance. |
|---|---|
| addr | Buffer address. Must be 32-byte aligned. |
| length | Number of bytes to read. Must be a multiple of 32. |
| offset | File position to start reading from. Must be a multiple of 4. |
Returns the number of bytes read if successful.
If a fatal error occurs during a read, the function returns DVD_RESULT_FATAL_ERROR. If the read is canceled, the function returns DVD_RESULT_CANCELED. DVD_RESULT_FATAL_ERROR and DVD_RESULT_CANCELED are both negative values.
Asynchronously reads data from a file. First opens the file with the DVDOpen function.
Note:Be careful if you are considering the use of a synchronous function in a real game. Synchronous functions can only be used in a multithreaded game. In single thread games, synchronous functions can't be used because there is no way to check errors.
Programmers must prepare enough memory space for storing the file read.
By default, invalidating the data cache for the memory space is unnecessary. The DVDRead function internally invalidates the data in the cache. Programmers can change this default setting so that programs can decide if the cache should be invalidated. For more detail, see the DVDSetAutoInvalidation function.
Issuing zero length reads is valid. In this case, the DVDRead function does nothing and returns 0.
This function may put the current thread to sleep. Refer to Interrupts and Callback Functions.
DVDOpen, DVDReadAsync, DVDGetLength, DVDSetAutoInvalidation, DVDCancel(Async), DVDCancelAll(Async), Interrupts and Callback Functions
2007/09/25 Added an explanation of thread behavior.
2006/03/01 Initial version.
CONFIDENTIAL