Open appvitor opened 1 year ago
Can be achieved with IOKit
import IOKit
import IOKit.pwr_mgt
let reasonForActivity = "Reason for activity" as CFString
var assertionID: IOPMAssertionID = 0
var success = IOPMAssertionCreateWithName( kIOPMAssertionTypeNoDisplaySleep as CFString,
IOPMAssertionLevel(kIOPMAssertionLevelOn),
reasonForActivity,
&assertionID )
if success == kIOReturnSuccess {
// Add the work you need to do without the system sleeping here.
success = IOPMAssertionRelease(assertionID);
// The system will be able to sleep again.
}
I have a similar problem, which happens when playing using the game controller (I'm using a Nintendo Switch Pro controller) while charging (wired). When playing with a game controller via bluetooth, Ryujinx register input activity normally, but when you connect the game controller via usb, Ryujinx stops registering the input activity to the system, which triggers the screen saver after a certain type of "inactivity".
I have created this simple script to monitor if Ryujinx is running and stop macOS from going into sleep until Ryujinx continues to run. This might be helpful for anyone looking for a short-term solution.
Description of the issue
During cinematic exhibitions, macOS will start the system's screensaver due to the lack of user input. This behavior shouldn't be allowed to happen, because the player is supposedly paying attention to it. One workaround is the user to increase the time that takes for the screensaver to kick in, but it's not a proper solution.
Mortal Kombat 11 is a great example for this situation. Many times I had to stop everything and move the cursor to solve this.
Reproduction steps
Choose a game with many long cinematics Set the systems screensaver to kick in with 3 - 5 minutes or even less Play the game and try to watch the cinematic, it will be interrupted many times.
Log file
Ryujinx_1.1.1000_2023-08-26_00-45-07.log.zip
OS
macOS 14 Beta 6
Ryujinx version
1.1.1000
Game version
1.0.26
CPU
M1
GPU
M1
RAM
8GB
List of applied mods
No mods applied
Additional context?
No response