snes9xgit / snes9x

Snes9x - Portable Super Nintendo Entertainment System (TM) emulator
http://www.snes9x.com
Other
2.62k stars 452 forks source link

Clarification: App requires monitor keystrokes from any apps permission #922

Closed SofaBandit closed 3 months ago

SofaBandit commented 3 months ago

Hi,

I attempted to run the emulator on a mac and the OS popped up a message saying the app requires permission to monitor keystrokes from any application. This spooked me somewhat as I do not understand why the app needs to monitor keystrokes when I'm using other applications (if my understanding is correct, could be wrong).

Can clarification be provided as to why this is needed?

Thanks for your time!

Snes9x 1.62.3 (Mac) MacOS Sonoma 14.5 Apple M3 Max

Screenshot 2024-05-17 at 21 09 50
qwertymodo commented 3 months ago

I'm not a Mac user, so I can't say this authoritatively, or speak to the exact specifics, but that looks to be just a poorly worded way of saying that the app is able to respond to inputs even when it isn't in focus.

SofaBandit commented 3 months ago

Thanks for the response @qwertymodo, I've gone ahead and tried out a couple of games with the permission denied and I can confirm, as best as I can tell, the app runs fine without it.

If you believe that this is a red herring, I'm happy to close the issue or feel free to close it yourself. Let me know what you think.

MichaelBuckley commented 3 months ago

This is actually caused by the code that searches for connected gamepads on your system. OpenEmu suffers from the same dialog. Neither of these emulators are actually monitoring your keystrokes when not in use. Instead, what's happening is that they contain code that connects to every USB device connected to your computer and asks it if it's a gamepad or not. Because you might have keyboards connected over USB, macOS is being paranoid and assuming that if your app directly connects to a keyboard over USB, it might be a keylogger, prevents the connection, and throws up that warning dialogue.

The funny thing is that it doesn't even matter to Snes9x. macOS doesn't prevent it from connecting directly to gamepads, only to keyboards. But that code is only looking for gamepads. Keyboard events are passed to the app from the OS, so it doesn't need to connect directly to the keyboards.

So even if you click the "Deny" button, it won't break anything in Snes9x or OpenEmu.

There's newer APIs we can use to more safely enumerate the USB devices and not trigger this warning, but I've been hesistant to do any more emulation work since you-know-who sued that emulator for their current system.

bearoso commented 3 months ago

but I've been hesistant to do any more emulation work since you-know-who sued that emulator for their current system.

I read a leaked log of that project's developers' chat, and they were actively sharing illicit copies of pre-release software amongst themselves.

I suggest that if the games you wish to emulate are available on some platform, you purchase a copy so you have a license to said game. Emulating falls under fair use. Do not share ROM files with others.

MichaelBuckley commented 3 months ago

I agree that emulation is legal, and that the developers of the project were doing the things you mentioned. However, just by being sued, you can lose big. I couldn't afford to fight a lawsuit against a company with deeper pockets than me.

I read the suit filed against that project. The thing that worried me the most was that they objected to developers even discussing the emulation of commercial games. That is something that happens in the Github issues here. We have a good reason to discuss that: accuracy. We want to make sure the emulator works properly. But proving that in court is a riskier prospect.

SofaBandit commented 3 months ago

Ah ok, thanks for the explaination @MichaelBuckley, it was really useful 👍

I was worrying over nothing it seems but better safe than sorry and I learned something out of it.

Thanks again and enjoy the rest of the weekend 😄