XBOXDRV Guidance Needed
-
@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
-
@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 thexboxdrv --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 mytest.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. -
@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 thefi
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 thefi
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 tojs0
andjs1
, 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?
-
@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.
-
Woot! Got Atari800 working, and using
$2 = atari800
in theonstart
script. This now works with the Atari 5200 and the Atari 800. Next up: mapping the joysticks to work with the Atari 2600/7800/ST.:)
Question to @mediamogul - Do you have an occasional hiccup with the Atari800 emulator not recognizing the keyboard when you boot it up through XBOXDRV? I've had maybe 1 in 3 boots where the keyboard is dead and I have to hit F9 to exit the emulator and try again. It's pretty annoying, especially when you have to use the keyboard to select what size ROM you have in the 5200 system. Also, I noticed in like the Frogger 2 game, I can't move unless I press the fire button, was it always like that? In Galaxian on the 800 system, I couldn't get the joystick to work right (it was left/right reversed) unless I set it to play 2 players. Any idea what that's all about?
Thanks again!
-
@hansolo77 said in XBOXDRV Guidance Needed:
Do you have an occasional hiccup with the Atari800 emulator not recognizing the keyboard when you boot it up through XBOXDRV?
I believe that's all tied into a bug found in the Atari800 emulator itself. After almost any setting is altered from the Atari800 GUI and saved, it will corrupt the configuration file and cause these types of issues. If this is the case, you'll need to delete the current configuration file and allow the program to generate a new one to regain stability. Once recreated, you can still alter any settings you wish from an external solution such as nano without issue.
-
Thanks for that. I'll try doing that. It's too bad RetroArch never established any kind of open-source port of an emulator for these systems.
-
I think they're currently working on an Atari800 core, but I might be mistaken. There are ups and downs to RetroArch cores though. If you look at their implementation of Stella for example, it lacks the capability to play many 2600 games, due to a lack of keypad, paddle and trackball support. I'm sure they'll get around to adding all that some day, but until then I'll be using the standalone version with bonus Mindlink support.
-
LOL!!! "My head hurts from playing with my eyebrows".
Got Atari 2600 and Atari 7800 working now too. Since they're both RetroArch, their configurations were the same. :) :) :) Next up.. ST.
-
Ok I'm lost. I realized I don't have my Atari ST stuff set up yet, so I'm moving on to Sega Genesis/MasterDrive. Now to start, the default/auto configuration using both original 6-button pads works fine. But to remap inside XBOXDRV is giving me a migraine tonight. I'm using the same connectors as I did with the Atari joysticks, so I'm using the same "device name" and event numbers. The only thing I'm really changing is the addition of the extra buttons. Player 1 works fine. Once I go to add the Player 2 though, I can't get the
START
button to work. I'm testing in Mortal Kombat 3, since I know it defaults to 6-button layout and has 2-player support. The idea of the game is that you start it up to the character selection screen, then press START on Player 2 to add that player. Nothing works, and the timer eventually ticks out and the game starts. Here is my current test script:#!/bin/bash sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event5 \ --detach-kernel-driver \ --device-name "ATARI_SEGA Player 1 (xboxdrv)" \ --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \ --evdev-keymap BTN_TR=back,BTN_TR2=start \ --evdev-keymap BTN_SOUTH=y,BTN_EAST=b,BTN_C=a \ --evdev-keymap BTN_NORTH=lb,BTN_WEST=x,BTN_TL=rb \ --dpad-only \ --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \ --ui-buttonmap y=KEY_Y,b=KEY_B,a=KEY_A,lb=KEY_L,x=KEY_X,rb=KEY_R,start=KEY_T,back=KEY_E \ & sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/event6 \ --detach-kernel-driver \ --device-name "ATARI_SEGA Player 2 (xboxdrv)" \ --evdev-absmap ABS_HAT0X=x1,ABS_HAT0Y=y1 \ --evdev-keymap BTN_TR=back,BTN_TR2=start \ --evdev-keymap BTN_SOUTH=y,BTN_EAST=b,BTN_C=a \ --evdev-keymap BTN_NORTH=lb,BTN_WEST=x,BTN_TL=rb \ --dpad-only \ --ui-axismap x1=KEY_G:KEY_H,y1=KEY_J:KEY_I \ --ui-buttonmap x=KEY_N,a=KEY_K,b=KEY_M,lb=KEY_P,y=KEY_O,rb=KEY_Q \ --ui-buttonmap start=KEY_KP9,back=KEY_KP0 \ & /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-picodrive/picodrive_libretro.so --config /opt/retropie/configs/megadrive/retroarch.cfg "/home/pi/RetroPie/roms/megadrive/Mortal Kombat 3 (USA).md" sudo killall xboxdrv
Now I have done all kinds of testing, and everything looks correct. I thought maybe RetroArch was having trouble with the mapping of the Player 2 Start button to "NUM_9", but it turns out it works fine for the NES. I then thought maybe my Player 2 controller wasn't working, so I swapped it, and it's working fine. I then opened up an SSH terminal, ran the command for just Player 2's xboxdrv, then opened another SSH terminal to do a
jstest
andevtest
on the newly created entries. Both of them seem to be picking up all the correct signals. EVTEST even shows that the key being transmitted is the correctKEY_KP9
. So I'm completely lost here.Got any ideas?
-
Well, you're nothing if not thorough. You've tried just about everything I would recommend. If you eliminate xboxdrv from the equation, do the assigned keys function if entered from a keyboard?
-
Hmm, never tried that. I'm actually shocked I didn't think of it. I used to be Tier 3 tech support. Going "off the script" and thinking of absolutely everything to eliminate all possibilities is just how I operate. I think that's why I'm probably able to grasp this better than other people. I've been trained on detective work, in a sense.
I've turned off my system for the night. I gotta eat dinner real quick and head to bed, work early tomorrow. Thanks for the suggestion, I'll give it a go when I get home tomorrow!
-
Ok, just got home, tried running the game from within EmulationStation (rather than my test script). Pressing
num0
andnum9
doesn't register in RetroArch. The EVTEST I ran yesterday confirms it's at least sending it. So the problem must be that RetroArch doesn't recognize that as a valid mappable key. I did some Googling, as RetroArch has NOTHING on a list of available keys. Turns out the left shift (shift
) and right shift (rshift
) ARE available, so I edited theretroarch.cfg
file and changed Start to shift and select to rshift. Loaded up the game, and it works! So, either you're using an outdated keymap list for your player 2, or maybe you just never encountered a need to press Start on Player 2. After thinking about it, there was no reason to do that in my tests on the NES. I was testing with Bubble Bobble, because I knew it had a 2 player option, but that 2nd player is set up from the opening menu, rather than you pressing a button to activate it.I'm glad I got it figured out. That would have been a hex on the whole thing if I couldn't make it work. Thanks again for that suggestion to test it. Had I not done that, I would have been completely lost.
-
@hansolo77 said in XBOXDRV Guidance Needed:
or maybe you just never encountered a need to press Start on Player 2
This is most likely the case. Looks like I'll have to switch things up a bit myself.
Thanks again for that suggestion to test it.
Not a problem. I'm glad it helped lead to a solution.
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.