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: Fixing MAME's handling of 12-position rotary controls  (Read 18227 times)

0 Members and 1 Guest are viewing this topic.

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Fixing MAME's handling of 12-position rotary controls
« on: January 30, 2006, 02:02:31 am »
I believe I can properly implement this device if MAME used a 1 input cycle per movement scheme.  It wouldn't lose movements and would consume a lot less than 12 inputs.

SO,  who's gonna fix it :) ?

i spent a couple hours last night, reading my way through a good bit of mame's input system and the snk driver. doesn't look like it would be hard to fix this problem.

i'll volunteer, but it may take a few wks; i won't have a rotary to test with until my slikstik arrives (it's currently in production).

hardware would deliver to mame the equivalent of one button press for each "click" of the rotary. (there would be two simulated buttons, one for clockwise rotation and one for counter-clockwise). mame maintains a simulated rotary switch, which it increments or decrements one position for each simulated button press it receives.

this would be my first contribution to mame; could someone clue me in about how to submit it for consideration for permanent inclusion in mame?
to see my "Frankenpanel" and design notes, click here.

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #1 on: January 30, 2006, 05:09:51 am »
I'll be interested to see if MAME accept this as an 'official' fix...they seem to have an unhealthy liking to poorly handled controls...

Not sure about the answer to your question tho, but the Software board or mame.net board might be a better place to post.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #2 on: January 30, 2006, 07:27:44 am »
See my comments in the original thread: http://forum.arcadecontrols.com/index.php?topic=49037.0
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

Lilwolf

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4946
  • Last login:July 31, 2022, 10:26:34 pm
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #3 on: January 30, 2006, 07:36:54 am »
I believe it wasn't originally accepted because

1) it didn't work on all of the games
and main reason
(2) Mame didn't handle that many inputs that well at the time.  You need to use player 3 and player 4 inputs to get it to work (if I remember correctly... been a year+ since I set this up).

