nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
5.03k stars 488 forks source link

Wired controller button mapping #1298

Open borbware opened 3 years ago

borbware commented 3 years ago

On the PS4 controller, TIC-80 maps controls as

L2, R2, R1, select (share), start (options), touchpad = open menu
triangle = Y
circle = X
square = A
cross = B

A better mapping would be

select (share), start (options), touchpad = open menu
triangle = Y
circle = B
square = X
cross = A

Also, would it be possible to detect from code if a PS4 controller is connected so you could use sprites of the triangle, circle, square, cross buttons in-game to represent the buttons?

Or rather, detect if there was any controller at all! I'm now using a checker function with a logic of "was a btnp and a corresponding keyp pressed at the same time? If not, then input must be coming from a controller".... It works 90% of the time!

nesbox commented 3 years ago

I'm not sure it will be possible to detect controller type in the future. Also, please look at SUPER MEAT BOY TIC-80 DEMAKE https://tic80.com/play?cart=1512, it has interesting input type detection on startup. Thanks.

borbware commented 3 years ago

yeah, i'm using similar trickery myself. ofc, i could just make my own button mapping screen where i could also make the player choose the icons they want to use for the controller buttons.

borbware commented 3 years ago

It seems this is actually (almost) fixed on 0.80. The ABXY buttons are mapped correctly, but dpad is not working anymore, and the ESC is mapped to the L3 button, instead of Start. I've expanded on the matter here.

borbware commented 3 years ago

Correction: this is not about the PS4 controller, it's more general.

I could reproduce the issue with an USB-connected SN30 pro (XINPUT controller). When the same controller was connected via bluetooth, the dpad started working.

So to wrap-up:

DannyCork commented 2 years ago

ps4 controller working fine here I'm using 1.0.19360 dev

aliceisjustplaying commented 6 months ago

@borbware is this still an issue?

borbware commented 6 months ago

Oh, I'll let you know when I've managed to check it with my PS5 controller.