diff -ruN original/Foundation/NSData.hpp patched/Foundation/NSData.hpp --- original/Foundation/NSData.hpp 2026-02-18 06:41:30 +++ patched/Foundation/NSData.hpp 2026-02-18 06:41:30 @@ -34,6 +34,7 @@ public: void* mutableBytes() const; UInteger length() const; + const void * bytes() const; }; } @@ -49,6 +50,11 @@ _NS_INLINE NS::UInteger NS::Data::length() const { return Object::sendMessage(this, _NS_PRIVATE_SEL(length)); +} + +_NS_INLINE const void * NS::Data::bytes() const +{ + return Object::sendMessage(this, _NS_PRIVATE_SEL(bytes)); } //------------------------------------------------------------------------------------------------------------------------------------------------------------- diff -ruN original/Foundation/NSDefines.hpp patched/Foundation/NSDefines.hpp --- original/Foundation/NSDefines.hpp 2026-02-18 06:41:30 +++ patched/Foundation/NSDefines.hpp 2026-02-18 06:41:30 @@ -22,6 +22,16 @@ //------------------------------------------------------------------------------------------------------------------------------------------------------------- +// Forward declarations to avoid conflicts with Godot types (String, Object, Error) +namespace NS { +class Array; +class Dictionary; +class Error; +class Object; +class String; +class URL; +} // namespace NS + #define _NS_WEAK_IMPORT __attribute__((weak_import)) #ifdef METALCPP_SYMBOL_VISIBILITY_HIDDEN #define _NS_EXPORT __attribute__((visibility("hidden"))) diff -ruN original/Foundation/NSObject.hpp patched/Foundation/NSObject.hpp --- original/Foundation/NSObject.hpp 2026-02-18 06:41:30 +++ patched/Foundation/NSObject.hpp 2026-02-18 06:41:30 @@ -68,6 +68,12 @@ class String* description() const; class String* debugDescription() const; + template + static _Ret sendMessage(const void* pObj, SEL selector, _Args... args); + + template + static _Ret sendMessageSafe(const void* pObj, SEL selector, _Args... args); + protected: friend class Referencing; @@ -84,10 +90,6 @@ static bool respondsToSelector(const void* pObj, SEL selector); template static constexpr bool doesRequireMsgSendStret(); - template - static _Ret sendMessage(const void* pObj, SEL selector, _Args... args); - template - static _Ret sendMessageSafe(const void* pObj, SEL selector, _Args... args); private: Object() = delete; diff -ruN original/Foundation/NSPrivate.hpp patched/Foundation/NSPrivate.hpp --- original/Foundation/NSPrivate.hpp 2026-02-18 06:41:30 +++ patched/Foundation/NSPrivate.hpp 2026-02-18 06:41:30 @@ -184,6 +184,8 @@ "bundleWithPath:"); _NS_PRIVATE_DEF_SEL(bundleWithURL_, "bundleWithURL:"); + _NS_PRIVATE_DEF_SEL(bytes, + "bytes"); _NS_PRIVATE_DEF_SEL(caseInsensitiveCompare_, "caseInsensitiveCompare:"); _NS_PRIVATE_DEF_SEL(characterAtIndex_, @@ -268,6 +270,8 @@ "initFileURLWithPath:"); _NS_PRIVATE_DEF_SEL(initWithBool_, "initWithBool:"); + _NS_PRIVATE_DEF_SEL(initWithBytes_length_encoding_, + "initWithBytes:length:encoding:"); _NS_PRIVATE_DEF_SEL(initWithBytes_objCType_, "initWithBytes:objCType:"); _NS_PRIVATE_DEF_SEL(initWithBytesNoCopy_length_encoding_freeWhenDone_, diff -ruN original/Foundation/NSString.hpp patched/Foundation/NSString.hpp --- original/Foundation/NSString.hpp 2026-02-18 06:41:30 +++ patched/Foundation/NSString.hpp 2026-02-18 06:41:30 @@ -104,6 +104,7 @@ String* stringByAppendingString(const String* pString) const; ComparisonResult caseInsensitiveCompare(const String* pString) const; + NS::String* init(const void * bytes, NS::UInteger len, NS::StringEncoding encoding); }; /// Create an NS::String* from a string literal. @@ -250,6 +251,11 @@ _NS_INLINE NS::ComparisonResult NS::String::caseInsensitiveCompare(const String* pString) const { return Object::sendMessage(this, _NS_PRIVATE_SEL(caseInsensitiveCompare_), pString); +} + +_NS_INLINE NS::String* NS::String::init(const void * bytes, NS::UInteger len, NS::StringEncoding encoding) +{ + return Object::sendMessage(this, _NS_PRIVATE_SEL(initWithBytes_length_encoding_), bytes, len, encoding); } //------------------------------------------------------------------------------------------------------------------------------------------------------------- diff -ruN original/QuartzCore/CALayer.hpp patched/QuartzCore/CALayer.hpp --- original/QuartzCore/CALayer.hpp 1970-01-01 11:00:00 +++ patched/QuartzCore/CALayer.hpp 2026-02-18 06:41:30 @@ -0,0 +1,79 @@ +#pragma once + +#include "CADefines.hpp" +#include "CAPrivate.hpp" +#include "../Foundation/NSObject.hpp" +#include + +namespace CA +{ +using DynamicRange = NS::String*; + +_CA_CONST(DynamicRange, DynamicRangeAutomatic); +_CA_CONST(DynamicRange, DynamicRangeStandard); +_CA_CONST(DynamicRange, DynamicRangeConstrainedHigh); +_CA_CONST(DynamicRange, DynamicRangeHigh); + + +class Layer : public NS::Referencing +{ +public: + bool wantsExtendedDynamicRangeContent() const; + void setWantsExtendedDynamicRangeContent(bool wantsExtendedDynamicRangeContent); + CA::DynamicRange preferredDynamicRange() const; + void setPreferredDynamicRange(CA::DynamicRange preferredDynamicRange); + CGFloat contentsHeadroom() const; + void setContentsHeadroom(CGFloat contentsHeadroom); + bool opaque() const; + void setOpaque(bool opaque); + +}; + +} // namespace CA + +// --- Inline implementations --- + +_CA_INLINE bool CA::Layer::wantsExtendedDynamicRangeContent() const +{ + return Object::sendMessage(this, _CA_PRIVATE_SEL(wantsExtendedDynamicRangeContent)); +} + +_CA_INLINE void CA::Layer::setWantsExtendedDynamicRangeContent(bool wantsExtendedDynamicRangeContent) +{ + Object::sendMessage(this, _CA_PRIVATE_SEL(setWantsExtendedDynamicRangeContent_), wantsExtendedDynamicRangeContent); +} + +_CA_INLINE CA::DynamicRange CA::Layer::preferredDynamicRange() const +{ + return Object::sendMessage(this, _CA_PRIVATE_SEL(preferredDynamicRange)); +} + +_CA_INLINE void CA::Layer::setPreferredDynamicRange(CA::DynamicRange preferredDynamicRange) +{ + Object::sendMessage(this, _CA_PRIVATE_SEL(setPreferredDynamicRange_), preferredDynamicRange); +} + +_CA_INLINE CGFloat CA::Layer::contentsHeadroom() const +{ + return Object::sendMessage(this, _CA_PRIVATE_SEL(contentsHeadroom)); +} + +_CA_INLINE void CA::Layer::setContentsHeadroom(CGFloat contentsHeadroom) +{ + Object::sendMessage(this, _CA_PRIVATE_SEL(setContentsHeadroom_), contentsHeadroom); +} + +_CA_INLINE bool CA::Layer::opaque() const +{ + return Object::sendMessage(this, _CA_PRIVATE_SEL(opaque)); +} + +_CA_INLINE void CA::Layer::setOpaque(bool opaque) +{ + Object::sendMessage(this, _CA_PRIVATE_SEL(setOpaque_), opaque); +} + +_CA_PRIVATE_DEF_CONST(CA::DynamicRange, DynamicRangeAutomatic); +_CA_PRIVATE_DEF_CONST(CA::DynamicRange, DynamicRangeStandard); +_CA_PRIVATE_DEF_CONST(CA::DynamicRange, DynamicRangeConstrainedHigh); +_CA_PRIVATE_DEF_CONST(CA::DynamicRange, DynamicRangeHigh); diff -ruN original/QuartzCore/CAMetalLayer.hpp patched/QuartzCore/CAMetalLayer.hpp --- original/QuartzCore/CAMetalLayer.hpp 2026-02-18 06:41:30 +++ patched/QuartzCore/CAMetalLayer.hpp 2026-02-18 06:41:31 @@ -32,13 +32,14 @@ #include "CADefines.hpp" #include "CAMetalDrawable.hpp" #include "CAPrivate.hpp" +#include "CALayer.hpp" //------------------------------------------------------------------------------------------------------------------------------------------------------------- namespace CA { -class MetalLayer : public NS::Referencing +class MetalLayer : public NS::Referencing { public: static class MetalLayer* layer(); diff -ruN original/QuartzCore/CAPrivate.hpp patched/QuartzCore/CAPrivate.hpp --- original/QuartzCore/CAPrivate.hpp 2026-02-18 06:41:30 +++ patched/QuartzCore/CAPrivate.hpp 2026-02-18 06:41:31 @@ -54,16 +54,49 @@ #define _CA_PRIVATE_DEF_CLS(symbol) void* s_k##symbol _CA_PRIVATE_VISIBILITY = _CA_PRIVATE_OBJC_LOOKUP_CLASS(symbol) #define _CA_PRIVATE_DEF_PRO(symbol) void* s_k##symbol _CA_PRIVATE_VISIBILITY = _CA_PRIVATE_OBJC_GET_PROTOCOL(symbol) #define _CA_PRIVATE_DEF_SEL(accessor, symbol) SEL s_k##accessor _CA_PRIVATE_VISIBILITY = sel_registerName(symbol) + +#include + +namespace CA::Private +{ + template + inline _Type const LoadSymbol(const char* pSymbol) + { + const _Type* pAddress = static_cast<_Type*>(dlsym(RTLD_DEFAULT, pSymbol)); + + return pAddress ? *pAddress : nullptr; + } +} // CA::Private + +#if defined(__MAC_26_0) || defined(__IPHONE_26_0) || defined(__TVOS_26_0) + #define _CA_PRIVATE_DEF_STR(type, symbol) \ _CA_EXTERN type const CA##symbol _CA_PRIVATE_IMPORT; \ type const CA::symbol = (nullptr != &CA##symbol) ? CA##symbol : nullptr +#define _CA_PRIVATE_DEF_CONST(type, symbol) \ + _CA_EXTERN type const CA##symbol _CA_PRIVATE_IMPORT; \ + type const CA::symbol = (nullptr != &CA##symbol) ? CA##symbol : nullptr + #else +#define _CA_PRIVATE_DEF_STR(type, symbol) \ + _CA_EXTERN type const CA##symbol; \ + type const CA::symbol = CA::Private::LoadSymbol("CA" #symbol) + +#define _CA_PRIVATE_DEF_CONST(type, symbol) \ + _CA_EXTERN type const CA##symbol; \ + type const CA::symbol = CA::Private::LoadSymbol("CA" #symbol) + +#endif + +#else + #define _CA_PRIVATE_DEF_CLS(symbol) extern void* s_k##symbol #define _CA_PRIVATE_DEF_PRO(symbol) extern void* s_k##symbol #define _CA_PRIVATE_DEF_SEL(accessor, symbol) extern SEL s_k##accessor #define _CA_PRIVATE_DEF_STR(type, symbol) extern type const CA::symbol +#define _CA_PRIVATE_DEF_CONST(type, symbol) extern type const CA::symbol #endif // CA_PRIVATE_IMPLEMENTATION @@ -76,6 +109,7 @@ namespace Class { _CA_PRIVATE_DEF_CLS(CAMetalLayer); + _CA_PRIVATE_DEF_CLS(CALayer); } // Class } // Private } // CA @@ -107,6 +141,8 @@ "allowsNextDrawableTimeout"); _CA_PRIVATE_DEF_SEL(colorspace, "colorspace"); + _CA_PRIVATE_DEF_SEL(contentsHeadroom, + "contentsHeadroom"); _CA_PRIVATE_DEF_SEL(device, "device"); _CA_PRIVATE_DEF_SEL(displaySyncEnabled, @@ -121,14 +157,20 @@ "maximumDrawableCount"); _CA_PRIVATE_DEF_SEL(nextDrawable, "nextDrawable"); + _CA_PRIVATE_DEF_SEL(opaque, + "opaque"); _CA_PRIVATE_DEF_SEL(pixelFormat, "pixelFormat"); + _CA_PRIVATE_DEF_SEL(preferredDynamicRange, + "preferredDynamicRange"); _CA_PRIVATE_DEF_SEL(residencySet, "residencySet"); _CA_PRIVATE_DEF_SEL(setAllowsNextDrawableTimeout_, "setAllowsNextDrawableTimeout:"); _CA_PRIVATE_DEF_SEL(setColorspace_, "setColorspace:"); + _CA_PRIVATE_DEF_SEL(setContentsHeadroom_, + "setContentsHeadroom:"); _CA_PRIVATE_DEF_SEL(setDevice_, "setDevice:"); _CA_PRIVATE_DEF_SEL(setDisplaySyncEnabled_, @@ -139,10 +181,19 @@ "setFramebufferOnly:"); _CA_PRIVATE_DEF_SEL(setMaximumDrawableCount_, "setMaximumDrawableCount:"); + _CA_PRIVATE_DEF_SEL(setOpaque_, + "setOpaque:"); _CA_PRIVATE_DEF_SEL(setPixelFormat_, "setPixelFormat:"); + _CA_PRIVATE_DEF_SEL(setPreferredDynamicRange_, + "setPreferredDynamicRange:"); + _CA_PRIVATE_DEF_SEL(setWantsExtendedDynamicRangeContent_, + "setWantsExtendedDynamicRangeContent:"); _CA_PRIVATE_DEF_SEL(texture, "texture"); + _CA_PRIVATE_DEF_SEL(wantsExtendedDynamicRangeContent, + "wantsExtendedDynamicRangeContent"); + } // Class } // Private } // CA diff -ruN original/QuartzCore/QuartzCore.hpp patched/QuartzCore/QuartzCore.hpp --- original/QuartzCore/QuartzCore.hpp 2026-02-18 06:41:30 +++ patched/QuartzCore/QuartzCore.hpp 2026-02-18 06:41:31 @@ -22,6 +22,7 @@ //------------------------------------------------------------------------------------------------------------------------------------------------------------- +#include "CALayer.hpp" #include "CAMetalDrawable.hpp" #include "CAMetalLayer.hpp"