Using xboxdrv with mame4all/advmame
-
@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. -
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! -
@mediamogul I had changed the
> /dev/null
to>>/dev/shm/runcommand.log
already, but I added the2>&1
just now. There's no change. xboxdrv is creating the virtual device like it's supposed to, and AdvanceMAME is not seeing any of its output--no stick, no mouse events, no keyboard events.[edit] And yes, xboxdrv does work in other emulators--or at least in the Atari 800 emulator(the non-RetroArch one). mame4all and advmame, not so much.
-
I have to admit, I'm almost at a loss. I know that AdvanceMAME will only use devices it discovers at launch, so perhaps the xboxdrv keyboard is being created slightly afterward for some reason. Try changing:
advmame = "/opt/retropie/emulators/advmame/bin/advmame %BASENAME%"
to
advmame = "sleep 2; /opt/retropie/emulators/advmame/bin/advmame %BASENAME%"
in
/opt/retropie/configs/mame-advmame/emulators.cfg
and see if that makes any difference. -
@mediamogul I added
sleep 2
right in runcommand-onstart.sh after the xboxdrv command, and no such luck. Both mame4all and advmame are completely oblivious to any keyboard/mouse/stick output from xboxdrv.The sad part is I can get this semi-working without xboxdrv, but the analog control snaps back and although the D-pad works now with the mapping I did, it's still hard to control via the D-pad. Besides, I still would like the option of using xboxdrv for other configuration issues down the road.
-
@mediamogul My
advancemame.rc
settings are almost the same as your's, but I include mouse3 settings as well.While trawling through that file, I did see these settings which are set to auto:
input_map[p1_mousex] auto
andinput_map[p1_mousey] auto
.I haven't changed these at all because everything is working on my system, but perhaps @Lummox-JR could change these to:
input_map[p1_mousex] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x] input_map[p1_mousey] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y]
And see if that has any effect.
-
@lummox-jr Although I'm not using mame4all, I am using lr-mame2000 which uses the same mame romset so I'd assume that core would work with Star Wars.
I also use xboxdrv for my libretro/retroarch cores and, on my system, xboxdrv works fine with lr-mame2000, albeit I'm not mimicking a mouse with it.
-
@spud11 I tried changing to lr-mame2000 but the same problem happens there. xboxdrv doesn't work, and also Star Wars doesn't function properly at all in lr-mame2000. There are major glitches with the game there. (The rom loads in lr-mame2003, but then nothing functions whatsoever, even the keyboard, and I have to reboot.)
I didn't try the mouse[3,x] and mouse[3,y] change, but at this point I don't see any value in trying that as the underlying problem definitely goes well beyond mouse input. Absolutely nothing from xboxdrv's mapping comes through in mame4all or advmame (or, when I tested, lr-mame2000 either which was super weird), whether it's keyboard, stick, or mouse.
Just to be safe I did try adding
--no-extra-events
to the xboxdrv command, but no luck there. -
Have you tried loading the map and then running
evtest
from the command line on the mouse and keyboard events created by xboxdrv? If they're not registering there, that'll at least explain why mame4all and AdvanceMAME aren't finding them. -
@mediamogul Yes, I've already tried
evtest
. The mapping works, but the mame4all and advmame emulators are not seeing it. -
That would seem to isolate the problem to a configuration issue in the
advancemame.rc
file and the mame4all preferences. Why don't you post both and perhaps something will jump out. -
@mediamogul I can't post the whole files because I have no way of doing so. I can't access the Pi via SCP/SFTP, so I'm limited to typing in what I see on the screen.
What I can tell you for sure is this is a vanilla config. The only relevant info I see in the mame4all mame.cfg file is this:
#Joystick controls for frontend only #Defaults to XBOX60 controller J_START=7 J_SELECT=6 J_A=0 AXIS_LR=0 AXIS_UD=1
And my advmame.rc file has:
device_joystick auto device_keyboard raw device_mouse auto
I have an update however. My evtest runs did not check the buttons, only the analog to mouse output. When I tried testing the buttons again--I think I was confused because I had tested them for the Atari 800--I discovered they weren't set up right at all for my cheapo controller. So I made the right changes for this controller and the keyboard mapping does work now.
I tried to add the mouse[3,x] and mouse[3,y] stuff to advmame.rc along with the earlier mouse changes, but so far no luck with the mouse output.
-
@mediamogul Adding to my previous message, I've tried setting this in advmame.rc:
device_raw_mousedev[0] /dev/input/js1
...since that's one of the devices setup by xboxdrv. (The other is /dev/input/event3 but I don't think going by number is safe if I have more controllers plugged in.) No response. I also tried setting
device_mouse
to auto, raw, event, and sdl but no luck with any of those so I've gone back to auto.device_raw_mousetype[0]
is set to the defaultpnp
.I found some more info here which tells me I need to use the
advm
utility in advmame's bin files. I tried that, and it tells me there are no mice found under event or raw.What I'm wondering is if the REL_X and REL_Y mappings don't work if no mouse is attached to the system. That would honestly explain a lot. But I would expect xboxdrv to have a way of dealing with that, maybe some option I'm overlooking. I did try the --mouse option just in case, and I am not currently using --no-extra-devices so that shouldn't be in the way.
-
@lummox-jr said in Using xboxdrv with mame4all:
I made the right changes for this controller and the keyboard mapping does work now.
Nice. That only leaves the mouse.
What I'm wondering is if the REL_X and REL_Y mappings don't work if no mouse is attached to the system.
xboxdrv creates its own mouse event, independent of any hardware mice that may or may not be attached. I believe we've narrowed the problem down to being emulator configuration in some way, but without being able to see a whole config file, I'm afraid its just a guessing game.
-
@mediamogul said in Using xboxdrv with mame4all:
xboxdrv creates its own mouse event, independent of any hardware mice that may or may not be attached. I believe we've narrowed the problem down to being emulator configuration in some way, but without being able to see a whole config file, I'm afraid its just a guessing game.
I've shared the portions that are relevant already, and adopted the input-map items suggested above (including
mouse[3,x]
andmouse[3,y]
), but I can type up a quick summary of that sometime tomorrow just to show where it's at. There isn't a lot in the config related to mouse input: justdevice_mouse
,device_raw_mousedev
, anddevice_raw_mousetype
and any input mappings. At least as far as I know, anyway.Maybe a better and more expedient question, though, is whether anyone has gotten mouse events from xboxdrv to work in advmame. Because if nobody has, maybe it's just not doable. But if someone has, maybe they could post their
advmame.rc
file and it'd be possible to compare. -
@lummox-jr said in Using xboxdrv with mame4all/advmame:
Maybe a better and more expedient question, though, is whether anyone has gotten mouse events from xboxdrv to work in advmame.
I use the xboxdrv mouse abilities with advmame quite often. It's usually pretty easy to get going, as there's hardly any setup past what we've already tried. If we rule out the emulator config files, the only suggestion I really have left is that it might be related to your controller in some way.
-
@lummox-jr I'm not using the mouse in advmame, but I am in several other emulators.
I'm just wondering whether you have any other input/joysticks attached or just your 1 Shanwan joystick.
-
@spud11 At the moment no. My system came with two simple retropads that I was setting up first, but I switched to this other one (it's basically just a generic that's laid out like a PS controller) to try setting up analog options. I have others like it I eventually intend to try. The only two peripherals I currently have attached are that and a keyboard; the keyboard is in the first USB slot.
@mediamogul Is there any chance you can show me what your own
advmame.rc
looks like, and the xboxdrv command you're using to set up the driver? Maybe something will jump out at me. In the meantime here's this:device_joystick auto device_keyboard raw device_mouse auto device_raw_firstkeyhack no device_raw_mousedev[0] auto device_raw_mousedev[1] auto device_raw_mousedev[2] auto device_raw_mousedev[3] auto device_raw_mousetype[0] pnp device_raw_mousetype[1] pnp device_raw_mousetype[2] pnp device_raw_mousetype[3] pnp ... input_map[p1_dialx] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x] input_map[p1_dialy] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y] input_map[p1_lightgunx] auto input_map[p1_lightguny] auto input_map[p1_mousex] auto input_map[p1_mousey] auto input_map[p1_paddlex] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x] input_map[p1_paddley] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y] input_map[p1_pedalbrake] auto input_map[p1_pedalgas] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y] input_map[p1_pedalother] auto input_map[p1_stickx] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x] input_map[p1_sticky] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y] input_map[p1_stickz] auto input_map[p1_trackballx] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x] input_map[p1_trackbally] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y]
And this is my current xboxdrv command:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >>/dev/shm/runcommand.log 2>&1 \ --evdev /dev/input/by-id/usb-ShanWan_ZD_Game_For_Windows-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 10% \ --mimic-xpad \ --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y,ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \ --evdev-keymap BTN_EAST=b,BTN_SOUTH=a,BTN_NORTH=y,BTN_WEST=x,BTN_START=start,BTN_SELECT=back,BTN_TL=lb,BTN_TR=rb,BTN_TL2=lt,BTN_TR2=rt,BTN_THUMBL=tl,BTN_THUMBR=tr \ --dpad-as-button \ --trigger-as-button \ --ui-buttonmap guide=void \ --ui-axismap x1=REL_X:10,y1=REL_Y:10,x2=void,y2=void \ --ui-buttonmap back=KEY_5,start=KEY_1,a=KEY_LEFTCTRL,b=KEY_LEFTSHIFT,back+start=KEY_ESC,tl=KEY_ENTER,back+x=KEY_TAB,back+y=KEY_P,du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \ &
The keyboard mappings are working very nicely now that I've finally got this controller done right.
BTW, I did try switching the USB slots just to see, but it made no difference.
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.