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: Mame doesn't recognize "artificial" keypresses from JoyToKey  (Read 10350 times)

0 Members and 1 Guest are viewing this topic.

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Mame doesn't recognize "artificial" keypresses from JoyToKey
« on: March 01, 2014, 02:29:06 pm »
I won't go into the entire background of why I'm trying to set things up this way, other than to say I have JoyToKey running and MAME running, and MAME won't recognize the keypresses coming from JTK.  Any reason why that is?  I know that I could set up my MAME to recognize gamepad presses just fine, but I was hoping to use JoyToKey in a few places.   So I guess I was just interested if there was any way to get that to work?  Any ideas?

Thanks!

yotsuya

  • Trade Count: (+21)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19960
  • Last login:July 17, 2025, 10:00:30 pm
  • 2014 UCA Winner, 2014, 2015, 2016 ZapCon Winner
    • forum.arcadecontrols.com/index.php/topic,137636.msg1420628.html
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #1 on: March 01, 2014, 02:36:40 pm »
I've given up on JoyToKey, especially with Hyperspin. I'll either hack a keyboard or buy a true keyboard encoder.
***Build what you dig, bro. Build what you dig.***

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #2 on: March 01, 2014, 02:53:45 pm »
I finally found a few other threads that touched on this topic.  From what it sounds JoyToKey (and I believe other similar softwares) just won't be recognized by MAME.   So that is what it is.

What I am wondering then is, I am a Mala user, for other emulators there is a "Pre Commands" and "Post Commands" section that is pretty nice.  Is there a pre/post section for MAME?  I can't seem to find it.   I have JoyToKey working as needed everywhere else except for MAME.  So what I want to do is Exit JoyToKey when MAME is open, and Open JoyToKey when MAME is closed.

Does anyone know how I can make that happen?

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9270
  • Last login:July 14, 2025, 01:30:54 pm
  • ...
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #3 on: March 01, 2014, 03:53:54 pm »
MAME gets it's input in a more direct way, so any windows software that generate "fake" key presses do not work.
There is a way to change one line in the source code and compile a custom copy of MAME that will accept such key presses.
I don't have a link handy, but if you search enough you'll find it.

MAME will accept fake gamepad input from programs like headkaze's vjoy program.
http://headsoft.com.au/index.php?category=vjoy

What I don't get is that absolutely everything in MAME can be mapped to your original gamepad buttons, so why the need for joy to key?

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #4 on: March 01, 2014, 04:12:57 pm »
It's kind of a long story.   I don't understand how vjoy works.  I tried to install it just now.  There is a Joystick Device dropdown box at the top of the window that just lists VJoy Virtual Joystick 1 and 2.   I have a GPWiz I'm using, I was expecting to see that listed in the dropbox.   The GPWiz has 32 buttons, so I set all 32 to be something.  Then when I pressed all my buttons wired into the GPWiz, nothing.  So how do I use VJOY to map the keys of my GPWiz gamepad?

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #5 on: March 01, 2014, 05:23:10 pm »
Actually, just read the description for the VJoy software.  It says:
VJoy Virtual Joystick is a software application and virtual driver system that allows keyboard input to be translated to joystick input.

So this appears to be the exact opposite of what I need.  This translates keyboard input into joystick input.  I need something that translates joystick into keyboard.  But yet something that MAME recognizes.

Anyway, I finally decided to quit trying to fight it and I set up MAME to use the GPWiz Gamepad native stuff.  Everything else still uses JoyToKey and everything appears to be working fine.
 Thanks for the help anyway!

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #6 on: March 01, 2014, 09:47:14 pm »
Hey BadMouth, or anyone else, I'm compiling a new version of MAME right now, I don't suppose you know any more about how to:
There is a way to change one line in the source code and compile a custom copy of MAME that will accept such key presses.

Or what words I might search for at least, to find the information?

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #7 on: March 01, 2014, 09:48:19 pm »
For the record, I plan on leaving MAME using the real joystick inputs and everything.  But I'm compiling a new version of MAME anyway now, so I figured whats the harm in changing this one thing while I'm at it...

SGT

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1146
  • Last login:May 31, 2025, 10:10:32 pm
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #8 on: March 01, 2014, 10:44:13 pm »
Hey BadMouth, or anyone else, I'm compiling a new version of MAME right now, I don't suppose you know any more about how to:
There is a way to change one line in the source code and compile a custom copy of MAME that will accept such key presses.

Or what words I might search for at least, to find the information?

Google the following:
mame FORCE_DIRECTINPUT

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #9 on: March 01, 2014, 10:54:30 pm »
Excellent!  Thanks much!  There's really no down side to making that change is there?  Seems relatively harmless to me!

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #10 on: March 02, 2014, 07:19:49 am »
Looks like even in the MAME Compiler 64 program, from this guide, there is a checkbox on the "Build" tab that allows you to check Force Direct Input.

So I'm assuming that's all you need to do is check that box.  Just thought I'd specifically call that out in case someone else wonders in the future and finds this thread!

NickG

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 586
  • Last login:September 26, 2022, 05:25:23 am
  • Dig.
    • My Projects Page
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #11 on: March 03, 2014, 12:35:25 pm »
AFAIK, only downside involved with Force Direct input patching is the added difficulty or prohibition of setting up multiples of like devices (ex three trackball panel assigned to separate players, dual keyboards, lightguns) or perhaps some devices which can only be detected with raw input, but not direct input.

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #12 on: March 03, 2014, 12:41:29 pm »
Out of curiosity how does it make it more difficult to do those things?   I would like to add two lightguns at some point, so I am wondering maybe if I should recompile without direct input.   I have multiple keyboards and multiple mice enabled in MAME already, so when I map keys and such it already shows up as "Keyboard 1..." and the like.  So why would force direct change that or make it any more difficult than it already is.    In the past I've hooked everything up, configured it, and then left it as is.  Meaning that I'm not hot-swapping in and out controls or anything.   So if that's the case, would Force Direct change anything you think?

NickG

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 586
  • Last login:September 26, 2022, 05:25:23 am
  • Dig.
    • My Projects Page
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #13 on: March 03, 2014, 01:33:40 pm »
an example setup difficulty may occur if mame can no longer tell between keyboard 1 anykey and directinput sendkey anykey, and you need to use both anykey for separate functions.  I am not sure if this happens when we compile that way, so sorry if I am spreading misinformed nay-say.  It is at least worth trying and testing, by all means.
 

markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #14 on: March 03, 2014, 01:36:04 pm »
Alright, thanks for the heads up anyway.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9270
  • Last login:July 14, 2025, 01:30:54 pm
  • ...
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #15 on: March 03, 2014, 01:54:19 pm »
When you enable fake keypresses, you're basically telling MAME to get the input after Windows has meddled with it.

Think of like this:
Windows only has one mouse pointer (the system mouse).  All mice connected work the same mouse pointer.
If MAME is getting it's mouse input through windows, it is like getting the movement from the mouse pointer.
It can no longer distinguish between multiple mice.  There's no way to have two players using one mouse pointer.

Same for keyboards.  If you're typing in notepad, Windows doesn't care which keyboard is being used and doesn't distinguish between them.


markronz

  • We traced the call, and it came from....INSIDE YOUR ARCADE MACHINE!
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 821
  • Last login:April 12, 2019, 12:03:08 am
  • Game on!
Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
« Reply #16 on: March 03, 2014, 02:19:05 pm »
My control panel only has two players, each button has it's own unique button.  So from that front, it'd be fine.  But yeah, lightguns wouldnt work then.  So I'll have to recompile.  Thanks for the info guys!