dirkwhoffmann / virtualc64

VirtualC64 is a cycle-accurate C64 emulator for macOS
https://dirkwhoffmann.github.io/virtualc64
Other
341 stars 33 forks source link

Prevent Mac from going idle if VirtualC64 receives game pad events. #504

Closed dirkwhoffmann closed 5 years ago

dirkwhoffmann commented 5 years ago

"When I play Virtual C64 with a bluetooth controller, Mac starts the screensaver in its setted time (on System Preferences). Obviously no problem using the keyboard."

I found a possible solution here:

https://stackoverflow.com/questions/40408063/replacement-for-deprecated-updatesystemactivity-to-reset-timers-used-to-measur

Executing the following code every time a game device event comes in should do the trick:

var assertionID : IOPMAssertionID = 0
 _ = IOPMAssertionDeclareUserActivity("TeslaWatcher" as CFString, kIOPMUserActiveLocal, &assertionID)

From the Apple docs:

dirkwhoffmann commented 5 years ago

Presumably fixed in V3.3.1 beta 1:

http://dirkwhoffmann.de/virtualc64/VirtualC64_3.3.1b1.zip

dirkwhoffmann commented 5 years ago

Version 3.3.1 is now available via the update server. Please reopen if the problem occurs again.