Jump to content
LaunchBox Community Forums

Trying to understand MAME ctrlr files for a 4 player control panel for both 4 player and 2 player games


Jakobud

Recommended Posts

I have built a custom arcade cabinet with room for 4 players. I'm using MAME for all games. I'm trying to understand ctrlr files. I've been using MAME on and off for 20+ years and I thought I fully understood ctrlr files a while back but I can't seem to get them to work these days at least how I expect.

Everything in my is hooked up to IPAC so all buttons and joysticks are keyboard inputs.

For 4 player games I want my control panel layout to be something like this:

image.thumb.png.a028d881c99d559885b40a89a1496425.png

 

For 2 player games I want it something like this

image.thumb.png.38fd2a6e07a63b218a7c50dd3fe88163.png

So anyways, I'm trying to understand the best way to do this. Obviously I do not want to individually remap controls for many hundreds of individual games. I think that ctrlr files are the way to go for this. Essentially I would have like 2player.cfg and 4player.cfg and other perhaps game-specific ctrlr files. Then I would pass them to the game via command line when starting those games. Is this the proper way to handle this?

I tried make a 4p.cfg ctrlr file but it didn't seem to work. Here is my 4p.cfg

 

<mameconfig version="10">
	<system name="default">

		<input>
			<port type="UI_SELECT"> <newseq type="standard"> KEYCODE_RCONTROL </newseq> </port>

            <port type="P1_JOYSTICK_UP"> <newseq type="standard"> KEYCODE_I </newseq> </port>
            <port type="P1_JOYSTICK_DOWN"> <newseq type="standard"> KEYCODE_K </newseq> </port>
            <port type="P1_JOYSTICK_LEFT"> <newseq type="standard"> KEYCODE_J </newseq> </port>
            <port type="P1_JOYSTICK_RIGHT"> <newseq type="standard"> KEYCODE_L </newseq> </port>
            <port type="P1_BUTTON1"> <newseq type="standard"> KEYCODE_RCONTROL </newseq> </port>
            <port type="P1_BUTTON2"> <newseq type="standard"> KEYCODE_RSHIFT </newseq> </port>
            <port type="P1_BUTTON3"> <newseq type="standard"> KEYCODE_ENTER </newseq> </port>
            <port type="P1_BUTTON4"> <newseq type="standard"> KEYCODE_O </newseq> </port>
			<port type="START1"> <newseq type="standard">KEYCODE_3</newseq> </port>
            <port type="COIN1"> <newseq type="standard">KEYCODE_7</newseq> </port>

            <port type="P2_JOYSTICK_UP"> <newseq type="standard"> KEYCODE_UP </newseq> </port>
            <port type="P2_JOYSTICK_DOWN"> <newseq type="standard"> KEYCODE_DOWN </newseq> </port>
            <port type="P2_JOYSTICK_LEFT"> <newseq type="standard"> KEYCODE_LEFT </newseq> </port>
            <port type="P2_JOYSTICK_RIGHT"> <newseq type="standard"> KEYCODE_RIGHT </newseq> </port>
            <port type="P2_BUTTON1"> <newseq type="standard"> KEYCODE_LCONTROL </newseq> </port>
            <port type="P2_BUTTON2"> <newseq type="standard"> KEYCODE_LALT </newseq> </port>
            <port type="P2_BUTTON3"> <newseq type="standard"> KEYCODE_SPACE </newseq> </port>
            <port type="P2_BUTTON4"> <newseq type="standard"> KEYCODE_LSHIFT </newseq> </port>
			<port type="START2"> <newseq type="standard">KEYCODE_1</newseq> </port>
            <port type="COIN2"> <newseq type="standard">KEYCODE_5</newseq> </port>

            <port type="P3_JOYSTICK_UP"> <newseq type="standard"> KEYCODE_R </newseq> </port>
            <port type="P3_JOYSTICK_DOWN"> <newseq type="standard"> KEYCODE_F </newseq> </port>
            <port type="P3_JOYSTICK_LEFT"> <newseq type="standard"> KEYCODE_D </newseq> </port>
            <port type="P3_JOYSTICK_RIGHT"> <newseq type="standard"> KEYCODE_G </newseq> </port>
            <port type="P3_BUTTON1"> <newseq type="standard"> KEYCODE_A </newseq> </port>
            <port type="P3_BUTTON2"> <newseq type="standard"> KEYCODE_S </newseq> </port>
            <port type="P3_BUTTON3"> <newseq type="standard"> KEYCODE_Q </newseq> </port>
            <port type="P3_BUTTON4"> <newseq type="standard"> KEYCODE_W </newseq> </port>
			<port type="START3"> <newseq type="standard">KEYCODE_2</newseq> </port>
            <port type="COIN3"> <newseq type="standard">KEYCODE_6</newseq> </port>

            <port type="P2_JOYSTICK_UP"> <newseq type="standard"> KEYCODE_Y </newseq> </port>
            <port type="P2_JOYSTICK_DOWN"> <newseq type="standard"> KEYCODE_N </newseq> </port>
            <port type="P2_JOYSTICK_LEFT"> <newseq type="standard"> KEYCODE_V </newseq> </port>
            <port type="P2_JOYSTICK_RIGHT"> <newseq type="standard"> KEYCODE_U </newseq> </port>
            <port type="P2_BUTTON1"> <newseq type="standard"> KEYCODE_B </newseq> </port>
            <port type="P2_BUTTON2"> <newseq type="standard"> KEYCODE_E </newseq> </port>
            <port type="P2_BUTTON3"> <newseq type="standard"> KEYCODE_H </newseq> </port>
            <port type="P2_BUTTON4"> <newseq type="standard"> KEYCODE_M </newseq> </port>
			<port type="START4"> <newseq type="standard">KEYCODE_4</newseq> </port>
            <port type="COIN4"> <newseq type="standard">KEYCODE_8</newseq> </port>

		</input>
	</system>
