1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=utf-8">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 6.5.0.0 for Windows">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
9<title>DVDPrepareDisk</title>
10</head>
11
12<body>
13
14<h1>DVDPrepareDisk<br>DVDPrepareDiskAsync</h1>
15
16
17<h2>Syntax</h2>
18
19<dl>
20  <dd><pre><code>#include &lt;revolution/dvd.h&gt;</code></pre>
21  </dd>
22  <dd><pre><CODE>typedef void (*DVDCBCallback)(s32 <i>result</i>, <a href="../dvd/DVDCommandBlock.html">DVDCommandBlock</a>* <i>block</i>);</CODE></pre>
23  </dd>
24  <dd><pre><CODE>s32 DVDPrepareDisk(<a href="../dvd/DVDCommandBlock.html">DVDCommandBlock</a>* <i>block</i>, DVDDiskID* <i>id</i>);</CODE></pre>
25  </dd>
26  <dd><pre><CODE>BOOL DVDPrepareDiskAsync(<a href="../dvd/DVDCommandBlock.html">DVDCommandBlock</a>* <i>block</i>, DVDDiskID* <i>id</i>,
27                        DVDCBCallback <i>callback</i>);</CODE></pre>
28  </dd>
29</dl>
30<h2>Arguments</h2>
31<TABLE border="1" cellpadding="3" cellspacing="0.1">
32  <tr>
33<TD width="120" bgcolor="#ffffe8"><code><em><strong>block</strong></em></code></TD>
34<TD width="520">Command block of this command.</TD>
35    </tr>
36  <tr>
37<TD width="120" bgcolor="#ffffe8"><code><em><strong>id</strong></em></code></TD>
38<TD width="520">Pointer to disc ID.</TD>
39    </tr>
40  <tr>
41<TD width="120" bgcolor="#ffffe8"><code><em><strong>callback</strong></em></code></TD>
42<TD width="520">Callback function that notifies of completion (<code>DVDPrepareDiskAsync</code> only).</TD>
43    </tr>
44  </TABLE>
45<h2>Return Values</h2>
46<P><code>DVDPrepareDisk</code>: Returns 0 if the command completes normally; returns a negative value otherwise.</P>
47<P><code>DVDPrepareDiskAsync</code>: Returns <CODE>TRUE</CODE> if the command terminates normally; returns <CODE>FALSE</CODE> otherwise.</P>
48<h2>Description</h2>
49<P>The <code>DVDPrepareDiskAsync</code> function waits for the game player to insert the game disc with the disc ID specified by <SPAN class="argument">id</SPAN>.</P>
50<P>After the read finishes, the function specified by <SPAN class="argument">callback</SPAN> is called (unless <CODE>NULL</CODE> is specified). When the game disc is successfully changed, zero is returned as the <SPAN class="argument">result</SPAN> argument (the first argument) of the <SPAN class="argument">callback</SPAN> function. If a fatal error occurs, <code>DVD_RESULT_FATAL_ERROR</code> is returned. If the function is canceled, <code>DVD_RESULT_CANCELED</code> is returned. <CODE>DVD_RESULT_FATAL_ERROR</CODE> and <CODE>DVD_RESULT_CANCELED</CODE> are both negative values. The second argument, <SPAN class="argument">callback</SPAN>, is the <a href="DVDCommandBlock.html"><CODE>DVDCommandBlock</CODE></a> structure, which is the same structure given when the <code>DVDCheckDiskAsync</code> function has been called.</P>
51<P>After calling the <code>DVDPrepareDiskAsync</code> function, there are two ways to determine whether the game disc exchange process has completed. One way is to check whether the <SPAN class="argument">callback</SPAN> function has been called. The other way is to poll with the <a href="DVDGetDriveStatus.html"><CODE>DVDGetDriveStatus</CODE></a> function and wait until the <a href="DVDGetDriveStatus.html"><CODE>DVDGetDriveStatus</CODE></a> function returns <code>DVD_STATE_END</code>.</P>
52<P>The <code>DVDPrepareDisk</code> function is the synchronous version of the <code>DVDPrepareDiskAsync</code> function.</P>
53<P>Caution: Be careful with 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 cannot be used because there is no method for error checking.</P>
54<h2>See Also</h2>
55
56<p><code><a href="../dvd/DVDGenerateDiskID.html">DVDGenerateDiskID</a></code></p>
57<H2>Revision History</H2>
58<P>2007/04/20 Initial version.</P>
59<hr><p>CONFIDENTIAL</p></body>
60</html>