libretro / mame2003-plus-libretro

Updated 2018 version of MAME (0.78) for libretro. with added game support plus many fixes and improvements
Other
183 stars 109 forks source link

Pole Position missing input controls #1699

Closed 9p6 closed 3 months ago

9p6 commented 4 months ago

The controls for polepos game are missing:

polepos-controls

The game requires 3 buttons (throttle, brake, shifter) but only one is available (Button 1) and it doesn't work.

mahoneyt944 commented 4 months ago

They aren't actually missing, this is a case where the control descriptors passed to retroarch didn't translate well. The buttons are all available in the mame menu however.

https://github.com/libretro/mame2003-plus-libretro/blob/3bfa9f89ab1ff4ac73a94e8ed1a9a7dbeb18d564/src/drivers/polepos.c#L498-L567

9p6 commented 4 months ago

They aren't actually missing, this is a case where the control descriptors passed to retroarch didn't translate well

How so? The controls are missing and the one that is present (Button 1) doesn't do anything. Pretty names are nice but here the controls are not available even with generic names.

The buttons are all available in the mame menu however.

I know but everything should work out of the box with gamepad. This is one of the games that is not available in FinalBurn Neo.

mahoneyt944 commented 4 months ago

Our mame inputs are translated and then passed to retroarch when the game loads....which is what you see in that menu. Some games, like this one, have controls that are not described in mame in a way that the "translation" picks up and therefore doesn't pass them off to retroarch. In this case specifically, the gas and brake are analog inputs not on/off buttons... so technically they aren't buttons but can be remapped as such in the mame menu.

We could potentially redescribe these in mame to better translate however, but there would have to be a consensus on what to map to. I suppose button1/2/3. But this ignores the true analog nature of them.

mahoneyt944 commented 4 months ago

Note to myself, ipt_pedal and ipt_pedal2 I believe should be picked up as joycode 5 and 6. Might need to accommodate this in the descriptor code if it's overlooked.

9p6 commented 4 months ago

In this case specifically, the gas and brake are analog inputs not on/off buttons... so technically they aren't buttons but can be remapped as such in the mame menu.

Ok I understand that this affects all arcade games with gas/brake pedals not just Pole Position and they all need to be handled in a consistent way.

We could potentially redescribe these in mame to better translate however, but there would have to be a consensus on what to map to. I suppose button1/2/3. But this ignores the true analog nature of them.

I'd say picking something arbitrary is better than current situation. In fact the steering wheel is already mapped to Left and Right buttons. Retropad has analog sticks and triggers they could be used as well, e.g.

LS or L-R: Steering Wheel L1/R1: Gearbox L2 or A: Brake R2 or B: Throttle

I haven't this in practice though. Probably worth checking at how they are mapped in racing games on consoles with similar controllers?

mahoneyt944 commented 3 months ago

Try this out: https://github.com/libretro/mame2003-plus-libretro/commit/b3982cb1a4c55bf543a8e0d69979b8ae4a607bb6 this should show the pedals now.

Edit: https://github.com/libretro/mame2003-plus-libretro/commit/d3b616a590e39d953c936281aff8efc51d361e7a should fix the gear shift binding

mahoneyt944 commented 3 months ago

@grant2258 do you know of a clean way to grab the default binding for IPT_PEDAL from inputport_defaults instead of hard coding the value like I did in the descriptor code in 'mame2003.c' in case this default would change in the future? https://github.com/libretro/mame2003-plus-libretro/commit/b3982cb1a4c55bf543a8e0d69979b8ae4a607bb6

It's functional as is but, not future proofed. Maybe we could snag it when we set the content flags then just check against it?

mahoneyt944 commented 3 months ago

Also, the gear selector was annoying me so I rewrote the code to move it to the side, similar to current mame. https://github.com/libretro/mame2003-plus-libretro/commit/3d88790f0318a4102ef38cae56b531d1f831946e

grant2258 commented 3 months ago

@mahoneyt944 the hard coding anywhere is a no go imho. There is more than one layout to choose from maybe it will appease gamepad users.

Ive spent way too much time on inputs already. It got to a point where I had to make two paths one for libretro and one for mame osd so we didnt loose functionality.

No one has made any progress in the libretro end and thats not surprising as its limited in scope what you can do with it. It is possible to get the defaults but the problem is you can have mapping libretro cant deal with like buttons across two different controllers for one player and as well as the not or and conditions that can be in the control sequence. There is no way too handle some combinations in libretro. As for your hard coding well there are I think 4 different layouts its probably only going to work properly on your particular layout of choice.

mahoneyt944 commented 3 months ago

Currently it does change with changing the layout. Retropad, 8button, 6 button, and fight stick etc. I just want to reference the actual default of IPT_PEDAL (just the joycode of that sequence). That way if we change the default down the road it will grab the latest default joycode. Should be a way to. I'll figure it out eventually. Just didn't see a easy way to without looping the entire structure

grant2258 commented 3 months ago

Well thats where the problem lies if it isint the default you need check that. Some games like midnight resistance use z x keys by default. I done a quick hack for kmdfmanic for his port ( note this only handles the non defaults) https://github.com/grant2258/mame2003-xtreme/blob/443944178f922abd60f6c4dd618b69d918d91482/src/libretro/libretro.c#L780-L815 . I personally have always thought multi changing macro layout is a mistake. People should be setting there input defaults in mame when not using a gamepad. That way you could conditionally map joypads if you wanted too. There is no way to properly handle a multi changing base default for defaults across all layouts. Another issue is when you pick a layout it changes the retroarch.cfg and if another core changes it they change each other and gets horrible. Ive spoken about this before in vain.

mahoneyt944 commented 3 months ago

I agree on that, certainly would be easier to only have retropad. Not sure how many people even switch the layout as it doesn't seem that useful to me. If anything it's more confusing.

grant2258 commented 3 months ago

The problem is if you start adding mapping without an option to only do it for gampepads that fit the retropad shape, users with arcade controllers will get there mapping all mixed up and will be guessing when you put a condition in that devaites from global mapping.

Its should only be applied to gamepads or if the user doesn't want to use mames global mapping. Right now FBNeo libretro port is a bomb scare on a arcade panel, because it custom maps certain conditions that dont translate well with a 6x6 or 8x8 panel layout.

I just use the standalone if using fbneo because it uses predictive mapping like mame does. For this port It would probably be best to leave it as a choice even if the default is on will please both end users and allow custom mapping for the retropad shape devices if you want too.

mahoneyt944 commented 3 months ago

Yeah it's a lot of work and you'll always upset someone. It would be cool to get away from all the mame to libretro conversions, but like you said not all controls are covered by libretro for arcade. But man would it be nice to just erase the joycode and keycodes and just use the libretro codes directly without conversion. If it could be done sensible. Probably a pipe dream though lol.

mahoneyt944 commented 3 months ago

How do you feel about removing the alternate layouts? Just use retropad, and let people remap either in retroarch or mame menu? Seems like that would be ok for most cases and much less to deal with on the input side. Just don't want anyone mad about removing them.

grant2258 commented 3 months ago

Its really up to you. I dont use the core anymore was never a fan of the macro though its a pretty nice for a macro to be honest.

mahoneyt944 commented 3 months ago

@9p6 I closed this as I believe it's fixed now for pole position. Let me know if it solved your issue. If not I'll address any issues you're still having. Thanks.