- if (s & gc->pads[GC_SNESMOUSE]) {
- /*
- * The 4 unused bits from SNES controllers appear to be ID bits
- * so use them to make sure iwe are dealing with a mouse.
- * gamepad is connected. This is important since
- * my SNES gamepad sends 1's for bits 16-31, which
- * cause the mouse pointer to quickly move to the
- * upper left corner of the screen.
- */
- if (!(s & data[12]) && !(s & data[13]) &&
- !(s & data[14]) && (s & data[15])) {
- input_report_key(dev, BTN_LEFT, s & data[9]);
- input_report_key(dev, BTN_RIGHT, s & data[8]);
-
- x_rel = y_rel = 0;
- for (j = 0; j < 7; j++) {
- x_rel <<= 1;
- if (data[25 + j] & s)
- x_rel |= 1;
-
- y_rel <<= 1;
- if (data[17 + j] & s)
- y_rel |= 1;
- }
-
- if (x_rel) {
- if (data[24] & s)
- x_rel = -x_rel;
- input_report_rel(dev, REL_X, x_rel);
- }
-
- if (y_rel) {
- if (data[16] & s)
- y_rel = -y_rel;
- input_report_rel(dev, REL_Y, y_rel);
- }
- }
- }