But now there is the mahjong game buttons.  If you look at the snk inputs, you should consider putting the inputs in on these I think.  Might be perfect.  (10 inputs plus a bet and another... at work, can't look now).

I would LOVE to see it in the original mame.  But even then, it would be very very cool to get victory road running.  I can do without ikari warriors (or just use the left/right from analog+ isn't bad) but vict road + the sword doesn't work well at all.

Let me know if there is ANYTHING I can do to help you.  Not a C programmer (java) so I don't know much help I can be... but if you would like beta testers let me know. 

XtraSmiley

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 958
  • Last login:April 06, 2024, 09:29:46 pm
  • Kill the Big Dog
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #4 on: January 30, 2006, 08:55:34 am »
Well, I have the original SNK yellow sticks, (mechanical) plus druins interface board, so as long as you are not making these obsolete, I'm good.  (or at least making them work better).

As for MAME, they may not take it b/c the inputs may or may not be true to the original game.  Not sure about this, as I'm no programmer, but they want things to be 100% as they original boards.  So, if the original game didn't take just two inputs to turn, then MAME won't want it that way.

Of course, I'm talking out ---my bottom---, so check over at www.mame.net for more info.

Thanks for any contribution you can give to the cause to!
hearingprotectionBIGDOG@yahooBIGDOG.com

Kill the Dog man.

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #5 on: January 30, 2006, 09:00:52 am »
I'm pretty sure all of us who actually play these games support your efforts 100% regardless of how the Mamedevs feel.  Thank you for tackling this.

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #6 on: January 30, 2006, 09:43:01 am »
As for MAME, they may not take it b/c the inputs may or may not be true to the original game.  Not sure about this, as I'm no programmer, but they want things to be 100% as they original boards.  So, if the original game didn't take just two inputs to turn, then MAME won't want it that way.

Unfortunately that is rubbish.  The current way of using a dial for rotation is terribly incorrect.  Most driving game shifters are not handled correctly.  The dial input for 720 was removed, even though that was the best (in comparison to original arcade) input method.  I could go on...

Sadly the MAMEdev do not consider this in their 'accuracy' goal.  I don't know why, but they don't.  I have made this point (& I know others have) at mame.net and the answer is always the same.  The last response I got re PolePos was 'well the code for the original shifter is in there so just recompile it'.  That's fine, but IMO the arcade-accurate handling should be in MAME by default.  Hypocrisy anyone?  :P

Still, with that said I really hope they will consider at least the 12-input 'raw' method for the rotational games (being careful to leave as dial the games which used an optical rotary).

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #7 on: January 30, 2006, 10:15:12 am »
As for MAME, they may not take it b/c the inputs may or may not be true to the original game.  Not sure about this, as I'm no programmer, but they want things to be 100% as they original boards.  So, if the original game didn't take just two inputs to turn, then MAME won't want it that way.

Unfortunately that is rubbish.  The current way of using a dial for rotation is terribly incorrect.  Most driving game shifters are not handled correctly.  The dial input for 720 was removed, even though that was the best (in comparison to original arcade) input method.  I could go on...

Sadly the MAMEdev do not consider this in their 'accuracy' goal.  I don't know why, but they don't.  I have made this point (& I know others have) at mame.net and the answer is always the same.  The last response I got re PolePos was 'well the code for the original shifter is in there so just recompile it'.  That's fine, but IMO the arcade-accurate handling should be in MAME by default.  Hypocrisy anyone?  :P

Still, with that said I really hope they will consider at least the 12-input 'raw' method for the rotational games (being careful to leave as dial the games which used an optical rotary).

WORD!!!!!
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #8 on: January 30, 2006, 01:15:20 pm »
See my comments in the original thread: http://forum.arcadecontrols.com/index.php?topic=49037.0
hmmm... if i can find versions of mame out there that play these games properly, i probably won't bother re-implementing the solution.

it's unfortunate that versions that meet different people's needs can't be maintained in the official mame source tree, so we all benefit from each others work.
to see my "Frankenpanel" and design notes, click here.

PetitMorte

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 332
  • Last login:December 11, 2015, 10:03:43 am
  • . . . - - - . . .
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #9 on: January 30, 2006, 01:42:25 pm »
If MAME gets corrected input for raw 12-way, then we will need some sort of new interface for the joysticks, yes? as opposed to Druin's board... coming soon: Rot-Wiz12?  ;D
Bitten by the cabinet bug... obsessing ever since.

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #10 on: January 30, 2006, 01:48:18 pm »
All I know is that for every game like these, there are games like Off-Road that now use the correct controls making them near impossible to play without having the actual controls. (now uses analog up for the gas feed rather than a button press)

I figure they should be consistent. If they support one game's controls accurately, they should support them all.
Raspberry Pi, AttractMode, and Skeletor enthusiast.

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #11 on: January 30, 2006, 02:27:55 pm »
If MAME gets corrected input for raw 12-way, then we will need some sort of new interface for the joysticks, yes? as opposed to Druin's board... coming soon: Rot-Wiz12?  ;D

Heh.  Raw 12-way wouldn't be the preferred method.  I think the same thing can be accomplished using far fewer inputs.

RandyT

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #12 on: January 30, 2006, 03:08:02 pm »
How can you use fewer inputs?  That rotary switch has 12 positions.  Even if MAME is looking for a left or right press instead of an absolute position, you've still got to physically hook that switch to something.

A raw 12-way solution still seems best to me.  That's what the original game had, that's what's hiding inside the ROM code, that's what the actual hardware outputs.  The only reason that's not the way it's already working is that the MAME code in betweeen the joystick and the game ROM is muddling the whole thing up.  I don't buy the input arguement, either.  With today's affordable encoders, 12 inputs doesn't really cost that much, especially if you're talking about people who are already willing to drop the cash on the rotary sticks.

A consistent left/right hack for all the games would be the 2nd best option, but you'd need another layer of hardware just to convert the 12-way switch into left/right presses, like the Druin board.  And everybody that's used one of those knows it's not perfect.  One click doesn't always equal 1 turn, and it ought to.  I believe a better piece of hardware could be built, but at what cost? 

Don't get me wrong, if somebody makes a left/right hack, and it works better than what we've got now, I'm all for it.  But it seems to me that if there's to be an attempt made at fixing these games, the raw 12-way fix is the right direction to work in.  U_Rebel already got it working for some games in Analog_+, why not just carry on with that work?

Necro

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1031
  • Last login:November 29, 2022, 08:22:22 pm
  • Building a 'Classic' MAME Cab
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #13 on: January 30, 2006, 03:11:13 pm »
8 with double button combos would work also...is that what you mean?  (Sorry, just interested in this stuff, I want to start coding edits into mame eventually).

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #14 on: January 30, 2006, 03:55:28 pm »
If MAME gets corrected input for raw 12-way, then we will need some sort of new interface for the joysticks, yes? as opposed to Druin's board... coming soon: Rot-Wiz12?  ;D

Wouldn't you just hook up up each leg of the rotary switch to one input on your encoder?  Is the switch position then always active (i.e. a key is always pressed)?

Lilwolf

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4946
  • Last login:July 31, 2022, 10:26:34 pm
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #15 on: January 30, 2006, 04:04:31 pm »
btw, there wouldn't ever be a use for a key12wiz whatever... Since its just 12 inputs...

so keywiz eco will do..

but if someone built a keyboard encoder with the right connectors so the original wires worked... and then enought extra inputs for the joystick and buttons... maybe....

but just to speed up wiring doesn't seem worth a custom board.. :)

And for anyone who doesn't think the extra 12 buttons are needed... until you try it with direct connect in analog+ mame, you can really say.  Its more pronounced change then 8way and a true 4way controller.  REALLY makes a difference.  But without ikari warrior / vict road support, its hard to justify an extra 24 inputs for a cab.... if you don't already have them.

rdagger

Re: Fixing MAME's handling of 12-position rotary controls
« Reply #16 on: January 30, 2006, 04:08:18 pm »
Is the switch position then always active (i.e. a key is always pressed)?

This would be another concern for me in addition to the large number of inputs.  If you had 2 joysticks wired up using 24 inputs than there would always be 2 key presses being sent to the computer, which could be annoying when not playing a game.

rdagger

Re: Fixing MAME's handling of 12-position rotary controls
« Reply #17 on: January 30, 2006, 04:14:50 pm »
It would be possible to build a USB rotary interface that did not require a keyboard encoder.  It could have 2 headers for 2 rotary joysticks and a single USB plug.  It could also have an on/off switch to prevent key presses when not in use.  The interface could be designed to implement either a USB keyboard or joystick using HID drivers.  The cost would probably be about the same as a standard rotary interface, but it would be easier to wire and not require any keyboard encoder inputs.

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #18 on: January 30, 2006, 04:52:14 pm »
The best solution as far as I'm concerned IS raw, IF the original ikari warriors handled conversion of the inputs through routines on its rom. If there was originally a converter, then 2 button solutions are fine, but ultimately it would be great to use an 12 postion stick wired up to just the 1 encoder, be it Ipac, GP-wiz, etc and let the game do the work it was designed to do.
Raspberry Pi, AttractMode, and Skeletor enthusiast.

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #19 on: January 30, 2006, 05:09:03 pm »
The best solution as far as I'm concerned IS raw, IF the original ikari warriors handled conversion of the inputs through routines on its rom. If there was originally a converter, then 2 button solutions are fine, but ultimately it would be great to use an 12 postion stick wired up to just the 1 encoder, be it Ipac, GP-wiz, etc and let the game do the work it was designed to do.
based on the code in snk.c, the ROM reads 4 bits from an input port and expects to see a number from 0 thru 11, so the 12 switch inputs must have gone through a hardware encoder.
to see my "Frankenpanel" and design notes, click here.

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #20 on: January 30, 2006, 05:13:11 pm »

Do these sticks have an indicator pointing to the same direction as the on-screen action?

Also, are ALL of these games 12-way or are there 24-way and 6-way and whathaveyou?  And if so, how do you manage these?

Don't get me wrong, for someone with a couple of GP-Wiz49 interfaces, direct input connection would be fine (there should be plenty of free inputs for it.)  The gamepad buttons are probably a pretty good candidate for being held down all the time as well without difficulty.  The keyboard encoders might have some other difficulties related to programming them and such, but I haven't tested for these possibilities yet.

RandyT

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #21 on: January 30, 2006, 05:14:53 pm »
A consistent left/right hack for all the games would be the 2nd best option, but you'd need another layer of hardware just to convert the 12-way switch into left/right presses, like the Druin board.  And everybody that's used one of those knows it's not perfect.  One click doesn't always equal 1 turn, and it ought to.

but the problems may very well be mame's fault, not druin's. does MameAnalog+ work 100% correctly with druin's board?

i prefer druin's to direct connect, because it doesn't leave any keys always on, as long as there is a software solution that yields perfect behavior.
to see my "Frankenpanel" and design notes, click here.

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #22 on: January 30, 2006, 05:37:05 pm »
There are 2 types. Optical and Mechanical rotaries. The optical ones are like spinners. The mechanical ones are 12 position, though I seem to recall there being mention of either and 8 or 10 position mechanical rotary as well. The 12 position ones are currently the only ones that anybody ever talks about, Ikari warriors being the primary game.

The sticks didn't have an indicator about which way the stick was supposed to point (i.e no "north" arrow) but you could definitely FEEL the major clicks as you spun your little dude around.

As you click left with a rotary to shoot somebody while you're walking forward and you rotate one click and your guy moves 2 clicks...AAARGhh.. maddening. Like having mario all confused on a ladder in Donkey Kong. I know you can relate. You KNOW what's supposed to happen, and something is obviously NOT happening and you just wanna scream.
Raspberry Pi, AttractMode, and Skeletor enthusiast.

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #23 on: January 30, 2006, 06:01:59 pm »
Do these sticks have an indicator pointing to the same direction as the on-screen action?

Nope, but they could.  The same side of the stick is always pointing straight up when the character is pointing straight up.

Also, are ALL of these games 12-way or are there 24-way and 6-way and whathaveyou?  And if so, how do you manage these?

Nope, all the games using mechanichal rotary sticks are 12-way. 

There are some other games that always come up when we get to talking about rotary games, that used different hardware:  Xybots, Frontline, Cal. 50. 

Xybots had a stick that didn't rotate all the way, it went a little less than 1/2 a turn either direction.  Twisting it contacted either a "Turn Right" or "Turn Left" switch.  MAME already correctly emulates this, by mapping "Turn Right" and "Turn Left" to button presses.

Frontline (and Tin Star & Wild Western) used a 8-way joystick with a knob instead of a regular handle.  When you twisted the knob, it rotated an actuator that would contact the correct microswitch(es) to point the gun in the correct direction.  You could also call this an 8-way rotary, but it does not use an 8-position switch, but rather 4 microswitches, just like a joystick.  MAME already correctly emulates this, with aiming handled by the "P2 Joystick" controls.

Cal. 50 used a rotary joystick with an optical encoder wheel on the bottom.  MAME already correctly emulates this, by using the "Dial" control type.

Don't get me wrong, for someone with a couple of GP-Wiz49 interfaces, direct input connection would be fine (there should be plenty of free inputs for it.) 


Agreed.  Two rotary joys could even be handled by a single GP-Wiz Eco, for less than $20.  If MAME were fixed.

but the problems may very well be mame's fault, not druin's. does MameAnalog+ work 100% correctly with druin's board?

The problem is MAME's fault.  MAME is forcing us to use an extra piece of hardware to translate an simple bit of absoulte data (which way is the switch pointing) into some very non-absolute data (how long were you twisting the knob), which MAME then attempts to re-translate back into absolute data (where would the switch be pointing if you turned it for x number of nanoseconds), and the result is that your guy doesn't point where he should.

Analog_+ works perfectly without the Druin's board.  It just doesn't support all the games.

It would be possible to build a USB rotary interface that did not require a keyboard encoder.  It could have 2 headers for 2 rotary joysticks and a single USB plug.  It could also have an on/off switch to prevent key presses when not in use.  The interface could be designed to implement either a USB keyboard or joystick using HID drivers.  The cost would probably be about the same as a standard rotary interface, but it would be easier to wire and not require any keyboard encoder inputs.

Why save keyboard encoder inputs by building a whole extra encoder?  I just don't get this thinking.  Again, don't get me wrong.  If you build one, and it works better than what we've got now, good.  But fixing the software seems like a superior fix in this case.


based on the code in snk.c, the ROM reads 4 bits from an input port and expects to see a number from 0 thru 11, so the 12 switch inputs must have gone through a hardware encoder.


If that's the case, then it was on-board the original PCB, and all it did was translate a simple closed circuit into a number.  Can you tell what's feeding that number to snk.c now?

If you had 2 joysticks wired up using 24 inputs than there would always be 2 key presses being sent to the computer, which could be annoying when not playing a game.

If this proved troublesome, a dpdt switch wired to the ground for the rotary switch could be used to kill them when not in use.

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #24 on: January 30, 2006, 06:02:32 pm »
There are 2 types. Optical and Mechanical rotaries. The optical ones are like spinners. The mechanical ones are 12 position, though I seem to recall there being mention of either and 8 or 10 position mechanical rotary as well. The 12 position ones are currently the only ones that anybody ever talks about, Ikari warriors being the primary game.

If this is true, then that is a good reason as to why 12 direct connections may not be the best approach, except for the games that require exactly a 12 position dial.

Quote
The sticks didn't have an indicator about which way the stick was supposed to point (i.e no "north" arrow) but you could definitely FEEL the major clicks as you spun your little dude around.

As I expected.  Still confident that a better solution can be had for far fewer inputs, but MAME would have to support it properly and some hardware would be involved.

Quote
As you click left with a rotary to shoot somebody while you're walking forward and you rotate one click and your guy moves 2 clicks...AAARGhh.. maddening. Like having mario all confused on a ladder in Donkey Kong. I know you can relate. You KNOW what's supposed to happen, and something is obviously NOT happening and you just wanna scream.

Yeah, I'm familiar with the problem.  No time constant or sensitivity seems to offer good results when using a button for right or left.  That's why I haven't even considered adding that kind of support.  It's one of those things that doesn't work well enough for it to be considered a "solution".

RandyT

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #25 on: January 30, 2006, 06:08:47 pm »
edit- already covered.
« Last Edit: January 30, 2006, 06:12:50 pm by Kremmit »

markrvp

  • ARGHHHHHHHHHHHHH!!!!!!!!!! True Genius!
  • Wiki Contributor
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3353
  • Last login:September 14, 2020, 10:19:57 am
  • NFL Expert
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #26 on: January 30, 2006, 06:09:31 pm »
I agree that the GP-Wiz gamepad inputs would be better candidates for always having a button pressed.  It's also easier to setup by using the GAMEPAD calibration in Control Panel.

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #27 on: January 30, 2006, 06:10:15 pm »
All I know is that for every game like these, there are games like Off-Road that now use the correct controls making them near impossible to play without having the actual controls. (now uses analog up for the gas feed rather than a button press)

I might have misunderstood (& I'm still on v0.101), but if you want to use a button for gas then why not just remap it?

But yes I agree all games should be treated as they were in the arcade.  That way we can interface just about anything and have it work properly one way or another.  However if we came up with our own 'BYOAC build' we could be a little less arcade-accurate if neccessary, and have some solid rules in place for max compatibility with the hardware we use.  Edit: for example here we would want raw 12 input and probably 2 input (left/right) inputs for Druin owners...
« Last Edit: January 30, 2006, 06:14:04 pm by Minwah »

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #28 on: January 30, 2006, 06:12:21 pm »
If this is true, then that is a good reason as to why 12 direct connections may not be the best approach, except for the games that require exactly a 12 position dial.

But the games almost all do require exactly a 12 positon dial.  Other than the ones I listed above, they all use the same setup.  Here they are:

-----------------------

Battle Field
Top Gunner (bootleg only)
World Wars
Ikari Warriors
Victory Road
Heavy Barrel
Gondomania
Bermuda Triangle
Time Soldiers
Guerilla War
SAR - Search And Rescue
Downtown
Legendary Wings
Victory Road
Midnight Resistance
Ikari III - The Rescue
Exterminator
TNK III
Touchdown Fever edit - oops, optical rotary!

-------
« Last Edit: February 01, 2006, 01:35:12 am by Kremmit »

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #29 on: January 30, 2006, 06:31:01 pm »
based on the code in snk.c, the ROM reads 4 bits from an input port and expects to see a number from 0 thru 11, so the 12 switch inputs must have gone through a hardware encoder.

If that's the case, then it was on-board the original PCB, and all it did was translate a simple closed circuit into a number.
that's very likely.

Quote
Can you tell what's feeding that number to snk.c now?

mame sees keystrokes which it interprets as CW and CCW rotations of an analog dial (a "relative" device). it munges these into a 16-bit number (i haven't read exactly how it does this) and the snk driver then munges them back into discrete CW or CCW rotations. by observation, these are not always one-to-one with the hardware rotations. the cleaner thing would be to create a new input type and model the 12-switch rotary directly, using the CW and CCW keystrokes that you'd get from the druin's thru a keyboard encoder.
to see my "Frankenpanel" and design notes, click here.

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #30 on: January 30, 2006, 06:42:15 pm »
Wouldn't it be even cleaner to strip out the CW and CCW keystrokes entirely, and convert directly between the 12 way switch and the SNK driver?

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #31 on: January 30, 2006, 07:11:50 pm »
Right. Exactly.

Raspberry Pi, AttractMode, and Skeletor enthusiast.

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #32 on: January 30, 2006, 07:37:41 pm »
Wouldn't it be even cleaner to strip out the CW and CCW keystrokes entirely, and convert directly between the 12 way switch and the SNK driver?
i prefer the druin's method, because you don't have any always-on keys, which might interfere with front-ends or general windows use.

i don't see any reason why the druin's solution couldn't be made 100% accurate. (unless there's some defect in the druin's hardware that i'm not aware of. but i suspect the druin's is fine and all the problems people are seeing are the result of mame's problems.)
« Last Edit: January 30, 2006, 07:55:46 pm by RobotronNut »
to see my "Frankenpanel" and design notes, click here.

rdagger

Re: Fixing MAME's handling of 12-position rotary controls
« Reply #33 on: January 30, 2006, 08:15:32 pm »
i don't see any reason why the druin's solution couldn't be made 100% accurate. (unless there's some defect in the druin's hardware that i'm not aware of. but i suspect the druin's is fine and all the problems people are seeing are the result of mame's problems.)

There is probably nothing wrong with Druin's board.  I built a rotary interface and I know it works accurately, because I can open up notepad and rotate the handles and I will always get 1 letter for every turn.  However, in Ikari I often get 1 too many or too few clicks.

rdagger

Re: Fixing MAME's handling of 12-position rotary controls
« Reply #34 on: January 30, 2006, 11:05:48 pm »
OK, I finally got MAME Analog+ working with my rotary interface so now it is exactly 1 rotation for every click of the LS-30.  I felt retarded because I was following all the instructions and I could not get the latest version .9 to work.  So I decided to download an earlier version and all the problems went away.  It worked perfectly without any adjustments. 

I tested every version and it appears that the last one to work correctly with a Druin-type rotary interface is MameAnalog+ ver. 0.83.2.

Maybe I'm still missing something to why the later versions don't work, but anyway Ikari rocks now.


spidermonkey

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 850
  • Last login:October 01, 2023, 04:15:59 am
  • Bombjack junkie
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #35 on: January 31, 2006, 12:38:05 am »


Here's a pair of loop 24 optical rotaries. They have an encoder wheel like a spinner but they don't act anything like a spinner. These sticks click just like their mechanical cousins(LS-30s) but they have 24 distinct positions instead of 12 ie  "loop 24" . Cal 50 and Touchdown fever 1 & 2 are the only three games that use loop 24 optical rotaries. The rest of Kremmit's list all use 12 position mechanical rotaries. Oh and another unimportant tidbit of info from the mind of Spidermonkey ::)...Both the LS-30S and the similar Loop 24 sticks were manufactured by Seimitsu. Not SNK.
"Sinistar has bad breath"

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8183
  • Last login:April 12, 2023, 09:22:35 pm
  • The Bears Still Suck!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #36 on: January 31, 2006, 02:07:09 am »
I haven't read through all this yet.  If anyone needs to know something about the ls30 let me know, I have one.

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #37 on: January 31, 2006, 04:54:14 am »
the cleaner thing would be to create a new input type and model the 12-switch rotary directly, using the CW and CCW keystrokes that you'd get from the druin's thru a keyboard encoder.

My only problem with this is that this requires the Druin or similar interface, whereas with raw-12 inputs you would not.

Personally I think both methods should be incorporated so everyone is happy, and arcade-accurate-ness is retained too.

Teknique

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 204
  • Last login:October 02, 2015, 10:35:46 am
  • I'm a Gauntlet wizard in real life
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #38 on: January 31, 2006, 06:56:12 am »
OK, I finally got MAME Analog+ working with my rotary interface so now it is exactly 1 rotation for every click of the LS-30.  I felt retarded because I was following all the instructions and I could not get the latest version .9 to work.  So I decided to download an earlier version and all the problems went away.  It worked perfectly without any adjustments. 

I tested every version and it appears that the last one to work correctly with a Druin-type rotary interface is MameAnalog+ ver. 0.83.2.

Maybe I'm still missing something to why the later versions don't work, but anyway Ikari rocks now.



rdagger,
Can you post your sensitivity settings and anything else you did in the tab menu to make it work as flawlessly as you have so the rest of us can test her out?

Thx.
Your screen name has been added to my frag list.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #39 on: January 31, 2006, 12:21:11 pm »
There are 2 types. Optical and Mechanical rotaries. The optical ones are like spinners. The mechanical ones are 12 position, though I seem to recall there being mention of either and 8 or 10 position mechanical rotary as well. The 12 position ones are currently the only ones that anybody ever talks about, Ikari warriors being the primary game.

The sticks didn't have an indicator about which way the stick was supposed to point (i.e no "north" arrow) but you could definitely FEEL the major clicks as you spun your little dude around.
Do these sticks have an indicator pointing to the same direction as the on-screen action?
Nope, but they could.  The same side of the stick is always pointing straight up when the character is pointing straight up.
Let me touch on a couple of points here.  Assuming the information on my page is correct, and I think I got it from BYOAC - All the games used a 12-position switch - but, IKARI (and many - ALL??? - other games) only rotated the sprites through 8 positions (45-degree firing).  So if you clicked the stick 180 degrees - six clicks - CW - your character should actually rotate 270 degrees and be pointing left.  However, the clicks were very easy to feel, so it became second-nature to rotate the stick 4 clicks to turn 180 degrees, and you never noticed that the actual stick only turned 120 degrees.

Frontline (and Tin Star & Wild Western) used a 8-way joystick with a knob instead of a regular handle.  When you twisted the knob, it rotated an actuator that would contact the correct microswitch(es) to point the gun in the correct direction.  You could also call this an 8-way rotary, but it does not use an 8-position switch, but rather 4 microswitches, just like a joystick.  MAME already correctly emulates this, with aiming handled by the "P2 Joystick" controls.
BINGO!!!! - Perfect example of what Mahuti and Minwah and I have been complaining about.

Frontline and Tin Star and Wild Western used a very unique controller that is not available except rarely on E-bay.  However, it could be played very authentically using a spinner.  MAME does not support the spinner (or really keyboard inputs), but sets itself up to use the actual arcade controls.

Ikari, et. al. used a very unique joystick with a mechanical rotary 12-position switch.  These were readily available as NOS until a couple of years ago, and are still quite common on E-bay.  The games could also be played using an optical rotary joystick or a spinner, or buttons for rotation.  MAME supports the game using a spinner or buttons, and does not (except for Analog Plus and some games) support the actual hardware.

If you ask about these things on www.mame.net, they will say that Tin Star is accurate, and that IKARI supports a dial or buttons because everyone has either a keyboard or mouse.

Our point is that MAME should either consistently support the actual hardware - and let the user figure out how to play the game without it, or consistently support the keyboard and mouse - and let the user come up with their own converters to make the actual hardware work, not some games one way and others the ohter way.
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

rdagger

Re: Fixing MAME's handling of 12-position rotary controls
« Reply #40 on: January 31, 2006, 01:17:25 pm »
Can you post your sensitivity settings and anything else you did in the tab menu to make it work as flawlessly as you have so the rest of us can test her out?
Thx.

Here's a screen shot of my settings.  For some reason I could not use ESC to asssign None to the controls I did not want, so I just set everything unnecessary to NumPad numbers.  The game seems to work perfectly now using the keyboard presses to fire a single rotation.

PetitMorte

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 332
  • Last login:December 11, 2015, 10:03:43 am
  • . . . - - - . . .
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #41 on: January 31, 2006, 02:09:10 pm »
Something that I'd like to point out about Ikari, is that even though it has a 12-way joystick that creates "raw" output, the game itself doesn't care which way the joystick is rotated at the start.

If you draw an arrow on the joystick to correspond to the way your guy is facing, then rotate it so he is pointing left and then die, when you start a new game, the guy doesn't start out pointing left.  They always get off the plane facing up, no matter how you started the joystick.

Since it doesn't remember the state of the joystick from play to play, then it's not actually dealing in "raw" input.  It's just turning it into ROTATE-LEFT and ROTATE-RIGHT and using that to play.
Bitten by the cabinet bug... obsessing ever since.

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #42 on: January 31, 2006, 02:42:37 pm »
Since it doesn't remember the state of the joystick from play to play, then it's not actually dealing in "raw" input.  It's just turning it into ROTATE-LEFT and ROTATE-RIGHT and using that to play.

the ROM definitely sees raw input. the ROM itself must be turning it into rotate-left and rotate-right internally.
to see my "Frankenpanel" and design notes, click here.

u_rebelscum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3633
  • Last login:April 21, 2010, 03:06:26 pm
  • You rebel scum
    • Mame:Analog+
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #43 on: January 31, 2006, 07:51:47 pm »
FWIW, different roms "read" the raw input differently. :)

A. Some had  the switches connected to a hardware counter, and the counter sends the rotation number of the direction faced.  Mame emulates the counter "in software" by letting the mouse counter do the counting.

B. Some have each direction mapped to memory, with the one bit of the closed switch one the rest off (or visa verse).  Mame emulates the switches "in software" by taking the mouse counter number and looking up the binary number in a table.

Examples:
Pretend the switches are numbered like a 12 hour clock.
If the closed switch is pointing to 3 o'clock, the memory could be seeing one of the following:
03 (if numbered from 1 to 12)
02 (if numbered from 0 to 11)
001000000000 (if bits started from left side, aka "msb", or 200 in hex)
110111111111 (if bits started from left side, aka "msb", or DFF in hex)
000000000100 (if bits started from right side, aka "lsb", or 4 in hex)
111111111011 (if bits started from right side, aka "lsb", or FFB in hex)

OTTOMH, I've seen mame map to memory in four of the six ways in the example in the dozen or so games that are emulated in mame.  :o

If all 12 switches were connected, the later (the last four in the example) could have mame passing the data "raw".  The former (the first two examples) means mame would emulate the counter in software.


Also, I think the difference between PetitMorte & RobotronNut is just semantics.  The thing to note is that the ROM does interally change to rotate left/right x times (up to 5 positions in the games I tested), but expects the "raw" inputs (see above for what that means).  If the the interface the rotary is connected to translates to "rotate left/right", mame would need to translate it back* to the format the game expects.  And then the game translate back to rotate left/right. :)

