Main > Linux

Attempting to hack and document GunCon2 for Linux, FreeBSD, and MacOS X.

(1/6) > >>

Numbski:
Okie, I started this.  I e-mailed acorns asking if he might share he sources, but with no luck. :(  So I started out on my own.  I started writing about this over at the SDLMAME boards, but since there are more people here that have been following this, I might have better luck tracking it here.

Here's the original thread:

http://www.bannister.org/forums/ubbthreads.php?ubb=showflat&Number=25264&page=0

What I've come to is that the gun sends a default binary over and over again in this pattern:

FF FF 01 00 05 00

They are hex values, and the first 3 values control the button presses.  Here is the matrix of those first three values:

First:
3 - Down-Left
6 - Up-Left
7 - Left
9 - Down-Right
B - Down
C - Up-Right
D - Right
E - Up
F - Control Pad not pressed

Second:
1 - A + B + C
3 - A + B
5 - A + C
7 - A
9 - B + C
B - B
D - C
F - Neither A, B, nor C is pressed.

Third:
1 - Select + Start + Trigger
3 - Select + Start
5 - Start + Trigger
7 - Start
9 - Select + Trigger
B - Select
D - Trigger
F - Neither Select, Start, nor Trigger Pressed


I got these by plugging into my FreeBSD box, which gave me a generic character device (/dev/ugen0.1).  I just pressed buttons and did a cat /dev/ugen0.1 > guncon2.log, then opened guncon2.log in a hex editor.  This is in my arcade cab, and I haven't wired up a circuit to get a composite video signal to the gun to figure out how it handles tracking.  I'm still holding out hope that Acorns will give me a shout on how it handles that so that maybe either one of the mame devs can just merge the support in directly, or at least I can hack the stock FreeBSD mouse driver to accept the gun as a valid mouse device. :\  Whatever the case, if it's documented, it's more likely that a skilled programmer can jump in and do something with this.

Silver:
Hi,

There is Guncon2 Linux driver available here:

http://mywebpages.comcast.net/bgoines78/

Someone else then wrote a Linux driver for the LCD Topgun, based on the above, here:

http://kaillera.com/topgun/

The Topgun is basically Guncon2 compatible, but it has these values hard coded:

X Min =  160
X Max =  672
Y Min = 32
Y Max = 224

as it has its own internal calibration (it always sends values within that range to the PC).

Hope that helps...

Numbski:
As is posted elsewhere here, that uses the PS2 control API (ie, it is intended for Linux running ON the PS2, and thus can't be used) which I don't have access to.

Got my gun wired up to my arcadevga card, and trying to do comparisons now.

As you see above, I've figured out that the first 3 (maybe 4?) values are the buttons.  Well, since we can elimate those, here's the default state again:

FF FF 01 00 05 00

Now, here's a sample of tracking:

FF FF A6 03 F0 00

I appears that the next 6 values are used for tracking.  I kinda expected to find an X-Axis and a Y-Axis.  I vaguely recall there being two settings for the GunCon2... 100Hz and something else?  Someone want to clear me up on this?

What I need to do is find a way to view these hex values in real-time.  Probalby hack together a perl script that runs a constant dump of /dev/ugen0.1 and converts it to readable hex.  Ideally updating the 6 hex pairs and not just spewing garbage, that way I can quickly determine what is X-Axis and what is Y-Axis.

Numbski:
I'm looking over that topgun driver, and it's puzzling...the output from the gun in that driver doesn't even come close to matching what I've observed:

input_report_key(dev, BTN_TRIGGER, !(data[1] & 0x20));
   input_report_key(dev, BTN_A,       !(data[0] & 0x04));
   input_report_key(dev, BTN_B,       !(data[0] & 0x08));
   input_report_key(dev, BTN_C,       !(data[0] & 0x02));
   input_report_key(dev, BTN_START,   !(data[1] & 0x80));
   input_report_key(dev, BTN_SELECT,  !(data[1] & 0x40));

   if(!(data[0] & 0x10)) x+=-1;
   if(!(data[0] & 0x40)) x+=1;
   if(!(data[0] & 0x80)) y+=-1;
   if(!(data[0] & 0x20)) y+=1;
Trigger is 0x20?  I'm geting it at 0x00D .  I'm sure that there's a mathematical conversion I'm missing here, but beats me what it is...

2600:
Endianness??

Navigation

[0] Message Index

[#] Next page

Go to full version