osPfsReSizeFile

osPfsReSizeFile

Function

osPfsReSizeFile

Changes the capacity reserved for game notes

This function was removed from the N64 operating system OS2.0I or later.

Syntax

#include <ultra64.h>
s32 osPfsReSizeFile(OSPfs *pfs, u16 company_code, u32 game_code, 
                        u8 *game_name, u8 *ext_name, int length);

Description

osPfsReSizeFile increases and decreases the size of existing game notes. However, since attempting to change the number of pages during a game may confuse the game user, use of this function should be minimized.

Information specified for game notes is the company code (company_code), game code (game_code), game name (game_name), extension (ext_name), and the new note size (length). Although the size is expressed in bytes, it must actually be allocated as a number of pages, so it should be specified as a multiple of 256.

When game note size is decreased, the area that is removed can no longer be read. When the size is increased, the area that is added is set to 0x00.

If the function is successful, 0 is returned; otherwise, the following error codes are returned.

PFS_ERR_NOPACK
Either the Controller Pak is not inserted into the specified Controller or the Controller is not properly connected. To determine which is the case, use osContStartQuery or osContGetQuery.

PFS_ERR_NEW_PACK
A different Controller Pak has been inserted. To use the inserted Controller Pak, initialize it by calling osPfsInitPak.

PFS_ERR_INCONSISTENT
There is a problem in the file system's management area. Usually this error does not occur because osPfsChecker is called internally when you initialize the file system by calling osPfsInitPak. If this error is returned, either the Controller Pak is not connected properly, or the Controller Pak itself is damaged.

PFS_ERR_CONTRFAIL
Data transfer to or from the Controller has failed. If a transfer error occurs, up to three tries will be done internally. Therefore, it is rather rare to see this error. If this error has returned, it is possible that either the Controller is not connected properly, or the Controller Pak or Controller Socket is damaged.

PFS_ERR_INVALID
If this error is returned, an incorrect argument was specified when this function was called, the specified game note does not exist, or the Pfs function has been called without being initialized using osPfsInitPak. This error should rarely occur.

See Also

osContInit, osContStartQuery, osContGetQuery, osPfsAllocateFile, osPfsChecker, osPfsDeleteFile, osPfsFileState, osPfsFindFile, osPfsFreeBlocks, osPfsInitPak, osPfsIsPlug, and osPfsReadWriteFile