The NEW Build Your Own Arcade Controls

Main => Software Forum => Topic started by: dragonstrap on December 03, 2012, 12:46:28 pm

Title: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: dragonstrap on December 03, 2012, 12:46:28 pm
12-Way Rotary Joystick Interface Program. version 2.1

The aim of this encoder is to eliminate the need of a hardware encoder to translate the raw outputs of a mechanical rotary joystick into the clockwise and anti-clockwise turns as required by MAME.
The program sits in your taskbar and converts mechanical rotary joystick outputs to virtual joystick outputs using a virtual joystick (or, if you want, as keyboard presses but these won't be picked up by MAME).
Included also is a configuration tool that will hopefully make the process as easy as possible.

(https://dl.dropbox.com/u/68787224/Rotary%20Joystick%20Interface/rji_contents.png)

Here's the program and documentation, zipped up.
Rotary Joystick Interface download link: https://dl.dropbox.com/u/68787224/Rotary%20Joystick%20Interface/Rotary%20Joystick%20Interface.zip
You will also need to install PPJoy. The installation and configuation of PPJoy is also covered in the guides.
PPJoy setup download link: https://dl.dropbox.com/u/68787224/Rotary%20Joystick%20Interface/PPJoySetup.zip

(https://dl.dropbox.com/u/68787224/Rotary%20Joystick%20Interface/rji_ppjoy.png)

I've added support for 2 rotary joysticks via a single virtual joystick device, but 1 will work fine too.
Wiring is the same as most (all?) hardware solutions, reducing 13 wires down to 4 (3 inputs and ground).
There is a wiring guide as well as a setup guide included in the documentation.


If you really like my program or it saves you from buying a hardware interface,
please right-click my program's icon in the system tray and hit "Donate" to bring you to my paypal page.
Buy me a virtual beer/pizza/whatever you think it's worth :)

This is largely to give me feedback and also some motivation to continue with bug fixes and updates.

Thanks to the author of PPJoy and someone called "Ninja Bob" whose DLL was used to help make this program.
Please report on your failures / successes / ideas and anything that may be useful for bug tracking or further development.

Plans for future versions:
- support VJoy as well as PPJoy (since PPJoy is unsigned and this can cause issues for Win7 users).
- allow low-level keyboard output so these too may be picked up by MAME (this seems to be very hard, so I'll probably never do it).
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: dragonstrap on December 03, 2012, 07:09:21 pm
I had some post here that is now irrelevant and misleading given how much the program has now changed, so I'm removing it.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: matsadona on December 04, 2012, 04:24:40 am
This is an excellent idea and effort, and I will definitely try it. I am about to build a multi-rotary cabinet based on MAME so if this is really working it would save some money if I only have to buy one interface. Thanks.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: Howard_Casto on December 04, 2012, 10:27:53 am
I hate to ask, but have you actually tested this on a recent version of mame?  Sending keystrokes to mame in a reliable fashion is rather difficult. 
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: dragonstrap on December 04, 2012, 12:17:08 pm
I hate to ask, but have you actually tested this on a recent version of mame?  Sending keystrokes to mame in a reliable fashion is rather difficult.

Thanks for asking. Nope, I didn't - it seems this will likely only work if you compile your own MAME.
Would need to use the DirectInput API by modifying a line in src\osd\windows\input.c to:
#define FORCE_DIRECTINPUT       1

damn.. if only things could be easier. Taking the download offline until I sort this out.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: Howard_Casto on December 04, 2012, 01:07:59 pm
Let me help you out right now:

1.  Abandon any hope of using keystrokes... that just isn't going to work without modifying the mame source.

2.  Switch to using joystick input... that is much easier.

3.  Contact headkaze... he has an joystick simulator driver that will most likely help you out.  ;)
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: matsadona on December 05, 2012, 04:32:10 am
This is when internet forums are at its best - people helping others moving forward with great ideas :)
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: nick3092 on December 08, 2012, 10:52:57 pm
This is an excellent idea and effort, and I will definitely try it. I am about to build a multi-rotary cabinet based on MAME so if this is really working it would save some money if I only have to buy one interface. Thanks.

If you want a single interface that can also handle rotary, look at the GP-Wiz40 offered by GGG.  It can handle rotary inputs from a 12 position joystick as well.  Same concept, you combine every 3rd wire together.  It's what I use for my modular panel, including my rotary sticks.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: matsadona on December 10, 2012, 05:14:22 am
Yes, thanks nick3092, I wasn't aware of that.
However I already have an interface from Ultimarc, so I'm still interested in this alternative.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: BadMouth on December 10, 2012, 10:13:36 am
Yes, thanks nick3092, I wasn't aware of that.
However I already have an interface from Ultimarc, so I'm still interested in this alternative.

It could probably be done in autohotkey.
It wouldn't surprise me if the OP's program is just a compiled ahk script.
If it is, it would be nice to share it with us.  ;D

It couldn't be too hard to change the keys it posts to fake gamepad button presses that MAME would detect.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: headkaze on December 12, 2012, 08:33:32 pm
It couldn't be too hard to change the keys it posts to fake gamepad button presses that MAME would detect.

It's not easy to do without custom joystick drivers like VJoy.

There is a way to inject keys into RawInput using a dll I've written. There are still issues to contend with though, for example, you need to attach a 32 or 64 bit version of the dll depending on the bitness of the MAME process.

I think the easiest way to do it is to compile MAME with FORCE_DIRECTINPUT set.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: BadMouth on December 13, 2012, 09:42:39 am
It couldn't be too hard to change the keys it posts to fake gamepad button presses that MAME would detect.

It's not easy to do without custom joystick drivers like VJoy.

There is a way to inject keys into RawInput using a dll I've written. There are still issues to contend with though, for example, you need to attach a 32 or 64 bit version of the dll depending on the bitness of the MAME process.

I thought unlike keyboards, MAME would accept joystick input generated by autohotkey/glovepie/etc.
(provided there is a virtual joystick installed in windows)
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: Howard_Casto on December 13, 2012, 10:31:33 pm
It will, easily.... that's how I did my glovepie scripts to get wiimotes to show up as joysticks in mame.  Not sure what headkaze is getting at. 
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: headkaze on December 13, 2012, 10:46:07 pm
I was just saying you need to have virtual joystick drivers installed. You can't spoof joystick input easily like you can with keystrokes.

I believe GlovePie has been updated to support VJoy as it used to use PPJoy but the drivers wern't signed so you had to put your Windows 7 machine into test mode to use them. VJoy drivers on the other hand are signed.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: Howard_Casto on December 14, 2012, 03:24:59 pm
I believe GlovePie has been updated to support VJoy

Btw I've been meaning to talk to you about this one.  If is has, I would sure like the link.  CK's site has been "hacked" for ages and he hasn't visited the glovepie forums in months.  The latest version I found was updated in december of last year. 
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: headkaze on December 14, 2012, 10:07:14 pm
When I spoke to Carl a few months ago he said he added support for VJoy so I have not idea why he wouldn't have released it yet.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: Howard_Casto on December 14, 2012, 10:50:16 pm
Well his site has been screwed up for over a year as well.  It might be he added support for his personal use but never released it. 
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: Kokapetl on December 18, 2012, 02:48:18 pm
nice
Title: Re: 12-Way Rotary Joystick Interface Program (translates to key presses for MAME)
Post by: dragonstrap on December 19, 2012, 09:10:52 pm
Release of version 2.1! - now working fine with MAME (via PPJoy) and 2 rotary joysticks supported.

First post has been updated. Please provide feedback / bug reports / suggestions. Thanks.

Also, I posted details of my USB rotary stick here: http://forum.arcadecontrols.com/index.php/topic,129303.0.html (http://forum.arcadecontrols.com/index.php/topic,129303.0.html)
(https://dl.dropbox.com/u/68787224/usbrotaryjoystick.jpg)

Note and Request : For the software interface to work, you really need to set the Positional Delay to zero and the Positional Sensitivity to 100%.
Does anyone know in which version of MAME they decided to remove these options?
Furthermore, is anyone aware of any diff patches to restore it?
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: dragonstrap on December 20, 2012, 03:39:53 am
For testing purposes, if you try it out there are some things I'd like to know:
Did my program work for you?
Which Operating System are you running?
Which version of MAME?
Which game(s)?
Any problems, suggestions?

edit: removing a question that was stupid and has now been answered so as not to waste anyone's time.

Note to self / others. This may be of use:
http://mame.hower.us/rotary/ (http://mame.hower.us/rotary/)
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: Howard_Casto on December 20, 2012, 05:08:12 am
Well yur dropbox link is dead... so I'm guessing that might be why you haven't gotten any response.  ;)
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: dragonstrap on December 20, 2012, 06:27:17 am
Fixed. Thanks for that, I hadn't noticed.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: nick3092 on December 20, 2012, 10:09:32 am

Also - if anyone finds a better way of configuring newer versions of MAME (the ones without positional delay and accuracy options), please let me know.
And.. does anyone know when (and why) MAME removed the options for accuracy and delay for rotary joysticks?


I'm using GGG's GP-Wiz for rotary, and it works pretty much the same way your software does by pressing a button based on combining every 3rd wire together.  I'm using MAME v.146 and the options are there and have been for several revisions.  So unless they were removed in .147 (which I sort of doubt) they should still be there.

Once you are in whatever game, you need to go to the Analog Controls menu option.  I have mine set the same way you said needs to be for your software.

Positional Digital Speed = 0
Positional Sensitivity = 100
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: dragonstrap on December 20, 2012, 11:33:31 am
I'm using MAME v.146 and the options are there and have been for several revisions.  So unless they were removed in .147 (which I sort of doubt) they should still be there.
Once you are in whatever game, you need to go to the Analog Controls menu option.  I have mine set the same way you said needs to be for your software.

Positional Digital Speed = 0
Positional Sensitivity = 100
Wow. I can not believe I missed that, I just assumed it was under the "Player 1 Controls" menu heading.
It's been so long since I've played around with MAME that I just assumed they killed it in a new version along with highscore support ;) haha. Thanks.

I'll fix up the readme and maybe find better default settings for my OutputDuration.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: dragonstrap on December 20, 2012, 12:05:15 pm
I'm using GGG's GP-Wiz for rotary, and it works pretty much the same way your software does by pressing a button based on combining every 3rd wire together.
I was considering doing every 4th wire at first, the program would be only slightly more complicated but it could handle very fast spins of the rotary better in theory.
It seems like there's no real need to do this though.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: TPB on October 17, 2013, 09:39:15 pm
Hi Dragonstrap,

Is your program still at version 2.1 ?

Does it allow usage of Happ rotary joysticks in MAME without the need for a "rotary interface board" ?  That is, it renders the boards from GGG and Ultimarc unnecessary ?

Does it work with both Happ optical rotaries (50-5619-00) and Happ 12-position mechanical rotaries (50-5618-00) ?

Does it work OK with the current version of MAME, or if not, which version do you recommend ?


Thanks.

Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: dragonstrap on January 10, 2014, 08:55:17 am
Is your program still at version 2.1 ?
Does it work OK with the current version of MAME, or if not, which version do you recommend ?
I've made some small changes to the configuration tool. It should be easier to understand now. (the link has been updated)
The program itself is still at 2.1, I haven't touched it since then. It should work fine with the current MAME version - try it out.

Does it allow usage of Happ rotary joysticks in MAME without the need for a "rotary interface board" ?  That is, it renders the boards from GGG and Ultimarc unnecessary ?
Does it work with both Happ optical rotaries (50-5619-00) and Happ 12-position mechanical rotaries (50-5618-00) ?
I've only tested this with what I had, and that was a rotary 12 way joystick. It worked for that without an interface board.
Essentially, I've bundled together every third position which you then wire up to as a button. My program translates these 3 button presses into presses triggered from a virtual joystick (which is what you will set to be used in MAME).
It should would for Happ 12-position rotaries without a problem, but not with the optical rotaries.
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: BadMouth on December 29, 2016, 10:40:16 am
The DropBox link is dead again.

Does anyone still have this program or an equivalent solution?
Title: Re: 12-Way Rotary Joystick Interface Program (translates to inputs for MAME)
Post by: Kokapetl on May 19, 2020, 10:09:17 pm
https://drive.google.com/open?id=1cG9LhE7FcLztbox_QXUKQPgLxf7YtZt1

I lost access to the email / password for the DragonsTrap account.
Here's a link to the rotary interface. I haven't touched in years so hopefully it still all works with a current MAME setup.