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

XBOXDRV Guidance Needed



  • OK cool. :) I'm taking a break, eating some dinner. I have to go back to work tomorrow, so If I can't figure this out within about 2 more hours, I'm calling it a day, and we'll just have to work on it through the week.

    I suspect the problem is coming from the xpad driver that RetroPie comes with preinstalled. I just can't wrap my head around how to have the NES controller be operatable inside RetroArch without having a pre-configured RetroArch configuration. It should be as simple as assigning the xboxdrv identified buttons to specific mappings in RetroArch, but I'm lost.

    Thanks for any help you can maybe provide!


  • Global Moderator

    @hansolo77

    So the next setup is mapping the controller to RetroArch inputs. Anybody got any pointers on that?

    I hope I'm not misreading the problem, but if you're looking to key-map a controller for use in RetroArch, you should first map a standard keyboard in EmulationStation with the keys you wish to occupy 'up,down,left,right,a,b...etc'. Once that is done, those will be the keys that control player 1 and the gui. If this isn't the case, they can be set manually in /opt/retropie/configs/all/retroarch.cfg. I'll share my personal entries, as I also took the time to manually map a player 2 entry for the keyboard and it should make for a good reference.

    # 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"
    
    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"
    
    # Two analog sticks (DualShock-esque).
    # Bound as usual, however, if a real analog axis is bound,
    # it can be read as a true analog.
    # Positive X axis is right, Positive Y axis is down.
    # input_player1_l_x_plus = "right"
    # input_player1_l_x_minus = "left"
    # input_player1_l_y_plus = "down"
    # input_player1_l_y_minus = "up"
    # input_player1_r_x_plus = "num2"
    # input_player1_r_x_minus = "num1"
    # input_player1_r_y_plus = "num4"
    # input_player1_r_y_minus = "num3"
    
    # input_player2_l_x_plus = "h"
    # input_player2_l_x_minus = "g"
    # input_player2_l_y_plus = "j"
    # input_player2_l_y_minus = "i"
    # input_player2_r_x_plus = "num6"
    # input_player2_r_x_minus = "num5"
    # input_player2_r_y_plus = "num8"
    # input_player2_r_y_minus = "num7"
    

    I'm having to head back out and I'll be gone for most of the night, so I'll also leave you with a player 1 key-mapping that I occasionally use in RetroArch as an example.

    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 \
    	--force-feedback \
    	--dpad-as-button \
    	--trigger-as-button \
    	--deadzone-trigger 15% \
    	--deadzone 4000 \
    	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
    	--silent \
    	--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 \
    	&
    

    Also, I believe you'll need to follow the final step of section 3A (quoted below) of the guide to force RetroArch to see the mapped keys as coming from an actual keyboard.

    To fully round out this section on key-mapping, it should be mentioned that in some rare scenarios, the keyboard that xbmc virtualizes may not be recognized as being a keyboard by the software you intend to use it with. In this situation, you can create a udev rule that will authenticate the input as being from an actual keyboard at a system level, allowing it to function anywhere. To add this udev rule, drop to the command line and type:

    sudo nano /etc/udev/rules.d/99-xboxdrv.rules
    
    Press 'Enter" and type the following:
    
    SUBSYSTEM=="input", ATTRS{name}=="Microsoft X-Box 360 pad - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
    
    

    Now press 'ctrl+o' to save the file, 'Enter' to confirm and 'ctrl+x' to exit. The name "Microsoft X-Box 360 pad - Keyboard Emulation" is dependent on the use of the --mimic-xpad variable used in your xboxdrv command. If you have customized that name using the --device-name variable instead, as seen in the earlier example, it would then be replaced with "My Most Non-Non-Triumphant Controller Name Here - Keyboard Emulation".



  • Wow, that's incredibly helpful. I knew I had to me missing something, and mapping a keyboard config for RetroArch just flew right past me. That should definitely give me a step in the right direction. I'll probably not bother with this any more tonight as well, gotta get back into my sleep rhythm.

    The only problem I see now, by going by your maps, is my mapping I would use for the d-pad on the NES. It's using ABS.. So would I just do a simple "axis as button" or can you actually map ABS to AXIS? It looks like that might be how you have it, but I'm not sure. Also, since you're not using it, should I remove the --mimic-xpad line and replace it with my own device name? Does that make a difference, or just make it easier?

    FInally, the problem I was having on my last troubleshooting was that with just 1 buttonmap, I was still getting that wierd error when the script finished. Hopefully, it's just not working because I don't have a true keyboard map in place for RetroArch. Stay in touch, I'll probably need your help again once I try to add the 2nd controller! lol And thanks again!



  • Ok I decided I didn't want to wait, and I'm hitting a snag. I added the lines of the keyboard mapping into the retroarch.cfg file, but they still don't work. Looking over it, it has me wondering... doesn't this permanently override the other mappings created by ES and RetroPie? Since I'm specifically identifying "for this button, use this key". Further up on my cfg, there are actual entries for those lines.. and they actually say 'nul'. So I think the reason it's not working now is because I have 2 entries for each line... The first batch is near the top of the cfg file, and the 2nd set is where I pasted them at the bottom of the file.



  • @mediamogul I did some more work... I guess I skipped the part where you said I should map the keyboard in EmulationStation first. So I did that now. Strange thing is, it still doesn't show up in the /opt/retropie/configs/all/retroarch/autoconfigfolder as a listed config. So I guess that's where you say I should go in and add it directly to the retroarch.cfg file? Also.. when I run through my test.sh script, I see a blurb at the bottom of my screen (not very long) inside RetroArch saying something like "Device not configured". And it's using my specified device name. So this has me thinking... should I set this up with the driver running, then launch EmulationStation and create a new controller config with that? I feel like this is defeating the purpose, since I might as well just use xpad. Any ideas why RetroArch would be displaying my xboxdrv device as an actual device and not a keyboard?

    Also, I'm still getting that weird dialog at the end of my script running:

    xboxdrv: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = Controller; typename boost::detail::sp_member_access<T>::type = Controller*]: Assertion `px != 0' failed.
    


  • @mediamogul I think I might have it, at least for Player 1... I'm not sure what I did.. I followed all the steps. It just works now. GRR. I wish I knew what I changed to make it work. I will say, once I finally had it, I had to go back in and change the ABS mapping to X1/etc instead of dpad_x. But aside from that, I don't know what I did. :( Maybe it was rebooting after adding that change to the /etc/udev/rules.d/99-xboxdrv.rules. I actually have mine configured as

    SUBSYSTEM=="input", ATTRS{name}=="Microsoft X-Box 360 pad - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
    SUBSYSTEM=="input", ATTRS{name}=="NES Pad (xboxdrv) - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
    

    When I read the bit at the bottom of it, saying it was dependent on the use of --mimic-xpad, I had a feeling I needed to add my OWN device name to the list as well. Maybe that's wrong, can you confirm?

    In any case, here's my working "prototype":

    #!/bin/bash
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/event3 \
        --detach-kernel-driver \
        --device-name "NES Pad (xboxdrv)" \
        --evdev-absmap ABS_X=x1,ABS_Y=y1 \
        --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
        --dpad-only \
        --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_UP:KEY_DOWN \
        --ui-buttonmap start=KEY_T,back=KEY_E,b=KEY_B,a=KEY_A \
    &
    "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _SYS_ "nes" "/home/pi/RetroPie/roms/nes/Bubble Bobble (USA).zip"
    sudo killall xboxdrv
    

    Stage 2 will be finding out how to make it work with 2 controllers (and figuring out how to add the player2 keyboard inputs).

    Also, I'm still getting that error:

    xboxdrv: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = Controller; typename boost::detail::sp_member_access<T>::type = Controller*]: Assertion `px != 0' failed.
    

  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    I think I might have it

    Nice!

    Maybe it was rebooting after adding that change to the /etc/udev/rules.d/99-xboxdrv.rules

    I'd put money on that being what solved the issue.

    I had a feeling I needed to add my OWN device name to the list as well.

    Once you customized your device name, it was the right thing to do.

    Also, I'm still getting that error

    This I'm not sure about, as I've never seen it come up before. Does the error still come up when triggered from /opt/retropie/configs/all/runcommand-onstart.sh like your previous 'Streets of Rage Remake' mapping?



  • @mediamogul said in XBOXDRV Guidance Needed:

    Does the error still come up when triggered from /opt/retropie/configs/all/runcommand-onstart.sh like your previous 'Streets of Rage Remake' mapping?

    Good question. I'll have to check this when I get home tonight. I didn't want to add this config to the onstart yet as I still want to get a Player 2 map working as well first. It's not discussed in the RetroPie wiki, so I'll have to look over at the official documentation. A quick glance makes me think I have to run the driver in daemon mode. But if I go further down the list, I see:

    If you want to use multiple wired controllers you need to start multiple instances of the xboxdrv driver and append the -i argument to select the appropriate controller like this:

    $ xboxdrv -i 1
    

    So does that mean, in my script, I basically have it say xboxdrv -i 1 (and then all the cfg) ending in the &, and then the next line be xboxdrv -i 2 (and all the 2nd controller mapping) and then the command to launch the game? Will the driver still properly unload itself with 2 instances like that?

    Also, I noticed that after rebooting, and then remapping the keyboard in ES, it actually changed the button mappings in the retroarch.cfg at the top of the file, rather than down at the bottom where I had added the lines you provided (I set it back to the way it was before). So do I simply add those player 2 lines right below where the modified keys for player 1 are listed?

    Lastly, is there any way that you know of that can make RetroArch not pop up an alert message saying that "so & so controller isn't configured"? Since I created a device name, it shows up like that now every time RetroArch starts. It's not there very long, but it's a little distracting.

    Thanks!


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    A quick glance makes me think I have to run the driver in daemon mode.

    I don't believe that applies when using the -evdev functions of xboxdrv. You can just append a second command to the first using a semicolon.

    it actually changed the button mappings in the retroarch.cfg at the top of the file, rather than down at the bottom

    If you're saying that these entries are listed twice, they shouldn't be. To my recollection, I had to add the player 2 entries, but the player 1 entries should already be there and shouldn't be duplicated.

    Lastly, is there any way that you know of that can make RetroArch not pop up an alert message

    I believe the entry that controls that is:

    # Enable usage of OSD messages.
    # video_font_enable = true
    

    You'll need to uncomment the second line there and of course change true to false.

    Edit: It should be noted that this will eliminate all onscreen text, making visual feedback for features like RetroAchievements nonexistent as well.



  • @mediamogul said in XBOXDRV Guidance Needed:

    Edit: It should be noted that this will eliminate all onscreen text, making visual feedback for features like RetroAchievements nonexistent as well.

    That's Ok.. I'll just keep it then.

    I'm still lost on how to do the the 2-controller thing. Can you give me an example of one you're using?


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    Can you give me an example of one you're using?

    I actually don't automate my mappings. I launch a series of player 1 and player 2 scripts that I keep in the RetroPie menu that are organized by system. I do this because I have several dozen controllers that I might want to make use of at any time and that particular scenario just doesn't lend itself to automation. That being said, I have automated a smaller group of two player controller mappings for friends and family. Using your mapping from above twice as an example, adding a second player can be accomplished by combining two mappings into one command that should look something like:

    if [ "$1" = "sorr" ]
    then
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick \
        --detach-kernel-driver \
        --silent \
        --force-feedback \
        --deadzone-trigger 15% \
        --deadzone 4000 \
        --mimic-xpad \
        --dpad-as-button \
        --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt \
        --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TR$
        --ui-buttonmap x=KEY_X,a=KEY_C,b=KEY_V,lb=KEY_A,Y=KEY_S,rb=KEY_D \
        --ui-buttonmap guide=KEY_B,start=KEY_ENTER,back=KEY_ESC \
        --ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \
        & ; \
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick \
        --detach-kernel-driver \
        --silent \
        --force-feedback \
        --deadzone-trigger 15% \
        --deadzone 4000 \
        --mimic-xpad \
        --dpad-as-button \
        --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt \
        --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TR$
        --ui-buttonmap x=KEY_X,a=KEY_C,b=KEY_V,lb=KEY_A,Y=KEY_S,rb=KEY_D \
        --ui-buttonmap guide=KEY_B,start=KEY_ENTER,back=KEY_ESC \
        --ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \
        &
    fi
    
    


  • Thanks for that. It helps to have a visual aide to see what exactly I need to do. You were saying to add a semicolon, but I didn't know where. So the only thing I would need to do, since both controllers are identified exactly the same, is just change the event# for the 2nd controller? Seems simple enough. I'll have a go with this tomorrow after work. Tonight's adventure dealt with installing a new Mausberry circuit in my Sega Genesis hub (and then finding out it doesn't quite work right). GRRR


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    Tonight's adventure dealt with installing a new Mausberry circuit in my Sega Genesis hub (and then finding out it doesn't quite work right). GRRR

    Yeah, I've been following that off and on. It looks like a great project. I hope it works out.



  • I've been working (at my job) so much, I'm really exhausted today. It's my day off, and I don't feel like messing with this ANY today. :( Kinda bummed about that. I can confirm now though that my Sega build is complete so woohoo there! I worked on that a bit last night to fix the power problem I was having. So now I'm free to further dive into the abyss of XBOXDRV. :)

    I'm going to try and find some time to mess with this maybe tomorrow after work. I'm working early so I'll be home earlier to work on it.



  • So I decided to try and spend maybe like 10-20 minutes on this just now. Here is my script:

    #!/bin/bash
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/event3 \
        --detach-kernel-driver \
        --device-name "NES Pad Player 1 (xboxdrv)" \
        --evdev-absmap ABS_X=x1,ABS_Y=y1 \
        --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
        --dpad-only \
        --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_UP:KEY_DOWN \
        --ui-buttonmap start=KEY_T,back=KEY_E,b=KEY_B,a=KEY_A \
    & ; \
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/event4 \
        --detach-kernel-driver \
        --device-name "NES Pad Player 2 (xboxdrv)" \
        --evdev-absmap ABS_X=x1,ABS_Y=y1 \
        --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
        --dpad-only \
        --ui-axismap x1=KEY_G:KEY_H,y1=KEY_I:KEY_J \
        --ui-buttonmap start=KEY_NUM9,back=KEY_NUM0,b=KEY_M,a=KEY_K \
    &
    "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _SYS_ "nes" "/home/pi/RetroPie/roms/nes/Bubble Bobble (USA).zip"
    sudo killall xboxdrv
    

    But when I run it, I get an error:

    ./test.sh: line 11: syntax error near unexpected token `;'
    ./test.sh: line 11: `& ; \'
    

    Are you sure about that semicolon?



  • Ok, so I figured out one thing.... Adding the "Player #" text into the --device-name caused nothing to work anymore. Then I remembered about the /etc/udev/rules.d/99-xboxdrv.rules entry I had to make, so I went back and added the "Player #" bit to the name, and then it started working. Then I added a line for Player 2, and setup the script. At first it wasn't working, still giving me that syntax error. For testing, I just ran the Player 2 part of the script in the terminal by itself, just to get that controller working. I had the remap key wrong. There is nothing named "KEY_NUM0", etc. I had to go back and call up the xboxdrv --help-key to find the equivalent. It's actually "KEY_KP0". So I fixed that, then ran it. It ran fine. I then exited and ran the the entire script without the ; \ on the first & line. It works! So I don't know, maybe I'm using a newer version of the driver? But here is my test.sh file that works perfectly with the selected ROM:

    #!/bin/bash
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/event3 \
        --detach-kernel-driver \
        --device-name "NES Pad Player 1 (xboxdrv)" \
        --evdev-absmap ABS_X=x1,ABS_Y=y1 \
        --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
        --dpad-only \
        --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_UP:KEY_DOWN \
        --ui-buttonmap start=KEY_T,back=KEY_E,b=KEY_B,a=KEY_A \
    &
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
        --evdev /dev/input/event4 \
        --detach-kernel-driver \
        --device-name "NES Pad Player 2 (xboxdrv)" \
        --evdev-absmap ABS_X=x1,ABS_Y=y1 \
        --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
        --dpad-only \
        --ui-axismap x1=KEY_G:KEY_H,y1=KEY_I:KEY_J \
        --ui-buttonmap start=KEY_KP9,back=KEY_KP0,b=KEY_M,a=KEY_K \
    "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _SYS_ "nes" "/home/pi/RetroPie/roms/nes/Bubble Bobble (USA).zip"
    sudo killall xboxdrv
    

    So now all I have to do is add this to the onstart script for RetroPie's launching, and it should work! Man I'm whooped. Going to eat dinner and then hit the hay. Next console is going to be that blasted Atari800 emulator. Then I'll do the Sega Genesis systems. I don't have any other dedicated controllers.


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    I then exited and ran the the entire script without the ; \ on the first & line. It works!

    Nice job! I thought I remembered it needing the semicolon, but I guess not. I'll have to remember that for the future.

    Next console is going to be that blasted Atari800 emulator.

    I was most pleased to get this one up and running myself. Between the 800 and the console 5200 there are some really great titles. Many of the basic arcade conversions, while not as graphically impressive, have a more polished and comfortable feel to the controls.



  • Yeah it's weird, after looking at it again, it doesn't even have the 2nd & symbol. Originally, it was at the end of the first xboxdrv command, and before the command to launch the game. I kept it in there between the 2 xboxdrv commands like you said, and just took out the ; \ bit, and it worked. So maybe that first & isn't needed either? Might be worth some further testing.


    I'm going to try it myself, but do I need to start the 2nd "entry" into the onstart script after the fi bit? So it would essentially look like this:

    if [ "$1" = "system 1" ]
    then
      blah blah xboxdrv stuff
    &
    fi
    
    if [ "$1" = "system 2" ]
    then
      blah blah xboxdrv stuff again for the other system
    &
    fi
    

    etc? Or would I need to enclose the entire list of if's inside the fi field? To make it look like this:

    if [ "$1" = "system 1" ]
    then
      blah blah xboxdrv stuff
    &
    if [ "$1" = "system 2" ] ### or maybe not a 2nd if here? ###
    then
      blah blah xboxdrv stuff again for the other system
    &
    fi
    

    I'm going to try the first one, first.



  • Looks like the first entry was the correct one. So now, using XBOXDRV, I have a fully working onstart script that allows me to play not only Streets of Rage Remix with my Xbox Controller (and fully exit the game) but I can now also "hot plug" in an NES controller if I want to play with those classic controllers. The XBOX controller still works in NES as a default Player 1 (through the RetroPad's xpad driver) and then the NES controllers are controlled via keyboard emulation through XBOXDRV. I did it this way so I could have multiple player 1 controllers working, since the way RetroArch configures the autoconfigure settings, there would be no way to accomplish this. Here is the working script for that:

    # the line below is needed to use the joystick selection by name method
    bash "/opt/retropie/supplementary/joystick-selection/js-onstart.sh" "$@"
    
    if [ "$1" = "sorr" ]
    then
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
        --evdev /dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick \
        --detach-kernel-driver \
        --silent \
        --force-feedback \
        --deadzone-trigger 15% \
        --deadzone 4000 \
        --mimic-xpad \
        --dpad-as-button \
        --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt \
        --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr \
        --ui-buttonmap x=KEY_X,a=KEY_C,b=KEY_V,lb=KEY_A,Y=KEY_S,rb=KEY_D \
        --ui-buttonmap guide=KEY_B,start=KEY_ENTER,back=KEY_ESC \
        --ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \
        -- \
    &
    fi
    
    if [ "$1" = "nes" ]
    then
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
        --evdev /dev/input/event3 \
        --detach-kernel-driver \
        --device-name "NES Pad Player 1 (xboxdrv)" \
        --evdev-absmap ABS_X=x1,ABS_Y=y1 \
        --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
        --dpad-only \
        --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_UP:KEY_DOWN \
        --ui-buttonmap start=KEY_T,back=KEY_E,b=KEY_B,a=KEY_A \
    &
    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
        --evdev /dev/input/event4 \
        --detach-kernel-driver \
        --device-name "NES Pad Player 2 (xboxdrv)" \
        --evdev-absmap ABS_X=x1,ABS_Y=y1 \
        --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=back,BTN_TOP=start \
        --dpad-only \
        --ui-axismap x1=KEY_G:KEY_H,y1=KEY_I:KEY_J \
        --ui-buttonmap start=KEY_KP9,back=KEY_KP0,b=KEY_M,a=KEY_K \
    &
    fi
    

    Like I said earlier, my next step is getting my original Atari Joysticks to work inside the Atari800 emulator. Getting the stick recognized inside the emulator just wouldn't work. I can even make the XBOX controller work with it. I think this is due to the way the emulator is programmed. The Streets of Rage game only excepted input from whatever was connected to /dev/input/js0 which in my particular case is a wireless keyboard/mouse dongle. So by simply moving the Atari Sticks to js0 and js1, that should be all that's needed. But if moving them doesn't fix it, I'll have to try remapping them inside an XBOXDRV command.

    @mediamogul - What was the method you were able to use to make it work in your case?


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    Getting the stick recognized inside the emulator just wouldn't work.

    Yeah, there are a few emulators that try to map the joystick for you and if it doesn't work, you have to look for outside options.

    What was the method you were able to use to make it work in your case?

    For the Atari800 emulator, I have a two player key-map setup for the default software assignments, including the 12 button 5200 keypads which are mapped to the right joysticks. I also threw in a toggle function to where you can switch the left joysticks to a mouse-mapping for analog paddle, trackball and mouse-based games.


Log in to reply
 

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.