Main > Software Forum

Custom Control to Keyboard Input?

Pages: << < (2/2)

Minwah:


--- Quote from: Bgnome on August 03, 2004, 07:57:20 pm ---well, if you are dead set on keeping your controls hooked up the way they are, you can get yourself keyboard emulators that map joystick/button inputs to keypresses.

JoyEMU
http://members.tripod.com/~szanella/joyemueng.htm

JoytoKey
http://hp.vector.co.jp/authors/VA016823/joytokey/english.html

--- End quote ---

I don't think this will work, as Windows won't see a parallel port interfaced set of switches as a joystick device.  If he wired the controls up to a gameport, then this would work fine, but of course the gameport has a limited no. of inputs...

PacManFan:

I'm not entirely sure that this will work, but it's worth a try.

I'm a c++ programmer too. Unfortunatley, with the parallel port, it doesn't have an interrupt that can signal when data is changed on the input lines, so it must be polled. You need to set up a timer that polls the parallel port at a configurable interval in the range of around 10 -20ms.

  Then, once you've detected a change of input on one of the input pins, you've got to map that to a key stroke through some sort of mapping table.

Then, when you know what key you want to press, use the "keybd_event" function to simulate a low-level keyboard press, as if it came from the keyboard itself.

Hope this helps.

-PMF

Chris:


--- Quote from: selethd on August 03, 2004, 06:40:15 pm ---Hello, Im not sure where to post this, however here is my problem

  I am making my own custom joystick and control boards for games.

  The games I would like to use them on are standard pc games that take keyboard input.

  How can I make a program driver or whatever I need to send an artificial keyboard keypress low enough in the chain of events that any game running will think the keyboard has been pressed.

  My controls hook in through the printer port, then I have a program reading the printer port for the controls and buttons, when a button is pressed, the program needs to then generate the artificial keypress.

--- End quote ---
Others have already said this, but if it's not too late to alter the design, a keyboard encoder like the IPac or KeyWiz is definately the best way to go.  

The IPac available in versions that plug into the PS/2 keyboard port (with a passthru) or a USB port.  There are versions of is that support 28 inputs or 56 inputs.  You can find it at http://www.ultimarc.com/ipac1.html .

The KeyWiz at http://www.groovygamegear.com/Page2.html .  The KeyWiz supports 32 inputs.  It is only available in a PS/2 keyboard version.

--Chris



Pages: << < (2/2)

Go to full version