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


  • Global Moderator

    @hansolo77

    I'm still here, but hammers keep falling around me like a Warner Brothers cartoon. To quote everyone's favorite Austrian, I'll be back.



  • Not to worry! I got it! WOO!!!
    All the while I was having trouble, I discovered I didn't have the --ui-buttonmap settings reinserted. I had them set up initially before I made the reverts and my backup SD. I just forgot to add them back into the script. Now, everything is working.

    TO EVERYBODY OUT THERE!!! DO THIS!! XBOXDRV is the only way to make your controllers work inside Streets of Rage Remix so you can ESCAPE out of the game! Plus, it helped me where my controller couldn't be mapped.

    My next project is figuring out how to map my Atari Joystick to work inside of the Atari800 emulator. I probably have to do the same thing, but I have no idea where to begin. That emulator doesn't have a keyboard backup mapping that I can see, so I'll have to figure out what joystick it's seeking mapping to, and try to get mine to match. Might just need to do a move command on the /dev/input/js# for it, but I'll worry about that when I get there.

    What a load off, this has bugged me for a week. I'm super excited now. So question to @mediamogul .... if I wanted to add a second controller, but keep these assignments, can I just add that as a separate thing in the script? Or do I need to do some fancy foot work to make the driver initialize 2 controllers together? Right now, I'm mapped using my Xbox360 Wireless controller. I ordered, and have arriving on Wednesday, a set of USB plugged Sega 6-button controllers. My plan is to use those when I play, but to have the Xbox working as a backup. I know the game itself is capable of 2 players, with 2 different keyboard mappings. But I don't know where to begin to have 2 controllers running simultaneously.


  • Global Moderator

    @hansolo77

    Man, I hate pine trees. The least little bit of snow and they fall right out of the ground. If you guys don't hear from me in the future, I will have likely met the tree with my name on it.

    Not to worry! I got it! WOO!!!

    Hah! I've just settled in for some serious troubleshooting, but I'm very glad it's working. Going into this you were a bit worried, but you got it without nearly a word from me about it.

    My next project is figuring out how to map my Atari Joystick to work inside of the Atari800 emulator.

    Now that you've done one mapping, they get progressively easier and you'll get more and more creative with all the possibilities afforded to you as well. Before long, you'll have complete control over every aspect if you want to take it that far.

    if I wanted to add a second controller... some fancy foot work to make the driver initialize 2 controllers together?

    Yeah, they will need to run as separate instances. The command you're running now is really just one line, so you could just use a semicolon to add the second command to the same line.



  • Well, I'm just glad I got it working. I had the buttonmap bits wrong. Initially, I had it set to

    BTN_NORTH=KEY_X,BTN_SOUTH=KEY_C
    

    etc, where infact I needed to have it as

    x=KEY_X, a=KEY_C
    

    etc. So you're configuring the long name "evdev" controls, to a short name XBOXDRV one. Then you configure the keymap to be the shortname=actual control. I was trying to use long name=actual control. Once I figured that last bit out, everything started working like it should have.


  • Global Moderator

    @hansolo77

    Bingo, bango, bongo! All in all, you moved through every troubleshooting method I could have recommended. Temporarily removing >dev/null, for example, is a great way to uncover what issues you're having. As complicated as it can get, xboxdvr is pretty verbose about it's errors, which makes solving them pretty easy.



  • @mediamogul Not knowing much about Linux (learning more each day!) and various terminal commands, I don't even know what that >dev/null command does. The > bit looks like something to redirect output, like in DOS/Command Prompt in Windows when you want to say create a text file of a directory listing (dir > list.txt). So my theory is saying we're basically displaying any output generated on the devices (null meaning all). I'm probably way off though. :)

    I'll give you a chance to troubleshoot something for me... My system runs all emulators and games fine until after I run Streets of Rage Remix. Once I return back to ES and try to run a different game, nothing happens. I get the RunCommand screen, then it returns to ES. If I reboot the system, everything is working again. Here's my runcommand.log:

    Parameters: 
    Executing: pushd /opt/retropie/ports/sorr; ./bgdi-330 ./SorR.dat; popd
    /opt/retropie/ports/sorr /home/pi
    /home/pi
    

    So something with my modified launch script is getting mucked up. I don't have that pushd thing in the script at all, so I don't know where that's coming from.


    For the records.. this is my "working" launching script:

    sudo killall xboxdrv
    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_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 \
        -- \
    "/opt/retropie/supplementary/runcommand/runcommand.sh" 0 _PORT_ "sorr" ""
    

  • Global Moderator

    @hansolo77

    Rather than going round and round on the cause, this might be a great opportunity to try the simpler method I had in mind earlier. It's also a much cleaner approach and shouldn't cause the type of conflicts you're currently experiencing. If you're game, go ahead and restore your launch script to the way it was before and add the following to /opt/retropie/configs/all/runcommand-onstart.sh:

    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_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
    

    Then add the following to /opt/retropie/configs/all/runcommand-onend.sh:

    sudo killall xboxdrv
    

    When I get some free time to sit down with it, I want to add this simpler and cleaner method to the guide, replacing the steps you had to work through.



  • Ok let me work through this a moment... so runcommand will actually run through the onstart script first.. then if it identifies that the command being launched is sorr then it will execute the script to launch the driver.. then it returns to runcommand to launch the game.. then when it finishes, it will run through the onend script to make sure the driver has been completely removed.

    Sound about right? Seems simple enough to do.


  • Global Moderator

    @hansolo77

    Sound about right?

    More or less, yessir.

    runcommand-onstart.sh always runs when a port/emulator is launched. The if /else statement we're adding to it then looks for $1 (see below) to be "sorr". If it is, it will run the xboxdrv command. The addition to runcommand-onend.shjust breaks it all down afterward, leaving you with your base controller settings. Other variables that can be added to the if / else statement for a variety of other situations are:

    • $1 - the system (eg: atari2600, nes, snes, megadrive, fba, etc).
    • $2 - the emulator (eg: lr-stella, lr-fceumm, lr-picodrive, pifba, etc).
    • $3 - the full path to the rom file.
    • $4 - the full command line used to launch the emulator.


  • My onstart file has this in it already:

    # the line below is needed to use the joystick selection by name method
    bash "/opt/retropie/supplementary/joystick-selection/js-onstart.sh" "$@"
    

    would I move that down and put the if statements above it since the bash doesn't have any?



  • Ok, that didn't work. I can confirm all my other games still work after rebooting, but when I try to launch SORR, it just goes back to the ES screen. It also looks like I lost my runcommand dialog box.



  • How can I test to see if the new changes are working? How do I pass a defined variable into a terminal entry? Something like bash /opt/retropie/configs/all/runcommand-onstart.sh $1=sorr Without some kind of observable interaction, I can't track down the problem.


  • Global Moderator

    @hansolo77

    Paste your full runcommand-onstart.sh for a look. I assumed "sorr" is the name of the system, but since it's a port rather than a system, perhaps it's got a different naming convention.

    Try changing

    if [ "$1" = "sorr" ]
    

    to

    if [ "$4" = "/path/to/executable" ]
    


  • I think I might have it cracked... by using the runcommand.log, I identified potential issues. Using some intelligence, I fixed them. The first issue is that in my post of the working script, for some reason the device listed as --evdev /dev/input/by-id/usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E1594E70-event-joystick \. The  part shouldn't be there. So I corrected that. That got me a little further. Then I was getting an error about line 24 or something. I checked, and it was the start of the BASH line. So I swapped the IF entry to the bottom, under the joystick-selection bash. That got things moving. Then I was getting an error about an unexpected END OF FILE. I had taken out the & line you included, because when I compared it to my WORKING script, I didn't have it. I added that line back in, and now things look like they might be ok. As another part of testing, I took out the --silent \ line, so I need to add that back in. More testing coming up, but it looks I might have cracked it. The game loads and exists, and I can play an NES game right afterward (where it was closing out immediately before).



  • Confirmed working!

    /opt/retropie/configs/all/runcommand-onstart.sh contents:

    # 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 \
        --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
    

    /opt/retropie/configs/all/runcommand-onend.sh contents:

    sudo killall xboxdrv
    

    Seems like loading games take maybe a second longer now though, as the scripts check to see if the command being launched is sorr or not, but that's ok. Now I just have to wait for my controllers to arrive so I can do it all over again with them!

    Ps: Is it possible to hide the bits where it's loading the driver, and then at the end when it says "Shutdown complete"?


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    Confirmed working!

    Great to hear.

    Is it possible to hide the bits where it's loading the driver, and then at the end when it says "Shutdown complete"?

    Try changing:

    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
    

    To:

    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
    

    Then changing:

    sudo killall xboxdrv
    

    To:

    sudo killall > /dev/null 2>&1 xboxdrv


  • I'm making another SD card backup, then I'll try that. :)

    I'd like to keep this thread open for a few more days, as I know I'll have some difficulties getting the Sega controllers working once they arrive. Can you maybe give me a head start on where to begin? I know the basic steps will require me to identify the location in Linux for each controller, and then their individual default mappings (might be the same, just different locations on the /dev/). Remapping isn't hard to do either now that I know how. But how do I go about setting up the script to launch multiple instances of the driver, so I can have 2 players simultaneously? And there's also the requirement of having the Xbox controller working as well. I assume, since we're not restricted to the RetroPad limitations, we can have 2 controllers mapped to player 1 this way? At least in the case where SORR can map to keyboard inputs (I actually have a keyboard attached, and the Xbox controller, so I know that's at least 2 controllers both capable of controlling 1 player). Can this also be used for RetroArch? My ultimate goal, now that I have the opened possibilities is to:

    • Have the Xbox controller be setup as my primary controller
    • Have my NES pads be available in RetroArch if I ever feel nostalgic, but not need to do any kind of special configuring before hand.. just plug it in, XBD is already configured, and off I go
    • Have my SEGA pads also be available in the same way
    • Have my ATARI Joysticks also available
    • Be able to just plug in and go, and have XBOXDRV already have the assignments ready, without needing to run joystick-selector.

    Is this all possible? How about some tips? :)


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    how do I go about setting up the script to launch multiple instances of the driver

    Just place a semicolon after the & from your first xboxdrv command, followed by the next xboxdrv command.

    Can this also be used for RetroArch?

    Yessir

    Is this all possible? How about some tips?

    All of that is possible. You'll just need to create the various if / else statements as you need them and make sure that the desired controllers are plugged in before a game is launched.



  • You and me buddy... we're best friends of the XBOXDRV now. :) I've got tomorrow off, I think I'll try and at least get some gaming in. Maybe try and tackle a bit of NES controllers, but I think I need to hold off before my brain mushes. lol

    PS - Those added commands you gave me worked great at hiding all the outputted text. Thanks again!


  • Global Moderator

    @hansolo77 said in XBOXDRV Guidance Needed:

    You and me buddy... we're best friends of the XBOXDRV now.

    I'd suggest we get t-shirts printed, but there's no use in making everyone else jealous.

    Thanks again!

    Not a problem. I'm glad it all worked out.


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.