kodi-game / controller-topology-project

The Controller Topology Project models how controllers connect to and map to each other for all gaming history
Open Data Commons Open Database License v1.0
21 stars 15 forks source link

Remove non-existing buttons from PS Gamepad #275

Closed KOPRajs closed 7 months ago

KOPRajs commented 7 months ago

Remove non-existing buttons from PS Gamepad as requested in https://github.com/kodi-game/game.libretro.pcsx-rearmed/pull/26.

I've checked the layout for the PS Dual Analog controller as well, but that one seems to be correct.

garbear commented 7 months ago

I checked the strings file and it's definitely inconsistent: https://github.com/kodi-game/controller-topology-project/blob/d00f0e3713ad521688743b32918d097a5ce4d9b5/addons/game.controller.ps.gamepad/resources/language/resource.language.en_gb/strings.po

Don't we want L1/R1/L2/R2? And clearly the sticks should be removed from the strings file.

I'm not sure how this controller got so messed up, it must have happened when I split out "models" in https://github.com/kodi-game/controller-topology-project/pull/16. I think it's worth scrutinizing the other PS models.

One thing I noticed is that the triggers are classified as "digital": https://github.com/kodi-game/controller-topology-project/blob/master/addons/game.controller.ps.dualshock/resources/layout.xml#L23-L24

In the PCSX source, it looks like all buttons are digital, except for NeGcon: https://github.com/libretro/pcsx_rearmed/blob/master/frontend/libretro.c#L2849-L2856

The way analog/digital works is, the core queries whichever it wants. game.libretro stores both analog/digital values. If game.controller.ps.gamepad has analog buttons game.libretro will have both analog and digital values, but if game.controller.ps.gamepad has digital buttons then game.libretro will only have 0.0/1.0 for analog values.

So if analog buttons are defined in layout.xml, we'll have analog end-to-end until the core requests digital. But if digital buttons are defined in layout.xml, it'll act like a threshold filter in Kodi and "destroy" the analogness, so if the core requests an analog value even though the physical controller's triggers are analog, they'll be thresholded before reaching game.libretro, and the core can't access the underlying analog trigger values, it only gets 0.0/1.0.

You can see this new behavior in the Player Viewer. Press a trigger slowly, and you'll see game.controller.default fade gradually, but the PS controller on the top will be thresholded to a digital value.

I'll check both PCSX and beetle-psx sources to verify we want digital triggers, but it could use an extra pair of eyes.

garbear commented 7 months ago

I checked the sources and it looks like both PSX cores use digital buttons for L2/R2, so I think we're good to leave these as digital in layout.xml, unless the dualshock/dualanalog can be used for PS2 cores that have analog triggers.

KOPRajs commented 7 months ago

According to Wikipedia (https://en.wikipedia.org/wiki/DualShock) the original DualShock PSX (PS1) controllers only used digital buttons (except the analog sticks). The DualShock 2 for the PS2 seems to be the first one to introduce analog buttons.

garbear commented 7 months ago

Then we're all good, we just need to update the strings file.

garbear commented 7 months ago

Just remove these lines for english, weblate will handle the translations.

garbear commented 7 months ago

When you remove the strings replace them with the comment:

#empty strings from id 30011 to 30012
KOPRajs commented 7 months ago

When you remove the strings replace them with the comment:

#empty strings from id 30011 to 30012

Done.

garbear commented 7 months ago

Thanks! I'll push a new version to https://github.com/xbmc/repo-resources

EDIT: done: https://github.com/xbmc/repo-resources/pull/446

garbear commented 7 months ago

I also took care of updating the peripheral.joystick "codex" buttonmap: https://github.com/kodi-game/controller-topology-project/pull/275