SNES Mouse Support

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
User avatar
D3thAdd3r
Posts: 2437
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

SNES Mouse Support

Post by D3thAdd3r » Sat Apr 11, 2015 9:56 pm

I am nearing completion on a new game and adding SNES mouse support as a feature. I think so far the mouse has been an under appreciated feature, and as far as I am aware Whack-A-Mole is the only game which uses it. Even Uzesweeper(minesweeper clone) doesn't have mouse support :oops:..which I intend to remedy. I have it up and working in the new game on hardware and in the emulator, but I think there are some things about mouse support overall I would like to discuss with the interest making in making it better and easier to learn/do.

I noticed that in Uzem it feels drastically different than it does on the real hardware. Part of this is due to a good modern laser mouse versus a 1990s ball mouse no doubt. The main thing I see is that the sensitivity is high in the emulator(even when I have not changed from default speed at mouse startup), versus the hardware SNES mouse which starts very slow by default(and max sensitivity is still quite slow for my taste, perhaps a multiplier should be included in kernel if others agree?). I don't know anything about how it is implemented in the emulator, but the operating systems mouse speed has a direct effect on cursor speed in Uzem. Maybe this part is for the best.

The bad thing as I see it is the mouse does not clip to the window unless you run full screen. I think most people play Uzem in a window, especially during game development. The emulated mouse does not move with a 1:1 relationship with the real PC mouse so you can move your PC mouse cursor entirely out of the window, when you go to re-enter the window it juts the emulated cursor into the window; this makes clicking things close the edge very difficult and nearly unplayable I find. I just wanted to verify with someone that it is the same way for them. Now another thing that is bizarre, the whack-a-mole I just built is different from the one on the wiki. It does not have the INTRO_LOGO and does not detect a mouse on hardware or in Uzem, whereas the older wiki version works perfect. Alec would you mind confirming this?

I'm not asking for someone to fix it since I'm pretty sure I could handle it, just want to make sure my findings make sense. I think the emulator should lock the cursor to the window, and also make the operating systems cursor invisible while it's in the window, since it is distracting from the game. By alt-tabbing the mouse should be released from the window and visible again. I don't see any disadvantages to it, thoughts?

User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: SNES Mouse Support

Post by paul » Sun Apr 12, 2015 6:17 am

I generally don't like when windows capture the mouse cursor. Perhaps if it defaulted to off but could be toggled, that would be good and would solve the SNES mouse issue without negatively impacting normal usage.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: SNES Mouse Support

Post by uze6666 » Tue Apr 14, 2015 1:38 am

I'll have a look at whack-a-mole. Already I suspect that somehow, at some point, the code may have got broken.

Though I'm not sure improving it is worth it. It's nice and cool, but I'd be surprised if over 4 persons ever got the mouse. That interface is also very slow and, as it is, take a lot of dead cycles to generate the good timing (several scanlines if I recall). I always though one day we would do the PS/2 interface and that would be much better and the devices more available. Another nagging thing is that it uses the same approach to be informed of communication: clock+latch at the same time. That means it could not work along the keyboard interface. I think we should add PS/2 mouse if we really want mouse support. And if that's the case, we will need another mcu with more pins.

As for the cursor thing, I tough it already worked like that with the window hiding the system cursor. How is it done in other emulators?

User avatar
D3thAdd3r
Posts: 2437
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: SNES Mouse Support

Post by D3thAdd3r » Tue Apr 14, 2015 3:44 am

uze6666 wrote:Another nagging thing is that it uses the same approach to be informed of communication: clock+latch at the same time.
Oh that is kind of a nail in the coffin then. I am struggling to find ways to burn up 12k of flash, so I think I'll keep SNES mouse support anyways for this small one since it does work at least.
uze6666 wrote: I think we should add PS/2 mouse if we really want mouse support. And if that's the case, we will need another mcu with more pins.
I'm convinced then. There seems no reason the same PS/2 pcb+hardware used for the keyboard shouldn't also work for the mouse with the right drivers made.
uze6666 wrote:As for the cursor thing, I tough it already worked like that with the window hiding the system cursor. How is it done in other emulators?
Im on Win8.1 64 and it doesn't. If it works like that on your end, maybe it's the logitech mouse utility program I'm using. I don't have an SNES emulator that seems to work with the mouse even though there are settings for it. VirtualNES emulates the zapper and it does allow your cursor to leave the bound of the screen, and hides the system cursor while drawing crosshairs when inside the window. It works well there because it exactly follows the speed of the system cursor so if you leave the window at the edges you can reenter more smoothly. Maybe it's fine the way it is, just making sure it follows the system cursor pixel for pixel if possible. Alternatively it could be an extra option by pressing the '5' key past "SNES Mouse" to "SNES Mouse Locked". I guess it's not too critical now, but having some form of proportional input would be handy.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests