Main > Driving & Racing Cabinets

Universal Gear Shifter support in MAME discussion

(1/11) > >>

EDIT: Link to the spreadsheet mentioned later in this thread:


The purpose of this thread is to discuss problems with using various gear shifters with the current MAME build and how a future build might best (and most simply) address these issues.  This thread is not about using old builds or workarounds just to get the game working on your cab.  This thread is also not to ---smurfette--- about MAME or the MAMEDevs.

What I would like to do is collect ALL the issues related to shifters and come up with ideas for some type of input system that addresses them all without having to hack all the different drivers in a bunch of different ways.

I'm not talking about just adding back support for old hi/lo shifters.
I'm talking about being able to play any driving game with any physical shifter setup and have it work correctly without doing much configuring.

I can't write code.   :dunno (odd that a thread about coding an input system should be started by someone with no hope of doing it  ::) )
I have some ideas I'll put out there, more information will come out of the discussions, & eventually maybe we'll end up with some coherent idea that's specific enough that it can act as a roadmap for someone to write the code.

Here are Derrick Renaud's quick thoughts on how a universal gear shift port might work:

I'm an end user, so I'm starting from that perspective.
Here are my thoughts on how it might work from the UI

Starting out with an example a little more complicated than the Pole Position shifter, take Cruis'n USA

Input(this game) , we already have

1st Gear
2nd Gear
3rd Gear
4th Gear

So basically, you need a 4 speed shifter or 4 buttons to shift properly.
Now add two more options:

Gear Up
Gear Down

These would be mapped just like any other button and would work simultaneously with the 1st Gear, 2nd Gear, etc.
Kind of like how both an actual Analogue input, Analogue Inc and Analogue Dec all work simultaneously.
I realize that in the Analogue Inc example, those are two different types of input, but both options are there and they can both be mapped and used.
This would provide a good experience to those with sequential & paddle shifters,
which is probably going to cover the bulk of users.

But what about the people who like their toggle button in the current build?
Add just one more:

Cycle Gears

This button will bump up to the next gear until it reaches the top one, then it will reverse order or cycle around.
Again, it will be mapped the same as any other input and will work simultaneously with all other inputs.

I think this makes the latching (or hold gear) unnecessary, but I could be wrong.

There may also need to be a default gear for some games (not sure which ones had a functioning neutral).
This would restore functionality to Hi/Lo shifters where only the Hi position has a switch.
For those, you'd only need to map Hi gear.

Not sure how the Hard Drivin' analogue shifter fits in there, but ideally you'd select the input and move your shifter into the position for that input, same as mapping any other control.

My $.02 to get the ball rolling.
Opinions and good information wanted, ---smurfette--- ing not.

I think that's about right.

However, as noted in the link.

A four speed shifter may not have four switches. It may, in fact, simply use three with no switches equaling gear 1 (or whatever). This leads into my next point of...

How one would handle a switch that's held down. If the interface is mapped to the joystick, this isn't a problem as long as that button is not used for any other MAME interface. If it's mapped to a keyboard input, then you have a problem. It would go into a key repeat just as any other keyboard would.

For these people, I have serious doubts MAMEDev (or anyone else for that matter) desire constructing a special case configuration for that. To that end, the solution presents itself. Construct a circuit that translates the three button states into one that virtualizes the fourth switch

While that is fine and dandy you're still left with trying to come up with a solution that doesn't wack out MAME (or the OS) with the shifter holding down a keyboard key. That leaves the joystick option. Personally, I'm OK with mapping the shifter to the joystick rather than the keyboard. And the controller offerings by GGG and Ultimarc pack a bazillion buttons into their interface.

Ideally, I think any solution would be a combination of hardware and software.

So... without looking at the source code (I should be fixing my TV right now). An ideal interface might look like this...

Gear Down/Lo Gear
1st Gear
2nd Gear
Nth Gear
Gear Up/Hi Gear

Cycle gear would be handled via the Gear Up/Down buttons via a setting. For those games that simply require a cycle gear that you describe, simply map Gear Up (or Down) and set Cycle to 1. There isn't much point in dedicating a two state gear their own buttons since the behavior would exactly mimic Gear Down/Up with Cycle set to 0.

For any of this to work, MAME needs to be state aware. It needs to see that a specific button is held down, know that that represents the shifter and act accordingly. IIUC, the toggling method technically isn't state aware so MAME would simply cycle through the gears. I don't know about this. I don't have a driving cab or any driving roms installed to test this out atm.

Currently, Cruis'n USA stays in gear when a button is pressed and released (pressing again puts it in neutral).
I'm assuming it's because of the way the driver was written and not anything to do with the original hardware.

The current toggle hack in the hi/lo shifter games also doesn't register any key presses while I'm trying to configure my keys.

Perhaps something similar could be done to put the car in 1st gear and have it stay there without registering a constant key press.
I understand if the issue is doing it at the shifter port level instead of in the driver.  
Like I said, I don't know code, so may occasionally cross the line into BS with my speculation.

I'm seeing things as what goes in and what comes out.  The underpants gnomes might be involved at some point.  ;D


--- Quote from: BadMouth on January 14, 2011, 09:01:18 pm ---
Perhaps something similar could be done to put the car in 1st gear and have it stay there without registering a constant key press.

--- End quote ---

It's possible, I recently built a circuit that does just that but.....

What happens during a virtual power cycle or game reset or whatever and the shifter is in low gear (or any other gear for that matter) and the game sets itself to a default gear? The shifter is now out of sync. This is why I suggest defaulting to the joystick interface. You can hold a button down and MAME won't care until it polls the joy.

For keyboard only users... don't know what to tell you.

I'm not sure I follow completely.  There's probably some aspect of it on the coding side that I'm not getting.
Or it could mean that it's laundry night, which involves me drinking and playing games while the washer does it's thing.

Are you talking about the gear shifter code that's sending the input to the driver becoming out of sync with the game's driver?
Like if someone goes into the service menu or resets the game while in 3rd gear?
That's something I never thought to consider.  I'll have to ponder that one for a while.

If you're talking about the physical shifter becoming out of sync, here's my logic.....
With the old hi/lo shifter, there was only one switch (on the hi side).
If that switch wasn't closed, it defaulted to low gear.  
Being in low gear is just the normal state of the game, like when no buttons are being pressed.
Think of the high gear switch as a turbo boost button.
Having the shifter in lo means absolutely nothing except that the high gear button isn't being pressed.
Same reasoning would apply to 1st gear on the 3 switch 4 spd shifter.

Thanks for taking an interest in this.
I plan to spend part of Sunday researching & downloading service manuals.
I'd like to end up with some type of spreadsheet listing all driving games, their mame drivers & pertinent info about their controls.
It should come in useful for other projects as well.


[0] Message Index

[#] Next page

Go to full version