Function


nuContPakFileReadWrite

Syntax:
s32 nuContPakFileReadWrite(NUContPakFile *file,
s32 offset, s32 size,u8* buf, u32 mode)
Arguments:
*file	Controller Pak structure
offset	Read/write offset position
size	Read/write size
*buf	Buffer where read data is to be stored
                   or the buffer where data to be written is stored.
mode	Specifies whether to read or write
	NU_CONT_PAK_READ	Read data
	NU_CONT_PAK_WRITE	Write data
Return Value:
Error
Explanation:

Read/write Controller Pak game note's game data

Reads game data from Controller Pak's game note or writes game data to the Controller Pak's game note. "file" specifies the Controller Pak structure in the game note opened by the nuContPakFileOpen function in the device opened by the nuContPakOpen function. "size" bytes of data are read or written starting from the "offset" position.

When NU_CONT_PAK_READ is specified for the mode, data is read into the area specified with "buf." When NU_CONT_PAK_WRITE is specified for the mode, the data specified with "buf" is written to the Controller Pak. Both "offset" and "size" must be multiples of 32 and they must be smaller than the file size.

The value returned from the osPfsFileReadWrite function is stored in file.error.

Errors:

PFS_ERR_NOPACK

Nothing is inserted in the specified Controller.

PFS_ERR_NEW_PACK

The Controller Pak may have been changed. Please perform the Open process again.

PFS_ERR_INCONSISTENT

There is an inconsistency in the file system management area.

PFS_ERR_CONTRFAIL

Data transfer with Controller has failed.

PFS_ERR_INVALID

Invalid parameter or the game note does not exist.

PFS_ERR_BAD_DATA

An attempt was made to read from a game note containing no data.


Reference: nuContPakOpen, nuContPakFileOpen, nuContPakFileOpenJis,
nuContPakFileRead, nuContPakFileWrite, nuContPakFileFread,
nuContPakFileFwrite