I decided to replace default Zippy joystick that came with iCade with Sanwa JLF-TP-8Y-MB without mounting plate that fits perfectly into mounting holes in the casing. In order to overcome some configuration issues created by physical mounting of the joystick I needed to look into xboxdrv.
One issue with the joystick is that you need to rotate it clockwise 90° so that connector will fit with plastic parts inside the casing. In this case your UP will become RIGHT, DOWN will be LEFT, so basically your axis will be switched.
You can map your keys easily in Retropie and the mapping will be reflected to all RetroArch emulators, but this will not reflect to runcommand.sh menu or emulators that have hard-coded joystick configuration.
In order to have identical working configuration in all emulators you could configure your usb encoder board to work with xboxdrv which will give it consistent behavior in all emulators and you can even map certain buttons per emulator.
First you need to exit your EmulationStation GUI via menu or by pressing F4.
Not to go into details how to install xboxdrv package I will just leave these screenshots for reference where you can find this options in retropie-setup script:
When you install xboxdrv end enable it, you will see a line added in your /etc/rc.local config file containing “”/opt/retropie/supplementary/xboxdrv/bin/xboxdrv” with a lot of switch options that you will need to modify later.
Trying to configure this to work as I expected is more work than I could ever imagine.
There is a wiki page dedicated to this topic, but I think I found an easier way to do it.
In order to use helper gamepad-util scripts created by Daniel Perelman, please install following packages first:
apt-get install python-pip python-dev
After you have installed these packages you will need to install python evdev with:
pip install evdev
Download the scripts from github first:
After you run the identify_evdev.py command with:
You will be presented with the event input device that you will need to use to configure:
Start the configuration and mapping script:
And follow the on-screen instructions as a result you will be presented with xboxdrv command line that you should put in your /etc/rc.local file.
In my case it looks like following:
"/opt/retropie/supplementary/xboxdrv/bin/xboxdrv" --id 0 --led 2 --deadzone 4000 --silent --trigger-as-button --next-controller --id 1 --led 3 --deadzone 4000 --evdev "/dev/input/event2" --evdev-keymap "BTN_JOYSTICK=a,BTN_THUMB2=b,BTN_TOP2=lb,BTN_BASE2=tr,BTN_BASE4=back,BTN_BASE3=start,BTN_BASE=tl,BTN_PINKIE=rb,BTN_TOP=y,BTN_THUMB=x" --evdev-absmap "ABS_X=y1,ABS_Y=x1" --axismap "" --mimic-xpad &
Blue colored text is the part of the command added from resulting identify_evdev.py and also I have removed few conflicting switches from original command added when xboxdrv was installed from retropie-setup script.
After you reboot or manually start the long command you have created you can start your EmulationStation agan and map the keys now using the newly recognized “Xbox Gamepad (userspace driver)” device.
In my case after input configuration was done in GUI following config file was created: /opt/retropie/configs/all/retroarch-joypads/Xbox\ Gamepad\ \(userspace\ driver\).cfg
input_device = "Xbox Gamepad (userspace driver)"
input_driver = "udev"
input_l_btn = "4"
input_load_state_btn = "4"
input_start_btn = "7"
input_exit_emulator_btn = "7"
input_up_axis = "-1"
input_a_btn = "0"
input_b_btn = "1"
input_reset_btn = "1"
input_enable_hotkey_btn = "6"
input_down_axis = "+1"
input_r_btn = "5"
input_save_state_btn = "5"
input_r2_btn = "10"
input_right_axis = "+0"
input_state_slot_increase_axis = "+0"
input_x_btn = "2"
input_menu_toggle_btn = "2"
input_select_btn = "6"
input_y_btn = "3"
input_left_axis = "-0"
input_state_slot_decrease_axis = "-0"
input_l2_btn = "9"
Since now I have my “Bus 001 Device 004: ID 0079:0006 DragonRise Inc. Generic USB Joystick” mapped as generic “Xbox Gamepad (userspace driver)” you can have a look at tweaking your configuration in various ways, for example different key-mapping per emulator. You can read about this more at the wiki page.