Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Guide: Advanced Controller Mappings


  • Global Moderator

    @guydot

    Have you updated RetroArch in a while? This may not be the issue, but recently a fix was implemented to avoid controller ordering based on detection. Before hand this was messing with tools like joystick selection utility. If you haven't already, try updating and see if the behavior continues.



  • @mediamogul said in Guide: Advanced Controller Mappings:

    @guydot

    Have you updated RetroArch in a while?

    I did a Retroarch update but it did not solve the issue. I am running RPi3 B+/Stretch/RetroPie 4.4, so it is a very recent image.

    At some point, Retroarch (yellow text on bottom just before the game starts) shows an incorrect port joystick mapping and the game does not work. Killing xboxdrive restores the use of Controlblock to exit the game, but Retroarch would not get the right mapping if I launch a new game unless I reboot. Frustrating.


  • Global Moderator

    @guydot

    This may be able to be sorted out as-is, but if you're open to an alternative, let me suggest something more reliable. I avoid the uncertainty of these particular situations by having a keyboard map set for players one and two in RetroArch. To correspond with this, I also have my two controllers fully key-mapped with xboxdrv to match. Once everything is launched, it really doesn't matter which controller RetroArch tries to grab hold of, because it'll be acknowledging the keyboard map regardless.



  • @mediamogul @guydot I agree 100% with this approach. Mediamogul put me onto this method about 2 years ago and it just works. 99% of cores and emulators have keyboard mapping. I've only struggled with one or two eg reicast; otherwise, all good.



  • @mediamogul I will give it a shot, as all other methods failed. The closest I got was with Joystick Selection "by name" method: the games work well even when Retroarch shuffled the ports, but Emulationstation crashes when I exit a "port-confused" game.

    If I understand the method correctly - I will have to change Controlblock to "MAME" mode = keyboard emulation and then run 2 xboxdrv configured to match the keys generated by my controllers. Correct?


  • Global Moderator

    @guydot said in Guide: Advanced Controller Mappings:

    If I understand the method correctly - I will have to change Controlblock to "MAME" mode = keyboard emulation and then run 2 xboxdrv configured to match the keys generated by my controllers. Correct?

    Actually, you would just change your xboxdrv maps to be complete key-mappings of the Controlblock. From there, you'd assign those keys to players one and two in RetroArch.



  • @mediamogul @spud11 I am missing something here.

    Right now:
    (1) Controlbox is creating 2 joypads: JS0/JS1 and event 2/3
    (2) I use 2 xboxdrv commands, each has --evdev-absmap and --evdev-keymap that correspond to a joypad joystick + buttons
    (3) In Retroarch.cfg, I tried to use input_player1_joypad_index = "2" and input_player2_joypad_index = "3" to map

    Is proposed method to add --ui-buttonmap to map xboxdrv to keyboard keys? I guess I need more steps... Thanks for all your help!


  • Global Moderator

    @guydot said in Guide: Advanced Controller Mappings:

    Is proposed method to add --ui-buttonmap to map xboxdrv to keyboard keys?

    It is, yes. As an example, below is an excerpt from my retroarch.cfg file where I've mapped my desired keyboard inputs for player one. Below that is a 4-way strict xboxdrv map that corresponds to those keys.

    retroarch.cfg excerpt:

    # Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely, 
    # rather than relying on a default.
    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"
    

    4-way strict xboxdrv command:

    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
    	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
    	--detach-kernel-driver \
    	--dpad-as-button \
    	--trigger-as-button \
    	--deadzone-trigger 15% \
    	--deadzone 4000 \
    	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
    	--silent \
    	--four-way-restrictor \
    	--axismap -Y1=Y1,-Y2=Y2 \
    	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
    	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
    	--ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN,X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4 \
    	--ui-buttonmap a=KEY_A,b=KEY_B,x=KEY_X,y=KEY_Y,lb=KEY_L,rb=KEY_R,lt=KEY_D,rt=KEY_F,tl=KEY_C,tr=KEY_V,du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT,start=KEY_T,back=KEY_E \
    	--ui-buttonmap guide=void \
    	&
    


  • @mediamogul I think I had my aha! moment :-) I am away but will test in a week or so and report back. Thanks!!!


  • Global Moderator

    @guydot

    Not a problem. Let us know how it works out.


 

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.