</mameconfig>

So according to this I would expect my Player 1 joystick up/down/left/right to be mapped to I,K,J,L, player 2 to be up/down/left/right, player 3 to be R,F,D,G and player 4 to be Y,N,V,U.

So I start a 4 player game using this ctrlr file like this:

mame captcommu -ctrlr 4p

And here are the control inputs in the game:

image.thumb.png.8e272b0677e928c288bb2285de578ae4.png

Okay so that didn't seem to work, right? I mean the key codes I have setup in my ctrlr file don't match at all what the game actually shows as the inputs. Also, I made sure to delete my cfg/captcommu.cfg configuration file before starting the game.

So what am I misunderstanding about ctrlr files? What is the best way to change controls for LOTS of games at the same time?

 

Edited by Jakobud
Link to comment
Share on other sites

27 minutes ago, Jakobud said:

So anyways, I'm trying to understand the best way to do this.

"Handwriting" a controller cfg file is a pain and it's too easy to have something go wrong.

I'd be inclined to open MAME, go into the general settings < input assignments and start with Player 1 Controls.  Say you're doing your 4-player setup as pictured above... Set your up/down/left/right and buttons using the very left set of controls.  Then go to Player 2 Controls and set those using the left-middle set of controls. etc. for 3 & 4.

Back out of the menus sand select Save Settings. Exit MAME.

Copy the "default.cfg" file from the /cfg/ folder and paste it into the /ctrlr/ folder and rename it to "4Player.cfg".

Go back into MAME and do those same steps for "2Player.cfg" and whatever else ones you may want. (maybe it's just those 2.)  Be sure to Save and exit before copying default.cfg, each time.

Do the one you want to have as your default panel setup, last.  That way if you don't add any command line parameters, it'll at least be default.

Link to comment
Share on other sites

Ah this seemed to work thanks. I think part of my problem was also that I had previously setup game-specific input cfg's and had a default.cfg setup with input changes as well that I think maybe overrides ctrlr files? Not sure. I cleared out all my cfg/*.cfg's and went with your route and that worked. Thanks,

  • Game On 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...