From 57f9ac6fed864860d3e71191219d6eac23985df8 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Mon, 25 Jul 2022 20:49:58 +0100 Subject: [PATCH] Metal-CPP: extend NS:Data* & NS::Bundle* methods Add: NS::String* NS::Bundle::pathForResource(const class String* pName, const class String* pExt) const; NS::Data *NS::Data::dataWithContentsOfFile(const String* path); const void* NS::Data::bytes() const; --- renderdoc/driver/metal/official/metal-cpp.h | 31 +++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/metal/official/metal-cpp.h b/renderdoc/driver/metal/official/metal-cpp.h index 13fedc17b..8b0425220 100644 --- a/renderdoc/driver/metal/official/metal-cpp.h +++ b/renderdoc/driver/metal/official/metal-cpp.h @@ -90,6 +90,7 @@ namespace Private _NS_PRIVATE_DEF_CLS(NSAutoreleasePool); _NS_PRIVATE_DEF_CLS(NSBundle); _NS_PRIVATE_DEF_CLS(NSCondition); + _NS_PRIVATE_DEF_CLS(NSData); _NS_PRIVATE_DEF_CLS(NSDate); _NS_PRIVATE_DEF_CLS(NSDictionary); _NS_PRIVATE_DEF_CLS(NSError); @@ -172,6 +173,8 @@ namespace Private "bundleWithPath:"); _NS_PRIVATE_DEF_SEL(bundleWithURL_, "bundleWithURL:"); + _NS_PRIVATE_DEF_SEL(bytes, + "bytes"); _NS_PRIVATE_DEF_SEL(caseInsensitiveCompare_, "caseInsensitiveCompare:"); _NS_PRIVATE_DEF_SEL(characterAtIndex_, @@ -192,6 +195,8 @@ namespace Private "count"); _NS_PRIVATE_DEF_SEL(dateWithTimeIntervalSinceNow_, "dateWithTimeIntervalSinceNow:"); + _NS_PRIVATE_DEF_SEL(dataWithContentsOfFile_, + "dataWithContentsOfFile:"); _NS_PRIVATE_DEF_SEL(defaultCenter, "defaultCenter"); _NS_PRIVATE_DEF_SEL(descriptionWithLocale_, @@ -200,6 +205,8 @@ namespace Private "disableAutomaticTermination:"); _NS_PRIVATE_DEF_SEL(disableSuddenTermination, "disableSuddenTermination"); + _NS_PRIVATE_DEF_SEL(distantPast, + "distantPast"); _NS_PRIVATE_DEF_SEL(debugDescription, "debugDescription"); _NS_PRIVATE_DEF_SEL(description, @@ -406,6 +413,8 @@ namespace Private "operatingSystemVersionString"); _NS_PRIVATE_DEF_SEL(pathForAuxiliaryExecutable_, "pathForAuxiliaryExecutable:"); + _NS_PRIVATE_DEF_SEL(pathForResource_ofType_, + "pathForResource:ofType:"); _NS_PRIVATE_DEF_SEL(performActivityWithOptions_reason_usingBlock_, "performActivityWithOptions:reason:usingBlock:"); _NS_PRIVATE_DEF_SEL(performExpiringActivityWithReason_usingBlock_, @@ -1344,6 +1353,7 @@ public: class String* resourcePath() const; class String* executablePath() const; class String* pathForAuxiliaryExecutable(const class String* pExecutableName) const; + class String* pathForResource(const class String* pName, const class String* pExt) const; class String* privateFrameworksPath() const; class String* sharedFrameworksPath() const; @@ -1512,6 +1522,11 @@ _NS_INLINE NS::String* NS::Bundle::pathForAuxiliaryExecutable(const String* pExe return Object::sendMessage(this, _NS_PRIVATE_SEL(pathForAuxiliaryExecutable_), pExecutableName); } +_NS_INLINE NS::String* NS::Bundle::pathForResource(const class String* pName, const class String* pExt) const +{ + return Object::sendMessage(this, _NS_PRIVATE_SEL(pathForResource_ofType_), pName, pExt); +} + _NS_INLINE NS::String* NS::Bundle::privateFrameworksPath() const { return Object::sendMessage(this, _NS_PRIVATE_SEL(privateFrameworksPath)); @@ -1562,11 +1577,18 @@ namespace NS class Data : public Copying { public: - void* mutableBytes() const; - UInteger length() const; + static NS::Data* dataWithContentsOfFile(const String* path); + void* mutableBytes() const; + const void* bytes() const; + UInteger length() const; }; } +_NS_INLINE NS::Data* NS::Data::dataWithContentsOfFile(const String* path) +{ + return Object::sendMessage(_NS_PRIVATE_CLS(NSData), _NS_PRIVATE_SEL(dataWithContentsOfFile_), path); +} + _NS_INLINE void* NS::Data::mutableBytes() const { return Object::sendMessage(this, _NS_PRIVATE_SEL(mutableBytes)); @@ -1577,6 +1599,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)); +} + namespace NS {