*Actually the former means very little translation, and the later is just as easy as currently done.  It's just that you could skip that translation if you did send it raw, but only for those games that expect the raw data.


The games (cal .50) that used the loop 24 optical turned the player 12 positions.  These games could work okay with the 12way rotaries raw data, but would need special hacks.  Either translate to rotate left/right (mame, driver, or hardware), or make the 12way a mouse (through driver).  These games are emulated very well as a dial; they just have 24 detentes.


The 8way rotaries could also have rotate left/right hacked in to let the 12 way rotatries work.


AFA mame's inputs, they know it's not consistant.  However, a lot of it is the control of the original driver writer for that game, and his view on inputs.  And his access to different inputs.  (And the number of annoying "why doesn't this work?" (cough720cough) questions.:()  Note that most mame users only have a keyboard, moouse, & gamepad, and mame is limited to the PC's inputs and how the OS handles them.  And the drivers were written over years of changes.  Asking for input consistency is like game begging; it don't work. :-\ [shurg]

Mame's current loose policy is for inputs is:
No multiple input hacks, unless can't get anything else to work (then leave in the original commented out, and put in the hack)
No cheat input hacks
The input method works in mame, and fits in the mame/PC frame/limit of inputs.
The person in charge of the driver okay with the method

The biggest thing is "can't get anything else to work", "mame frame/limit", and "PC frame/limit" are open to interpretation.   :-\


My biggest peeve ATM with inputs is that mame doesn't handle multiple input types for the same input.  There's only a few games that have it, but those few have dip switch or F2 option set which type of input comes through the same port.  Great 1000 Miles Rally and Gauntlet Legends are two examples of games that could have one of two (or three in MM:GTMR2) totally different inputs plugged into the same port.  Mame doesn't have any way of picking one or the other (besides hacking): the type is set at compile time.  If mame was set up to handle these changes, switching between 12-way rotary "raw", rotary left/right, & mouse should be also doable.

Did I miss anything? ;)
Robin
Knowledge is Power

