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 http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 8<title>CNTRead</title> 9</head> 10 11<body> 12 13<h1>CNTRead</h1> 14 15<h2>Syntax</h2> 16<dl><dd><pre><code> 17#include <revolution/cnt.h> 18 19s32 CNTRead(CNTFileInfo* cf, void* addr, u32 length); 20</code></pre></dd></dl> 21 22<h2>Arguments</h2> 23<p> 24<TABLE border="1" > 25 <tr> 26<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>cf</EM></STRONG></CODE></TD> 27<TD width="520">Pointer to the <CODE>CNTFileInfo</CODE> structure.</TD> 28 </tr> 29 <tr> 30<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>addr</EM></STRONG></CODE></TD> 31<TD width="520">Pointer to the write destination for the data that was loaded. The write buffer must be 32-byte aligned.</TD> 32 </tr> 33 <tr> 34<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>length</EM></STRONG></CODE></TD> 35<TD width="520">Number of bytes to load. Must be a multiple of 32.</TD> 36 </tr> 37</TABLE> 38</p> 39 40<h2>Return Values</h2> 41<p> 42Returns the size (in bytes) successfully loaded when the process completes normally.<br>Returns one of the following codes when the process fails. 43<p> 44<code>CNT_RESULT_AUTHENTICATION<br> CNT_RESULT_CORRUPT<br> CNT_RESULT_ECC_CRIT<br> CNT_RESULT_INVALD<br> CNT_RESULT_OUT_OF_MEMORY<br> CNT_RESULT_UNKNOWN<br> CNT_RESULT_FATAL<br></code> 45</p> 46<p> 47If a fatal error occurs during loading when a disc application is being executed, the function will return <CODE>CNT_RESULT_READ_ERR</CODE>. If the load is canceled, the function returns <code>CNT_RESULT_DVD_CANCELED</code>. 48</p> 49</p> 50 51<H2>Description</H2> 52<p> 53Reads and loads the files in the content file. After reading the files, the file access position moves by the amount of data read. 54</p> 55<p><B>Note:</B></p> 56<ul> 57<li>This function sometimes puts the current thread to sleep, so it cannot be called from callback functions. Refer to <a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a>.</li> 58<li>If, while the <code>CNTRead</code> function is processing, certain functions or combinations of functions are called from a different thread, the processing of these other functions may be delayed or even fail. For more information about the occurrence conditions, symptoms, and workarounds, see <a href="../nand/intro.html#NAND RW NOTICE">Notes Regarding Read/Writes to Wii Console NAND Memory</a>.</li> 59</ul> 60 61<H2>Differences Between Disc and NAND Access</H2> 62<p> 63Note that in the cases outlined below, the behavior is different depending on whether the disc or NAND is being accessed. 64</p> 65<h4>Loading data in excess of the file size (although file size is rounded up for 32-byte alignment)</h4> 66<p> 67When accessing a disc, the process involves access of individual files, so invalid references out of the file range generates an error. When accessing NAND, the process involves access of files inside the archive file, so there is no error. The portion in excess of the file size is loaded as another file in the archive. 68</p> 69<h4>Loading the last file of the archive file</h4> 70<p> 71The end of the archive file is not 32-byte aligned. For this reason, if the size of the file located at the end of the archive is not a multiple of 32 bytes, then the value returned when accessing a disc is the size of the specified file after being aligned to 32 bytes. When accessing NAND, however, the value returned is the actual, successfully loaded size (not 32 byte-aligned). 72</p> 73 74<h2>See Also</h2> 75<p> 76<code><a href="./CNTOpen.html">CNTOpen</a><BR> <a href="./CNTSeek.html">CNTSeek</a><BR> <a href="./CNTTell.html">CNTTell</a><BR> <a href="./CNTReadWithOffset.html">CNTReadWithOffset</a><br> <a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a><BR> <a href="../nand/intro.html#NAND RW NOTICE">Notes Regarding Read/Writes to Wii Console NAND Memory</a></code> 77</p> 78<H2>Revision History</H2> 79<p> 802009/12/02 Added the <a href="../nand/intro.html#NAND RW NOTICE">Notes Regarding Read/Writes to Wii Console NAND Memory</a> information.<br>2009/04/15 Added note about the difference between disc and NAND access. <br> 2009/04/07 Revised the description of <B>Return Values</B>.<br>2008/01/11 Changed the specifications of <code>CNTRead</code>.<br>2007/11/20 Added information about the result code used with disc applications. Standardized the use of the term "content file".<BR>2007/09/12 Added information about the sleep status of threads.<br>2006/12/04 Added result code descriptions.<br>2006/09/20 Added a description about the restrictions when specifying <CODE><STRONG><EM>offset</EM></STRONG></CODE>.<br>2006/09/08 Revised the description of the <CODE><STRONG><EM>offset</EM></STRONG></CODE> argument, which was insufficient.<br>2006/08/15 Initial version. 81</p> 82 83 84<hr><p>CONFIDENTIAL</p></body> 85</html> 86