mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
macOS: Use custom declaration for master/main port default
This commit is contained in:
parent
f9c66481c1
commit
829511a337
@ -1451,6 +1451,10 @@ static cc_result GetMachineID(cc_uint32* key) {
|
||||
return res;
|
||||
}
|
||||
#elif defined CC_BUILD_MACOS
|
||||
/* kIOMasterPortDefault is deprecated since macOS 12.0 (replaced with kIOMainPortDefault) */
|
||||
/* And since kIOMasterPortDefault is just 0/NULL anyways, just manually declare it */
|
||||
static const mach_port_t masterPortDefault = 0;
|
||||
|
||||
/* Read kIOPlatformUUIDKey from I/O registry for the key */
|
||||
static cc_result GetMachineID(cc_uint32* key) {
|
||||
io_registry_entry_t registry;
|
||||
@ -1458,7 +1462,7 @@ static cc_result GetMachineID(cc_uint32* key) {
|
||||
char tmp[256] = { 0 };
|
||||
|
||||
#ifdef kIOPlatformUUIDKey
|
||||
registry = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
|
||||
registry = IORegistryEntryFromPath(masterPortDefault, "IOService:/");
|
||||
if (!registry) return ERR_NOT_SUPPORTED;
|
||||
|
||||
devID = IORegistryEntryCreateCFProperty(registry, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
|
||||
@ -1466,7 +1470,7 @@ static cc_result GetMachineID(cc_uint32* key) {
|
||||
DecodeMachineID(tmp, String_Length(tmp), key);
|
||||
}
|
||||
#else
|
||||
registry = IOServiceGetMatchingService(kIOMasterPortDefault,
|
||||
registry = IOServiceGetMatchingService(masterPortDefault,
|
||||
IOServiceMatching("IOPlatformExpertDevice"));
|
||||
|
||||
devID = IORegistryEntryCreateCFProperty(registry, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user