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
|
|
osContStartReadData
osContGetReadData
Format
#include <ultra64.h>
s32 osContStartReadData(OSMesgQueue *mq);
void osContGetReadData(OSContPad *pad);
What These Functions Do
The osContStartReadData and osContGetReadData functions obtain game Controller input settings.
The osContStartReadData function issues a read data command to obtain game Controller input settings, and the osContGetReadData call returns 3D Stick data and button settings to the location pointed to by the pad argument.
You must supply a block of
memory large enough for MAXCONTROLLERS structures of type OSContStatus.
The message queue pointed to by the mq argument must be an initialized message queue associated with
the OS_EVENT_SI event. See osSetEventMesg for details on how to
create this association. The read data command will take around two
milliseconds to pull data back from game Controllers. You can use the
osRecvMesg call on the message queue specified by the mq argument to wait for this
event.
Notes
The 3D Stick data is of type signed char and in the range between 80 and
-80. The game Controller's input settings can be the following defined
constants:
- START_BUTTON is the start button
- A_BUTTON is the A Button
- B_BUTTON is the B Button
- U_CBUTTONS is the C Button Up
- D_CBUTTONS is the C Button Down
- L_CBUTTONS is the C Button Left
- R_CBUTTONS is the C Button Right
- U_JPAD is the Control Stick Up
- D_JPAD is the Control Stick Down
- L_JPAD is the Control Stick Left
- R_JPAD is the Control Stick Right
- Z_TRIG is the Z Button
- L_TRIG is the L Button
- R_TRIG is the R Button
The error number returned from game Controllers can be:
- CONT_NO_RESPONSE_ERROR - The controller does not respond.
- CONT_OVERRUN_ERROR - The controller sends data at a higher data transfer rate than the hardware can handle. In this case, you should ignore the data.
Example
main()
{
OSMesgQueue intMesgQueue;
OSMesg intMesgBuf[NUM_MESSAGE];
OSContStatus sdata[MAXCONTROLLERS];
OSContPad rdata[MAXCONTROLLERS];
osCreateMesgQueue(&intMesgQueue,
intMesgBuf, NUM_MESSAGE);
osSetEventMesg(OS_EVENT_SI,
&intMesgQueue,
dummyMassage);
osContInit(&intMesgQueue,
&pattern, &sdata[0]);
osContStartReadData(&intMesgQueue);
.
.
osRecvMesg(&intMesgQueue,
&actualMesg,
OS_MESG_BLOCK);
osContGetReadData(&rdata[0]);
}
See Also
osContInit
osContReset
osContStartQuery
osContSetCh
|
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
|
|