From 8cd7f69cbcc449edd647a5ffe0c201125f48afa2 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Fri, 27 Mar 2026 00:06:53 +0900 Subject: [PATCH] [Kernel] Fix macro collisions with macOS system headers Rename IPPROTO_TCP/UDP/VDP enum values to XE_IPPROTO_* to avoid collision with macOS macros. Add #undef WAIT_ANY guard for macOS macro. --- src/xenia/kernel/xsocket.cc | 4 ++-- src/xenia/kernel/xsocket.h | 6 +++--- src/xenia/kernel/xthread.h | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/xenia/kernel/xsocket.cc b/src/xenia/kernel/xsocket.cc index 3376f57df..3ff28a76e 100644 --- a/src/xenia/kernel/xsocket.cc +++ b/src/xenia/kernel/xsocket.cc @@ -70,9 +70,9 @@ X_STATUS XSocket::Initialize(AddressFamily af, Type type, Protocol proto) { type_ = type; proto_ = proto; - if (proto == Protocol::IPPROTO_VDP) { + if (proto == Protocol::XE_IPPROTO_VDP) { // VDP is a layer on top of UDP. - proto = Protocol::IPPROTO_UDP; + proto = Protocol::XE_IPPROTO_UDP; } native_handle_ = socket(af, type, proto); diff --git a/src/xenia/kernel/xsocket.h b/src/xenia/kernel/xsocket.h index 10dcf42f1..13a146f0f 100644 --- a/src/xenia/kernel/xsocket.h +++ b/src/xenia/kernel/xsocket.h @@ -90,13 +90,13 @@ class XSocket : public XObject { }; enum Protocol { - IPPROTO_TCP = 6, - IPPROTO_UDP = 17, + XE_IPPROTO_TCP = 6, + XE_IPPROTO_UDP = 17, // LIVE Voice and Data Protocol // https://blog.csdn.net/baozi3026/article/details/4277227 // Format: [cbGameData][GameData(encrypted)][VoiceData(unencrypted)] - IPPROTO_VDP = 254, + XE_IPPROTO_VDP = 254, }; XSocket(KernelState* kernel_state); diff --git a/src/xenia/kernel/xthread.h b/src/xenia/kernel/xthread.h index 4c60e5c63..dd0fa31b8 100644 --- a/src/xenia/kernel/xthread.h +++ b/src/xenia/kernel/xthread.h @@ -222,6 +222,9 @@ struct X_KPCR { uint8_t unk_2AC[0x2C]; // 0x2AC }; +#ifdef WAIT_ANY +#undef WAIT_ANY +#endif enum : uint16_t { WAIT_ALL = 0, WAIT_ANY = 1,