mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 01:55:19 -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;
|
return res;
|
||||||
}
|
}
|
||||||
#elif defined CC_BUILD_MACOS
|
#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 */
|
/* Read kIOPlatformUUIDKey from I/O registry for the key */
|
||||||
static cc_result GetMachineID(cc_uint32* key) {
|
static cc_result GetMachineID(cc_uint32* key) {
|
||||||
io_registry_entry_t registry;
|
io_registry_entry_t registry;
|
||||||
@ -1458,7 +1462,7 @@ static cc_result GetMachineID(cc_uint32* key) {
|
|||||||
char tmp[256] = { 0 };
|
char tmp[256] = { 0 };
|
||||||
|
|
||||||
#ifdef kIOPlatformUUIDKey
|
#ifdef kIOPlatformUUIDKey
|
||||||
registry = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
|
registry = IORegistryEntryFromPath(masterPortDefault, "IOService:/");
|
||||||
if (!registry) return ERR_NOT_SUPPORTED;
|
if (!registry) return ERR_NOT_SUPPORTED;
|
||||||
|
|
||||||
devID = IORegistryEntryCreateCFProperty(registry, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
|
devID = IORegistryEntryCreateCFProperty(registry, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
|
||||||
@ -1466,7 +1470,7 @@ static cc_result GetMachineID(cc_uint32* key) {
|
|||||||
DecodeMachineID(tmp, String_Length(tmp), key);
|
DecodeMachineID(tmp, String_Length(tmp), key);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
registry = IOServiceGetMatchingService(kIOMasterPortDefault,
|
registry = IOServiceGetMatchingService(masterPortDefault,
|
||||||
IOServiceMatching("IOPlatformExpertDevice"));
|
IOServiceMatching("IOPlatformExpertDevice"));
|
||||||
|
|
||||||
devID = IORegistryEntryCreateCFProperty(registry, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0);
|
devID = IORegistryEntryCreateCFProperty(registry, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user