| 1 |
/* |
| 2 |
joy2key |
| 3 |
|
| 4 |
This program gets events from the joystick device /dev/input/js0 and |
| 5 |
dispatches X events or console keypresses to a specific window |
| 6 |
based on joystick status. It is most useful for adding joystick |
| 7 |
support to games that don't nativly support the joystick, using |
| 8 |
joy2key to send XKeyPress (or console ioctl()) messages in place of |
| 9 |
actually typing movement keys. This code is under the GNU Public |
| 10 |
License (see COPYING), you can do whatever you want to it, and if |
| 11 |
you do anything really neat, I'd like to see it! |
| 12 |
|
| 13 |
- Peter Amstutz ([email protected]) |
| 14 |
|
| 15 |
special thanks to Zhivago of EFNet's #c for helping me out |
| 16 |
a LOT with the XSendEvent() code... |
| 17 |
|
| 18 |
The latest version of joy2key can be found in |
| 19 |
ftp://sunsite.unc.edu/pub/Linux/X11/xutils |
| 20 |
or on joy2key's (rather spartan) website, |
| 21 |
http://www-unix.oit.umass.edu/~tetron/joy2key |
| 22 |
|
| 23 |
Revision History |
| 24 |
---------------- |
| 25 |
1.0 (12 Aug 1997) - First version. |
| 26 |
1.1 (04 Dec 1997) - Thanks to Craig Lamparter |
| 27 |
([email protected]), |
| 28 |
joy2key now has support for four-buttoned |
| 29 |
joysticks/gamepads! Also some bugfixes. |
| 30 |
1.2 (28 Apr 1998) - Pierre Juhen ([email protected]) |
| 31 |
fixed a dumb little bug and added the |
| 32 |
autorepeat feature! |
| 33 |
1.3 (04 Jun 1998) - Frederic Lepied ([email protected]) added |
| 34 |
option to call w/o the window title arg to |
| 35 |
select target window interactivly |
| 36 |
(gee, why didn't I do that in the first |
| 37 |
place?) and detect when the window closed and |
| 38 |
exit properly. Also now uses 1.0 joystick |
| 39 |
module event-based handling instead of |
| 40 |
polling (now _requires_ 1.0+ joystick driver, |
| 41 |
which is available for v2.0+ Linux kernels), |
| 42 |
and is able to send events to the console |
| 43 |
with an ioctl() as well! |
| 44 |
Lots of code cleanup and restructuring. |
| 45 |
1.4 (17 Aug 1998) - .joy2keyrc implemented, this adds -rcfile and |
| 46 |
-config. Bugfix for -dev command. Also |
| 47 |
automatic calibration when no -thresh is found, |
| 48 |
added -deadzone option. |
| 49 |
1.5 (20 Jul 1999) - Patch by Jeremy ([email protected]) to look up |
| 50 |
windows by their numeric ID when they cannot by |
| 51 |
found by name; this makes it possible to use |
| 52 |
joy2key with full-screen (DGA) X apps. |
| 53 |
Joy2key also now uses autoconf/automake. |
| 54 |
1.6 (10 Apr 2001) - Okay, after getting mail about it for |
| 55 |
literally years, I've finally fixed the |
| 56 |
bug parsing joy2keyrc files... ;-p |
| 57 |
1.6.1 (27 Jan 2005) - Just a trivial update to fix the web page |
| 58 |
and email addresses. |
| 59 |
1.6.2 (22 Mar 2007) Rens ([email protected]) |
| 60 |
- Fixed a bug, preventing joy2key from using your |
| 61 |
highest numbered button. |
| 62 |
- Made joy2key lower case / upper case - aware |
| 63 |
by simulating actual keyboard behaviour: capital |
| 64 |
A is generated like this: |
| 65 |
key-shift-down, key-"a"-down, key-"a"-up, key-shift-up |
| 66 |
Exactly as you would type it..... It sounds trivial, |
| 67 |
but I found out that a lot of games |
| 68 |
( Especially Windoze games running in Wine ) |
| 69 |
require exact simulation of the keyboard-presses |
| 70 |
or there will be no joy(2key). |
| 71 |
1.6.3 (12 Apr 2008) Peter Alfredsen ([email protected]) |
| 72 |
- Fix up a few compiler warnings. |
| 73 |
- Once and for all fix configure.ac so it works. |
| 74 |
- Merge Debian, OpenSuse and Gentoo patches. |
| 75 |
Related bugs: |
| 76 |
Opensuse: |
| 77 |
https://bugzilla.novell.com/226508 |
| 78 |
Gentoo: |
| 79 |
http://bugs.gentoo.org/82685 |
| 80 |
Debian: |
| 81 |
http://bugs.debian.org/365146 |
| 82 |
http://bugs.debian.org/404543 |
| 83 |
http://bugs.debian.org/404550 |
| 84 |
- Fix up the ... unique ... coding style that Rens |
| 85 |
Introduced. Merge only relevant parts of his changes. |
| 86 |
Change comment style to C. |
| 87 |
*/ |