osPfsRepairId osPfsRepairId (function)

Repairs the Controller Pak file system


#include <ultra64.h>        /* os.h */
s32 osPfsRepairId(OSPfs *pfs);


It checks the Controller Pak ID area, assigns a new ID if this area is damaged, and repairs the Controller Pak file system.

This function can be used if a PFS_ERR_ID_FATAL error code is returned by the osPfsInitPak function. For information, see osPfsInitPak.

The OSPfs structure pfs is a file handle initialized by the function osPfsInitPak. For information on creating this handle, see osPfsInitPak

If the function call is successful, a 0 is returned as the return value. If an error occurs, one of following error codes is returned:

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.

A different Controller Pak has been inserted; internally specified controller pak is recognized by comparing ID each Controller pak has. To use the inserted Controller Pak, initialize it by calling osPfsInitPak.

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.

Recovery failed. Possible causes are an abnormality in the controller Joyport or Controller Pak.

A peripheral device other than a Controller Pak (eg, Rumble Pak, 64GB Pak) has been inserted in the controller. Whether a Controller Pak has been inserted is determined by whether the device has RAM. This error is issued if there is no RAM present.

The Pfs function was called without initialization by osPfsInitPak. This error also can be issued if the file handle structure pfs is initialized by a function other than the Controller Pak initialization function osPfsInitPak and a Controller Pak function is then executed. An example would be if the Rumble Pak initialization function osMotorInit were used to initialize the structure pfs and osPfsRepairId were then executed. Game program processing should be modified if this error is returned.

See Also

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

Revision History

1999/02/01 Completely revised
1999/04/30 Changed format