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: single switch shifter - how to invert Hi-Lo positions  (Read 4932 times)

0 Members and 1 Guest are viewing this topic.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 02:40:48 pm
single switch shifter - how to invert Hi-Lo positions
« on: June 08, 2021, 01:31:15 pm »
Hello guys, I am almost done configuring a very nice Buggy Boy cabinet a friend of mine gave me to set up. The cabinet equips the original single micro switch shifter. The switch is wired as normally open.

I have installed 3 MAME games, and they act differently from each other: some are Hi-geared when the switch is closed (pole position, chase HQ), and some are Low-geared  (buggy boy).

Is there a way to reverse the gear behaviour on a per-game level so that I can have all games working the same way? Is there some configuration option I can define in gamename.cfg (or elsewhere), to have an "active low" (or active high") behaviour of the switch?

I know I could wire also the normally closed pin, but I am in the hunt for a software solution to this.

I also know where I could act in the source code, but I would prefer to use a "regular" MAME.

thanks!  :)

(here is a link to the project, in case someone is curious)
« Last Edit: June 08, 2021, 01:38:47 pm by baritonomarchetto »

DarthMarino

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 565
  • Last login:Today at 06:51:56 am
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #1 on: June 08, 2021, 04:35:17 pm »
Did you try mapping it to NOT that button?

Examples:
NOT KEYCODE_K
NOT JOYCODE_1_BUTTON1

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 02:12:01 pm
  • Designated spam hunter
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #2 on: June 08, 2021, 05:04:00 pm »
As I finished typing up this long-winded reply, DarthMarino posted what looks like the easy answer.   :lol

I'm posting this anyways because someone might find the script idea useful for playing single-switch shifter games on a progressive sequential shifter setup.
-------------------------
The stickied driving cab thread has some related info.
                                  There is an issue with the way shifter input is handled in MAME.
               A lot of the original arcade Hi/Lo shifters had only one switch that was held closed while in high gear.
               The game would just default to Lo if that swich wasn't closed.  For the sake of testing and ease
               of use by the majority of people, MAME developers chose to make the shifter a toggle so the
               button/key wouldn't have to be held down while trying to work all the other controls.
               This causes problems when using the original controls.  Most people end up adding a second switch to the
               shifter and mapping the single toggle button in MAME to both the Hi and Lo switches in their shifter.
               This works, but the shifter easily becomes out of sync (backwards)....very confusing for guests.
               Dmod made a diff patch for MAME .127 that may work on other versions.
               (You'll have to compile MAME yourself to install the patch)
               There are some builds in this thread with Dmod's shifter fix applied:
               http://forum.arcadecontrols.com/index.php/topic,134889.0.html
               ShifterMAME and RacerMAME are other options - see below.

               As of MAME v.151, the shifter toggle can be disabled in the game's individual cfg file!
                More info here:http://forum.arcadecontrols.com/index.php/topic,135345.msg1397466.html#msg1397466
       

     
   Shiftermame - minwah did a custom MAME build specifically for driving games based on v.125. 
                       This build addresses shifter issues related to older games with Hi/Lo shifters.
                       Keep in mind v.125 might not include support for some popular games of the 90's.


   RacerMAME - Similar to Shiftermame.  Based on v.106 and
                      makes games compatible with any shifter.  The author's shifter utility also allows sequential
                      shifters to be used with Sega Model 2 emulator. 
                      Newer version based on MAME v.160 with groovymame patches now available!!

Just spitballing here, but maybe there's a way to combine disabling the shifter toggle in the game's individual cfg file with a LUA or AHK script that does two things:

1. Outputs a software button press or release of "space bar" to control the shifter in MAME, based on a shifter-controlled encoder button press/release like "N" that MAME doesn't use.
- The software button press keystroke must be different than the button press sent by the encoder so the script's "space bar" is controlling MAME, not the encoder's "N" output.
- When "N" changes state, toggle the "space bar" state.
- By isolating the encoder output state from MAME control state, you can control both "active high" and "active low" games.

2. Compare the MAME output that controls the on-screen shifter position artwork (i.e. what MAME *thinks* is the position of the shifter) to the encoder "N" button press/release state (i.e. the actual position of the shifter) and re-sync them when needed by toggling the "space bar" state.

This type of script could also adapt progressive sequential shifters for single switch shifter games.


Scott
« Last Edit: June 09, 2021, 08:49:33 pm by PL1 »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 02:12:01 pm
  • Designated spam hunter
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #3 on: June 08, 2021, 05:51:33 pm »
Did you try mapping it to NOT that button?

Examples:
NOT KEYCODE_K
NOT JOYCODE_1_BUTTON1
That works.   ;D

For those wondering how/where to do that:
1. Re-map the button in MAME so a .cfg file is created.

2. Go into the mame\cfg folder and open the game's .cfg file using Notepad.

3. Add a "NOT" in front of the keycode/joycode.
Code: [Select]
"KEYCODE_SPACE"becomes
Code: [Select]
"NOT KEYCODE_SPACE"
4. If you haven't already disabled the shifter toggle in the game, add toggle="no" to the end of the port tag.
Code: [Select]
<port tag=":IN0" type="P1_BUTTON3" mask="2" defvalue="2">becomes
Code: [Select]
<port tag=":IN0" type="P1_BUTTON3" mask="2" defvalue="2" toggle="no">

Scott

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 02:40:48 pm
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #4 on: June 09, 2021, 01:35:47 am »
That "NOT" mapping looks to be the solution to the problem, thanks!
« Last Edit: June 09, 2021, 01:38:47 am by baritonomarchetto »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #5 on: June 09, 2021, 02:17:30 am »
So would it be nice for my shifter project to have a button that swaps the switches? 

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 02:40:48 pm
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #6 on: June 09, 2021, 07:49:24 am »
I have a sequential shifter in my racingcab, with toggle DISABLED so to have a single direction for Hi gear, the other for Lo gear. I am using H2seq in background which emulates the press/release of a key or pad button. I had not the need for an inverting switch. If your project is sequential or single micro you won't need an inverting switch
« Last Edit: June 10, 2021, 01:43:00 am by baritonomarchetto »

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Today at 02:40:48 pm
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #7 on: June 09, 2021, 03:00:20 pm »
Confirmed that setting NOT keys was the solution. Thanks!

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:Today at 05:29:33 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: single switch shifter - how to invert Hi-Lo positions
« Reply #8 on: June 09, 2021, 04:56:44 pm »
I'm going to support all the shifters man.   I'm not talking about for my personal use, I mean in general for others as I'll be adding hi/low support for my shifter spoofing project.