dirkwhoffmann / virtualc64

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

Screensaver starts if plays with a joystick or joypad USB #709

Closed Gianmarco72 closed 2 years ago

Gianmarco72 commented 2 years ago

When I play using my Speedlink Competition PRO USB, my iMac starts the screensaver after time I set in Sys Pref on macOS. Same thing with other joypad USB (Gravis GamePro). I think it also happens with a Bluetooth gamepad but I haven't tried it yet.

Virtual C64 v4.4 macOS Monterey (12.0.1)

dirkwhoffmann commented 2 years ago

I've implemented a fix according to this article:

    var token: NSObjectProtocol!

    public func applicationDidFinishLaunching(_ aNotification: Notification) {

        debug(.lifetime)

        token = ProcessInfo.processInfo.beginActivity(options: [ .userInitiated ],
                                                      reason: "Running VirtualC64")
    }

    public func applicationWillTerminate(_ aNotification: Notification) {

        debug(.lifetime)

        ProcessInfo.processInfo.endActivity(token)
    }
dirkwhoffmann commented 2 years ago

v4.5b1 is online.