Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: markronz on March 01, 2014, 02:29:06 pm

Title: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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!
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: yotsuya 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.
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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?
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: BadMouth 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 (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?
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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?
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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!
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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?
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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...
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: SGT 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
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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!
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz on March 02, 2014, 07:19:49 am
Looks like even in the MAME Compiler 64 program, from this guide (http://www.headsoft.com.au/index.php?category=mame&page=mc64), there is a checkbox on the "Build" tab that allows you to check Force Direct Input.
(http://www.markronsman.com/1ForceDirect.jpg)
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!
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: NickG 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.
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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?
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: NickG 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.
 
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz on March 03, 2014, 01:36:04 pm
Alright, thanks for the heads up anyway.
Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: BadMouth 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.

Title: Re: Mame doesn't recognize "artificial" keypresses from JoyToKey
Post by: markronz 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!