N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

osPfsIsPlug

Format
#include <ultra64.h>
s32 osPfsIsPlug(OSMesqQueue *mq, u8 *bitpattern);


What This Function Does
It detects which Controller contains a Controller Pak, and it returns the results as a bit pattern to the location pointed to by the bitpattern argument. Bits 0, 1, 2, and 3 of the bit pattern correspond to Controllers 0, 1, 2, and 3, respectively.

The message queue specified by the mq argument must be the initialization completion message waiting line associated with the OS_EVENT_SI event. For information on how to make this association, please see osSetEventMesg.

Because the message queue specified by mq is used for the message waiting within the function osPfsIsPlug, you must ensure that the message queue specified by mq is not shared. In addition, because of synchronous initialization at a low level of the OS, you must call osContInit before calling osPfsIsPlug.

If the function is successfully called, a 0 is returned. Otherwise, 1 is returned.

Example Code
main()
{
OSMesgQueue intMesgQueue;
OSMesg intMesgBuf[1];
OSContStatus sdata[MAXCONTROLLERS];
u8 cont_pattern;
u8 pak_pattern;

osCreateMesgQueue(
osSetEventMesg(OS_EVENT_SI, 
osContInit(
osPfsIsPlug(
}
Notes
In addition to osPfsIsPlug, the following functions can be used to check the status of the Controller Pak: There are, however, differences. The osPfsIsPlug function issues a request command that checks the status of the Controller and Controller Pak. It checks all Controller sockets, converts the results to a bit pattern, and returns them.

In contrast, osPfsInitPak performs processing for only a single Controller. In addition to performing the Controller and Controller Pak status check that osPfsIsPlug performs, it also performs processing such as initializing the OSPfs structure, acquiring the Controller Pak ID and label areas, and calling the osPfsChecker function. As a result, it is very time consuming to call osPfsInitPak to determine whether the Controller Pak is inserted.

For simple status checking, the fastest approach is to use osContStartQuery and osContGetQuery. These functions perform the same processing as the osPfsIsPlug function does and they simplify the error checking process.

See Also
osPfsInitPak
osPfsAllocateFile
osPfsChecker
osPfsFileState
osPfsFreeBlocks
osPfsReSizeFile
osPfsReadWriteFile
osPfsSetLabel
osPfsRepairld



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998