Info on Serial/PS2/USB Mouse 'Polling'

From BYOAC New Wiki
Jump to navigation Jump to search

This info is paraphrased from posts made by Derrik Renaud on BYOAC which contains useful info on the polling of mice with different interfaces. See here: http://forum.arcadecontrols.com/index.php?topic=61381.msg608294#msg608294

http://forum.arcadecontrols.com/index.php?topic=62774.msg636497#msg636497

General Info on Mouse Polling

Polling affects the ability of the emulated control to match the real control, which would be perceived as smoothness. There are 2 different polling things in emulation to be aware of. One is the polling rate of the original game. Usually done during v-blank. And the other is the OS's polling rate.

The original game knows nothing about your OS, so it is up to MAME to get the info and feed it to the game when the game asks for it.

Ideally we want an OS sample rate that is much higher then the original game. This is so that the values can gbe smoothed out to better simulate what the original control used. If the original game used 60Hz and the OS uses 100Hz, then during 40 of the games polls it uses the combined reading of 2 OS polls of the control. For the other 20 game polls, it uses only 1 OS poll of the control.

For the same 60Hz game, lets say we now use 500Hz OS polling. So now during 20 of the game polls, the OS supplies 9 polls. For the other 40 game polls, the OS supplies 8. From that you can see that the higher the OS poll rate, the closer the OS polling will match the original games polling.

This is also the same reasoning for wanting a high resolution control. That way it can be scaled down to match the original control. A lower resolution control can not easily match all games. It will have a jerky reaction to it because it can not smoothly be scaled to match the original game.


Summary:

So to recap. Spinners need high resolution so they can be easily scaled and also need a high polling rate of 200 - 500.

Even low res spinners and trackballs need 200+ polling rate. This balances the data for when an emulated game actually reads the data. MAME trys to emulate reading the real control where the game would read at the game's vblank. But windows gets the data at a fixed rate which is different. So even if a spinner is turning at a fixed rate, the values read by the game drift a little because some vblank reads will have more mouse polling samples then others. So the faster the polling, the lower the difference sent to mame.

Serial Mice

So lets say the game polls once each field for a polling rate of 60 times a second. Now lets say you are using a serial mouse with a polling rate of 40Hz. That means in every second of polling, 20 samples are missed because the serial mouse can't keep up. The moral here is... Throw Your Serial Mice Away!


PS/2 mice

PS/2 mice are the bare minimum you should use. You should also set the PS/2 sampling to 200Hz in the XP control panel, or by using a utility program such as: http://www.majorgeeks.com/PS2Rate_Plus_d300.html

Even if you do not use a PS/2 mouse, you NEED this program because it will tell you the polling rate of your mouse.

Now the first thing you find on XP, is that your PS/2 200Hz polling rate, is limited by XP to 125Hz. (I've said this many times, but here goes again. Windows input handling blows!) So you need to also do the USB fix below.


USB Mice + Windows Polling rate fix for XP

USB mice are the best if you have XP, even though windows limits the polling rate to 125Hz. That is because you can use this nifty utility to up that rate:

http://www.majorgeeks.com/USB_Mouserate_Switcher_d4469.html

Set a rate of 250 or 500. USB set to 1000 is overkill.

Note that without using this utility, then PS2 beats USB. 125 is too low.

You can also use the "PS/2" utility above to confirm the polling rate. Even though it is called PS2 rate, it reads USB rates too. http://www.majorgeeks.com/PS2Rate_Plus_d300.html


USB Mice + Windows Polling rate fix for Vista 64

Vista 64 SP1 can be patched to do 500/1000 Hz.

The hidusbf mentioned here (http://mas0ne.servegame.com/mousepolling_rate_vista) did not work for me. So I mixed and matched some stuff on the net and came up with this hopefully easy to follow guide.

Download dseo12.exe, mouserate.exe and dimr.exe from here. http://www.ngohq.com/news/15043-how-to-increase-usb-sample-rate-in-windows-vista-sp1.html

dimr & mouserate both do the same thing. They show the mouse poll rate. Try both and see which you prefer.

Download the "Vista USB Poolrate.7z" USB driver from here. http://www.speedyshare.com/368949342.html

Download RemoveWatermark_20090117.zip from here. http://deepxw.blogspot.com/2008/12/remove-watermark-v03-build-20081210.html

Then follow these directions:

1. Copy dseo12.exe to the desktop. Trust me, you'll want it there when you lock up your mouse.

2. Copy the usbport.sys file for the refresh rate you want to c:\

3. Run dseo12.exe and Enable Test Mode.

4. Restart the computer, press F8 repeatidly while booting to get to the boot menu. Run Safe Command Prompt mode.

5. You will probably be in the c:\windows\system32 directory so type "cd drivers". Make sure you are at the c:\windows\system32\drivers prompt.

6. execute this command: takeown /f usbport.sys

7. execute this command: cacls usbport.sys /G username:F

Replace username with your username. Use quotes around it if your name has spaces in it. If you have changed your original user name, for some reason you have to use the name you installed Vista with. Can't remember? Check c:\users - there will be a directory there with the name you need.

5. You should still be in the c:\windows\system32\drivers directory. execute this command: ren usbport.sys usbport.old

6. execute this command: copy c:\usbport.sys

7. Ctrl-Alt-Delete. Lower right corner - Restart Windows

8. What the hey?? No mouse. Hit Alt-Tab to select the desktop. Use the arrows to select dseo12.exe that you put on the desktop. Enter to run it. Navigate with Tab and arrows as needed to finally select "Sign a system file". Tab to select "Next" then enter. Type "c:\windows\system32\drivers\usbport.sys" and then enter. Now restart the computer from the windows key. You don't need to close the program.

9. Your mouse now works. Run mouserate.exe and/or dimr.exe to verify that you now have a 500/1000Hz polling rate.

10. Yes, it now says Test mode on your screen, Get over it. Or run removeWatermark_20090117.