Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Custom Control to Keyboard Input?  (Read 1028 times)

0 Members and 1 Guest are viewing this topic.

selethd

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:August 03, 2004, 06:33:46 pm
  • I'm a llama!
Custom Control to Keyboard Input?
« 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.
  I have tried the general windows commands like SendInput() however they are not 'root' enough to work with any game Ive tried, just windowed applications.

  I program in VC++, so if anyone knows of somthing that can do this task, or knows someone who has done somthing similar, please point me in the correct direction.

  Dont point me to programming sites, I have asked just about every programming site I can think of, and when im not getting the response 'your trying to make a virus' then im getting suggestions to ask on MAME sites like this.

  So please help with any info you can, thanks.

jub3i

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 30
  • Last login:January 05, 2006, 02:04:06 am
Re:Custom Control to Keyboard Input?
« Reply #1 on: August 03, 2004, 06:46:34 pm »
Sounds like an I-PAC.  It also sounds like you already made something yourself if you have something you are plugging into the parallel port.

Anyways if you don't know what the I-PAC is I'll tell you.  It's a PCB that you can plug into the PS/2 or USB port on your computer.  It has inputs on it that you can wire joysticks/buttons or whatever onto and windows treats it like a keypress.  There is also the KeyWhiz which does pretty much the same thing.  You can get the I-PAC from www.ultimarc.com and I'm sure someone else here can tell you where to get KeyWhiz.  I know it's not a software answer, but I hope that helps you get what you are looking for.

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re:Custom Control to Keyboard Input?
« Reply #2 on: August 03, 2004, 07:02:59 pm »
I second the IPAC idea...they do a great job.

I haven't programmed in VC++ (I use VB), but I also found it a right pain to do what you are trying to do.  For the most part it seems you are not 'supposed' to be able to do things like that...

Some of the other devs round here might be able to offer something more - this should be moved to the Software forum btw...

Bgnome

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:January 10, 2005, 04:05:16 pm
  • Who's da gnome?
Re:Custom Control to Keyboard Input?
« Reply #3 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

selethd

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:August 03, 2004, 06:33:46 pm
  • I'm a llama!
Re:Custom Control to Keyboard Input?
« Reply #4 on: August 03, 2004, 09:56:31 pm »
  Thanks so much for all the info. I was looking for a software only solution, but things arent like they were in the days of DOS. As a programmer you want to think software is all powerful, however Windows has such a death grip on the hardware that i'll probably have to go with using a hardware solution after all.

  Ill look into all the suggestions, again thanks so much :)

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re:Custom Control to Keyboard Input?
« Reply #5 on: August 04, 2004, 04:41:27 am »
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

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

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 858
  • Last login:December 06, 2005, 12:18:56 pm
    • Kymaera Home Page
Re:Custom Control to Keyboard Input?
« Reply #6 on: August 04, 2004, 10:06:35 am »
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
All Hail Smezznar! The Giant purple centipede of Omnicron 5. Regail him with your odiferous offerings of onion powder!

Chris

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4574
  • Last login:September 21, 2019, 04:59:49 pm
    • Chris's MAME Cabinet
Re:Custom Control to Keyboard Input?
« Reply #7 on: August 04, 2004, 12:18:59 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.
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

--Chris
DOSCab/WinCab Jukebox: http://www.dwjukebox.com