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: Bind keys to MAME  (Read 1449 times)

0 Members and 1 Guest are viewing this topic.

GeoMan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 181
  • Last login:Yesterday at 06:30:42 pm
Bind keys to MAME
« on: March 20, 2017, 06:35:58 am »
I use MAME 0.183. As i have at least 4 different controllers connected (and 3 more for hotswap), i'd like to bind different keys to specific MAME games, without manual editing or the need to rebind all again.

For example:

I have already setup Joy1UP, Joy2UP, Joy3UP, Joy4UP for PacMan. Now i want to setup Joy5UP. Can it be done without remapping all 5 joysticks for UP again (or manually editing the .cfg files)?

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: Bind keys to MAME
« Reply #1 on: March 21, 2017, 01:27:30 pm »
Not sure what you are trying to do ...

So you might potentially have 5 or more joysticks connected at the same time and want any of them to work in PacMan ???
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.

GeoMan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 181
  • Last login:Yesterday at 06:30:42 pm
Re: Bind keys to MAME
« Reply #2 on: March 21, 2017, 01:46:10 pm »
It's simple:

I want to add to existing button assignments without setting up all assignments again for this action. So if for example the Player Button 1 is already assigned to CTRL, Joy1B1, Joy2B1, can i also assign Joy3B1 without reassign all 4 again?

(If you just press Enter to assign a new button, all existing assignments are removed...)

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: Bind keys to MAME
« Reply #3 on: March 21, 2017, 01:57:22 pm »
Again, I assume you know this, but ...

If you have one joystick plugged it, it is Joy1B1.  If you plug in a second one, it becomes Joy2B1.  If you remove the first one and start a new game, the second one is now Joy1B1.

The only way this matters if if you might have 4 or 5 joysticks plugged in at the same time.

I got to where I preferred manually editing the .cfg files, but I think there was a way to add a new binding without losing the existing bindings, but you had to carefully time how long you wait between button presses (but that was also 70 or so MAME versions ago).
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.

GeoMan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 181
  • Last login:Yesterday at 06:30:42 pm
Re: Bind keys to MAME
« Reply #4 on: March 21, 2017, 02:39:13 pm »
As i have at least 4 controllers connected at any time, i use the mapdevice to have stable gamepad IDs (http://docs.mamedev.org/advanced/devicemap.html)

So unplugging the first Joystick the second one doesn't become Joy1.

The trick you are mentioning is to exclude keys: for example "D not K"

You press D and then double press K to produce "not"

DeLuSioNal29

  • Global Moderator
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4778
  • Last login:October 20, 2023, 11:39:06 pm
  • Build the impossible -"There is no Spoon"
    • DeLuSioNaL's YouTube Videos
Re: Bind keys to MAME
« Reply #5 on: March 21, 2017, 02:44:18 pm »
(If you just press Enter to assign a new button, all existing assignments are removed...)
You're doing it wrong.  The above statement is true if you arrow down after assigning the the button that you want.  However, if you hit enter to assign a button and then press enter again on the same one field, it will allow you to enter an additional button.  Do this many time if you wish depending on how many buttons you want assigned to that particular action.



For example:
If you want to assign P1 up to two inputs:  Arrow down to P1UP:  <Hit Enter> <Press Up Arrow> Stay on the same field <Hit Enter again> <Press Joy1 UP>

If you want to erase what you just did, simply arrow down to another field.  Arrow back up, <Press Enter> <press a new key> It will erase what was there.

Hope this helped!

DeL
Stop by my Youtube channel and leave a comment:

DeLuSioNal29

  • Global Moderator
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4778
  • Last login:October 20, 2023, 11:39:06 pm
  • Build the impossible -"There is no Spoon"
    • DeLuSioNaL's YouTube Videos
Re: Bind keys to MAME
« Reply #6 on: March 21, 2017, 02:47:29 pm »
Sorry, just re-read the OP and realized you want to add an input without erasing them.   :banghead:

Have you tried CFG magician?  I'm not sure if it works on more recent builds of MAME but you can give it a shot:
http://forum.arcadecontrols.com/index.php?topic=88948.0

Updated link to download CFG magician here:  http://emumovies.com/files/file/601-cfg-magician/

DeL
« Last Edit: March 21, 2017, 02:49:22 pm by DeLuSioNal29 »
Stop by my Youtube channel and leave a comment:

GeoMan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 181
  • Last login:Yesterday at 06:30:42 pm
Re: Bind keys to MAME
« Reply #7 on: March 21, 2017, 02:56:52 pm »
Thanks, i'll give it a try!

DeLuSioNal29

  • Global Moderator
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4778
  • Last login:October 20, 2023, 11:39:06 pm
  • Build the impossible -"There is no Spoon"
    • DeLuSioNaL's YouTube Videos
Re: Bind keys to MAME
« Reply #8 on: March 21, 2017, 04:09:38 pm »
Thanks, i'll give it a try!
Make sure you back up your configs first of course...
Stop by my Youtube channel and leave a comment:

GeoMan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 181
  • Last login:Yesterday at 06:30:42 pm
Re: Bind keys to MAME
« Reply #9 on: March 21, 2017, 04:31:45 pm »
I have a full backup, but CFG Magician doesn't seem to work for what i want to do. It allows you to modify multiple .cfg files adding the same controls to all.

yamatetsu

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2695
  • Last login:Yesterday at 02:39:39 pm
  • Just because.
Re: Bind keys to MAME
« Reply #10 on: March 21, 2017, 05:47:25 pm »
So if for example the Player Button 1 is already assigned to CTRL, Joy1B1, Joy2B1, can i also assign Joy3B1 without reassign all 4 again?

You can do it semi-manually by using a text-editor that can replace text in multiple files, something like Notepad++, which is free. You have to put all .cfg files you want to change into one folder,
open the first one with Notepad++ and then replace the assignments for each button in all the files.

For example, this is the config for 10yard.zip. Player 1 button 1 is set to Joy1B1 and Joy2B1.

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="10yard">
        <input>
            <port tag=":IN1" type="P1_BUTTON1" mask="128" defvalue="128">
                <newseq type="standard">
                    JOYCODE_1_BUTTON1 OR JOYCODE_2_BUTTON1
                </newseq>
            </port>
        </input>
    </system>
</mameconfig>

To add Joy3B1, you use 'replace' to replace JOYCODE_2_BUTTON1 with JOYCODE_2_BUTTON1 OR JOYCODE_3_Button1. If you use 'replace in files', you change the button 1 assignment in all files.

You have to do that for every joystick button, but it sure beats editing every file by hand.
                  

GeoMan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 181
  • Last login:Yesterday at 06:30:42 pm
Re: Bind keys to MAME
« Reply #11 on: March 21, 2017, 08:25:03 pm »
I already use Notepad++. I could also do the editing with an Autohotkey script. I was just wondering if it was possible to do it through the Mame interface.