dingusdev / dingusppc

An experimental emulator
GNU General Public License v3.0
200 stars 21 forks source link

Add a basic mouse grab mode when running on macOS #74

Closed mihaip closed 6 months ago

mihaip commented 6 months ago

Adds a "Grab Mouse" command to the "Window" menu which toggles SDL_SetRelativeMouseMode. That "traps" the mouse to the current window (and hides it) which makes it less annoying to deal with the separate acceleration curves of the host and guest OS.

This needs to be done via AppKit code since SDL does not have a cross-platform way to add menu commands.

I also looked into the extended ADB mouse protocol but it does not appear to do that we want. If we use it to report a device class of classAbsolute (0) the acceleration curve changes to a flat response (we end up using accl 0 from https://github.com/elliotnunn/supermario/blob/9dd3c4bef84df2ea30f5ec2c5e97b043e8267b3f/base/SuperMarioProj.1994-02-09/Resources/MiscROMRsrcs.r#L64-L76) but the coordinates are still interpreted as being deltas. If I use a device type 4 (Absolute pointing devices) then the mouse position is never queried. Per https://68kmla.org/bb/index.php?threads/anyone-have-an-adb-graphics-tablet-or-joystick.39128/ all tablet devices end up using custom drivers.