XtraSmiley

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 958
  • Last login:April 06, 2024, 09:29:46 pm
  • Kill the Big Dog
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #44 on: January 31, 2006, 08:41:23 pm »
I'm just a little confused as to why the MAME guys don't want to fix this.  Has anyone tried to just email Aaron or post on his website?  I realize he hates when people contact them and beg for games, but this is a totaly different issue.  I don't mind doing it, but I just don't understand all the ins and outs yet.
hearingprotectionBIGDOG@yahooBIGDOG.com

Kill the Dog man.

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #45 on: January 31, 2006, 08:54:15 pm »
I'm just a little confused as to why the MAME guys don't want to fix this.  Has anyone tried to just email Aaron or post on his website?  I realize he hates when people contact them and beg for games, but this is a totaly different issue.  I don't mind doing it, but I just don't understand all the ins and outs yet.

IIRC it was Aaron who removed the dial input stuff for 720....he was challenged at the time and wouldn't back down unfortunately.

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #46 on: January 31, 2006, 09:27:03 pm »
I'm just a little confused as to why the MAME guys don't want to fix this.  Has anyone tried to just email Aaron or post on his website?  I realize he hates when people contact them and beg for games, but this is a totaly different issue.  I don't mind doing it, but I just don't understand all the ins and outs yet.

Because from the mamedev point of view it's not broken.  Writing code to support  a third party adapter for sticks almost no one has is not something they want to do.


You can add  showdown to the list of games that need some kind of switching input type.  It autodetects the input device and then writes it in nvram so I'm not sure how to fix it without making 2 games out of 1 rom set.  Just switching inputs won't help unless you delete the nvram. :(








RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #47 on: February 01, 2006, 12:00:29 am »
Because from the mamedev point of view it's not broken.  Writing code to support  a third party adapter for sticks almost no one has is not something they want to do.

Who are the first and second parties?  This is something that I don't quite get.  They obviously can't write code for the original hardware (first party),  and the MAME devs don't do physical hardware (second party).  As MAME is supposedly a "documentation" effort, would not somehow making the original controls work on the new hardware platform be an important part of fully documenting the machine?

The argument could be brought up that they are documenting only circuitry.  But if that were the case, all of the input routines would be fully functioning but nobody could play.  So obviously, that isn't the standard.

Seems like just about anything that would allow the original controls to work on the hardware platform doing the emulation would be more accurate from a documentation standpoint than just making everything work as well as it can on a mouse, keyboard or gamepad.  And since you can't actually connect the original control directly to the foreign hardware, something is going to have to bridge the gap. 

And I don't think I would consider writing an input routine to rotate based on a cycling input "Writing code to support  a third party adapter."  This is far more accurate to the way the game was actually played than just holding the input in a single state.  Every click of the rotary required a conscious effort on the part of the gamer and, depending on play style, a mental count of the clicks.  Each action was independent.  You can do this by cycling a button, but it is impossible to achieve by merely holding it down.

I'm not ranting, even though it may look that way.  Just trying to follow the thought processes :)

RandyT

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #48 on: February 01, 2006, 01:02:59 am »
Because from the mamedev point of view it's not broken.  Writing code to support  a third party adapter for sticks almost no one has is not something they want to do.

Who are the first and second parties?  This is something that I don't quite get.  They obviously can't write code for the original hardware (first party),  and the MAME devs don't do physical hardware (second party).  As MAME is supposedly a "documentation" effort, would not somehow making the original controls work on the new hardware platform be an important part of fully documenting the machine?


The argument could be brought up that they are documenting only circuitry.  But if that were the case, all of the input routines would be fully functioning but nobody could play.  So obviously, that isn't the standard.

Seems like just about anything that would allow the original controls to work on the hardware platform doing the emulation would be more accurate from a documentation standpoint than just making everything work as well as it can on a mouse, keyboard or gamepad.  And since you can't actually connect the original control directly to the foreign hardware, something is going to have to bridge the gap. 

And I don't think I would consider writing an input routine to rotate based on a cycling input "Writing code to support  a third party adapter."  This is far more accurate to the way the game was actually played than just holding the input in a single state.  Every click of the rotary required a conscious effort on the part of the gamer and, depending on play style, a mental count of the clicks.  Each action was independent.  You can do this by cycling a button, but it is impossible to achieve by merely holding it down.

I'm not ranting, even though it may look that way.  Just trying to follow the thought processes :)

RandyT

The way the ls30 works is by dectecting movements up or down.  As has already been mentioned there is no 1:1 relationship between the position of the stick and a position of the players sprite.   You move 3 clicks clockwise and the binary number goes up by 3.  That is pretty much exactly the way an analog spinner works.  You move a wheel so many notches and the binary number the rom sees goes up.  If you move a tempest spinner x number of degrees the sprite moves y number of degrees.  Pretty much all spinners I can think of except Omega Race work like that.  I don't see how it's that much inaccurate to treat it as an analog spinner.  The only difference is you don't feel the notches.  What's inaccurate is letting people control an analog spinner with 2 buttons.  You are correct, that should probably be removed.  :)



« Last Edit: February 01, 2006, 01:36:15 am by Dav »

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #49 on: February 01, 2006, 02:00:06 am »
The way the ls30 works is by dectecting movements up or down.  As has already been mentioned there is no 1:1 relationship between the position of the stick and a position of the players sprite.   You move 3 clicks clockwise and the binary number goes up by 3.  That is pretty much exactly the way an analog spinner works.  You move a wheel so many notches and the binary number the rom sees goes up.  I don't  see how it's that much inaccurate to treat it as an analog spinner.  What's inaccurate is letting people control an analog spinner with 2 buttons.  You are correct, that should probably be removed.

I disagree.  While the motion may be similar, the two have about as much in common as the current button method does.

A spinner works on a principle known as "step and direction."   The device takes one step in one direction or the other and this is all the information it transmits.  One could say that a spinner has only 3 states.  Idle, moving forward and moving backward.  That makes it a relative positioning device.

The LS30 has 13 connections, presumably 12 contacts and a common.  So this would mean, as urebel demonstrated, that the device has 12 distinct states, one for each possible direction.  The interesting thing about this device is that it is an absolute positioning device that can be used as a relative device for games with less (or more) than 12 possible positions.

Aside from the electrical differences, the most important one is physical.  There is absolutely zero tactile feedback for the user to know that he has moved one position one way or the other.  Overshooting and undershooting the move is still a problem, even with the spinner, because the motion is continuous.  The user has no way of knowing how close or far away the next "click" is that causes the player to index to the next position.

However, if every cycle of a button causes exactly one index, this would be far more accurate.   If anything, the spinner support should go (note: I am not advocating this.  More options are always better than less.)

Here's a simple way to think about this.  A hardware interface for this purpose does nothing but attempt to translate the output of a device to a form expected by the computer/software.  As it currently stands, it is impossible to implement such a device, because it is impossible for a user to control the software properly.  Were such control possible by the user, then that control could be automated by an external device.  To be honest, I really don't know what to say to anyone who reads this and still thinks there isn't a problem.

BTW, I advocate a step and direction solution.  This can be handled as part of the input routines (provided the polling is fast enough) and would require only 3 inputs on any input interface (provided there were no problems with a constant "on" input.)   In the event that MAME does not poll quickly enough, the next option would be some tricks in hardware and a INC and DEC input that acted only once per cycle.  Having both of these solutions available would make virtually any rotary game absolutely controllable, regardless of whether a rotary switch or buttons were used to index the player position.  It would also work regardless of external specialized hardware.

RandyT
« Last Edit: February 01, 2006, 09:23:21 am by RandyT »

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #50 on: February 01, 2006, 02:32:33 am »

The LS30 has 13 connections, presumably 12 contacts and a common. 

....

..and would require only 3 inputs on any input interface (provided there were no problems with a constant "on" input.)

You keep teasing me with this, and I give up.  What are you thinking here?  While I can see ways to feed a tweaked version of MAME with data from three inputs, (or even two, or one, for that matter) there's 12 wires coming off of that switch (plus the ground, but we can ignore that), and those wires have gotta go somewhere.

brandon

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 807
  • Last login:October 19, 2023, 03:08:43 pm
  • I <3 arcade games.
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #51 on: February 01, 2006, 02:36:12 am »
from what I recall (and I have the Jamma PCB stored amongst my junk) on the actual PCB for Time Solder if your player was facing left and you died he would be facing left when the player respawn.  I also don't recall the player always facing forward when the game started.  I think it was absolute based on the position of the joystick.  If the movement was relative then I really don't see the point in havent 12 distinct positions in the first place.  I guess maybe that was the cheapest way to make the joystick from an existing 12-way switch?  but anyways, for the purpose of Mame I don't think it matters if its absolute as long as it moves one click on the stick and one click on the screen.  
« Last Edit: February 01, 2006, 02:38:40 am by brandon »

Minwah

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7662
  • Last login:January 18, 2019, 05:03:20 am
    • MAMEWAH
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #52 on: February 01, 2006, 05:10:24 am »
Because from the mamedev point of view it's not broken.  Writing code to support  a third party adapter for sticks almost no one has is not something they want to do.

This isn't what they need to do.  As I was sortof getting at in the other thread, they only need support keyboard, mouse and joystick devices - that makes sense as they are easy to interface to a PC and most people have them.  Us BYOAC-ers can have the hassle of interfacing our controls to be seen as one of these devices.  The problem is MAME should be written to accept the input as the arcade game did, IMO at least, purely for the 'accurately documenting' aspect of things.  If they don't want things handled accurately they should change their mission statement.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #53 on: February 01, 2006, 06:39:58 am »
Mame's current loose policy is for inputs is:
No multiple input hacks, unless can't get anything else to work (then leave in the original commented out, and put in the hack)
No cheat input hacks
Except BattleZone with a single joystick and Defender with a 4-way joystick (or was this removed in one of the later builds?)
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #54 on: February 01, 2006, 06:45:13 am »
Because from the mamedev point of view it's not broken.  Writing code to support  a third party adapter for sticks almost no one has is not something they want to do.
Dav, glad you're on the boards, but basically (with some flaws, no offense), that's exactly what they did do.

