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
|
osContInitFormat#include <ultra64.h> s32 osContInit(OSMesgQueue *mq, u8 *bitpattern, OSContStatus *status); What This Function Does It initializes the game Controller. It initializes the internal variables to be used for the Controller and returns the bit pattern of the connected Controller to the location pointed to by the bitpattern argument. It also checks and returns the status of the connected Controller and the Controller Pak to the location pointed to by the status argument. Before a Controller, Controller Pak, or EEPROM can be used, this function must be called. However, it is meaningless to call this function more than once. This function does nothing if it is called again, after the first call. Therefore, you cannot check the Controller's status. If you want to check the status of the Controller or the Controller Pak after the first call, use the osContStartQuery and osContGetQuery functions. The area specified by the status argument must be large enough to store the number of OSContstatus structures specified by MAXCONTROLLERS. The message queue (pointed to by the mg argument) must be the initialized message queue, linked to OS_EVENT_SI. To learn how to make the link, see osSetEventMesg. When the osContInit blocks on the message queue, do not share the queue. 0 is returned if the call is successful, otherwise -1 is returned. Here is the definition for the structure: typedef struct { u16type; /*Controller type*/ u8status; /*Controller Pak status*/ u8errno; }OSContStatus;According to the state of the Controller, the status->type becomes one of these:
Before using an application that uses a standard Controller, make sure the CONT_ABSOLUTE and CONT_JOYPORT bits are high. Nintendo 64 OS version 2.0F and later versions do not reset the Controller. Although it is not usually necessary, you can reset the Controller by using osContReset. Example main() { OSMesgQueue intMesgQueue; OsMesg intMesgBuf[1]; OSContStatus sdata[MAXCONTROLLERS]; osCreateMesgQueue( osSetEventMesg(OS_EVENT_SI, osContInit( }See Also osContReset osContStartQuery osContStartReadData osContGetQuery osContGetReadData osContSetCh
|