After xboxdrv mapping, controller isn't recognized by emulator
-
@lummox-jr I'd also suggest replacing
>/dev/null \
with>> /dev/shm/runcommand.log 2>&1 \
Any errors will appear in
/dev/shm/runcommand.log
so you can see what the problem is easily. -
I did have the logging going to runcommand.log initially to suss out any errors, and only changed it to /dev/null after those got fixed.
As for the extra
&
I don't think that's correct. The original guide doesn't show such a thing. The$atari800
variable isn't a command unto itself but more arguments appended to the main command. -
I'm assuming that if you use the full command on the commandline, it works?
A couple of years ago when I tried to split my code in
runcommand-onstart.sh
similar to the way you've done it, I couldn't get it to work. I couldn't figure out why. It just wouldn't work.I wound up having entirely separate code for each emulator like this:
Player1_Coleco="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap tl=void,tr=void,guide=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_TRIGGER=x,BTN_THUMB=y,BTN_TOP2=lb,BTN_TOP=rb,BTN_BASE3=back,BTN_BASE6=start,BTN_BASE2=lt,BTN_BASE5=rt \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap a=KEY_SPACE,b=KEY_M,x=KEY_1,y=KEY_2,lb=KEY_3,rb=KEY_4,back=KEY_0,start=KEY_UNKNOWN,lt=KEY_1,rt=KEY_5,back+rt=KEY_LEFTCTRL+KEY_ESC \ --ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/SoundToggle.sh" Player1_c64="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap x=void,y=void,lb=void,rb=void,tl=void,tr=void,guide=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_A:KEY_D,Y1=KEY_W:KEY_S \ --evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_BASE3=back,BTN_BASE6=start,BTN_BASE2=lt,BTN_BASE5=rt \ --ui-buttonmap a=KEY_F,b=KEY_W,lt=KEY_ESC,rt=KEY_SPACE+KEY_ENTER \ --ui-buttonmap back=KEY_Y+KEY_1,start=KEY_N+KEY_2,lt=KEY_F1,rt=KEY_F2,rt+back=KEY_F12,back+rt=KEY_LEFTALT+KEY_Q \ --ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/SoundToggle.sh"
So each emulator was effectively separate. It does mean that
runcommand-onstart.sh
can get very large, but I didn't care because it worked. -
When I run the full xboxdrv command from the command line, it "works" in the sense that xboxdrv creates the virtual controller and I can see it pressing keys when I run
evtest
. My problem is the Atari 800 emulator simply stops seeing the joystick at all.I haven't tried running the Atari 800 emulator from the command line yet because I don't know the command I'd need to do so (I'd have to look that up), only through EmulationStation. But I can tell that the runcommand-onstart script runs because when I don't use the special xboxdrv setup or deliberately add a typo to make the command fail, the Atari 800 emulator sees my joystick the way it normally would.
To be thorough, I will try doing the whole command from scratch tonight in runcommand-onstart instead of piecing together a main command with extra arguments, just to see what happens. I would expect to see no difference, but there's no harm in trying. I'll give that a shot tonight. Meanwhile I'm hoping @mediamogul takes notice and can offer some guidance too.
-
@lummox-jr said in After xboxdrv mapping, controller isn't recognized by emulator:
Meanwhile I'm hoping @mediamogul takes notice and can offer some guidance too.
Sure. I've been using the Atari800 emulator quite a bit here recently between 'Last Starfighter', 'Montezuma's Revenge' and 'Pac-Man' (I really like the unpredictable ghost AI).
My problem is the Atari 800 emulator simply stops seeing the joystick at all.
Seeing as how you're key-mapping, the emulator shouldn't be looking for a controller at all, but rather the keyboard. Are you sure you have the emulator set to use the 'Keyboard Maps' for controller input?
One piece of advice you can take or leave is to key-map your entire controller. An example of this using the default Atari800 key-mappings would look like.
--ui-buttonmap b=KEY_RIGHTCTRL,a=KEY_RIGHTSHIFT,x=KEY_UNKNOWN,y=KEY_UNKNOWN,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,du=KEY_KP8,dd=KEY_KP5,dl=KEY_KP4,dr=KEY_KP6,start=KEY_F4,back=KEY_P,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN
You'll notice that only 'up', 'down', 'left', 'right', 'a', 'b', 'back' and 'start' are mapped which covers the directions, both action buttons and the start and pause functions. The rest are all mapped as 'KEY_UNKNOWN'. I do this to give myself placeholders for remapping Atari 5200 keypad input to the controller's face buttons for certain games.
Also, any button left unmapped will produce input from the virtual xboxdrv controller rather than the virtual keyboard, which can have undesired effects in a few emulators. That said, it can also be handy sometimes to mix keyboard input with controller input. The great part about xboxdrv its versatility for just about any use case.
-
@mediamogul said in After xboxdrv mapping, controller isn't recognized by emulator:
Seeing as how you're key-mapping, the emulator shouldn't be looking for a controller at all, but rather the keyboard. Are you sure you have the emulator set to use the 'Keyboard Maps' for controller input?
I do not. Where would I change that setting? I tried looking it up but it's Google-proof.
-
I'm not near my Pi at the moment, but after invoking the options menu, it should be labeled something like 'Controller Input Settings'. From there, the option should be in one of the pull-down menus.
-
@mediamogul Which options menu do you mean? There's the Retroarch RGUI (which I can't open with the joystick set the way it is), the Atari 800 emulator options via F1 (I don't see an option by that name there), or do you mean a different menu like in EmulationStation?
I don't see anything that has the name "Controller input settings" anywhere that I've been looking.
-
@lummox-jr said in After xboxdrv mapping, controller isn't recognized by emulator:
In the standalone Atari800 emulator, you invoke the options menu with 'F1' and then navigate to the 'Controller Configuration' menu. From there, you'll see 'Enable Keyboard Joystick' and 'Define Layout of Keyboard Joystick'. Between those two settings you'll be able to enable and map accordingly. You'll notice that there's no input setting for the second action button, necessary for some games. For some reason this is hard-coded into the emulator to be the 'Right Shift' key for both player one and two. Using xboxdrv, you can map the 'Right Shift' key using
KEY_RIGHTSHIFT
to whatever button you like and you should be good to go. -
@mediamogul The emulator I'm using is lr-atari800. When I go to "Controller configuration" in the F1 menu, I see these options:
Joystick autofire: No Enable MultiJoy4: No Mouse device: None Mouse port: 1 Mouse speed: 3
There is no option to enable a keyboard joystick.
If I change the emulator to just plain atari800, I do see that option. However, the colors of the non-lr atari800 emulator are totally messed up, so that the default colors instead of being white on blue are very light blue on white, and the game looks all wrong.
-
@lummox-jr said in After xboxdrv mapping, controller isn't recognized by emulator:
However, the colors of the non-lr atari800 emulator are totally messed up, so that the default colors instead of being white on blue are very light blue on white, and the game looks all wrong.
Believe it or not, this is meant to better simulate how the games would actually look on original hardware. In the Options menu, you can set it to use true black and vibrant colors, which is probably the way lr-atari800 is set by default.
-
@mediamogul I'm using the
atari800
emulator too. @Lummox-JR As mediamogul says, mapping to the keys generally works better than other methods.If you can't get
lr-atari800
to work properly, inatari800's
GUI (entered with F1), go to "controller configuration" and define the joystick keys for both joysticks 1 and 2. For example, I mapped joystick 1/player 1 up/down/left/right to W, S, A and D etc. My xboxdrv configuration looks like this:Player1_atari800="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap b=void,x=void,y=void,lb=void,rb=void,tl=void,tr=void,guide=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_A:KEY_D,Y1=KEY_W:KEY_S \ --evdev-keymap BTN_THUMB2=a,BTN_BASE3=back,BTN_BASE6=start,BTN_BASE2=lt,BTN_BASE5=rt \ --ui-buttonmap a=KEY_F \ --ui-buttonmap back=KEY_UNKNOWN,start=KEY_UNKNOWN,rt+back=KEY_F1,back+rt=KEY_F9,lt=KEY_F4,rt=KEY_SPACE \ --ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/SoundToggle.sh"
-
@mediamogul Thank you! I finally got all this working!
The only question I have left is that if I have a .bin file that I'm loading, is there any way to tell the emulator what cartridge type is being loaded so I don't have to manually select that (with the keyboard) each time? (Also, is there a way to choose to load BASIC with certain images? There were lots of BASIC games I used to play from Compute! magazine.)
-
@lummox-jr said in After xboxdrv mapping, controller isn't recognized by emulator:
is there any way to tell the emulator what cartridge type is being loaded so I don't have to manually select that (with the keyboard) each time? (Also, is there a way to choose to load BASIC with certain images? There were lots of BASIC games I used to play from Compute! magazine.)
Both can be accomplished by first selecting the right cartridge type or to load with BASICand then save the ROM out through the options menu using the cartridge management menu. I would recommend saving them to a separate location, rather than saving over the existing files, then archive the originals and finally move the newly saved ROMs into place.Edit: Come to think of it, I don't believe you can specify BASIC this way, but cartridge types will definitely work.
-
@mediamogul I found a solution to running BASIC games (these being in .atr files created by basic2boot). This is what the relevant part of my
runcommand-onstart.sh
file looks like now:# In the case statement atari800) eval $xboxkill joycommand="$retropad $atari800 &" eval $joycommand basicregex='basic\.atr$' if [[ $rom =~ $basicregex ]]; then newcmd=`echo $4 | sed 's/\(atari800 \)/\1-basic -xl /'` echo >>/dev/shm/runcommand.log "Execute: $newcmd" # Launch the game with altered params eval >>/dev/shm/runcommand.log $newcmd eval $xboxkill # Kill the calling script so it doesn't launch the game kill $(ps ex | grep runcommand.sh | grep bash | awk '{print $1}') fi ;;
I thought that might be pretty useful for others looking to run BASIC games when the emulator is configured to leave BASIC off by default. In my case it was Gold Rush from the Compute! magazine. The filename is "goldrush -basic.atr". I haven't figured out yet how to get the i flag into the regex I'm using in the if statement (this is largely cobbled together via a lot of Google fu and trial and error) but I'm otherwise happy with it.
-
Darn it, I'm trying to edit my post but the stupid spam filter isn't letting me.
-
It should let you edit it now that some time has passed. If not, I'll delete it and you can post your revision below. In any event, thanks for posting your solution. I don't currently have any games in mind that this would apply to, but I'm sure I'll run across some eventually and I'll give this a shot.
-
Six years later, I’m on 4.8.8 on a Pi 5 and I too cannot get the standalone emulator to work with my controller (8BitDo Pro 2). Have followed all the steps, but nothing.
Well, almost nothing…
If I start emulationstation under tmux directly on the Pi, then log into the same tmux session via SSH on my laptop, I can see the remapped button values (‘4’ when I D-Pad left, ‘6’ when right, etc.) which possibly means xboxdrv is being loaded correctly, the remapping is working but atari800 cannot ‘see’ this.
I’m connecting by Bluetooth and xboxdrv assigns a different event handler to that it initially connects on. The guide is unclear on having to remap the controller once it is being handled by xboxdrv. I had to quit out of ES with F4, then run the xboxdrv command in the background, restart ES and remap. Is thia how it should be done? I’m not starting xboxdrv through rc.local as a) Bluetooth and b) I only want to use this method for this emulator, particularly to remap number keys for games like Miner 2049er.
-
-
@cheesymonkey please don't bump ancient topics.
For your controller model, you should install the
xpadneo
driver and then (re-)map the controller in EmulationStation, you don't needxboxdrv
unless nowadays unless you're trying to set-up some special mapping (i.e. emulate 4way joysticks, keys pressed on button combo, modify the deadzone, etc.)If you still have issues after installing
xpadneo
with the gamepad, please open a separate topic. -
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.