Guide: Advanced Controller Mappings
-
@spud11 ... That Commando might be the Sega commando, not the Capcom one. Unless memory is playing tricks on me, I'd have a hard time playing the Capcom one with 4 directions only. I never played the Sega one, so that's why I'm guessing it's that one. I may be wrong though.
Also unsure of whether Rolling Thunder wouldn't allow you to turn while crouching, which would suggest that there'd be use in 8-way controls.
Still, great list, will certainly keep it for reference!
-
@mediamogul That made me laugh. By the way, I have got it working up to a point using the @madhorse technique.
The code is below, and a couple of interesting pointers for anyone else who finds themselves stuck and is not sure why:
(a) the issue you alluded to with the --device-name problem definitely is a problem. It really doesn't seem to like any "white space" or "brackets" in the name. Adding underscores instead seems to work;
(b) the start of each line shouldn't start with a number. For example, I've got "amiga1" for the name of my first Amiga joystick. If I had that as "1amiga", it would spit out errors. I think that's why my previous code wasn't working - because I had names like "8way" and "4way" for my joysticks. Starting a line with a number is verboten;
(c) although I had set up a separate folder on the pi for my cocktail (arcade vertical) games, I needed to point to mame-libretro to get it working as I'm using lr-mame2003;
(d) it's possible to get 2 (or more) joysticks working at the same time by using & but you have to remember to refer back to the "basic" joystick configuration each time.
#!/bin/sh ## Uncomment one or all of the following if you need to find some information about the emulator or roms ## Name of the emulator #echo $1 >> /dev/shm/runcommand.log ## Name of the software used for running the emulation #echo $2 >> /dev/shm/runcommand.log ## Name of the rom #echo $3 >> /dev/shm/runcommand.log ##Executed command line #echo $4 >> /dev/shm/runcommand.log ### The FUN begins #Get ROM name striping full path rom="${3##*/}" ### Set variables for your joypad and emulator ### Basic Configurations - Standard controller mappings basic="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void" ### Extended Configurations ### Specific emulator configurations or any other parameters you will need only for some emulators scummVM="--axismap -Y1=Y1,-Y2=Y2 \ --ui-axismap x1=REL_X:10,y1=REL_Y:10 \ --ui-buttonmap a=BTN_LEFT,b=BTN_RIGHT,start=KEY_F5,back=KEY_ESC \ --ui-buttonmap guide=void,x=void,y=void,lb=void,rb=void,tl=void,tr=void,lt=void,rt=void,back=void \ --ui-axismap x2=void" amiga1="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Amiga_Joystick_Player_1_xboxdrv" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_TRIGGER=x,BTN_THUMB=y,BTN_THUMB2=a,BTN_PINKIE=b,BTN_BASE3=back,BTN_BASE6=start" amiga2="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \ --device-name "Amiga_Joystick_Player_2_xboxdrv" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy1restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1_-_4-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --four-way-restrictor \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy1unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1_-_8-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy2restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \ --device-name "Player_2_-_4-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --four-way-restrictor \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy2unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \ --device-name "Player_2_-_8-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy3restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \ --device-name "Player_3_-_4-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --four-way-restrictor \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy3unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \ --device-name "Player_3_-_8-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy4restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \ --device-name "Player_4_-_4-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --four-way-restrictor \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" joy4unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \ --device-name "Player_4_-_8-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start" fourway="--four-way-restrictor" invert="--ui-buttonmap du=KEY_DOWN,dd=KEY_UP" ### Kill Command xboxkill="sudo killall xboxdrv" ### Execute the driver with the configuration you need # $1 is the name of the emulation, not the name of the software used # it is intellivision not jzintv case $1 in mame-libretro) case $rom in "amidar.zip"|"atetris.zip"|"puckman.zip") # Configuration used only for these ROMs $xboxkill joycommand="$basic $joy3restricted & $basic $joy4restricted &" eval $joycommand ;; *) # Configuration for every other ROMs on this emulator $xboxkill joycommand="$basic $joy3unrestricted & $basic $joy4unrestricted &" eval $joycommand ;; esac ;; daphne) ;; scummvm) $xboxkill joycommand="$basic $scummVM &" eval $joycommand ;; amiga) $xboxkill joycommand="$basic $amiga1 & $basic $amiga2 &" eval $joycommand ;; intellivision) ;; esac
So where I'm up to with this is that the Amiga joysticks work.
But the same can't be said for the "cocktail" games. When I start Amidar for example, the little yellow writing at the bottom comes up and it informs me that the 4 DragonRise joysticks are set up and also starts joy3restricted and joy4restricted, but that they are unconfigured. The result of that is that I can't press any joystick buttons at all once the rom has begun (although the keyboard still works). Using TAB to get to Mame's internal menu doesn't help as I can't change the buttons. Exiting out of the rom with the keyboard triggers the runcommand-onend.sh file killing xboxdrv and everything then works as per normal using the xpad driver. (If I start Amidar without loading xboxdrv, then everything works but of course I'm using an 8-way unrestricted joystick.)
To troubleshoot, as I'm using lr-mame2003, using putty I have first started xboxdrv for those 2 joysticks (joy3restricted and joy4restricted), then fired up retroarch and configured those joysticks as users 5 and 6, saving the configurations to retroarch.cfg.
I then go back, start Amidar again, and note that joy3restricted and joy4restricted have started, but once again - no buttons work and using the mame TAB interface again doesn't do anything.
Not sure where to go from here. Any help would be great please.
-
@pjft I definitely can't take credit for the list, but I imagine you'll be right - that some of the games aren't really 4 way. I have the same recollection as you about Commando. I'm sure it's 8 way.
It's going to be trial and error, I feel, for a lot of these games, particularly as there's going to be a need to match the game names to the actual rom names. Haven't figured out yet an automatic method of doing this to save time. May have to do it manually.....
-
@spud11 Thanks a ton for the list! BTW I ran into that same error too with the devicename not working when having spaces in it. Glad to know I wasn't crazy and it happened to others as it took me forever to troubleshoot.
-
@Hubz No problems. It was mediamogul who picked it up.
-
Glad to see things working out here. I'll add the information about
--device-name
to the guide . -
@mediamogul That's a good idea.
I'm still having a bit of trouble as per 3 posts ago. Hoping you might still be able to help, if possible, please.
-
Have those particular virtual controllers been mapped through Emulation Station like any other controller? If not, it could be that there's no automatic configuration for them at
/opt/retropie/configs/all/retroarch/autoconfig
for RetroArch to draw on. -
@mediamogul Hi. Yes, they are in fact both mapped:
Player_3_-_4-Way_Joystick_xboxdrv.cfg
input_driver = "udev" input_device = "Player_3_-_4-Way_Joystick_xboxdrv" input_b_btn = "1" input_y_btn = "3" input_select_btn = "8" input_start_btn = "9" input_up_axis = "+0" input_down_axis = "-0" input_left_axis = "+1" input_right_axis = "-1" input_a_btn = "0" input_x_btn = "2"
Player_4_-_4-Way_Joystick_xboxdrv.cfg
input_driver = "udev" input_device = "Player_4_-_4-Way_Joystick_xboxdrv" input_b_btn = "1" input_y_btn = "3" input_select_btn = "8" input_start_btn = "9" input_up_axis = "+0" input_down_axis = "-0" input_left_axis = "+1" input_right_axis = "-1" input_a_btn = "0" input_x_btn = "2"
And thinking about it, I'll need to map the corresponding 8 way configs to Users 7 and 8 in Retroarch too, given that all other roms will rely on those 8 way configs. Personally, I'd just prefer for the xpad (rather than xboxdrv) driver to work for normal 8 way mame-libretro joystick games, but when I added the hash to the below, xboxdrv wouldn't load at all:
;; *) # Configuration for every other ROMs on this emulator $xboxkill # joycommand="$basic $joy3unrestricted & $basic $joy4unrestricted &" # eval $joycommand ;;
I've also tried to edit, without success, the individual amidar.zip.cfg file which is as follows by adding the extra line at the top:
# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line input_player3_joypad_index = 5 video_allow_rotate = "true" video_rotation = "3" aspect_ratio_index = "19" video_aspect_ratio_auto = "false" video_aspect_ratio = "1.75" #include "/opt/retropie/configs/all/retroarch.cfg"
-
You may just want to map those final two controllers for keyboard input. I have most of my controllers mapped like that anyway. RetroArch will still respect all the controller button mappings, but have a separate set for keyboard keys as well. An example of one and two player keyboard controls from my own
retroarch.cfg
is:input_player1_a = "a" input_player1_b = "b" input_player1_y = "y" input_player1_x = "x" input_player1_start = "t" input_player1_select = "e" input_player1_l = "l" input_player1_r = "r" input_player1_left = "left" input_player1_right = "right" input_player1_up = "up" input_player1_down = "down" input_player1_l2 = "d" input_player1_r2 = "f" input_player1_l3 = "c" input_player1_r3 = "v" input_player2_a = "k" input_player2_b = "m" input_player2_y = "o" input_player2_x = "n" input_player2_start = "num9" input_player2_select = "num0" input_player2_l = "p" input_player2_r = "q" input_player2_left = "g" input_player2_right = "h" input_player2_up = "i" input_player2_down = "j" input_player2_l2 = "s" input_player2_r2 = "u" input_player2_l3 = "w" input_player2_r3 = "z"
-
So far I am mainly using this for dosbox to capture the mouse. Are there reason to use this as the main controller rather than the xpad default mapping ?
The systems I am suing are :
DosBOX
Vice (C64)
Amiberry (amiga)
Daphne (Dragon's Lair)
Mame 2003I am currently initiating the xboxdrv in the .sh of each game for DosBOX.
Thanks
-
@mediamogul Hi. I had my input references slightly wrong (
input_player1_joypad_index = 4
). I'm assuming the 4 corresponds to User 5's input in Retroarch (which in my case is now mapped to Player_3_-4-Way_Joystick_xboxdrv) and 5 corresponds to User 6's input in Retroarch (mapped to Player_4-_4-Way_Joystick_xboxdrv). So I have amended the input indexes below to reflect that.Adapting your code, to change the settings for Amidar only at the moment, I would just change amidar.zip.cfg as follows:
# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line input_player1_joypad_index = 4 input_player1_a = "a" input_player1_b = "b" input_player1_y = "y" input_player1_x = "x" input_player1_start = "t" input_player1_select = "e" input_player1_left = "left" input_player1_right = "right" input_player1_up = "up" input_player1_down = "down" input_player2_joypad_index = 5 input_player2_a = "k" input_player2_b = "m" input_player2_y = "o" input_player2_x = "n" input_player2_start = "num9" input_player2_select = "num0" input_player2_left = "g" input_player2_right = "h" input_player2_up = "i" input_player2_down = "j" video_allow_rotate = "true" video_rotation = "3" aspect_ratio_index = "19" video_aspect_ratio_auto = "false" video_aspect_ratio = "1.75" #include "/opt/retropie/configs/all/retroarch.cfg"
After that, I would just remap the buttons in game with the TAB menu?
Thanks.
-
@spud11 said in Guide: Advanced Controller Mappings:
After that, I would just remap the buttons in game with the TAB menu?
After that, RetroArch just assumes the keyboard presses are coming from it's own "Retropad" controller as the proper button presses, so it'll work without any further remapping.
-
@mediamogul Thanks, mediamogul. Will try later in the day and let you know how I go.
-
@mediamogul Hi. I've now tried the approach of mapping the keys, but no luck. Nothing works automatically.
# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line input_player1_joypad_index = 4 input_player1_a = "a" input_player1_b = "b" input_player1_y = "y" input_player1_x = "x" input_player1_start = "t" input_player1_select = "e" input_player1_left = "left" input_player1_right = "right" input_player1_up = "up" input_player1_down = "down" input_player2_joypad_index = 5 input_player2_a = "k" input_player2_b = "m" input_player2_y = "o" input_player2_x = "n" input_player2_start = "num9" input_player2_select = "num0" input_player2_left = "g" input_player2_right = "h" input_player2_up = "i" input_player2_down = "j" video_allow_rotate = "true" video_rotation = "3" aspect_ratio_index = "19" video_aspect_ratio_auto = "false" video_aspect_ratio = "1.75" #include "/opt/retropie/configs/all/retroarch.cfg"
The joypad index numbers are correct - 4 and 5 - reflect the 2 4-way xboxdrv scripts.
I also inserted the same values (as above) in the main retroarch.cfg file. They worked in the Retroarch menu in emulationstation, as the "x" and "y" keys had become "a" and "b", as per the script.
I'm clearly missing something along the line somewhere, but just not sure what. Now that I've mapped the keys in Retroarch, should I also be changing the xboxdrv scripts in some way too?
-
Now that I've mapped the keys in Retroarch, should I also be changing the xboxdrv scripts in some way too?
You'll need to make sure the intended controllers are mapped to the corresponding keyboard keys that match your new RetroArch entries.
-
@mediamogul Hi. Thanks for your patience.
If that means going into the Retroarch menu, going to user 5 (being the 1st of the 4-way joysticks) and mapping those keys to that joystick's buttons, I did that, but unfortunately it had no result either.
I've also tried the non-libretro advmame emulator. As an experiment, in the runcommand-onstart.sh, I switched from "mame-libretro" to "mame-advmame", mapped the joystick buttons using the TAB menu in game which did work, but once I exited the game and re-started it again, the joysticks were assigned new js numbers which weren't the same as before and so the controls were messed up.
I'm already using the joystick-selection tool which maps the 4 DragonRise xpad drivers to Players 1-4, so they don't change each time. The result is that I can't "fix" the xboxdrv joysticks to players 1 to 4.
Just trying to think of alternatives. What if, in the advmame TAB menu, I changed the keys to UP, DOWN etc to keyboard controls, then in the runcommand_onstart.sh, remapped the joystick buttons to the keyboard inputs?
-
@spud11 said in
If that means going into the Retroarch menu, going to user 5 (being the 1st of the 4-way joysticks) and mapping those keys to that joystick's buttons
That's the first part of it. Then you need to use xboxdrv to map those controllers to send out the corresponding keyboard keys when each button is pressed.
What if, in the advmame TAB menu, I changed the keys to UP, DOWN etc to keyboard controls, then in the runcommand_onstart.sh, remapped the joystick buttons to the keyboard inputs?
That's the same idea as the method above, but it would be limited to only working in Advance MAME.
-
@mediamogul Hi mediamogul.
I'll try using Advmame rather than Retroarch to begin with, so will map advmame to the keys using the TAB menu.
I'm not near my Pi at the moment, but I was just wondering if you could please look at the syntax to see if anything stands out as being obviously wrong please as I haven't used the ui settings in this way before:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \ --device-name "Player_3_-_4-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --four-way-restrictor \ --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap a=KEY_A,b=KEY_B,x=KEY_X,y=KEY_Y,back=KEY_E,start=KEY_T \ &
The last 2 lines are the added lines. I'm assuming that I still need the --evdev-absmap line to map the axes, but that the --ui-axismap is sort of superimposed on top of it, so that the axes are mapped to the up, down, left, right keys on the keyboard.
Thanks.
-
if you could please look at the syntax to see if anything stands out as being obviously wrong
Everything looks good.
I'm assuming that I still need the --evdev-absmap line to map the axes, but that the --ui-axismap is sort of superimposed on top of it
That's correct.
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.