mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- replaced usage of deprecated APIs to get macOS version
This commit is contained in:
parent
181c923001
commit
fc7af31cb9
1 changed files with 29 additions and 13 deletions
|
@ -125,20 +125,36 @@ void Mac_I_FatalError(const char* const message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000
|
||||||
|
|
||||||
|
// Available since 10.9 with no public declaration/definition until 10.10
|
||||||
|
|
||||||
|
struct NSOperatingSystemVersion
|
||||||
|
{
|
||||||
|
NSInteger majorVersion;
|
||||||
|
NSInteger minorVersion;
|
||||||
|
NSInteger patchVersion;
|
||||||
|
};
|
||||||
|
|
||||||
|
@interface NSProcessInfo(OperatingSystemVersion)
|
||||||
|
- (NSOperatingSystemVersion)operatingSystemVersion;
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif // before 10.10
|
||||||
|
|
||||||
static void I_DetectOS()
|
static void I_DetectOS()
|
||||||
{
|
{
|
||||||
SInt32 majorVersion = 0;
|
NSOperatingSystemVersion version = {};
|
||||||
Gestalt(gestaltSystemVersionMajor, &majorVersion);
|
NSProcessInfo* const processInfo = [NSProcessInfo processInfo];
|
||||||
|
|
||||||
SInt32 minorVersion = 0;
|
if ([processInfo respondsToSelector:@selector(operatingSystemVersion)])
|
||||||
Gestalt(gestaltSystemVersionMinor, &minorVersion);
|
{
|
||||||
|
version = [processInfo operatingSystemVersion];
|
||||||
SInt32 bugFixVersion = 0;
|
}
|
||||||
Gestalt(gestaltSystemVersionBugFix, &bugFixVersion);
|
|
||||||
|
|
||||||
const char* name = "Unknown version";
|
const char* name = "Unknown version";
|
||||||
|
|
||||||
if (10 == majorVersion) switch (minorVersion)
|
if (10 == version.majorVersion) switch (version.minorVersion)
|
||||||
{
|
{
|
||||||
case 7: name = "Mac OS X Lion"; break;
|
case 7: name = "Mac OS X Lion"; break;
|
||||||
case 8: name = "OS X Mountain Lion"; break;
|
case 8: name = "OS X Mountain Lion"; break;
|
||||||
|
@ -163,9 +179,9 @@ static void I_DetectOS()
|
||||||
"Unknown";
|
"Unknown";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Printf("OS: %s %d.%d.%d (%s) %s\n", name,
|
Printf("OS: %s %d.%d.%d (%s) %s\n", name,
|
||||||
int(majorVersion), int(minorVersion), int(bugFixVersion),
|
int(version.majorVersion), int(version.minorVersion), int(version.patchVersion),
|
||||||
release, architecture);
|
release, architecture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue