Cyberonix
Posts: 1
Joined: Sun Jul 17, 2016 6:17 pm

I can't seem to map certain ports to a custom configuration file.

I have a custom controller file I use to map buttons and keys for MAME. It works great except for one recent addition. I'm trying to add Space Wars to my configuration but it's not behaving how I expect it to. Here's the entry.

<system name="spacewar">
<input>
<port type="P1_JOYSTICK_LEFT">
<newseq type="standard">KEYCODE_LEFT OR JOYCODE_1_XAXIS_LEFT_SWITCH</newseq>
</port>
<port type="P1_JOYSTICK_RIGHT">
<newseq type="standard">KEYCODE_RIGHT OR JOYCODE_1_XAXIS_RIGHT_SWITCH</newseq>
</port>
<port type="P1_BUTTON1"> <!-- Fire -->
<newseq type="standard">KEYCODE_LCONTROL OR JOYCODE_1_BUTTON1</newseq>
</port>
<port type="P1_BUTTON2"> <!-- Forward -->
<newseq type="standard">KEYCODE_LALT OR JOYCODE_1_BUTTON2</newseq>
</port>
<port type="P1_BUTTON3"> <!-- Hyperspace -->
<newseq type="standard">KEYCODE_SPACE OR JOYCODE_1_BUTTON3</newseq>
</port>
<port type="P2_JOYSTICK_LEFT">
<newseq type="standard">KEYCODE_D OR JOYCODE_2_XAXIS_LEFT_SWITCH</newseq>
</port>
<port type="P2_JOYSTICK_RIGHT">
<newseq type="standard">KEYCODE_G OR JOYCODE_2_XAXIS_RIGHT_SWITCH</newseq>
</port>
<port type="P2_BUTTON1"> <!-- Fire -->
<newseq type="standard">KEYCODE_A OR JOYCODE_2_BUTTON1</newseq>
</port>
<port type="P2_BUTTON2"> <!-- Forward -->
<newseq type="standard">KEYCODE_N OR JOYCODE_2_BUTTON2</newseq>
</port>
<port type="P2_BUTTON3"> <!-- Hyperspace -->
<newseq type="standard">KEYCODE_Q OR JOYCODE_2_BUTTON3</newseq>
</port>
<port type="OTHER" mask="2048" defvalue="2048"> <!-- Option 0 -->
<newseq type="standard">KEYCODE_Q</newseq>
</port>
<port type="OTHER" mask="16" defvalue="16"> <!-- Option 1 -->
<newseq type="standard">KEYCODE_W</newseq>
</port>
<port type="OTHER" mask="64" defvalue="64"> <!-- Option 2 -->
<newseq type="standard">KEYCODE_E</newseq>
</port>
<port type="OTHER" mask="1" defvalue="1"> <!-- Option 3 -->
<newseq type="standard">KEYCODE_R</newseq>
</port>
<port type="OTHER" mask="4" defvalue="4"> <!-- Option 4 -->
<newseq type="standard">KEYCODE_T</newseq>
</port>
<port type="OTHER" mask="1024" defvalue="1024"> <!-- Option 5 -->
<newseq type="standard">KEYCODE_Y</newseq>
</port>
<port type="OTHER" mask="32" defvalue="32"> <!-- Option 6 -->
<newseq type="standard">KEYCODE_U</newseq>
</port>
<port type="OTHER" mask="128" defvalue="128"> <!-- Option 7 -->
<newseq type="standard">KEYCODE_I</newseq>
</port>
<port type="OTHER" mask="2" defvalue="2"> <!-- Option 8 -->
<newseq type="standard">KEYCODE_O</newseq>
</port>
<port type="OTHER" mask="8" defvalue="8"> <!-- Option 9 -->
<newseq type="standard">KEYCODE_P</newseq>
</port>
</input>
</system>

The joysticks and buttons map correctly. It's the "options" that aren't working. When I launch the game they are all set to their MAME default values even though they're specified differently here. Even more confusing is if I remove this from my custom controller and past it into the spacewar.cfg file MAME creates it works perfectly. I know it's reading the entry from my configuration file because if I set different settings for the joysticks or buttons there they will override what I paste into the spacewar.cfg file.

Any input? (Pun intended)

BlindRebel
Posts: 2
Joined: Tue Nov 23, 2021 6:56 pm

Re: I can't seem to map certain ports to a custom configuration file.

TLDR; ctrlr input settings doublely won't work for Space Wars, so you need to use the game's specific cfg file as you found out.

Long answer:
  1. ctrlr settings change the "Input (general)" inputs. The "Input (general)" inputs are only used if a game's inputs aren't modified in the source code or in the game's/parent's/source .cfg files. Games like Space Wars modify those inputs you pointed out in the source code (see next on why this game does). There is a hack to get around this limit if the input type is a normal type (example: Toobin), but it won't work in Space Wars because:
  2. Space Wars uses the input type "Other" for the buttons. "Input (general)" has only one "Other" input, so even if you could get around limit 1) above, All the buttons would be set to the same input button. The game can have more than one "Other" because of the "mask" and "defvalue" qualifiers, things that only are valid in cfg files, and are ignored in ctrlr files.
I can go into the work around for games that use normal player/buttons or player/joys, if you want me too. The thing is the work around is more work than just normal remapping is. And doesn't work for Space Wars anyway (at least not without editing the source and recompiling).

User avatar
cuavas
Posts: 99
Joined: Tue Nov 11, 2014 1:04 pm
Location: Sydney, Australia
Contact: Website

Re: I can't seem to map certain ports to a custom configuration file.

That hasn’t been true since MAME 0.234 – you can override specific controls for a system in controller configuration files: The OP started this thread on the day MAME 0.234 was released, so if they updated and tried again, it would have worked.

BlindRebel
Posts: 2
Joined: Tue Nov 23, 2021 6:56 pm

Re: I can't seem to map certain ports to a custom configuration file.

Thanks for the corrections and links. Just getting back into Mame, and didn't realize that happened. I'm glad to see the updates in the input system going on now. :D

Should bugs 01080 (https://mametesters.org/view.php?id=1080) and 07153 (https://mametesters.org/view.php?id=7153) be listed as fixed, then? The hand edit the .cfg file's NEWSEQ to DEFAULT hack still seems to work for most normal inputs (not Space War's OTHER types, though)..

Return to “MAME Discussion”