How does Input.add_joy_mapping() work?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Corruptinator
:warning: Old Version Published before Godot 3 was released.

I would like to try to remap or debug gamepad controllers and was told that I can test the mapping by using this code:

void add_joy_mapping( String mapping, bool update_existing=false )

Right now I have no idea how it works but I would like to try to use it in order to remap any gamepad controller buttons or joysticks for debugging purposes.

Any ideas on how that small line of code is appropriately used?

:bust_in_silhouette: Reply From: zlok

It’s used with SDL mappings.

here is an example of one I use.

	Input.add_joy_mapping("03000000ad1b000000f9000000010000,360 Afterglow,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,", true)

To get the string I used this tool. SDL2 Gamepad Tool by General Arcade