osContStartQuery.3p 2.67 KB
.TH osContStartQuery 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
osContStartQuery, osContGetQuery \- obtain game controller status and type
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
s32 osContStartQuery(OSMesgQueue \(**mq);
.sp .8v
void osContGetQuery(OSContStatus \(**status);
.Op
\f1
.fi
.SH DESCRIPTION
The
.I osContStartQuery
call issues a query command to game controllers to obtain game controller status 
and type, and the
.I osContGetQuery
call returns game controller's type and status back to
.I status.
The user must supply a block of memory large enough for 
.I MAXCONTROLLERS
structures of type
.I OSContStatus.
The message queue
.I mq
must be an initialized message queue associated with the
.I OS_EVENT_SI
event.
See
.IR osSetEventMesg (3P)
for details on how to create this association.
The query command will take around 2 milliseconds to pull data back 
from game controllers.
Thus, the
.I osRecvMesg
call on the message queue
.I mq
can be used to wait for this event.
.sp
The game controller's type can be one of the following defined constants:
.PP
.nf
.ta 5 20 
	CONT_ABSOLUTE	The controller contains counters inside and 
			sends the joystick data as an absolute value.
	CONT_RELATIVE	The controller contains counters inside and
			sends the joystick data as a relative value.
	CONT_JOYPORT	The controller has a joyport which connects 
			to an exchangeable CONTROLLER PAK.
.fi
.sp
The game controller's status are used for CONTROLLER PAK and can be one of 
the following defined constants:
.PP
.nf
.ta 5 23
	CONT_CARD_ON	This bit is set if CONTROLLER PAK is connected 
			to the controller.
	CONT_CARD_PULL	After controller is reset, if the CONTROLLER 
			PAK is pulled out, this bit will be set.
	CONT_ADDR_CRC_ER 	This bit is set if the address is not 
			transfered to the joyport correctly.
.fi
.sp
The error number return from game controllers can be:
.PP
.nf
.ta 5 28
	CONT_NO_RESPONSE_ERROR	The controller doesn't respond.
	CONT_OVERRUN_ERROR	The controller sends data at higher
				data transfer rate than the hardware
				handling capability.
.fi
The user should ignore the data when detects 
.I CONT_OVERRUN_ERROR.
.SH EXAMPLE
.nf
.ta 5 20
main()
{
	OSMesgQueue      intMesgQueue;
	OSMesg		 intMesgBuf[NUM_MESSAGE];
	OSContStatus     sdata[MAXCONTROLLERS];
.sp
	osCreateMesgQueue(&intMesgQueue, intMesgBuf, NUM_MESSAGE);
	osSetEventMesg(OS_EVENT_SI, &intMesgQueue, dummyMessage);
	osContInit(&intMesgQueue, &pattern, &sdata[0]);
	osContStartQuery(&intMesgQueue);
		.
		.
	osRecvMesg(&intMesgQueue, &actualMesg, OS_MESG_BLOCK);
	osContGetQuery(&sdata[0]);
}
.fi
.SH "SEE ALSO"
osContInit (3P),
osContReset (3P),
osContStartReadData (3P),
osContGetReadData (3P),
osContSetCh (3P)