CoolCV joystick configurator
-
Before posting things about specific controller mappings, what is really not that clever...
I recognized using 2 different (original) PS3 controllers, and detected, that it may happen, the numbers of the buttons are not always the same! even for the first channel. This may depend on the driver you use...
Nevermind, so I guess this is a quick and dirty solution, but works like a charm - better than editing this crazy file manually... :)
Here is a little script. put it into your pi's home (beside the coolcv_mappings.txt) and name it e.g. coolcv_map, and give chmod +x on it.IMPORTANT (without further script adaption):
- This is a quick and dirty solution with some minor issues left open.
- All the buttons you map need a line containing already a "joy0_" content.
it's not tested, and may not work, if there is no joy-content within the line!
(feature idea: sed removes the joy part completely and the next patching sed call will add explicitely the resulting joy-part.) - ~/coolcv_mappings.txt has to exists - script will patch it here directly!
- There is only oneplayer mapping. If you need, then extend the script in the same way/manner.
a novice coder shall get this working without further instructions. - Copy your current coolcv_mappings.txt to a bak-file - I'm not responsible if you loose your settings :)
- Your js0 device has to be present - if its BT, and switched off, then you'll get a file-not-found error, due RPI will remove the /dev/input/js0
- HINT: Working with symlinks on the mapping-file works like a charm you can symlink it around and around where you want. Tested this with my solution here and link the file over to the configs folder. It works. so feel free to use symlinks. - Happy gaming!
Maybe there is somebody that puts this into the retropie in any way - maybe into the coloeco-configuration section.
This is a bit offtopic in this context ... BUT... to say thanks, you can do me / us a flavor also...
Beside - to say thanks, please find a way to give a shortcut to emulationstation to delete the current rom. Please no hints to file-manager, or the UI-menu scrolling down with that "Delete" button in the metadata-editor - this is all not what I want. I need a quick and dirty button like that one that manages the favorite add/remove.Well well, now the script ... here you are...
#!/bin/bash function get { printf "%-20s: " "$1" read nr < <(jstest --event /dev/input/js0 | grep -m 1 "type 1, time .*, number .*, value 1" | cut -d, -f3 | cut -d" " -f3) echo $nr v=$(cat coolcv_mapping.txt | grep $2 | sed s/joy.*/joy0_$nr/g) sed -i -e "s/$2.*/$v/g" coolcv_mapping.txt # This is the commented idea to remove joy part and insert it explicitely... # You see, that the joy part is removed completely from the line and is # inserted explicitely within the patching sed line. # if you want to test it, replace the last 2 according lines with those two: #v=$(cat coolcv_mapping.txt | grep $2 | sed s/joy.*//g) #sed -i -e "s/$2.*/$v joy0_$nr/g" coolcv_mapping.txt } echo ==================================================== echo CoolCV button mapper by Fishy_PKAT151... get "Up" up_1 get "Right" right_1 get "Down" down_1 get "Left" left_1 get "Left trigger" left_button_1 get "Right trigger" right_button_1 get "Key 1" key1_1 get "Key 2" key2_1 get "Key 3" key3_1 get "Key 4" key4_1 get "Key *" key*_1 get "Key #" key#_1 get "Save" key_save get "Restore" key_restore get "Exit" key_exit get "Pause" key_pause get "Reset" key_reset
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.