Universal-G-Code-Sender
Universal-G-Code-Sender copied to clipboard
How can I add different custom joystick configurations?
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
Yes you currently need to change the configuration file and recompile the software. It is a nice idea to make the configuration more dynamic.
Any idea when this option could be implemented?
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-
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