#include <revolution/cnt.h>
s32 CNTReadWithOffset(CNTFileInfo* cf, void* addr, u32 length, s32 offset);
#ifdef CNT_READ_BACKWARD_COMPATIBLE
#define CNTRead CNTReadWithOffset
#endif
cf |
Pointer to the CNTFileInfo structure. |
addr |
Pointer to the write destination for the data that was loaded. The write buffer must be 32-byte aligned. |
length |
Number of bytes to load. Must be a multiple of 32. |
offset |
File position to start loading from. Must be a multiple of 4. |
Returns the size (in bytes) successfully loaded when the process completes normally.
Returns one of the following codes when the process fails.
CNT_RESULT_AUTHENTICATION
CNT_RESULT_CORRUPT
CNT_RESULT_ECC_CRIT
CNT_RESULT_INVALD
CNT_RESULT_OUT_OF_MEMORY
CNT_RESULT_UNKNOWN
CNT_RESULT_FATAL
If a fatal error occurs during loading when a disc application is being executed, the function will return CNT_RESULT_READ_ERR. If the load is canceled, the function returns CNT_RESULT_DVD_CANCELED.
Reads and loads the files in the content file. The access position in the file does not change after loading. The current file access position is used as the point of reference for the file read position specified in the argument offset. Note that, unlike DVDRead, the reference position is not always the start of the file. This reference position will change if CNTSeek is executed.
This function is the same as CNTRead in NADK Version 2.1 and earlier. Since CNTRead is replaced with this function if the macro CNT_READ_BACKWARD_COMPATIBLE is defined, applications created using NADK Version 2.1 or earlier can be ported to this version of NADK without changing function calls.
Note:
CNTReadWithOffset 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 Notes Regarding Read/Writes to Wii Console NAND Memory.Note that in the cases outlined below, the behavior is different depending on whether the disc or NAND is being accessed.
When 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.
The 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, whereas when accessing NAND the value returned is the actual, successfully loaded size (not 32 byte-aligned).
CNTOpen
CNTSeek
CNTTell
CNTRead
Interrupts and Callback Functions
Notes Regarding Read/Writes to Wii Console NAND Memory
2009/12/02 Added the Notes Regarding Read/Writes to Wii Console NAND Memory information.
2009/04/15 Added note about the difference between disc and NAND access.
2009/04/07 Revised the description of Return Values.
2008/01/11 Initial version.
CONFIDENTIAL