Firstborn/Library/PackageCache/com.unity.ads@4.4.2/Plugins/iOS/UnityAdsUtilities.m
Schaken-Mods 9092858a58 updated to the latest editor
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
2023-05-07 17:43:11 -05:00

39 lines
1.1 KiB
Objective-C

const char * UnityAdsCopyString(const char * string) {
char * copy = (char *)malloc(strlen(string) + 1);
strcpy(copy, string);
return copy;
}
/**
* Returns the size of an Il2CppString
*/
size_t Il2CppStringLen(const ushort* str) {
const ushort* start = str;
while (*str) ++str;
return str - start;
}
/**
* Converts an ushort string to an NSString
*/
NSString* NSStringFromIl2CppString(const ushort* str) {
size_t len = Il2CppStringLen(str);
return [[NSString alloc] initWithBytes:(const void*)str
length:sizeof(ushort) * len
encoding:NSUTF16LittleEndianStringEncoding];
}
/**
* Converts an NSString to a char string.Does pre checks for null pointer
*/
const char * CStringFromNSString(const NSString * string) {
return string != NULL ? UnityAdsCopyString([string UTF8String]) : NULL;
}
/**
* Converts a char string to an NSString.Does pre checks for null pointer
*/
NSString* NSStringFromCString(const char* string) {
return string != NULL ? [NSString stringWithUTF8String: string] : NULL;
}