MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

midget35
MAME Fan
Reged: 02/20/07
Posts: 41
Send PM


MAME Config - input changes
#396120 - 05/01/23 01:56 PM


Hi all. I am a developer and have written some tools to auto-generate MAME xml input files. In recent months, I understand that the MAME input system has changed somewhat.

To this end, I notice that some port types have changed. e.g.

P1_JOYSTICK_UP -> JOYCODE_1_HAT1UP

JOYCODE_1_BUTTON8 -> JOYCODE_1_SELECT

... is there a definitive resource on what all these changes are, even if it is just a link to the MAME pull request(s) that saw these renames?

Really appreciate any pointers here. Thanks!



RobbbertModerator
Sir
Reged: 08/21/04
Posts: 3207
Loc: A long way from you
Send PM


Re: MAME Config - input changes new [Re: midget35]
#396121 - 05/01/23 03:28 PM



> ... is there a definitive resource on what all these changes are, even if it is just
> a link to the MAME pull request(s) that saw these renames?

This? https://docs.mamedev.org/advanced/ctrlr_config.html



midget35
MAME Fan
Reged: 02/20/07
Posts: 41
Send PM


Re: MAME Config - input changes new [Re: Robbbert]
#396122 - 05/01/23 03:44 PM


Thank you for the link. Was looking at this. But I don't believe it states which button / input names are changed.

And I'm still digging into this... but I think some button names have just been out and out swapped. So 'Button 8' may have changed from being start to right analog btn. Not sure though.

I get the impression it is only causing me headaches tho, so that's good. Doesn't seem to have confused many other devs



RobbbertModerator
Sir
Reged: 08/21/04
Posts: 3207
Loc: A long way from you
Send PM


Re: MAME Config - input changes new [Re: midget35]
#396123 - 05/01/23 04:12 PM


> Thank you for the link. Was looking at this. But I don't believe it states which
> button / input names are changed.
>
> And I'm still digging into this... but I think some button names have just been out
> and out swapped. So 'Button 8' may have changed from being start to right analog btn.
> Not sure though.
>
> I get the impression it is only causing me headaches tho, so that's good. Doesn't
> seem to have confused many other devs

I don't use controllers so can't help you further. Maybe talk to cuavas since he did the changes.



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4469
Loc: Melbourne, Australia
Send PM


Re: MAME Config - input changes new [Re: midget35]
#396124 - 05/01/23 04:20 PM


The codes generated depend on the build configuration, input module, and the kind of controller. The source files are here: https://github.com/mamedev/mame/tree/master/src/osd/modules/input



midget35
MAME Fan
Reged: 02/20/07
Posts: 41
Send PM


Re: MAME Config - input changes new [Re: Vas Crabb]
#396125 - 05/01/23 05:13 PM


Thanks. So... for xinput (joystickprovider = xinput)... it looks like there are some changes:

- Button 9 is now button 7.
- Button 10 is now button 8.

... Right trigger behaviour seems to have been moved to right analog stick x axis.

Big changes indeed. Is there a way to map to the old system? I see your notes on sdl input reversion but can it be done for dinput and xinput (preferably with mame.ini setting)?

Thanks again.



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4469
Loc: Melbourne, Australia
Send PM


Re: MAME Config - input changes new [Re: midget35]
#396126 - 05/01/23 05:26 PM


No, you can’t go back. The new defaults make more things work out-of-the-box with more controllers. The previous approach led to all sorts of stupid workarounds like the one that led to this issue which is the thing that pushed me over the edge to spend two months working on it.



midget35
MAME Fan
Reged: 02/20/07
Posts: 41
Send PM


Re: MAME Config - input changes new [Re: Vas Crabb]
#396127 - 05/01/23 05:37 PM


Thanks again, Vas.

So is the best way to find old > new mappings just to go through all axis on xinput controllers and look at the input xml changes? Is there a centralised list of what got swapped?

