mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-06 16:43:09 -06:00
* Use MacOS-specific refresh rate check to avoid SDL race condition * IsLowRefreshRate: Change back to `SDL_Init` just to be safe
33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
// Copyright Citra Emulator Project / Azahar Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import <CoreGraphics/CoreGraphics.h>
|
|
#import <Foundation/Foundation.h>
|
|
|
|
namespace AppleUtils {
|
|
|
|
float GetRefreshRate() { // TODO: How does this handle multi-monitor? -OS
|
|
NSScreen* screen = [NSScreen mainScreen];
|
|
if (screen) {
|
|
NSDictionary* screenInfo = [screen deviceDescription];
|
|
CGDirectDisplayID displayID =
|
|
(CGDirectDisplayID)[screenInfo[@"NSScreenNumber"] unsignedIntValue];
|
|
CGDisplayModeRef displayMode = CGDisplayCopyDisplayMode(displayID);
|
|
if (displayMode) {
|
|
CGFloat refreshRate = CGDisplayModeGetRefreshRate(displayMode);
|
|
CFRelease(displayMode);
|
|
return refreshRate;
|
|
}
|
|
}
|
|
|
|
return 60; // Something went wrong, so just return a generic value
|
|
}
|
|
|
|
int IsLowPowerModeEnabled() {
|
|
return (int)[NSProcessInfo processInfo].lowPowerModeEnabled;
|
|
}
|
|
|
|
} // namespace AppleUtils
|