Getting Trackball to work with MAME
Hi, I'm new here and to the whole setup, to thanks in advance for any slow, patient replies!
I downloaded the full retropie package and did a default install about 8 weeks ago. I don't know how to tell which version this is (not much like finding out where to gather that info...feel free to chastise me and tell me where to find so I can update this post if you like).
My goal is to get a trackball working with Marble Madness and Pole Position (as suggested in article below).
I have purchased a CST USB Trackball.
I have Ports/Desktop installed, so I launched to the desktop GUI and can confirm that the trackball works for the mouse pointer just fine.
I exited to a prompt and used "cat /dev/input/mouse1 then rolled the trackball and saw input, so I assume this means my trackball is device index 1.
I have a working copy of both Marble Madness and Pole Position installed and running under "Arcade". I currently have them set to run using lr-mame2003. My other choices are lr-fbalpha, lr-imame4all, mame4all, and pifba. But lr-mame2003 seems to be the only one that will work.
I'm not sure exactly what steps to take next. It sounds like I now have to configure the trackball in both Retroarch and in MAME?
I thought I 'd test the game by just configuring the game itself, so I launched it and hit TAB, Input This Game, and selected the "track" items, but moving the ball didn't get accepted as an input. So I guess this means I need to configure in Retroarch first?
I found this article: https://github.com/RetroPie/RetroPie-Setup/wiki/lr-mame2003#mame-menu and attempted to follow the instructions under the section "Pointer/Trackpad/Touchscreen support"
Since my trackball didn't seem to work by default, I was guessing it might be an "absolute pointer device", (is it? I don't know) so I followed the instructions in that section like this:
Emulation Station / Retropie/Retropie Setup/Config Tools/Configedit/Advanced Config/Manually Edit All Configurations and scrolling down to find all/retroarch-core-options.cfg.
I edited that file and found the line: mame2003-mouse_device = "mouse" and changed "mouse" to "pointer"
Still no luck when hitting TAB from within marble madness and configuring input.
Next, I thought maybe I need to configure in Retroarch itself. So I launched it from the EmulationStation menu. It seems that I'm running version 1.5.0. When I open it, it says "no core" at the bottom. I go to Settings/Input and down to Input User 1 Binds.
For Device Type, my only choices are RetroPad, Retropad+Analog and None.
I figured I had to choose a Device Index 1 based on the info I mentioned earlier, but all four choices have "N/A" next to them. Yet I know that Retroarch can see the device because pressing any of the buttons on the trackball goes back one menu in Retroarch itself (the ball does nothing).
If anyone can point this newbie in the right direction, I'd appreciate it.
Also, take a look at this thread. It starts out with some challenges in lr-mame2003 with trackballs after the most recent update but goes on to describe how to generate and check log files and how to set core options to work the way you want.
I can also tell you that you definitely want to set your mouse device to “mouse” not “pointer” and that using the TAB menu in MAME will only let you make sensitivity adjustments, never to select the analog device.
You are actually really close. Keep at it after looking at these details.
@caver01 The wiki document is the one I was using. That's how I knew to try the command to find that mine is mouse1. What I didn't do though (because I don't know how) is use the verbose option to get a log and look at event indexes. Is that necessary? It seems that since I saw characters on screen when rolling the ball after the cat /dev/input/mouse1 that I now have the info I need: device 1, right?
Once I know that I'm on mouse1, shouldn't I be able to just go to retroarch and choose settings/input /Input User 1 Binds and set Mouse Index to 1, then got down to User 1 Right Analog X+, press ENTER, then roll the trackball before the countdown finishes?
I'm thinking I have to see some input there before I worry about seeing the trackball in any of the emulators, right?
What should I be using for the three settings at the top?
User 1 Device Type
User 1 Analog to Digital
User 1 Device Index
I set both the device index and mouse index to 1.
For the record, I grabbed another SD card and downloaded Retropie 4.3 and set it up from scratch.
@jvinga1 I gave that wiki link because it was updated and the new edits might not yet be in the prettier Docs. Check the logs, yes. The index in MAME might not match the numbers in Linux from your cat command.
@jvinga1 also I can’t speak to doing binds in retroarch GUI. That’s not what the wiki nor the post about the new MAME2003 changes describe. You need to tell the core what device to map to what player, and we were doing it with core options in the config files based on details from the logs. You wanna do it some other way that’s fine, but my trackball works.
Thanks again for the fast reply. I'll be happy to check the logs, but I need a little help getting retroarch to run in verbose mode. The only way I know how to run it is from the GUI. I thought I could type it at the shell prompt, but it's not recognized.
As far as retroarch GUI, the Wiki actually does say to do that. It has a section "setting mouse indexes via the RetroArch GUI" and then one under it "setting mouse indexes via retroarch.cfg. In any case, I found how to edit the cfg file and it responds the same either way. I confirm this because if I manually edit the cfg file, then go check the GUI, it shows my change.
I'll grab logs if I can get some help with that, but I should point out that I tried the mouse index at 0 through 5 and none of them show input when I try to use the retroarch GUI to select User 1 Right Analog X+.
Would you mind opening your retroarch GUI to check if it responds to your trackball?
For reference, I don't have any game controllers, just the arcade cabinet controls hooked to a controller that emulates a keyboard (sorry, the name escapes me at the moment). So EmulationStation just sees the joysticks and buttons as keyboard keys and does not recognize any game controllers. There's nothing else hooked to my Pi3 except the trackball. I substituted a mouse in the same port and get the same results.
Any other ideas? There's a ton of stuff in that thread that seems like it doesn't apply as it's related to sharing multiple controllers, but maybe I'm missing something big in trying to figure out what applies and what does not.
@jvinga1 As described in the thread I linked, to record logs you need to start the game in verbose mode using the runcommand, and then use ssh to access /dev/shm/runcommand.log. There you will find references to the mouse devices that the core is seeing and their indices, although your troubleshooting kinda makes that irrelevant if you have tried all of them, but perhaps it has not been in the context of other correct settings.
I am glad you grabbed the latest image. Are you using that now? It was recent updates to lr-mame2003 where these ideas apply and it is important to be on the same page if we are troubleshooting.
It sounds like we might have similar configurations. I run a four-player cocktail cabinet using a keyboard controller (IPAC4) for all joysticks and pushbuttons, plus I have the Ultimarc UTrak trackball and a pair of TurboTwist2 spinners. SO, I have three analog devices that appear as two separate "mouse" inputs. The recent update to mame2003 made my spinners or my trackball unusable depending on which game I was running. But using core option configs for the ROMs that need it I was able to get everything sorted. In fact, it works better now that I have no overlap.
I don't really have an easy way to bring up the RGUI, as it is something I never configured for my cabinet. I disabled hotkeys. I don't really know the menus in there anyway since I never use it.
If we still cannot get a working config for you, you can always try AdvanceMAME which is much more explicit about analog inputs in its configuration and it always works great with analog.
Oh, now I see what you mean about runcommand - just pressing a key before the game loads and choosing to load it in verbose mode. See, told you I was a beginner at this!
Here are the lines from the log:
[INFO] [udev] Adding device /dev/input/event3 as type ID_INPUT_KEYBOARD.
[INFO] [udev] Adding device /dev/input/event0 as type ID_INPUT_KEYBOARD.
[INFO] [udev] Adding device /dev/input/event1 as type ID_INPUT_MOUSE.
[INFO] [udev] Adding device /dev/input/mouse0 as type ID_INPUT_MOUSE.
[INFO] [udev] Adding device /dev/input/event2 as type ID_INPUT_MOUSE.
[INFO] [udev] Adding device /dev/input/mouse1 as type ID_INPUT_MOUSE.
[INFO] [Joypad]: Found joypad driver: "udev".
[WARN] [udev]: Full-screen pointer won't be available.
I don't know if these lines are helpful to you to know what's loading or not:
[INFO] [Config]: loading config from: /opt/retropie/configs/arcade/retroarch.cfg.
[INFO] Config: appending config "/dev/shm/retroarch.cfg"
[INFO] Loading dynamic libretro core from: "/opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so"
Yes, I'm still using the 4.3 image I downloaded and installed fresh last night.
Does the above help? It's definitely different from what the wiki says to expect for udev.
@jvinga1 These log entries are consistent with what I saw and another user shared in the thread I linked above. I should update the example block in the wiki page so it is a closer/exact match.
This would lead me to make sure I have the core option enabled in
/opt/retropie/configs/all/retroarch-core-options.cfgwith the line
mame2003-mouse_device = "mouse"
and add/adjust lines in my
input_player1_mouse_index = "0"
and if that doesn't work, try index 1.
Actually, I use per-game configs for this, as my player1 mouse varies depending on if it is a spinner/driving game or a trackball game.
Well, I was feeling like it was getting close and this would do it, but no luck. First, the mame2003 line for retroarch-core-options.cfg was already in there.
I added the input line to retroarch.cfg, but still did not have luck when running Centipede or Marble Madness. I edited and changed the index from 0 to 1 with no effect.
Next, I thought I'd try an ROM specific setting. So I started the game and hit tab for the runcommand menu. From there I selected the option to edit the rom-specific retroarch config. The little editor opened to a blank file. I entered the in input_player1_mouse_index = "0", then ran the game. No luck. Edited again with index of 1 and still no luck.
Here are any lines from the log file that I thought might be involved in any way:
Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so --config /opt/retropie/configs/arcade/retroarch.cfg "/home/pi/RetroPie/roms/arcade/marble.zip" --verbose --appendconfig /dev/shm/retroarch.cfg'|'"/home/pi/RetroPie/roms/arcade/marble.zip.cfg" [INFO] RetroArch 1.6.7 (Git 8e8bdaa)
[INFO] [Config]: loading config from: /opt/retropie/configs/arcade/retroarch.cfg. [INFO] Config: appending config "/dev/shm/retroarch.cfg" [INFO] Config: appending config "/home/pi/RetroPie/roms/arcade/marble.zip.cfg" [INFO] Loading dynamic libretro core from: "/opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so" [INFO] [overrides] no core-specific overrides found at /home/pi/.config/retroarch/config/MAME 2003/MAME 2003.cfg. [INFO] [overrides] no game-specific overrides found at /home/pi/.config/retroarch/config/MAME 2003/marble.cfg. [INFO] Shaders: preset directory: /home/pi/.config/retroarch/shaders/presets [INFO] Shaders: no game-specific preset found at /home/pi/.config/retroarch/shaders/presets/MAME 2003/marble.cgp. [INFO] Shaders: no game-specific preset found at /home/pi/.config/retroarch/shaders/presets/MAME 2003/marble.glslp. [INFO] Shaders: no core-specific preset found at /home/pi/.config/retroarch/shaders/presets/MAME 2003/MAME 2003.cgp. [INFO] Shaders: no core-specific preset found at /home/pi/.config/retroarch/shaders/presets/MAME 2003/MAME 2003.glslp.
and a bunch of lines like this:
[INFO] RetroPad, User 1, Button "B (bottom)" => "Button 1" [INFO] RetroPad, User 1, Button "Y (left)" => "Button 2" [INFO] RetroPad, User 1, Button "Select" => "Insert Coin" [INFO] RetroPad, User 1, Button "Start" => "Start" [INFO] RetroPad, User 1, Button "D-Pad Up" => "Joystick Up" [INFO] RetroPad, User 1, Button "D-Pad Down" => "Joystick Down" [INFO] RetroPad, User 1, Button "D-Pad Left" => "Joystick Left" [INFO] RetroPad, User 1, Button "D-Pad Right" => "Joystick Right" [INFO] RetroPad, User 1, Button "A (right)" => "Button 4" [INFO] RetroPad, User 1, Button "X (up)" => "Button 3"
[INFO] [udev] Adding device /dev/input/event3 as type ID_INPUT_KEYBOARD. [INFO] [udev] Adding device /dev/input/event0 as type ID_INPUT_KEYBOARD. [INFO] [udev] Adding device /dev/input/event1 as type ID_INPUT_MOUSE. [INFO] [udev] Adding device /dev/input/mouse0 as type ID_INPUT_MOUSE. [INFO] [udev] Adding device /dev/input/event2 as type ID_INPUT_MOUSE. [INFO] [udev] Adding device /dev/input/mouse1 as type ID_INPUT_MOUSE. [INFO] [Joypad]: Found joypad driver: "udev". [INFO] Saved core options file to "/opt/retropie/configs/all/retroarch-core-options.cfg"
Any other ideas before attempting to jump to AdvanceMAME? I hate to jump ship and figure out how to go install and configure a different emulator when the games all run well under this one.
Okay, installing AdvancedMame was pretty easy - found it on the retropie menu and installed 1.4.
I never could get the AdvancedMAME mouse testing command to run so I just moved on to editing the config files, all as described in the wiki (https://github.com/RetroPie/RetroPie-Setup/wiki/Spinners,-Trackballs,-Lightguns,-and-other-Mouse-Devices).
I left the Marble Madness ROM in the Arcade folder, but went to the runcommand menu when starting it and changed the emulator for that ROM to AdvancedMame. It works! I changed Centipede to use AdvancedMAME in the same way it it works too, so I'm in business.
Thanks so much for your help! Too bad it would not work under Mame2003, but that's okay since this works for the two games I wanted working the most. I might go try a driving game now as suggested in the Wiki. Thanks again.
@jvinga1 I am torn. On the one hand, congrats for getting the AdvanceMAME config working. It can actually be a little harder! But on the other hand, I really think there is light at the end of the 2003 tunnel. I am actually pretty excited about the recent analog developments in this version of MAME because I like the RetoArch shaders so much more than what I can get out of AdvanceMAME. Still, I am glad you will at least have a working trackball. Sorry we could not get it sorted in the other one.
@jvinga1 The only thing I can think to double check is if maybe you have conflicting entries in the cascade of retroarch configs. For example, if you specify
mame2003-mouse_device = "mouse"or
input_player1_mouse_index = "X"in more than one location, the setting will be overridden the closer the config gets to the ROM. In other words, it will load core options
/opt/retropie/configs/all/retroarch-core-options.cfgbut then it will append the
/opt/retropie/configs/all/retroarch.cfgand any repeat here will override, followed by arcade and finally rom specific configs. This is handy, especially when using a default and multiple emulator cores, but confusing if troubleshooting after you may have added or changed a setting in one of them.
ajacks504 last edited by
I've been following along here, trying to get my system going, thanks for all of the notes.
I finally got it going with 2003 - some tips:
Instead of using of using the trackball to test the input, I was just using the mouse, seemed to make things a little easier.
What finally got it working was something I didn't see listed here, in the
directory, in the
file, I had to enable this option, then it started working immediately.
mame_current_mouse_enable = "enabled"
Thanks again for the notes, hope this helps someone!
I had to enable this option, then it started working immediately.
mame_current_mouse_enable = "enabled"
Interesting. I am not familiar with that option, but I am glad it worked for you. Where did you see this suggested? Perhaps we need to include that option in the wiki.
ajacks504 last edited by
I had same results as jvinga1, had both of these options set:
mame2003-mouse_device = "mouse"
input_player1_mouse_index = "0"
and I was sure about my index, so i just started searching anything with a mame in it, and a mouse setting, if it was disabled, I enabled it, seemed to work for me.
jellohead last edited by
@ajacks504 This worked for me! I didn't have any trouble getting my trackball to be recognized as soon as I plugged it in, but couldn't get MAME to see it as an input device. I tried lots of changes to various config files with no luck. As soon as I enabled this option, my trackball started working.
This post is the only place I found in the internet that mentioned this setting for the retroarch-core-options.cfg file. Not sure how you figured out that option was even available but I'm glad you did. Thanks!
Thug last edited by
@ajacks504 Hello ajacks504. Yes, I know this reply is almost 3 years old. I am having the same issue and just changed to "enabled" wherever it said "disabled" under mame. The next question is I do not have the line
input_player1_mouse_index = "0" underneath the device =" mouse line" anywhere
Is this something I need to add? I'm sorry I just don't understand all this. I'm not very computer savvy when changing the config stuff. I don't have a trackball yet but I have a spinner right now and I cannot get it to work or be recognized when playing tron. Thank you. hopefully this msg finds you