#include <revolution/dvd.h>
typedef void (*DVDCBCallback)(s32 result, DVDCommandBlock* block);
s32 DVDChangeDisk(DVDCommandBlock* block, DVDDiskID* id);
BOOL DVDChangeDiskAsync(DVDCommandBlock* block, DVDDiskID* id,
DVDCBCallback callback);
| block | Command block of this command. |
|---|---|
| id | Pointer to the disc ID. |
| callback | Callback function that indicates completion. (Only for DVDChangeDiskAsync.) |
DVDChangeDisk: Returns 0 if the command completes normally; otherwise, returns a negative value.
DVDChangeDiskAsync: Returns TRUE if the command terminates normally; otherwise, returns FALSE.
DVDChangeDiskAsync waits for the game player to insert the game disc with a matching id.
After the read finishes, the callback function is called (unless NULL is specified for callback). When the game disc is successfully changed, zero is returned as the first argument result of the callback function. If a fatal error occurs, DVD_RESULT_FATAL_ERROR is returned. If the function is canceled, DVD_RESULT_CANCELED is returned. DVD_RESULT_FATAL_ERROR and DVD_RESULT_CANCELED are both negative values. The second argument of callback is the same DVDCommandBlock structure as that passed when DVDCheckDiskAsync is called.
After the DVDChangeDiskAsync function is called, two methods are available for determining if the game disc change is completed. One method is to check that the callback function was called. The other is to poll with the DVDGetDriveStatus function and wait until it returns DVD_STATE_END.
The DVDChangeDisk function is a synchronous version of DVDChangeDiskAsync.
Note:Be careful if you are considering the use of synchronous functions in a real game program; use synchronous functions if the game program is multithreaded. In single threaded games, synchronous functions can't be used because there is no method for error checking.
2006/03/01 Initial version.
CONFIDENTIAL