Home › Forums › Raspberry Pi, Odroid and all SBCs › Raspberry Pi Images › Attract Mode setup › Reply To: Attract Mode setup

ok for the trackball ignore what I said before about in game editing ,test it in kodi if it works move on to this next part
Configuring RetroArch emulators for multi-mouse use
Input Drivers: As of September 2017, there is only one RetroArch input driver for Linux with support for multi-mouse: udev
.
Determining mice index numbers
- Make sure that your RetroArch input driver is set to
udev
- Start a RetroArch emulator with the option
--verbose
to generate a detailed log. Verbose mode is selected via the runcommand - The resulting log is saved to
/dev/shm/runcommand.log
There should be a section of the log similar to this:
[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.
Interpretation: Please disregard any devices listed for the legacy interfaces /dev/input/mouse*
and /dev/input/js*
. Look instead for the /dev/input/event*
indexes. In this example, there are two lightgun devices attached, along with a keyboard-style arcade control panel. To use both lightguns, the correct mouse indexes to use would be 0
and 2
.
Beware: The index of a specific device may change depending on what device you have attached to which port. For example, if you boot with an external mouse, it might be detected by udev
as event0
and your spinner as event1
, but if you boot the same system without the external mouse attached, everything might ratchet down (spinner becomes event0
).
Setting mouse indexes via the RetroArch GUI
For each user and mouse you wish to configure, visit the corresponding RetroArch user 'binds' screen and set Mouse Index
to match the indexes discovered earlier.
Setting mouse indexes via retroarch.cfg
As an alternative to using the RetroArch GUI to set the mouse indexes, you can map mice to users via the retroarch.cfg
in this format: input_player1_mouse_index = "0"
Configuring Emulators
Not all emulators support mouse input. Fortunately, software evolves as developers add more functionality. The two MAME emulators that offer the best mouse support for arcade games in RetroPie are lr-mame2003 and AdvanceMAME.
lr-mame2003
As of August 4, 2016, mame2003-libretro has been capable of trackball and spinner support. Following the steps above for RetroArch mouse support, it is even possible to adjust the mouse index to get multiple mouse devices working for different players. Index settings may be necessary even for single player functionality, depending on the mouse devices detected on your system. Once configured, the Player 1 DIAL control (spinner, steering, etc.) receives input from the X-axis of the mouse device, and TRACKBALL inputs come from both X and Y. For two-player spinner control where the spinners share a single mouse device (together comprising both X and Y axes), an additional core option allows you to split the player 1 mouse device into two players.
If you enable a core option (described here), it is possible to share the mouse input to effectively copy the Y axis to the Player 2 DIAL control. This makes sense, as most interfaces are for either trackballs or two spinners.
This flexibility is sufficient for most games, but there are exceptions on complex control panels. If you need to map multiple trackballs, or your Player 1 and Player 2 spinners are on different mouse inputs, you will need to assign the indices accordingly following the details above or use AdvanceMAME to map your devices to the proper controls.
Configuring RAW, PS2 for all possible mouse inputs
Beware: The index of a specific device may change depending on what device you have attached to which port. For example, if you boot with an external mouse, it might be detected by udev
as event0
and your spinner as event1
, but if you boot the same system without the external mouse attached, everything might ratchet down (spinner becomes event0
). As long as you aren't changing your hardware configuration everything should stay where it is, but if you routinely connect an external mouse to troubleshoot or launch the desktop, this can be frustrating. We can overcome it by mapping multiple inputs together in AdvanceMAME.
For starters, we need to enable all possible mouse inputs in the configuration file (we will edit the configuration for AdvanceMAME 1.4, but if you use multiple versions of AdvanceMAME, you need to make edits in each respective config).
Find these lines in /opt/retropie/configs/mame-advancemame/advmame-1.4.rc
and update them as shown:
device_mouse raw
device_raw_mousedev[0] /dev/input/mouse0
device_raw_mousedev[1] /dev/input/mouse1
device_raw_mousedev[2] /dev/input/mouse2
device_raw_mousedev[3] /dev/input/mouse3
device_raw_mousetype[0] ps2
device_raw_mousetype[1] ps2
device_raw_mousetype[2] ps2
device_raw_mousetype[3] ps2
This establishes 4 different mouse inputs which is probably more than most people will need.
Mapping Specific Controls
The following configurations can depend on your hardware setup. You can make adjustments as needed, especially if you have multiple inputs you are trying to configure. Note that you cannot make the mapping selections inside the MAME GUI. Even a properly configured mouse input may not look correct inside the MAME menus even though it works. To setup the proper mapping, you need to edit the configuration again in /opt/retropie/configs/mame-advancemame/advmame-1.4.rc
.
Trackball
Since most trackball games will be emulated in AdvanceMAME using Player1, configure these lines as follows:
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]
This tells MAME to map the Player 1 Trackball to the X and Y inputs for all four of our possible mouse inputs. We are covering all possibilities here so if the mouse indexes change (maybe you boot up with an external mouse attached and next time you don't) it won't affect the gameplay. Basicially, all attached mouse inputs will map to the game input.
Spinner
One spinner will send input on either X or Y for a given mouse. Assuming you have yours connected to the X axis of your interface, configure this line:
input_map[p1_dialx] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x]
Here again, we are covering the possibilities. No matter how Linux and MAME are indexing your mouse devices, the x-axis of all four should map to the game.
If it doesn't work, and you know you have functioning inputs (see tests above) you might have your spinner on the y-axis. You could switch the hardware connection or change the input map to input_map[p1_dialx] mouse[0,y] mouse[1,y] mouse[2,y] mouse[3,y]
You might also find that your spinner rotates in the wrong direction. You can fix that too with a minus sign as follows: input_map[p1_trackballx] -mouse[0,x] -mouse[1,x] -mouse[2,x] -mouse[3,x]
There are many possibile combinations if you have more than one input device. Here's an example for two spinners, both connected to the same USB interface, but the Player 2 spins backwards. So. . .
input_map[p1_dialx] mouse[0,x]
input_map[p2_dialx] -mouse[0,y]
Notice that from MAME's perspective, both DIAL inputs use the x-axis, but we are using two spinners on the same USB interface, so player 1 of our “mouse0” is x and player 2 is on y. As you can see, AdvanceMAME can handle this easily. Also note that we are not mapping mouse1, 2, 3. On this arcade cabinet we have a dedicated trackball on mouse1 and we don't want people to be able to interfere with our game if they touch the trackball while the spinners are in use.
Other Considerations
Sometimes, a game doesn't use the DIAL input. It uses Paddle. It can be convenient map inputs for the paddle device just in case:
input_map[p1_paddlex] mouse[0,x] mouse[1,x] mouse[2,x] mouse[3,x]
It is also possible to configure controls for certain games only. While this is not generally necessary, you do have the option to override defaults you might have configured above by specifying a ROM/ at the beginning of an input line. For example, if Tempest worked just like every other game but for some reason, just that game has the spinner working backwards, you could specify an additional input for that game only:
tempest/input_map[p1_trackballx] -mouse[0,x] -mouse[1,x] -mouse[2,x] -mouse[3,x]
Sensitivity
Each game may require adjustments to the sensitivity. This too can be configured in the .rc file, but it is easier to adjust this within the MAME GUI. Bring up the menu in AdvanceMAME and adjust the analog inputs and test as needed. The results will be saved into the .rc file when you exit.
Poll Rate
Some spinner hardware is designed with high precision. The encoder + optical sensors are capable of extreme sensitivity. However, this can work against you if Linux is not observing the mouse interface fast enough. It can cause a strange negative effect called “backspin”. If you have ever watched an old western movie and noticed how a fast turning wagon wheel can appear to spin backwards–that's the same effect caused by a low frame rate during filming. It can be very frustrating to give a quick spin in Tempest only to watch it move backwards in the game until it slows down. One way to overcome this is to tell Linux to increase the poll rate of the mouse interface. You need to edit your /boot/cmdline.txt
by appending usbhid.mousepoll=2
to increase the mouse poll rate.