You can play IKARI with Druin's adapter and an LS-30 (you could do it more accurately with U_rebelscum's/MC-Escher's one-increment/button press hacks), but you can play it.  You cannot play any rotary game with the original hardware WITHOUT Druin's interface, except for about half the games if you used the hacked inputs added in MAME Analog Plus. . .
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #55 on: February 01, 2006, 06:55:43 am »
The way the ls30 works is by dectecting movements up or down.  As has already been mentioned there is no 1:1 relationship between the position of the stick and a position of the players sprite.   You move 3 clicks clockwise and the binary number goes up by 3.  That is pretty much exactly the way an analog spinner works.  You move a wheel so many notches and the binary number the rom sees goes up.  If you move a tempest spinner x number of degrees the sprite moves y number of degrees.  Pretty much all spinners I can think of except Omega Race work like that.  I don't see how it's that much inaccurate to treat it as an analog spinner.  The only difference is you don't feel the notches.  What's inaccurate is letting people control an analog spinner with 2 buttons.  You are correct, that should probably be removed.  :)
I'm not sure I am tecnically savvy enough to follow this argument.  The LS30 used a 12-position switch.  You are saying this is the equivalent of an analog spinner.  If so, then it would presumably be the equivalent of an analog spinner with 8 notches, (Since rotating the control through 12 clicks produces 540-degrees of rotation, so 360 degrees requires 8 clicks).

