Here is another interesting light gun if anyone wants to check it out:

http://www.lik-sang.com/info.php?category=0&products_id=1429&;


On Sunday, October 19, 2003, at 01:48 PM, Ben Collins wrote:


So I got my ACT LABS PC TV Lightguns in finally. Started working on
getting them working with xmame, and discovered a few things.

First, these things do in fact work like mice. Just like the docs say.
Problem is that when Linux exports a mouse, it exports things as a
mouse. Mice, by definition are relative pointing devices. IOW, the
values read are delta's from the previous position, denoting motion.

The Linux mouse driver does in fact read the lightguns as absolute
pointing devices, but then converts that to relative motion deltas for
the mouse interface, which makes sense.

Problem is, this is useless for what we want to do with the lightguns.
We want absolute positions.

So I chose to implement an event reader from /dev/input/event* devices.
It will make use of any device that outputs absolute X and Y axis
values. This is primarily USB devices, but in actuality, any device can
export an event/input device. The only requirement is that it exports
EV_ABS events for X and Y axis. Heck, this could even be a tablet or
touchpad.

Also, by doing this, we exclude dependence on a certain UI target (e.g.
SDL, SVGA, X11). It can be used by any interface.

There's one thing that I am unsure of, and that is whether other
lightguns export the buttons the same way. For the ACT LABS guns,
shooting offscreen, or pressing the side button, causes a BTN_SIDE event
code. Shooting directly at the screen produces an X and Y axis event,
aswell as a BTN_MIDDLE event. For b2 (BTS_SIDE), I set the abs values to
-128,-128 and produce a normal b1 event. I made the shots correspond to
joy-button1 codes. This seems to make the most sense.


One quirk I am experiencing right now is that shooting offscreen does
not get the cursor to the top-left position quick enough before the shot
is registered. So sometimes I have to shoot offscreen twice to get the
"reload" affect.


After applying this patch, editing makefile.unix to enable the support,
you then add lines like this to xmamerc:

evabs-lightgun1         /dev/input/event1
evabs-lightgun2         /dev/input/event2

The actual event* device you use will vary. May take awhile to figure
out which one it is, since some devices export several event devs. I am
planning on making "auto" an option for the device, and let it scan
available ones for usage.

All-in-all, it's really nice to be able to play Area 51 with a real gun.
Some games don't seem to work well with lightgun support, but I don't
think that's the fault of the gun or my code, since it does the right
thing.


--
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
WatchGuard - http://www.watchguard.com/
<abs-event-lightgun.diff>


_______________________________________________
Xmame mailing list
[EMAIL PROTECTED]
http://toybox.twisted.org.uk/mailman/listinfo/xmame

Reply via email to