Here are the commands just for the buttons.
So button B is mapped to button 0 on my joystick.
So I could change button b to 0,1,2,3,4,5….
input_player1_b_btn = 0
input_player1_a_btn = 1
input_player1_y_btn = 2
input_player1_x_btn = 3
input_player1_l_btn = 4
input_player1_r_btn = 5
input_player1_start_btn = 9
input_player1_select_btn = 8
input_player1_l2_btn = "6"
input_player1_r2_btn = "7"
input_player1_l3_btn = "11"
input_player1_r3_btn = "12"
Now your probably asking “WHICH BUTTON IS 0?” or “is Start button 6 or 7 on my controller”
Theres an easy way to find out.
Exit emulation station and go to the raspberry pi terminal
type this command
jstest /dev/input/js0
Now this will load a joystick test, press a button and you will find out which number it corresponds to.
To exit jstest press ctrl+c
Good luck!