Function


nuContPakFileOpen


Syntax

s32 nuContPakFileOpen(NUContPakFile *file, u8* noteName, u8* extName, u32 mode, s32 size)

Arguments

file        Controller Pak file structure
*noteName game note name (16 bytes N64 font code)
*extName note extension (1 byte N64 font code)
mode specifies whether to create a new game note if no game note exists. NU_CONT_PAK_CREATE Create game note if no note exists NU_CONT_PAK_NOCREATE Do not create game note
size size for game note which is being created when the mode is NU_CONT_PAK_CREATE. (When the mode is NU_CONT_PAK_NOCREATE, the value of "size" is invalid.)

Return Value

Error

Description

Opens a Controller Pak game note

Makes preparations so the Controller Pak can access the game note. "file" is the Controller Pak structure of the device opened with the nuContPakOpen function. If a device is not opened, PFS_ERR_NOPACK is returned to file.error. The company code and game code must be registered with the nuContPakCodeSet function before this function is called.

"noteName" is 16 bytes of N64 font code giving the name of the game note. If the note name is not a full 16 bytes, assign 0x00 to the unused area.

"extName" specifies an extension for use of multiple notes. The size is 4 bytes, but only 1 byte is usable, and it is normally 0x00. Additional notes get assigned 0x1A~0x33 (N64 font code 'A'~'Z').

When NU_CONT_PAK_CREATE is specified for "mode" then a game note of the specified "size" will be created if no game note exists. Since game notes are managed in units of 256 bytes, the actual region reserved will be a multiple of 256.

When NU_CONT_PAK_NOCREATE is specified and no game note exists, PFS_ERR_INVALID is returned to file.error. The value returned to file.error is slightly different depending on whether the mode is set to NU_CONT_PAK_CREATE or NU_CONT_PAK_NOCREATE. For NU_CONT_PAK_CREATE, the error value osPfsFindFile or osPfsAllocateFile is stored in file.error. For NU_CONT_PAK_NOCREATE, the osPfsFindFile error code is put there. Please note the different error processes.

The error check role differs for the nuContPakOpen function and the nuContPakFileOpen function. The nuContPakOpen errors are physical errors, regarding the presence or absence of a Controller Pak, and whether the Controller Pak can be accessed. In contrast, the nuContPakFileOpen errors are errors relating to the data in the Controller Pak, such as whether a game note exists and whether there is free space. Thus, the error processing routine can be branched according to the error group.

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_DATA_FULL The Controller Pak does not have enough free space.
PFS_DIR_FULL Cannot create game note since maximum number already exist.
PFS_ERR_EXIST Cannot create game note because that game note already exists.

See Also

nuContPakOpen, nuContPakFileOpenJis, and nuContPakCodeSet