Acquires the maximum note number and the number of notes used
#include <ultra64.h> /* os.h */
s32 osPfsNumFiles(OSPfs *pfs, s32 *max_files, s32 *files_used);
osPfsNumFiles acquires the maximum note number and the number of notes used in the Controller Pak. When called, this function returns the number of notes used to the location pointed to by the files_used argument, and it returns the total number of notes to the location pointed to by the max_files argument, which is 16.
OSPfs structure pfs is a file handle which was initialized by a function osPfsInitPak. For how to create this handle, refer to osPfsInitPak.
If this function is called successfully, 0 is returned. If an error occurs, one of the 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. To use the inserted Controller Pak, initialize it by calling osPfsInitPak.
- 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.
- NData 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.
- 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. Also, if the functions for the Controller were executed after the file handle structure pfs was initialized by other than osPfsInitPak, this error occurs.For instance, if osPfsNumFiles is executed after the initialization function for rumble pak osMotorInit is used to initialize OSPfs structure, then this error occurs.
osContInit, osPfsAllocateFile, osPfsChecker, osPfsFileState, osPfsInitPak, osPfsIsPlug, and osPfsReadWriteFile
1999/02/01 Completely revised
1999/04/30 Changed format