CNTReadWithOffset

Syntax


#include <revolution/cnt.h>

s32 CNTReadWithOffset(CNTFileInfo* cf, void* addr, u32 length, s32 offset);

#ifdef CNT_READ_BACKWARD_COMPATIBLE
#define CNTRead CNTReadWithOffset
#endif

Arguments

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.

Return Values

Returns the size (in bytes) 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.

Description

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: This function may put the current thread to sleep. Refer to Interrupts and Callback Functions.

Note

The end of the archive file is not 32-byte aligned. For this reason, the return value for optical disc applications is the 32-byte aligned value specified for loading, while the return value for NAND applications is the actual length of the load (that is, a value that is not 32-byte aligned). Be aware that the values will be different because of this.

See Also

CNTOpen, CNTSeek, CNTTell, CNTRead
Interrupts and Callback Functions

Revision History

2008/01/11 Initial version.


CONFIDENTIAL