diff --git a/common/Darwin/DarwinMisc.cpp b/common/Darwin/DarwinMisc.cpp index 21788e4c50..cad0cb42be 100644 --- a/common/Darwin/DarwinMisc.cpp +++ b/common/Darwin/DarwinMisc.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "common/Pcsx2Types.h" #include "common/General.h" @@ -93,8 +94,17 @@ std::string GetOSVersionString() return type + " " + release + " " + arch; } +static IOPMAssertionID s_pm_assertion; + void ScreensaverAllow(bool allow) { - // no-op + if (s_pm_assertion) + { + IOPMAssertionRelease(s_pm_assertion); + s_pm_assertion = 0; + } + + if (!allow) + IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep, kIOPMAssertionLevelOn, CFSTR("Playing a game"), &s_pm_assertion); } #endif