macOS: Use custom declaration for master/main port default
Some checks failed
Build latest (3DS) / build-3DS (push) Has been cancelled
Build latest (Android2) / build (push) Has been cancelled
Build latest (Dreamcast) / build (push) Has been cancelled
Build latest (FreeBSD) / build (push) Has been cancelled
Build latest (Haiku) / build-haiku (push) Has been cancelled
Build latest (iOS) / build (push) Has been cancelled
Build latest (Linux) / build-32 (push) Has been cancelled
Build latest (Linux) / build-64 (push) Has been cancelled
Build latest (macOS 32 bit) / build (push) Has been cancelled
Build latest (macOS 64 bit) / build (push) Has been cancelled
Build latest (Mac Classic) / build-mac-classic (push) Has been cancelled
Build latest (MS DOS) / build-msdos (push) Has been cancelled
Build latest (N64) / build (push) Has been cancelled
Build latest (NDS) / build-DS (push) Has been cancelled
Build latest (NetBSD) / build (push) Has been cancelled
Build latest (PS1) / build-PS1 (push) Has been cancelled
Build latest (PS2) / build (push) Has been cancelled
Build latest (PS3) / build-PS3 (push) Has been cancelled
Build latest (PSP) / build-PSP (push) Has been cancelled
Build latest (RPI) / build-RPI32 (push) Has been cancelled
Build latest (RPI) / build-RPI64 (push) Has been cancelled
Build latest (Saturn) / build (push) Has been cancelled
Build latest (Switch) / build-switch (push) Has been cancelled
Build latest (Vita) / build-Vita (push) Has been cancelled
Build latest (Webclient) / build (push) Has been cancelled
Build latest (Wii/GameCube) / build (push) Has been cancelled
Build latest (WiiU) / build (push) Has been cancelled
Build latest (Windows ARM32/64) / build-32 (push) Has been cancelled
Build latest (Windows ARM32/64) / build-64 (push) Has been cancelled
Build latest (Windows) / build-32 (push) Has been cancelled
Build latest (Windows) / build-64 (push) Has been cancelled
Build latest (Xbox) / build-Xbox (push) Has been cancelled
Build latest (Xbox 360) / build-360 (push) Has been cancelled

This commit is contained in:
UnknownShadow200 2024-12-31 16:24:00 +11:00
parent f9c66481c1
commit 829511a337

View file

@ -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);