"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."
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:
IOPMAssertionDeclareUserActivity
Declares that the user is active on the system. This causes the display to power on and postpone display sleep up to the user's display sleep Energy Saver settings.
"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:
From the Apple docs:
IOPMAssertionDeclareUserActivity
Declares that the user is active on the system. This causes the display to power on and postpone display sleep up to the user's display sleep Energy Saver settings.