Log In  

Cart #gamepad_tester-5 | 2024-03-20 | Embed ▽ | License: CC4-BY-NC-SA
12

A quick gamepad tester I wrote for picotron to test the gamepad api. The tester also supports changing the player number to use multiple gamepads.

I labeled the buttons according to their corresponding keyboard inputs, and layed out the buttons according to how they mapped on my xbox controller.

The two buttons in the middle are buttons 6 and 7, which the readme lists as reserved, but I think represent start and select buttons.
Button 6 seems to map to the start and home buttons, as well as the enter key.
Button 7 doesn't seem to map to anything yet.

As of writing there seems to be a bug in picotron where higher player numbers don't work correctly.
player 0 works properly, but odd numbered players, such as player 1, will have their inputs split across two controllers.

I've also confirmed that as of writing picotron only fully supports up to 4 controllers. If you connect a 5th controller, half of their inputs will register on player 7, and player numbers higher than 7 aren't supported so only half the controller will work.

Update:
Now highlights the player tab when that player's controller has active inputs, making it easier to find what player your controller is mapped to.

Update 2:
Now reports analogue values for the sticks

P#143045 2024-03-15 02:26 ( Edited 2024-03-20 23:35)

3

How did you export this as a png?

P#143046 2024-03-15 02:27
3

It wouldn't let me export on windows so I tried on my steamdeck, which runs linux

P#143047 2024-03-15 02:32
1

I started writing the same thing to make a dual-stick shmup, and discovered there are some bugs in Picotron's input. Arrow keys, d-pad and joysticks aren't mapped to the 0,1,2,3 directions properly, at least in Windows 10.

P#143093 2024-03-15 12:30

Nice work!
There is a problem pointing straight x/y axis with sticks. I think v2 of this app must show the stick direction as a vector :)

P#143096 2024-03-15 12:37

Joystick axis are being reported as diagonals too often, I think the circle is not evenly divided by either Picotron or Gamepad_tester. https://youtube.com/shorts/e5BfUavQVcQ?feature=share

P#143102 2024-03-15 13:06 ( Edited 2024-03-15 13:11)
1

I wrote my own gamepad tester app and I can confirm this input issue is in Picotron itself. https://twitter.com/conorokane/status/1768608063886651458

P#143107 2024-03-15 13:17

I've tested it with 5 different gamepads so far and strangely I've found the diagonals issue only happens with some of them! It seems with some controllers picotron reports any nonzero axis value as being true for that direction?

In particular my generic xbox and switch controllers have worked properly with picotron whereas all of my playstation controllers have the diagonals issue others have described. (both my generic and official ps4 controller, as well as my victrix controller when set to pc mode has the issue)

P#143117 2024-03-15 14:06

I'm pretty sure the axis thing is not a real issue in the tester.
Even more! And if your gamepad gives you easy x/y axis -- it is a one with bad sticks that tend to stick to axis.
In real world the real "only X" or "only Y" have to be triggered ONLY when sticks are moved STRICTLY vertical or horizontal, that is pretty difficult to do with this analog stuff (and the more precise stick is, the harder the job is).
That is why I asked for the vector version of the tester. But it is possible ONLY if picotron has an API to get stick angles and not a binary values

P#143153 2024-03-15 16:51

I don't think picotron currently has a way to get analogue values for the sticks, the value returned by the btn function is just true or false.

P#143188 2024-03-15 19:36
1

@Cutievirus & @maleficmax Actually, one of the first tests I did was to print the values of the btn function, which showed that the value returned by btn is actually a number! Here's a basic test program to show the printed values:

function _draw()
    cls()
    for i=0,15 do
        ?tostr(btn(i)),0,i*10,btn(i) and 27 or 22
    end
end
P#143283 2024-03-16 10:30
1

Oh I didn't know that! I got errors when trying to treat them as numbers because they're false when at rest, so I assumed it was just a limitation.

It's a bit strange to switch between boolean and numbers like that but I guess that's how it has to be considering zero is truthy in lua.

I updated the tester to report analogue values now!

P#143302 2024-03-16 13:31

@Cutievirus Wow! Great news! It works awesome now, exactly as intended!
Thank you!

P#143363 2024-03-16 19:59
1

@Cutievirus - great to see the analog sticks in action! I'm quite excited for making dual-stick shmups in Picotron now.

P#143703 2024-03-18 14:55

Also, I noticed at line 59 you're normalizing the vector if both axes have input. Isn't that only required for keyboard input? The circular gate on the joystick means you don't need to do this for analog joystick inputs.

P#143707 2024-03-18 15:07 ( Edited 2024-03-21 06:27)

@Conor
I checked the outputs and when you do a diagonal input both values sit at about 181, which even seems to be true for keyboard input.
So you're right that I don't need to normalize them, it seems like picotron normalizes them for us which is pretty convenient.

P#143995 2024-03-20 23:17

[Please log in to post a comment]