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: Best practices mapping arcade buttons to scripts?  (Read 337 times)

0 Members and 2 Guests are viewing this topic.

SpaceParanoid

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 9
  • Last login:Yesterday at 09:22:33 pm
  • I want to build my own arcade controls!
Best practices mapping arcade buttons to scripts?
« on: Yesterday at 05:04:43 pm »
I'm exclusively using Autohotkey to do some stuff on button presses but finding it doesn't listen specifically enough for the correct button press mapped to a specific PCB pin.

I have a script that, when you hit LT or RT on my PACTO PCB (each one is mapped from the Player 2 LT/RT pins to an arcade button on my CP) it creates a nice gui of a volume bar and raises and lowers the volume. Problem is that every reboot sometimes pressing those buttons triggers 2JoyZ +/- and sometimes 1JoyZ +/-....seems like Windows 11 just randomly switches depending on which button gets recognized first on boot. Do I need to add a layer of Joy2Key in there or can I listen for something other than 2JoyZ? Or perhaps some other solution entirely?

SpaceParanoid

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 9
  • Last login:Yesterday at 09:22:33 pm
  • I want to build my own arcade controls!
Re: Best practices mapping arcade buttons to scripts?
« Reply #1 on: Yesterday at 07:26:40 pm »
In case anyone comes across this, I did end up getting it working much more reliably by using Autohotkey in conjunction with JoyToKey:

1) Map hotkeys for the "Xbox controllers" in JoyToKey (several specific P1 and P2 pins on my PACTO tech board which I want to each do something different in a AHK script)

2) Having my AutoHotkey scripts just listen for those hotkeys instead of trying to listen for the buttons directly.

3) JoyToKey seems to maintain P1 and P2 designations for the correct pins on multiple reboots (for now at least....I've never messed around with it till today).

So that works. Was just curious if this is a common workflow or if I am missing a more tried-and-true method.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9716
  • Last login:Today at 04:30:42 am
  • Designated spam hunter
Re: Best practices mapping arcade buttons to scripts?
« Reply #2 on: Yesterday at 08:38:19 pm »
Sounds like you're running into the Windows device renumbering problem.

Windows assigns the first gamepad joystick it sees on bootup as Joy1, the second as Joy2, etc.
- It also does the same with mice, which can cause a problem if you have multimouse enabled in mame.ini.

You might want to look into either the ControllerRemap utility https://forum.arcadecontrols.com/index.php/topic,108767.0.html or MAME's newer devicemap function. https://docs.mamedev.org/advanced/devicemap.html


Scott

SpaceParanoid

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 9
  • Last login:Yesterday at 09:22:33 pm
  • I want to build my own arcade controls!
Re: Best practices mapping arcade buttons to scripts?
« Reply #3 on: Yesterday at 09:22:33 pm »
Great, thank you. I hadn't heard of the ControllerRemap utility, will look into it.