1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 8<TITLE>DVDRead</TITLE> 9</HEAD> 10<BODY> 11<H1>DVDRead</H1> 12<H2>Syntax</H2> 13<dl><dd><pre class="construction">#include <revolution/dvd.h> 14 15s32 DVDRead(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset); 16</pre></dd></dl> 17 18<H2>Arguments</H2> 19<TABLE class="arguments" border="1" > 20 <TBODY> 21 <TR> 22<TH>fileInfo</TH> 23<TD>Information about the file associated by calling the <A href="DVDOpen.html"><CODE>DVDOpen</CODE></A> function in advance.</TD> 24 </TR> 25 <TR> 26<TH>addr</TH> 27<TD>Buffer address. Must be 32-byte aligned.</TD> 28 </TR> 29 <TR> 30<TH>length</TH> 31<TD>Number of bytes to read. Must be a multiple of 32.</TD> 32 </TR> 33 <TR> 34<TH>offset</TH> 35<TD>File position to start reading from. Must be a multiple of 4.</TD> 36 </TR> 37 </TBODY> 38</TABLE> 39 40<H2>Return Values</H2> 41<P>Returns the number of bytes read if successful.</P> 42<P>If a fatal error occurs during a read, the function returns <CODE>DVD_RESULT_FATAL_ERROR</CODE>. If the read is canceled, the function returns <CODE>DVD_RESULT_CANCELED</CODE>. <CODE>DVD_RESULT_FATAL_ERROR</CODE> and <CODE>DVD_RESULT_CANCELED</CODE> are both negative values.</P> 43 44<H2>Description</H2> 45<P>Asynchronously reads data from a file. First opens the file with the <A href="DVDOpen.html"><CODE>DVDOpen</CODE></A> function.</P> 46<P><strong><B>Note:</B></strong>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.</P> 47 48<P>Programmers must prepare enough memory space for storing the file read.</P> 49<P>By default, invalidating the data cache for the memory space is unnecessary. The <code>DVDRead</code> 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 <A href="DVDSetAutoInvalidation.html"><CODE>DVDSetAutoInvalidation</CODE></A> function.</P> 50 51<p>Issuing zero length reads is valid. In this case, the <code>DVDRead</code> function does nothing and returns 0.</p> 52 53<p>This function may put the current thread to sleep. Refer to <a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a>.</p> 54 55<H2>See Also</H2> 56<P class="reference"> 57<A href="DVDOpen.html">DVDOpen</A>, 58<A href="DVDReadAsync.html">DVDReadAsync</A>, 59<A href="DVDGetLength.html">DVDGetLength</A>, 60<A href="DVDSetAutoInvalidation.html">DVDSetAutoInvalidation</A>, 61<A href="DVDCancel.html">DVDCancel(Async)</A>, 62<A href="DVDCancelAll.html">DVDCancelAll(Async)</A>, 63<a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a> 64</P> 65 66<H2>Revision History</H2> 67<P>2007/09/25 Added an explanation of thread behavior. <BR>2006/03/01 Initial version.<BR> 68</P> 69 70<hr><p>CONFIDENTIAL</p></body> 71</HTML>