26.5 N64 Mouse


26.5.1 What is the N64 Mouse?

A mouse is scheduled to be sold in the near future (as of December,1998). The mouse will be connected to the N64 Controller port. This section explains the use of the mouse.

There are no special N64 functions for use with a mouse. When creating applications which utilize a mouse, use the same set of functions which are used with the Standard N64 Controller.

UP


26.5.2 How to Use the N64 Mouse

First execute the osContInit() function in order to make the initial settings for using the SI. Next check the value of the type member variable of the OSContStatus structure to confirm that the mouse has been attached. You know the mouse is attached when b12~b8 of "type" are all 0, the CONT_RELATIVE bit is raised, and the CONT_ABSOLUTE and CONT_JOYPORT bits are not raised.

A macro has been defined in OS 2.0I and after, so check using the following method:

osContInit(&siMessageQ, &pattern, contstat);

for (i = 0 ; i < MAXCONTROLLERS ; i ++) {
	if ((pattern >> i) & 1) {
		if ((contstat[i].type & CONT_TYPE_MASK) == CONT_TYPE_MOUSE){
			osSyncPrintf("Mouse\n");
		} else {
			osSyncPrintf("Some other device\n");
		}
	} else {
		osSyncPrintf("Nothing is inserted\n");
	}
}

UP


26.5.3 How to Read the Data

To read data from the mouse, use the Controller read functions, osContStartReadData() and osContGetReadData(). The data read about the movement of the mouse is placed in the "stick_x" and "stick_y" member variables of the OSContPad structure, while the data read about clicking the mouse buttons is placed in the button member variable. The Left Mouse Button corresponds to the A Button, and Right Mouse Button corresponds to the B Button. The button member variable is ANDed with A Button or B Button to check which mouse button has been clicked.

UP