Figure it's worth asking. Not complaining. Just trying to update 100+ input configs expeditiously. Cheers.



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4469
Loc: Melbourne, Australia
Send PM


Re: MAME Config - input changes new [Re: midget35]
#396128 - 05/01/23 07:48 PM


You should really just use the Input Devices menu to see what the tokens are for a given controller. It’s not just a matter of things being “swapped”, it recognises more kinds of controllers and gives better assignments.



midget35
MAME Fan
Reged: 02/20/07
Posts: 41
Send PM


Re: MAME Config - input changes new [Re: Vas Crabb]
#396129 - 05/01/23 08:04 PM


Oh I have a very good understanding of how the input system markup works. For anyone that wants to update their manually created input configs, the following will help.

You'll want to carefully regex the following for xinput.

JOYCODE_1_DPAD -> JOYCODE_1_HAT1
JOYCODE_1_BUTTON8 -> JOYCODE_1_SELECT
JOYCODE_1_BUTTON7 -> JOYCODE_1_START
JOYCODE_1_BUTTON10 -> JOYCODE_1_BUTTON8
JOYCODE_1_BUTTON9 -> JOYCODE_1_BUTTON7
JOYCODE_1_ZAXIS -> JOYCODE_1_SLIDER2
JOYCODE_1_RZAXIS -> JOYCODE_1_SLIDER1

This basically means that the buttons we had before that were assigned to Coin1 and Start1 map to L3 and R3, so be careful about the order you make those regex changes.

Also, it looks to me like we might see more renaming in the future. I don't see the naming consistency in:

- JOYCODE_1_RZAXIS = Right analog vertical, and
- JOYCODE_1_ZAXIS = Right analog horizontal

Cheers.



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4469
Loc: Melbourne, Australia
Send PM


Re: MAME Config - input changes new [Re: midget35]
#396130 - 05/01/23 08:53 PM


That’s only true for an Xbox style dual analog pad though. An Xinput fight pad has different tokens, as does an Xinput guitar controller, or whatever.

The de facto standard for dual analog DirectInput controllers (e.g. Logitech gamepads and PlayStation adapters) is to make the left thumb stick X/Y and the right thumb stick Z/Rz. The newer PlayStation pads with analog triggers extend that by making the left trigger Rx and the right trigger Ry. Xinput dual analog pads in MAME now follow the convention for the thumb sticks.

When Microsoft added support for Xbox pads in Windows, they went out of their way to ensure that it wouldn’t work well with existing software via DirectInput. They made the right thumb stick Rx/Ry and combined the triggers into a single Z axis, as well as making it impossible to use vibration features via the DirectInput API. For whatever reason, Nintendo Switch controllers also se Rx/Ry for the right thumb stick, but they don’t have analog triggers.

Blame Microsoft for going out of their way to make Xbox pads work poorly with DirectInput to try and push developers to use the Xinput API (and hence only support Xbox-style peripherals), and blame Brad Hughes for doing a shoddy job of Xinput support in MAME in the first place.



midget35
MAME Fan
Reged: 02/20/07
Posts: 41
Send PM


Re: MAME Config - input changes new [Re: Vas Crabb]
#396131 - 05/01/23 09:06 PM


Ah I see. Thanks for the info there, Vas. I was not aware of this: "the right thumb stick Z/Rz".

In that case I don't see that there will be future naming changes needed. Looks like you've nailed it

As to your point: "That’s only true for an Xbox style dual analog pad"...

Again - absolutely right. That is an important qualifier and I am happy to make that super clear to anyone else reading my last comment: if you use ps/xbox style gamepads with xinput, the above regex changes will help you, but more exotic controllers may not benefit.

Finally, I don't want to blame Brad or anyone else for how MAME handles input. In fact - I think the input system in MAME is excellent, and your changes in MAME 0.252 make it even more powerful.


Pages: 1

MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 142 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 328