gamecon module & PSX dance mat controller

gamecon module & PSX dance mat controller

Post by Tobias Diedric » Sun, 08 Jun 2003 02:00:13



Hi,

I noticed that the directional buttons are mapped on the x and y axis.
This breaks dance mat support, because there you can actually (and have
to) stand on both left and right or up and down at the same time,
the following patch fixes that by mapping the directional buttons on
BTN_LEFT, BTN_RIGHT, BTN_FORWARD and BTN_BACK instead of x- and y-axis.
With this patch, you can use a real psx dance mat controller for games
like pyddr and stepmania.

--- linux/drivers/char/joystick/gamecon.c       2001-09-13 00:34:06.000000000 +0200

 #define GC_PSX_ID(x)   ((x) >> 4)        /* High nibble is device type */
 #define GC_PSX_LEN(x)  ((x) & 0xf) /* Low nibble is length in words */

-static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y };
+static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY };
 static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y,
-                               BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR };
+                              BTN_SELECT, BTN_THUMBR, BTN_THUMBL, BTN_START, BTN_FORWARD, BTN_RIGHT, BTN_BACK, BTN_LEFT};

 /*

                switch (gc_psx_read_packet(gc, data)) {

                        case GC_PSX_RUMBLE:
-
-                               input_report_key(dev + i, BTN_THUMB,  ~data[0] & 0x04);
-                               input_report_key(dev + i, BTN_THUMB2, ~data[0] & 0x02);
-
                        case GC_PSX_NEGCON:
                        case GC_PSX_ANALOG:

                                for (j = 0; j < 4; j++)
                                        input_report_abs(dev + i, gc_psx_abs[j], data[j + 2]);

-                               input_report_abs(dev + i, ABS_HAT0X, !(data[0] & 0x20) - !(data[0] & 0x80));
-                               input_report_abs(dev + i, ABS_HAT0Y, !(data[0] & 0x40) - !(data[0] & 0x10));
-
-                               for (j = 0; j < 8; j++)
-                                       input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j));
-
-                               input_report_key(dev + i, BTN_START,  ~data[0] & 0x08);
-                               input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01);
-
-                               break;
-
                        case GC_PSX_NORMAL:

-                               input_report_abs(dev + i, ABS_X, 128 + !(data[0] & 0x20) * 127 - !(data[0] & 0x80) * 128);
-                               input_report_abs(dev + i, ABS_Y, 128 + !(data[0] & 0x40) * 127 - !(data[0] & 0x10) * 128);
-
-                               for (j = 0; j < 8; j++)
+                               for (j = 0; j < 8; j++) {
+                                       input_report_key(dev + i, gc_psx_btn[j+8], ~data[0] & (1 << j));
                                        input_report_key(dev + i, gc_psx_btn[j], ~data[1] & (1 << j));
-
-                               input_report_key(dev + i, BTN_START,  ~data[0] & 0x08);
-                               input_report_key(dev + i, BTN_SELECT, ~data[0] & 0x01);
+                               }

                                break;

                                        case GC_PSX_ANALOG:
                                        case GC_PSX_RUMBLE:

-                                               for (j = 0; j < 6; j++) {
+                                               for (j = 0; j < 4; j++) {
                                                        psx = gc_psx_abs[j];
                                                        set_bit(psx, gc->dev[i].absbit);

                                                        }
                                                }

-                                               for (j = 0; j < 12; j++)
+                                               for (j = 0; j < 16; j++)
                                                        set_bit(gc_psx_btn[j], gc->dev[i].keybit);

                                                break;

--
Tobias                                          PGP: http://9ac7e0bc.2ya.com
This mail is made of 100% recycled bits
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. multiple psx pads with gamecon

Hello,

I post carbon copy to linux-kernel and joystick guru on my own
judgment. Please forgive me.

Your procedure seems to be perfect. Your problem is not caused by your
miss, but by gamecon.c specification.

There are several varieties in DPP-style pararrel connector. Each 1P
are same, but 2P+ are differant. Your DPP is 1 or 2 perhaps. Gamecon.c
seems to support 3 (SNESkey psx). I am sorry, I can not help you.

1. DPP standard (1P-2P)
  http://www.arcadecontrols.com/Mirrors/www.ziplabel.com/dpadpro/psx.html
1-1. DPP standard + unmodified multitap (1P-4P)
  http://web.archive.org/web/20011123185146/http://www.geocities.co.jp/...
  http://www.geocities.co.jp/SiliconValley/2650/dpp_mlt.lzh

2. DPP multitap (1P-5P, also called "mega-tap")
  http://clear-blue.ath.cx/sasab/dpp/img/cab_multi.gif

3. SNESkey psx (1P-5P, gamecon.c psx)
  http://www.arcadecontrols.com/Mirrors/www.csc.tntech.edu/~jbyork/defa...
  http://www.charmed.com/support/kernel/docs/joystick-parport.txt

Thank you for your reading,
  yokota

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. Quotas and Links

3. USB Dance mat

4. Help: XFree Setup Problems

5. My question has still not been answered.Dance..Dance...Dance...

6. xlock on Red Hat 5?

7. Dance RatSkink Bojangles, Dance LIAR..........

8. threads vs. processes

9. gamecon (added support for Sega Saturn controller), kernel 2.4.20

10. gamecon.c change for SNES controller

11. db9.c (Re: [PATCH] gamecon (added support for Sega Saturn controller), kernel 2.4.20)

12. gamecon.c: Fix for SNES controllers