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

Using xboxdrv with mame4all/advmame



  • Following the controller configuration guide by @mediamogul, I've tried to get Star Wars running in mame4all as it doesn't work in other emulators. Specifically, I want to override the controls so I can avoid mame4all's annoying autocenter feature that can't be turned off.

    Whenever I do this, using either a simple retropad or another controller, xboxdrv sets up the new device correctly but mame4all acts like it no longer sees any joystick at all. It also does not see any keyboard or mouse input generated by the new device, even though evtest insists everything is fine.

    What do I need to do to make mame4all recognize the xboxdrv-mapped control?


  • Global Moderator

    @lummox-jr

    I'm heading out for the night, but I'll get back with you later. One thing to consider in the mean time is that in my experience, if you want analog control in games like 'Star Wars' without the auto-centering, you'll need to choose an emulator that both supports the game and supports mouse input. I don't know if that's the case with mame4all, as I've never used it myself. If it does, you'll want to map mouse movement to the analog stick that you want to use. When that's done and MAME supports the mouse input, it usually just works as it's supposed to.

    Edit:
    Also, you may want to consider key-mapping your controller and adding those key assignments to RetroArch as well. When RetroArch makes use of the keys, it doesn't matter what order the controller is assigned and it uncomplicates things quite a bit.



  • Isn't mame4all a non-RetroArch emulator, though?

    Star Wars does run in either lr-mame2003 or lr-mame2010 (I forget which) but it doesn't see the gamepad either with or without xboxdrv. In mame4all it sees the gamepad without xboxdrv, but not with.



  • @mediamogul @lummox-jr Advance Mame works well with Star Wars; not sure about mame4all either.



  • @lummox-jr Perhaps post your runcommand-onstart settings with xboxdrv.



  • Here is what the xboxdrv command looks like (this is for a different controller than I normally use so I'm still tinkering, but the basic retropad one isn't much different and has the same results):

    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >/dev/null \
    	--evdev /dev/input/by-id/usb-ShanWan_ZD_Game_For_Windows-event-joystick \ 
    	--silent \
    	--detach-kernel-driver \
    	--force-feedback \
    	--deadzone-trigger 15% \
    	--deadzone 4000 \
    	--mimic-xpad \
    	--evdev-absmap ABS_X=x1,ABS_Y=y1
    	--evdev-keymap BTN_THUMB=b,BTN_THUMB2=a,BTN_TRIGGER=y,BTN_TOP=x,BTN_BASE4=start,BTN_BASE3=back,BTN_TOP2=lb,BTN_PINKIE=rb \
    	--dpad-as-button \
    	--ui-axismap lt=void,rt=void \
    	--ui-buttonmap tl-void,tr-void,guide=void \
    	--ui-axismap x1=REL_X:10,y1=REL_Y10,x2=void,y2=void &
    

    I should caution that the absmap doesn't handle the right analog yet on this pad and I didn't redo the keymap section for this pad yet (that's what I had for the regular retropad I was using before), but this command does run and sets up the device, which then tests out properly in evtest. But any time I use xboxdrv for any reason, mame4all doesn't see the device.

    I tried AdvanceMAME 3 as well. Basically all the same issues, and it too doesn't see the stick after running xboxdrv but sees it fine otherwise. Annoyingly, the analog settings in AdvanceMAME don't seem to let me turn off autocentering even though the option is there, although I think I get why: the emulator is seeing my analog stick as an absolute position of the yoke, whereas what I'm trying to do is make it use relative position instead. Absolute position works dreadfully in this game because you can't make fine movements with the analog stick without a lot of practice.

    I guess a simpler variation on this question is: Is there any way to get mame4all or advmame to see the analog position as relative rather than absolute? But regardless I'd like to know why xboxdrv seems to not get along with either emulator at all.

    Update: I managed to get relative controls with the dpad in advmame by finding the right game-specific input settings. On my regular retropad that might work out okay. It's not really great for control but it's better in some ways than it was.



  • @lummox-jr --detatch-kernel-driver \ should be --detach-kernel-driver \. Change that and test, I think.



  • @spud11 That's just a typo I made while making the post. I typed it in on my computer while looking at my TV screen.

    The xboxdrv command is running successfully, so I know there's nothing syntactically wrong with the options. I think the problem is something in mame4all/advmame's configuration.



  • Another part of this, I think, is that I need to drop the dead zone to something way lower. I know xboxdrv will help with that, once I can figure out how to get the driver talking to advmame.

    BTW, I looked at the advmame.rc file, and this is what I have for the devices:

    device_joystick auto
    device_keyboard raw
    device_mouse auto
    

    With that setting I find it odd that xboxdrv's mouse mapping isn't being noticed. But I'm still convinced the problem is those two emulators.

    I should also note that I've got xboxdrv working for the Atari 800 emulator so I know this isn't simply a problem with xboxdrv or runcommand itself. It's these specific emulators that aren't seeing the xboxdrv-created device.



  • @lummox-jr What does the /dev/shm/runcommand.log show after using either mame4all or Advance Mame?



  • @spud11 This is the contents of the file:

    xboxdrv: no process found
    

    That's from the killall command. Next is the sudo xboxdrv command above (not bothering to retype that here, although I did change from >/dev/null to >>/dev/shm/runcommand.log), then:

    xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/
    Copyright C 2008-2011 Ingo Ruhnke <grumbel@gmail.com>
    Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This program comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to redistribute it under certain
    conditions; see the file COPYING for details.
    
    Your Xbox/Xbox360 controller should now be available as:
      /dev/input/js1
      /dev/input/event3
    
    Press Ctrl+C to quit
    Parameters:
    Executing: /opt/retropie/emulators/advmame/bin/advmame "starwars"
    Shutdown complete
    

    So as you see there's absolutely zero information about why advmame can't see the gamepad or the keyboard/mouse events it fires.



  • @mediamogul Any new thoughts?


  • Global Moderator

    @lummox-jr

    I've been away from my setup since Saturday night and I need to look at a few of my maps to compare them. I'll be sure to touch base sometime tomorrow.



  • @lummox-jr Are you able to copy and paste rather than type everything from scratch? It's just a little bit harder to troubleshoot as I'm not sure whether it is a typo or whether it's actually a mistake in your runcommand-onstart.
    Anyway:

    --ui-axismap x1=REL_X:10,y1=REL_Y10
    

    I think it should read:

    --ui-axismap X1=REL_X:10,Y1=REL_Y:10 \
    

    The X1 and Y1 should be capitalised.


  • Global Moderator

    @lummox-jr said in Using xboxdrv with mame4all:

    I find it odd that xboxdrv's mouse mapping isn't being noticed.

    While I don't have any experience with mame4all, I know that AdvanceMAME tries to automatically arrange the mouse index and many times sets the wrong one when you have multiple mice. Setting the mouse index manually doesn't work either because the index set by the system often varies as well. I handle this by assigning mouse0, mouse1 and mouse2 indexes to the various arcade options manually in advancemame.rc, which looks like:

    input_map[p1_dialx] mouse[0,x] mouse[1,x] mouse[2,x]
    input_map[p1_dialy] mouse[0,y] mouse[1,y] mouse[2,y]
    input_map[p1_paddlex] mouse[0,x] mouse[1,x] mouse[2,x]
    input_map[p1_paddley] mouse[0,y] mouse[1,y] mouse[2,y]
    input_map[p1_pedalgas] mouse[0,y] mouse[1,y] mouse[2,y]
    input_map[p1_stickx] mouse[0,x] mouse[1,x] mouse[2,x]
    input_map[p1_sticky] mouse[0,y] mouse[1,y] mouse[2,y]
    input_map[p1_trackballx] mouse[0,x] mouse[1,x] mouse[2,x]
    input_map[p1_trackbally] mouse[0,y] mouse[1,y] mouse[2,y]
    


  • @mediamogul I could give the mouse thing a try. I'll do so later and post an update let you know. (Usually I do not have a mouse plugged in, since I haven't needed it since the initial setup.) However since the xboxdrv keyboard output also isn't seen, I think there's probably more to the problem than that. Mapping select/back to a key like 5 so it can trigger the coin slot does not work any more than the mouse stuff has.

    @spud11 Sadly copying and pasting is not an option. Because of the way my network is configured I can't use SCP/SFTP to reach the Pi from my Windows desktop. However I'm absolutely positive that there is no need to capitalize x1 or y1 in the --ui-axismap option; I got that part of the command directly from mediamogul's configuration guide, where x1 and y1 are lowercase.


  • Global Moderator

    @lummox-jr said in Using xboxdrv with mame4all:

    However since the xboxdrv keyboard output also isn't seen, I think there's probably more to the problem than that.

    While you're setting the mice options, try also setting:

    device_keyboard raw
    


  • @mediamogul I made the suggested changes for mouse input in advmame.rc, but to no avail. Also, device_keyboard was already set to raw. The emulator takes input from the actual keyboard but doesn't respond to simulated keypresses from xboxdrv.


  • Global Moderator

    @lummox-jr

    Very strange. And you say other xboxdrv maps are working in other emulators? Try changing:

    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >/dev/null
    

    to

    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1
    

    Then launch a game, exit the game and check /dev/shm/runcommand.log to see if there are any errors.



  • This post is deleted!


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.