The idea behind button mapping and input button index

Hi there, lately I’ve been digging to understand controller mapping concept and already asked a question related to it: SDL Game controller button mapping issue

Before that I realized that I should understand every concept about mapping and I’m doing observations.
I connected 2 of my controllers and I use https://gamepad-tester.com/ for my observations

This is when I press leftmost button of the right button group (X for XBox, Rectangle for PS4, “4” for my usb controller)

image

On PS4: Button 2 is highlighted
On USB Generic: Button 3 is highlighted

The result says they have different correspondance, which might be OK for every distict controller. This is my first observation.

The other observation is, when I use SDL_GameControllerGetButton() to read button states:
state = SDL_GameControllerGetButton(m_pGameController, (SDL_GameControllerButton)bIndex)

The leftmost button (X, Rectangle, “4”) of right button group always corresponds to index 2 (index starts with 0). What I mean is when I press the leftmost button and then use SDL_GameControllerGetButton(m_pGameController, (SDL_GameControllerButton)2), then I’m able to read the the button state, for both USB and PS4 controller. This is my second observation.

So, can I state this conclusion/generalisation?
Game controllers’ physical button correspondance with SDL_GameControllerGetButton() is always the same. Whatever the controller is:

Right Button Group:
left = SDL_GameControllerGetButton(2) // Rectangle, 4
right = SDL_GameControllerGetButton(3) // Triangle, 2
bottom = SDL_GameControllerGetButton(0) // X, 3
up = SDL_GameControllerGetButton(1) // Circle, 1

Middle Button Group:
back = SDL_GameControllerGetButton(4)
guide= (not exist on USB controller)
start= SDL_GameControllerGetButton(6)
touch= (not exist on USB controller)

DPad:
left = SDL_GameControllerGetButton(13)
right = SDL_GameControllerGetButton(14)
up= SDL_GameControllerGetButton(11)
down= SDL_GameControllerGetButton(12)

Back Group:
RT = SDL_GameControllerGetButton(10)
RB = SDL_GameControllerGetAxis(5)
LT = SDL_GameControllerGetButton(9)
LB = SDL_GameControllerGetAxis(4)

(So if I had an XBox controller and press X button (left button) then I should use SDL_GameControllerGetButton(2) to read its state?)

Also:
For USB game controller this mapping is used:
“03004f8e790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows”

For PS4 controller no mapping is found. The results above are get by this configuration