Universal-G-Code-Sender icon indicating copy to clipboard operation
Universal-G-Code-Sender copied to clipboard

How can I add different custom joystick configurations?

Open hmantz opened this issue 3 years ago • 3 comments

How can I add different custom joystick configurations? Do I have to edit gamecontrollerdb.txt and compile the entire code again every time I add a new one? If yes, is it possible to have gamecontrollerdb.txt (or some other text configuration file) in the settings directory and be able to edit it with a text editor without needing to recompile?

Thanks

Originally posted by @hmantz in https://github.com/winder/Universal-G-Code-Sender/issues/1565#issuecomment-838208993

hmantz avatar May 11 '21 14:05 hmantz

Yes you currently need to change the configuration file and recompile the software. It is a nice idea to make the configuration more dynamic.

breiler avatar May 15 '21 16:05 breiler

Any idea when this option could be implemented?

hmantz avatar May 16 '21 10:05 hmantz

The API for accessing the gamepads/joystick doesn't allow dynamic configurations. Otherwise it would have been easy to read the gamecontrollerdb.txt and then append your configuration from the UGS settings file.

To achieve this behaviour you would need to write a new temporary file which is then loaded: https://github.com/winder/Universal-G-Code-Sender/blob/master/ugs-platform/ugs-platform-plugin-joystick/src/main/java/com/willwinder/ugs/nbp/joystick/service/JoystickServiceImpl.java#L94

We are using an old variant of the library, the newer one looks like it has this option of adding mappings dynamically: https://github.com/electronstudio/sdl2gdx https://electronstudio.github.io/sdl2gdx/org/libsdl/SDL_GameController.html#addMapping-java.lang.String-

breiler avatar May 17 '21 05:05 breiler

It will now be possible to add custom gamepad mappings without the need to recompile. Available in the nightly builds and will be available in the next version 2.1.7

breiler avatar Mar 15 '24 15:03 breiler