Perhaps then (by your argument, which I'm not sure I buy into), the problem is MAME's analog sensitivity, which is designed for 36 to 72 to 100 notch mouse encoder wheels and not an 8 notch encoder wheel . . .
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

Xiaou2

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4098
  • Last login:November 12, 2023, 05:41:19 pm
  • NOM NOM NOM
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #56 on: February 01, 2006, 07:00:25 am »

 Not only that,  but optical stuff tends to get un-calibrated when it misses a poll, or other issue.   This isnt true for a switch thats always on.

 

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #57 on: February 01, 2006, 02:47:29 pm »
The way the ls30 works is by dectecting movements up or down.  As has already been mentioned there is no 1:1 relationship between the position of the stick and a position of the players sprite.   You move 3 clicks clockwise and the binary number goes up by 3.  That is pretty much exactly the way an analog spinner works.  You move a wheel so many notches and the binary number the rom sees goes up.  I don't  see how it's that much inaccurate to treat it as an analog spinner.  What's inaccurate is letting people control an analog spinner with 2 buttons.  You are correct, that should probably be removed.

I disagree.  While the motion may be similar, the two have about as much in common as the current button method does.

A spinner works on a principle known as "step and direction."   The device takes one step in one direction or the other and this is all the information it transmits.  One could say that a spinner has only 3 states.  Idle, moving forward and moving backward.  That makes it a relative positioning device.

The LS30 has 13 connections, presumably 12 contacts and a common.  So this would mean, as urebel demonstrated, that the device has 12 distinct states, one for each possible direction.  The interesting thing about this device is that it is an absolute positioning device that can be used as a relative device for games with less (or more) than 12 possible positions.


Sure it could be used as an absolute positioning device, but according to an earlier post it is not.   If it is used as an absolute position device then your solution is incorrect as well.  I have a time soldiers board around here somewhere but I don't have time to look for it.

Quote
Aside from the electrical differences, the most important one is physical.  There is absolutely zero tactile feedback for the user to know that he has moved one position one way or the other.  Overshooting and undershooting the move is still a problem, even with the spinner, because the motion is continuous.  The user has no way of knowing how close or far away the next "click" is that causes the player to index to the next position.


Cut notches on the bottom of your spinner attach a spring to contact the notches and voila, it's physically identical.  That's the most important difference?

Quote
However, if every cycle of a button causes exactly one index, this would be far more accurate.   If anything, the spinner support should go (note: I am not advocating this.  More options are always better than less.)

Here's a simple way to think about this.  A hardware interface for this purpose does nothing but attempt to translate the output of a device to a form expected by the computer/software.  As it currently stands, it is impossible to implement such a device, because it is impossible for a user to control the software properly.  Were such control possible by the user, then that control could be automated by an external device.  To be honest, I really don't know what to say to anyone who reads this and still thinks there isn't a problem.

If the device was connected to a usb mouse and an appropriate pulse train were sent for each each time it changed positions it would work correctly* with absolutely no changes to mame.

(* the definition of correctly here meaning 1 click produces a movement of X degrees of the character,  If it's shown that time soldiers uses absolute positioning then everything's out the window and we're back to raw input.)

Quote
BTW, I advocate a step and direction solution.  This can be handled as part of the input routines (provided the polling is fast enough) and would require only 3 inputs on any input interface (provided there were no problems with a constant "on" input.)   In the event that MAME does not poll quickly enough, the next option would be some tricks in hardware and a INC and DEC input that acted only once per cycle.  Having both of these solutions available would make virtually any rotary game absolutely controllable, regardless of whether a rotary switch or buttons were used to index the player position.  It would also work regardless of external specialized hardware.

RandyT

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #58 on: February 01, 2006, 04:44:08 pm »
Sure it could be used as an absolute positioning device, but according to an earlier post it is not.   If it is used as an absolute position device then your solution is incorrect as well.  I have a time soldiers board around here somewhere but I don't have time to look for it.

I do believe Time Soldiers uses the control as an absolute positioning device.  I don't think you need an original board to verify this if you assume it to be emulated correctly.  With Ikari, every time you start a new game, the character faces front without exception.  However, The character in Time Soldiers faces the same direction upon the start of a new game, as the direction it was last in before the end of the previous game.  This indicates absolute positioning.

Regardless, I don't think I used the word "correct" in the method I advocate, rather "accurate."  I would much prefer a solution that was incorrect, but could be accurately controlled by the user, to one that is incorrect  and cannot.

Quote
Cut notches on the bottom of your spinner attach a spring to contact the notches and voila, it's physically identical.  That's the most important difference?

Heh.  Well, that would indeed provide some tactile feedback.  I don't know about the "identical" part ;) 

But this difference is very important.  I'm not sure I understand how introducing a totally new control to accommodate a software anomaly could be a technically more accurate solution than the anomaly being altered so that the original could be employed.

Quote
If the device was connected to a usb mouse and an appropriate pulse train were sent for each each time it changed positions it would work correctly* with absolutely no changes to mame.

I will concede this point.  This would make a very specialized interface a possibility, even though it is technically at the expense of absolute positioning (I don't consider this necessarily a bad thing, as functionality is probably not appreciably affected.)   But it doesn't really address the accuracy of human control, which was another part of my concern.  I think both "birds" could be killed with the same well-thought out stone.

Quote
(* the definition of correctly here meaning 1 click produces a movement of X degrees of the character,  If it's shown that time soldiers uses absolute positioning then everything's out the window and we're back to raw input.)

I guess it's time I whip out the "C" word :).   But yes, I also agree that to be totally correct, there should be 12 dedicated inputs for the LS30 type controls.  All of that processing would be done internally and the inputs would literally just be a means of exposing the lines used by the original hardware.  To be 100% accurate, ALL emulated hardware should offer direct exposure of logic lines for manipulation at some level.  But practicality issues would soon rears their ugly heads.

My view is that using 24 inputs is somewhat impractical (and I think you shared that view in another post) and that there is middle ground that can be accurate and practical.  Something I don't believe the current methods offer.

RandyT
« Last Edit: February 01, 2006, 04:46:28 pm by RandyT »

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #59 on: February 01, 2006, 05:26:39 pm »
Sure it could be used as an absolute positioning device, but according to an earlier post it is not.   If it is used as an absolute position device then your solution is incorrect as well.  I have a time soldiers board around here somewhere but I don't have time to look for it.

I do believe Time Soldiers uses the control as an absolute positioning device.  I don't think you need an original board to verify this if you assume it to be emulated correctly.  With Ikari, every time you start a new game, the character faces front without exception.  However, The character in Time Soldiers faces the same direction upon the start of a new game, as the direction it was last in before the end of the previous game.  This indicates absolute positioning.

Regardless, I don't think I used the word "correct" in the method I advocate, rather "accurate."  I would much prefer a solution that was incorrect, but could be accurately controlled by the user, to one that is incorrect  and cannot.

Quote
Cut notches on the bottom of your spinner attach a spring to contact the notches and voila, it's physically identical.  That's the most important difference?

Heh.  Well, that would indeed provide some tactile feedback.  I don't know about the "identical" part ;) 

But this difference is very important.  I'm not sure I understand how introducing a totally new control to accommodate a software anomaly could be a technically more accurate solution than the anomaly being altered so that the original could be employed.

Quote
If the device was connected to a usb mouse and an appropriate pulse train were sent for each each time it changed positions it would work correctly* with absolutely no changes to mame.

I will concede this point.  This would make a very specialized interface a possibility, even though it is technically at the expense of absolute positioning (I don't consider this necessarily a bad thing, as functionality is probably not appreciably affected.)   But it doesn't really address the accuracy of human control, which was another part of my concern.  I think both "birds" could be killed with the same well-thought out stone.

Quote
(* the definition of correctly here meaning 1 click produces a movement of X degrees of the character,  If it's shown that time soldiers uses absolute positioning then everything's out the window and we're back to raw input.)

I guess it's time I whip out the "C" word :).   But yes, I also agree that to be totally correct, there should be 12 dedicated inputs for the LS30 type controls.  All of that processing would be done internally and the inputs would literally just be a means of exposing the lines used by the original hardware.  To be 100% accurate, ALL emulated hardware should offer direct exposure of logic lines for manipulation at some level.  But practicality issues would soon rears their ugly heads.

My view is that using 24 inputs is somewhat impractical (and I think you shared that view in another post) and that there is middle ground that can be accurate and practical.  Something I don't believe the current methods offer.

RandyT


Time soldiers could still be relative to the position at boot, so using mame proves nothing since it would look the same either way.

My point about notching your controller is that it's not the interface that's different.  I'm not saying a rotary controller is the same as every spinner.  The fact that it operates the same as a hypothetical spinner proves that interfacing it as a spinner is valid.  Looking at the ps2 mouse protocol it doesn't even look like it would be that difficult.  I don't understand what you mean by the problem of  human control.  If you move the ls30 and it moves the mouse exactly X number of pixels the control should be correct assuming you select X within the range of sensitivity in mame.  Any interface to an ls30 would by definition be very specialized.

Yes, 24 inputs is crazy.  It's also not necessary.  By definition only 1 of 12 can be active so all the data is maintained by passing it through binary encoders like 74148's and getting it down to 8 lines.  Although if it were me I'd probably use a cpld.
 




RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #60 on: February 01, 2006, 07:08:13 pm »
Time soldiers could still be relative to the position at boot, so using mame proves nothing since it would look the same either way.

Maybe, but I doubt the programmers of the original would have done it that way.  All the data is right there at the interface.  Why track it just to have the character come up facing the same way when binding it to the control does the same thing without the work.  It's one of those things that doesn't make sense from a programming standpoint.

Quote
My point about notching your controller is that it's not the interface that's different.  I'm not saying a rotary controller is the same as every spinner.  The fact that it operates the same as a hypothetical spinner proves that interfacing it as a spinner is valid.

Well, here's something to throw your point on it's proverbial "ear" :-)

MAME doesn't appear to work the way you say it does with the spinner.  I just verified incorrect operation with both Time Soldiers and Ikari.  The number of pulses required to make a turn is inconsistent on both games.  On Ikari, with the spinner sensitivity at 100%, sometimes it will miss a pulse.  Sometimes it will make 8 turns before a miss and sometime 9 turns.

In TS, it's even more bizarre.  Instead of one pulse per click at 100%, as one would rightfully expect, this game requires between 19 and 23, also apparently at random.

This should not be.  The optical interface is tracking perfectly (I'm doing the pulses manually) and can easily walk it across the entire screen in Windows without it missing a beat.  MAME seems to be the problem.

One would think that perhaps a sensitivity adjustment might help, but not so.  Increasing the sensitivity retains the missed move problem and just adds an the extra move problem.

So, the nagging question.  Why the huge discrepancy in the way these two games operate and why the missed movements? 

And an even bigger question:  Is this the reason why the Druin interface won't work properly?

Quote
Yes, 24 inputs is crazy.  It's also not necessary.  By definition only 1 of 12 can be active so all the data is maintained by passing it through binary encoders like 74148's and getting it down to 8 lines.  Although if it were me I'd probably use a cpld.

But MAME doesn't support that either.... ;)

RandyT

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #61 on: February 01, 2006, 07:54:22 pm »
Time soldiers could still be relative to the position at boot, so using mame proves nothing since it would look the same either way.

Maybe, but I doubt the programmers of the original would have done it that way.  All the data is right there at the interface.  Why track it just to have the character come up facing the same way when binding it to the control does the same thing without the work.  It's one of those things that doesn't make sense from a programming standpoint.

Quote
My point about notching your controller is that it's not the interface that's different.  I'm not saying a rotary controller is the same as every spinner.  The fact that it operates the same as a hypothetical spinner proves that interfacing it as a spinner is valid.

Well, here's something to throw your point on it's proverbial "ear" :-)

MAME doesn't appear to work the way you say it does with the spinner.  I just verified incorrect operation with both Time Soldiers and Ikari.  The number of pulses required to make a turn is inconsistent on both games.  On Ikari, with the spinner sensitivity at 100%, sometimes it will miss a pulse.  Sometimes it will make 8 turns before a miss and sometime 9 turns.

In TS, it's even more bizarre.  Instead of one pulse per click at 100%, as one would rightfully expect, this game requires between 19 and 23, also apparently at random.

This should not be.  The optical interface is tracking perfectly (I'm doing the pulses manually) and can easily walk it across the entire screen in Windows without it missing a beat.  MAME seems to be the problem.

One would think that perhaps a sensitivity adjustment might help, but not so.  Increasing the sensitivity retains the missed move problem and just adds an the extra move problem.

So, the nagging question.  Why the huge discrepancy in the way these two games operate and why the missed movements? 

And an even bigger question:  Is this the reason why the Druin interface won't work properly?

Quote
Yes, 24 inputs is crazy.  It's also not necessary.  By definition only 1 of 12 can be active so all the data is maintained by passing it through binary encoders like 74148's and getting it down to 8 lines.  Although if it were me I'd probably use a cpld.

But MAME doesn't support that either.... ;)

RandyT


Trying to attribute logic to arcade programmers is futile.  I can think of a lot of examples where they did things the hard way for no apparent reason.  I've given up trying to guess what they were thinking.

You'd have to talk to someone like urebelscum that knows something about inputs to explain that one.  That does seem like a bug to me but I wouldn't know.

Yes, but at least with raw input you have the argument of accuracy on your side.  :)


 


RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #62 on: February 01, 2006, 09:19:47 pm »
Quote
I just verified incorrect operation with both Time Soldiers and Ikari.

RandyT - try the same experiment with MameAnalog+ 0.83.2; it is claimed to handle Ikari perfectly.
to see my "Frankenpanel" and design notes, click here.

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #63 on: February 01, 2006, 09:38:40 pm »
Quote
I just verified incorrect operation with both Time Soldiers and Ikari.

RandyT - try the same experiment with MameAnalog+ 0.83.2; it is claimed to handle Ikari perfectly.


With the spinner?

I was under the impression that Analog+ only made the change of adding new button inputs to do this, not modifications to the spinner portion.

Am I missing something?


RandyT

RobotronNut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:December 22, 2018, 11:39:19 am
  • I want to build my own arcade controls!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #64 on: February 01, 2006, 11:29:56 pm »

With the spinner?

I was under the impression that Analog+ only made the change of adding new button inputs to do this, not modifications to the spinner portion.

Am I missing something?


there's at least one more difference. mame 0.103 inserts invalid codes into the stream to work around the "joystick error protection in Guerilla War". it would seem that this would cause you to lose pulses, although i can't explain why this would once every 8 or 9 pulses.
to see my "Frankenpanel" and design notes, click here.

brandon

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 807
  • Last login:October 19, 2023, 03:08:43 pm
  • I <3 arcade games.
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #65 on: February 02, 2006, 12:14:36 am »
somebody may have mentioned this but... 
IF we could change the way Mame handles the control of these games then I think the "ideal" solution would be some sort of cheap circuit using TTL logic to convert the 12 position switch to a 4-bit code so that only 4 inputs would be needed on the gamepad or keyboard encoder.  I don't know if they make a 16 to 4 encoder but if not two LS74148 8 to 3 priority encoders would do the trick nicely(I think... :P)  and as far as those 4 buttons being on all the time.. as somebody mentioned you could put a switch on the common (gnd) of the 12-ways or better yet maybe do something with the enable lines on the chips?
BTW.. I took digital electronics class several years ago so I may be totally talking out of my arse  ;D

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #66 on: February 02, 2006, 12:53:36 am »
there's at least one more difference. mame 0.103 inserts invalid codes into the stream to work around the "joystick error protection in Guerilla War". it would seem that this would cause you to lose pulses, although i can't explain why this would once every 8 or 9 pulses.

Seems to do it with all versions.  The only difference I saw was Ikari was less "sensitive" at 100% in the earlier version (.71, I believe)

There is something seriously wrong with the way the input is working, if it's supposed to behave the way Dave described it.

Designing an interface for this would be like chasing a moving target.   

RandyT

MikeQ

  • Guest
  • Trade Count: (0)
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #67 on: February 02, 2006, 01:39:41 am »
I've only skimmed through this thread so forgive me if I am repeating anything.

Does MAME truly poll the inputs or are inputs interrupt driven?  If MAME is polling them and not reacting to an interrupt, it would seem very likely that signals would be lost.  I think looking through the code (at least for key controls) MAME looks at what keys are pressed during vsync or v-retrace.  I'm not sure how it works with analog devices.  If the polling of analog devices is the problem, then switching to an interrupt approach that then queues the inputs until they can be dealt with would seem to be a safer approach.

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #68 on: February 02, 2006, 01:46:52 am »
I've only skimmed through this thread so forgive me if I am repeating anything.

Does MAME truly poll the inputs or are inputs interrupt driven?  If MAME is polling them and not reacting to an interrupt, it would seem very likely that signals would be lost.  I think looking through the code (at least for key controls) MAME looks at what keys are pressed during vsync or v-retrace.  I'm not sure how it works with analog devices.  If the polling of analog devices is the problem, then switching to an interrupt approach that then queues the inputs until they can be dealt with would seem to be a safer approach.

I'm not sure about the aquisition methods, but I'm pretty sure MAME wasn't missing the input due to speed.  I was manually keying in quadrature on 2 pushbuttons connected to an Opti-Wiz  :D  It was the only way to know exactly what was happening.

So, the signals were coming at MAME very slowly relative to actual spinner input.

It seemed like an internal counter was screwy to me.

RandyT


Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #69 on: February 02, 2006, 01:49:01 am »
there's at least one more difference. mame 0.103 inserts invalid codes into the stream to work around the "joystick error protection in Guerilla War". it would seem that this would cause you to lose pulses, although i can't explain why this would once every 8 or 9 pulses.

Seems to do it with all versions.  The only difference I saw was Ikari was less "sensitive" at 100% in the earlier version (.71, I believe)

There is something seriously wrong with the way the input is working, if it's supposed to behave the way Dave described it.

Designing an interface for this would be like chasing a moving target.   

RandyT


I don't know how mame works.  I'm describing how spinners work.  Every spinner I've ever seen (with the exception of omega race) has a constant ratio between the spinner movement and pulses.  If mame doesn't do that it sounds like a bug to me.  Whether the problem is in mame or a library or a driver I wouldn't even guess.  Regardless it affects how well the interface works whether you're using using a mouse interface or druins.


I'll see if I can find my time soldiers board tomorrow and solve the absolute or not question definitively.  You could probably do the encoding with ttl's but a cpld might be cheaper and would give you more flexibility as far as features, such as disabling the output.   As far as the changes required for mame to use it, I think they'd be fairly straight forward if it's just 4 bits into the rom as described.  Shouldn't take more than a few minutes per game.


Tiger-Heli

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5447
  • Last login:January 03, 2018, 02:19:23 pm
  • Ron Howard? . . . er, I mean . . . Run, Coward!!!
    • Tiger-Heli
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #70 on: February 02, 2006, 10:36:08 am »
Quote
I just verified incorrect operation with both Time Soldiers and Ikari.

RandyT - try the same experiment with MameAnalog+ 0.83.2; it is claimed to handle Ikari perfectly.


With the spinner?

I was under the impression that Analog+ only made the change of adding new button inputs to do this, not modifications to the spinner portion.

Am I missing something?


RandyT

Analog Plus gives you at least three different control options -

Dial for rotation - Same as standard MAME (AFIAK).

Button 4 and Button 5 for Rotation - Each button press results in a single click - Analog Plus is supposed to work perfectly with Druin's Interface using this method.

Directly, mapping Player 1 to P3 Buttons 1-10 and then P1 Buttons 9 and 10, and for Player 2 to P4 Buttons 1-10 and then 2 Buttons 9 and 10. - Analog Plus is supposed to work perfectly with this method, but it works in Time Soldiers and not Ikari or Victory Road.
It's not what you take when you leave this world behind you, it's what you leave behind you when you go. - R. Travis.
When all is said and done, generally much more is SAID than DONE.

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #71 on: February 02, 2006, 10:56:51 am »
Same as standard MAME (AFIAK).

Unfortunately, that's starting to look like it means "broke."  That's too bad.  I thought Dave had brought up an approach that might have some possibilities.  Unfortunately, that one doesn't seem to work right either.

So, I guess it's back to my original statement.  Neither the user nor an external interface is able to accurately control this type of action on these games with the official distribution, which is why no properly working interface can be offered.

So, the ball appears to be in the developers courts to provide at least one absolute method for controlling these things and the MAMEdevs to acknowledge the problem and make it part of the official distribution.

RandyT

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #72 on: February 02, 2006, 11:11:26 am »

So, the ball appears to be in the developers courts to provide at least one absolute method for controlling these things and the MAMEdevs to acknowledge the problem and make it part of the official distribution.


That's what I've been saying since page 1.  But even if the devs don't want to add it to the official distro, if some input genius were to fix the problem, there's no reason it can't exist as a .dif file or in an alternative build, ala Analog_+.

u_rebelscum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3633
  • Last login:April 21, 2010, 03:06:26 pm
  • You rebel scum
    • Mame:Analog+
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #73 on: February 02, 2006, 04:49:12 pm »
You guys ready? ;D  BIG post.

Here's my view on the 12 way rotary (it's changed before though, so don't think I think this is "The Way It Has To Be" ;)).

The rotary is an absolute "analog" input that rolls over from min to max and visa verse, with 12 levels.  Each level has its own digital switch.  The original controller gives each switch it's own wire to plug into the PCB.  The original games take the absolute analog data and convert it into relative analog internally.  It could be argued (or treated) that the controller has 12 separate digital inputs, or that since the games used it like relative input the controller was really relative.  (I'll get into these later.) 

The mechanical rotary games I tested could have the rotary jump up to five (5) positions, with the player also skipping those five positions (150 degrees on the rotary, & 270 degrees on the screen).  That means if one switch was bad and never closed, you could skip one direction every 540 degrees on the screen (depending how the original game treated no direction pressed, of course).  The tests were done with 12 buttons connected as if they were the 12 switches in the rotary, using analog+ code.


Now, mame has three basic types of inputs: digital, absolute analog and relative analog, and PC inputs follow this too.  (This is explained well in the source.) 

Since the 12 way rotary can be argued as any of the three types, what should be done?

Well, from a programmer and user point of view, mame is great at the following input-to-input relaying (the first type being the physical PC input, the second being mame's input type for the emulated game):
digital  --> digital
absolute --> absolute
relative --> relative
relative --> absolute (note: mame's absolute stops at min & max and doesn't automatically roll over)

Mame is pretty good at:
absolute --> digital (with a limit of 2 digital per each analog axis)

Mame sucks at (not saying it's mame's fault, and others might call it "okay" instead of "sucks", but it's less than pretty good):
digital  --> absolute (note: mame's absolute stops at min & max and doesn't automatically roll over)
digital  --> relative
absolute --> relative

Mame cannot (ATM):
relative --> digital

Notice how whatever input type mame uses, there is at least one physical type that at best sucks at feeding it, possibly the physical type can't feed it.  And whatever physical type you have, it sucks at feeding at least one mame type.  So from the usability view, not everybody can be pleased at the same time.

Also notice how if the original controller was absolute that rolled over (like warlords, and IMO 12 way rotaries) and/or mame uses its absolute input type, spinners and keyboards don't roll over unless the source is hacked in the game's driver to cover roll over.  This non roll over is perfect for most games (star wars with trackball, for example).

MameDev's current view is there should be one physical input in the driver per game input.  Not sure if this is a goal of this view, but the number of inputs matches the original number, at the cost of not having "hack" ("usable") OR not having original inputs.  It's very much a good KISS way of handling inputs.  This is different from the past, and although much of the old code has been cleaned to match this, there still is old code out there that can be changed to match.  So if game A does YYY, and game B does ZZZ, just means one of those games was written before this view was in place and wasn't updated yet.  It's HARD to keep 6000+ games up to date in all aspects.  Arguments based on "mame's inconsistency should be fixed" do NOT promote the importance one bit; some devs treat it the same as a noobie saying "add 'dis game NOW!!!".


Since mame is not about usability ;), let's look at the ways the original controller could be treated. 
Currently, mame treats the input as a relative analog input (dial).  Alright, the (or maybe most) original games refine the original input into relative data, but the original game software refines it, not the controller.  Currently in mame, the driver takes the relative data, converts (possibly reconverts if the core converted it from absolute to relative which mame sucks at) it to "absolute" (which mame does great) and sends the absolute data to the ROM.  (Which the game converts back to relative.)  This setup works best with spinners, but absolute and digital inputs work with problems.  (Druin's interface sends digital left/right data.)  Pluses for mame using relative type include the game treats the input as relative even though gets absolute, spinners work, works on all PCs, and it's the current setup.  Minuses include original controllers (raw or with interfaces) don't work well, it's doing the work the game ROMs do, and obscures the original inputs deeper into the source than most other inputs and totally out of mame's input UI. 

RandyT, Mame takes the relative data (which is stored in a 256 value rolling counter) and multiples by 12 and divides by 256.  In integer.  This means rounding, which is why you get the two values in ikari.  Looks like timesold has same sensitivity as the other games, but a lower keydelta (keydelta shouldn't effect mouse inputs but seem to in small and mysterious ways).  It still is weird that timesold needs between 19 & 23 steps.  I could see it was the rounding problem if it took say 20 or 22, but with the range you list, it might be something else too. 
The reason Druin's interface doesn't work perfectly is that it "holds down a button" for a given amount of time for each mechanical click.  Mame reads the digital input and translates it to relative, the "delta" based on how long the button is pressed.  If the timing is not perfectly matched to mame's settings (keydelta & sensitivity), the microseconds add up and finally show up as a missed signal.  If the timing is bad, you see it every other click.  This is done in the core, not the driver, and is about as good as you can get when converting digital to relative.


If mame's input type is changed from relative to 12 digital inputs, you could hook up the original controllers through any interface with 12 free digital inputs (aka buttons) as long as it's okay with one always closed.  (Or the interface and mame could be set up to remember the current direction so that it doesn't need to send the closed switch all the time.)  Major problems arise when you try to use a spinner or almost any other input besides an original controller.  But the original controllers work great this way.


If it is changed to only 2 digital inputs (left/right), spinners wouldn't work.  Absolute would suck, but any device hooked up to something like Druin's interface would work pretty well.


If it is changed to absolute, spinners and keyboards would run into the roll over problem.  Original controllers would need new interfaces to hook up as an absolute joystick (much like the GPwiz49).  A pot based spinner should work.  But almost nothing out there in any quantity would work correctly, even though IMO the closest to what the original was. ;D


The way to please most users would be to give them the choice of mame using any of the above.  However, it would either complicate the input UI and the driver code big time, or need a big rewrite of mame's core UI and input handling.  Either way, this way would conflict with the current KISS policy about inputs and if done incorrectly really complicate the driver, just for usability purposes.  IOW, it would not be accepted unless it was done very cleanly and (my guess) 100% within the core code.


FWIW, Analog+ added the 12 digital and the 2 digital input ways on top of the spinner way.  It was implemented (hacked) on the driver level, and not correctly in all games, so it isn't mame acceptable for these two reasons.
Robin
Knowledge is Power

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #74 on: February 02, 2006, 06:34:35 pm »
I just took a look at time soldiers.   It uses absolute positioning.  It works great defining the 4 raw encoded bits as buttons 5-8.  I think the spinner is off on it possibly because there are dead spots.  instead of 1-12 like I was expecting the valid values are:  0/1, 2, 3, 4/5, 6, 7, 8/9, a, b, c/d, e, f.

I took a look at bermudaa also.  It uses the 4 bits like a spinner.  Defining the 4 bits as buttons and trying to play gave a little control but not much.  I desoldered the decoder on my board and made an adapter to dump it.  It encodes the 12 bits as 0-11binary  so there's nothing tricky going on with that.  Still it would probably work with the ls30  it would just require subs in to match the 4 bits to what the roms were expecting.

I'm real curious why guerrilla war doesn't like going from 5 to 6.  Possibly it's like time soldiers and 5 is not a valid value. 

It seems to me that if i wanted the original sticks to work then hooking it up with the 4 encoded raw bits would be pretty easy and cheap.  At least on the ones I looked at.



RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6891
  • Last login:May 01, 2024, 01:02:33 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #75 on: February 02, 2006, 10:21:48 pm »
You guys ready? ;D  BIG post.

I had to get another cup of coffee to get through that one.  Nice job ;)

Quote
RandyT, Mame takes the relative data (which is stored in a 256 value rolling counter) and multiples by 12 and divides by 256.  In integer.  This means rounding, which is why you get the two values in ikari.  Looks like timesold has same sensitivity as the other games, but a lower keydelta (keydelta shouldn't effect mouse inputs but seem to in small and mysterious ways).  It still is weird that timesold needs between 19 & 23 steps.  I could see it was the rounding problem if it took say 20 or 22, but with the range you list, it might be something else too. 
The reason Druin's interface doesn't work perfectly is that it "holds down a button" for a given amount of time for each mechanical click.  Mame reads the digital input and translates it to relative, the "delta" based on how long the button is pressed.  If the timing is not perfectly matched to mame's settings (keydelta & sensitivity), the microseconds add up and finally show up as a missed signal.  If the timing is bad, you see it every other click.  This is done in the core, not the driver, and is about as good as you can get when converting digital to relative.

It appears that the "19" may have been a mis-count on my part, as I didn't see it again just now.  It appears the actual numbers were 20 - 23.  I don't fully understand the significance, so I'll leave that one for you.

So in any case, I believe I have a solution to this problem.  Whether it's one that they would be willing to implement is another story, but seems clean to me.

They are using a rolling counter for the spinner / relative control .  The problem comes from the fact that the rolling counter isn't evenly divisible by 12.

So.........MAME needs a small piece of code that will allow the user to set the rollover value of the counter to one that is evenly divisible by 12, say 252, or any other number they fancy.  This would probably come in handy for other oddball absolute controls (although I can't think of any at the moment) using this method.  That way, nothing breaks and everything else still works the way it is expected.  The left and right button method still use the counter, it just rolls at a different spot.

Obviously there would be a slight performance hit, because one would need to compare for the value and set it to that value if the counter should go below 0, but that doesn't sound like the end of the world.

Or did I miss the gist completely?

RandyT
« Last Edit: February 02, 2006, 11:29:02 pm by RandyT »

brandon

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 807
  • Last login:October 19, 2023, 03:08:43 pm
  • I <3 arcade games.
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #76 on: February 03, 2006, 02:31:02 am »
I desoldered the decoder on my board and made an adapter to dump it.  It encodes the 12 bits as 0-11binary  so there's nothing tricky going on with that. 

what sort of chip did it use to do that? was it some generic TTL encoder?  maybe something we could order from Mouser for a few bucks?

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #77 on: February 03, 2006, 10:28:53 am »
MB 7134.  That's not a chip I'm familiar with, but when I mapped out the lines I could see it was a 4k*4 bit prom.  It was not one I could dump on my programmer which is why I had to make an adapter.  Bascially any eprom should work, so as long as you have a eprom programmer it's going to cost less than a buck.  In fact anyone with an eprom program has old eproms laying around so it's closer to free. :)   You just wire the inputs to the address lines and the 4 output bits give you the raw data.  If you wanted to do it in different for different games you can use a rom with more than 12 address lines and put a dipswitch on upper lines to bank.  Here's a chart of what it looked like.  I didn't fill in all the values for where 2 switches where pressed, and of course the majority of the eprom is invalid so contained 0F but you get the idea.   I'll probably add this prom to the next mame version so everyone will have to download new rom sets for bermuda triangle and victory road.  When anyone asks why I'll say it's arcade controls fault.

ba98 7654 3210 <-address lines
                           switch number/address/data value i.e. raw bits
1111 1111 1110 1 / ffe/ 00        <--switch 1 is pressed
1111 1111 1100 1/2 ffc 01         <--switch 1 and 2 are pressed
1111 1111 1101 2 ffd 01           <-- switch 2 is pressed
1111 1111 1001 2/3 ff9 02
1111 1111 1011 3 ffb 02
1111 1111 0111 4 ff7 03
1111 1110 1111 5 fef 04
1111 1100 1111 5/6 fcf 05
1111 1101 1111 6 fdf 05
1111 1001 1111 6/7 f9f 06
1111 1011 1111 7 fbf 06
1111 0111 1111 8 f7f 07
1110 1111 1111 9 eff 08
1101 1111 1111 a dff 09
1011 1111 1111 b bff 0a
0111 1111 1111 c 7ff 0b



Also if you do try this, you can put a switch on the enable line to kill the output, when you don't want any keypresses.  If I were making one I'd probably still use the cpld because the cost  difference vs 2 eproms isn't that great, and I think there's more features that could be available.  Like a timer circuit to disable output if you don't move the stick for 30 seconds.
« Last Edit: February 03, 2006, 10:50:56 am by Dav »

tetsujin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 222
  • Last login:April 10, 2007, 05:51:25 pm
  • My controls will have programmable button labels.
    • My Homepage
BYOAC branch of MAME
« Reply #78 on: February 03, 2006, 11:27:36 am »
But yes I agree all games should be treated as they were in the arcade.  That way we can interface just about anything and have it work properly one way or another.  However if we came up with our own 'BYOAC build' we could be a little less arcade-accurate if neccessary, and have some solid rules in place for max compatibility with the hardware we use.

I think this would be a fantastic and important project.  Lots of great work has been done on MAME in the form of extensions and special builds but as far as I know not so much on integrating those add-ons together.  Things like improved input support and generalized output support (for interfacing with lights, etc.), common refinements like getting rid of warning screens, and so on.  I expect I'll have to do some work on MAME myself (unless I find there really has been a build done that ties it all together), either to get the combination of features I want or for some other reason...  it'd be wasteful to do a bunch of work on MAME and keep it to myself, and it'd be wasteful for someone else to do a bunch of work on MAME and not share it in a useful way...  (Making the work available to other people is useful - but the complication of integrating different branch builds together is a process of exponential complexity...)
---GEC

brandon

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 807
  • Last login:October 19, 2023, 03:08:43 pm
  • I <3 arcade games.
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #79 on: February 03, 2006, 04:43:21 pm »
MB 7134.  That's not a chip I'm familiar with, but when I mapped out the lines I could see it was a 4k*4 bit prom.  It was not one I could dump on my programmer which is why I had to make an adapter.  Bascially any eprom should work, so as long as you have a eprom programmer it's going to cost less than a buck.  In fact anyone with an eprom program has old eproms laying around so it's closer to free. :)   You just wire the inputs to the address lines and the 4 output bits give you the raw data.  If you wanted to do it in different for different games you can use a rom with more than 12 address lines and put a dipswitch on upper lines to bank.  Here's a chart of what it looked like.  I didn't fill in all the values for where 2 switches where pressed, and of course the majority of the eprom is invalid so contained 0F but you get the idea.   I'll probably add this prom to the next mame version so everyone will have to download new rom sets for bermuda triangle and victory road.  When anyone asks why I'll say it's arcade controls fault.

ba98 7654 3210 <-address lines
                           switch number/address/data value i.e. raw bits
1111 1111 1110 1 / ffe/ 00        <--switch 1 is pressed
1111 1111 1100 1/2 ffc 01         <--switch 1 and 2 are pressed
1111 1111 1101 2 ffd 01           <-- switch 2 is pressed
1111 1111 1001 2/3 ff9 02
1111 1111 1011 3 ffb 02
1111 1111 0111 4 ff7 03
1111 1110 1111 5 fef 04
1111 1100 1111 5/6 fcf 05
1111 1101 1111 6 fdf 05
1111 1001 1111 6/7 f9f 06
1111 1011 1111 7 fbf 06
1111 0111 1111 8 f7f 07
1110 1111 1111 9 eff 08
1101 1111 1111 a dff 09
1011 1111 1111 b bff 0a
0111 1111 1111 c 7ff 0b



Also if you do try this, you can put a switch on the enable line to kill the output, when you don't want any keypresses.  If I were making one I'd probably still use the cpld because the cost  difference vs 2 eproms isn't that great, and I think there's more features that could be available.  Like a timer circuit to disable output if you don't move the stick for 30 seconds.


wow.. I never would've thought of doing it that way in a million years ;D  so basically I can program any old eprom with those hex values at those addresses and that should do it right?  and by bank switching you could program it to only move every other turn (6-way) or run backwards or any other bit patterns that it needed right?  Would be cool if you could program it to work with Xybots. (but that couldnt work with this method..) and on that note.. anybody ever try Druins interface with Xybots?  I know its was a different stick but if the interface translated the movement to just left and right then it would still work.. just not "accurately" compared to the original...


EDIT*  now that I'm thinking about it.. is this how all dipswitches work on PCBs?  the dipswitch just bank switches an eprom so that aternate code is ran?  hmm.. maybe this stuff is starting to make sense to me after all... :P
« Last Edit: February 03, 2006, 04:50:04 pm by brandon »

Dav

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 220
  • Last login:March 29, 2016, 05:39:35 am
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #80 on: February 03, 2006, 05:08:56 pm »
MB 7134.  That's not a chip I'm familiar with, but when I mapped out the lines I could see it was a 4k*4 bit prom.  It was not one I could dump on my programmer which is why I had to make an adapter.  Bascially any eprom should work, so as long as you have a eprom programmer it's going to cost less than a buck.  In fact anyone with an eprom program has old eproms laying around so it's closer to free. :)   You just wire the inputs to the address lines and the 4 output bits give you the raw data.  If you wanted to do it in different for different games you can use a rom with more than 12 address lines and put a dipswitch on upper lines to bank.  Here's a chart of what it looked like.  I didn't fill in all the values for where 2 switches where pressed, and of course the majority of the eprom is invalid so contained 0F but you get the idea.   I'll probably add this prom to the next mame version so everyone will have to download new rom sets for bermuda triangle and victory road.  When anyone asks why I'll say it's arcade controls fault.

ba98 7654 3210 <-address lines
                           switch number/address/data value i.e. raw bits
1111 1111 1110 1 / ffe/ 00        <--switch 1 is pressed
1111 1111 1100 1/2 ffc 01         <--switch 1 and 2 are pressed
1111 1111 1101 2 ffd 01           <-- switch 2 is pressed
1111 1111 1001 2/3 ff9 02
1111 1111 1011 3 ffb 02
1111 1111 0111 4 ff7 03
1111 1110 1111 5 fef 04
1111 1100 1111 5/6 fcf 05
1111 1101 1111 6 fdf 05
1111 1001 1111 6/7 f9f 06
1111 1011 1111 7 fbf 06
1111 0111 1111 8 f7f 07
1110 1111 1111 9 eff 08
1101 1111 1111 a dff 09
1011 1111 1111 b bff 0a
0111 1111 1111 c 7ff 0b



Also if you do try this, you can put a switch on the enable line to kill the output, when you don't want any keypresses.  If I were making one I'd probably still use the cpld because the cost  difference vs 2 eproms isn't that great, and I think there's more features that could be available.  Like a timer circuit to disable output if you don't move the stick for 30 seconds.


wow.. I never would've thought of doing it that way in a million years ;D  so basically I can program any old eprom with those hex values at those addresses and that should do it right?  and by bank switching you could program it to only move every other turn (6-way) or run backwards or any other bit patterns that it needed right?  Would be cool if you could program it to work with Xybots. (but that couldnt work with this method..) and on that note.. anybody ever try Druins interface with Xybots?  I know its was a different stick but if the interface translated the movement to just left and right then it would still work.. just not "accurately" compared to the original...


EDIT*  now that I'm thinking about it.. is this how all dipswitches work on PCBs?  the dipswitch just bank switches an eprom so that aternate code is ran?  hmm.. maybe this stuff is starting to make sense to me after all... :P

Yes, every other turn and backwards are easy to do.  Although it would be easier to modify mame with a read handler to modify the input data for you for each game. 

Getting relative ie R,L out of it would be much harder as it doesn't remember where it was last.

Dips don't normally work that way as it's very wasteful of eprom space.  However a lot of multigames and modern hacks do, since eprom space of that size is practically free now.


BTW the code changes I made to timesold in the inputs section of alpha68k.c

   PORT_START_TAG("IN5")  /* player 1 12-way rotary control - converted in controls_r() */
change input 5 from the line that said dial to this.
   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON5  )
   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON6  )
   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON7  )
   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8  )

This is just a quick hack to test how it worked and it worked pretty well.  In reality I think it should be active high which reverses direction and I think there's an inverting read handler that may need to be removed.  You can press different combo's of buttons to see how it works. 

I verified on bermudaa that the encoded 4 bits goes straight to the cpu data bus so it should work, but I'm not an expert on relative inputs so who knows.  You may still need a read handler to cover specialized cases  ie apparently gwar doesn't like going from 5 directly to 6.  I don't really understand why unless 5 is not a valid number or the inputs are not consecutive.



SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8183
  • Last login:April 12, 2023, 09:22:35 pm
  • The Bears Still Suck!
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #81 on: February 03, 2006, 05:19:23 pm »
I verified on bermudaa that the encoded 4 bits goes straight to the cpu data bus so it should work, but I'm not an expert on relative inputs so who knows.  You may still need a read handler to cover specialized cases  ie apparently gwar doesn't like going from 5 directly to 6.  I don't really understand why unless 5 is not a valid number or the inputs are not consecutive.
Well, find a wiring schematic for the game.  Maybe there's something missing??

Kremmit

  • - AHOTW -
  • Wiki Contributor
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3164
  • Last login:November 22, 2020, 05:59:29 pm
  • Who the heck is that?
Re: Fixing MAME's handling of 12-position rotary controls
« Reply #82 on: February 04, 2006, 11:52:52 pm »
re: xybots-

Yes, it works fine with a Druin's.  Also works with a "left" and "right" button on the CP.

re:  tetsujin-

Have you seen the MAMEDevs VS. BYOAC thread?  MikeQ is starting a project.