Initial commit.

This commit is contained in:
Martin Lachmair 2019-07-01 14:33:21 +02:00
parent 92a04d779e
commit baa2e0279d
1624 changed files with 3204958 additions and 0 deletions
.vscode
App/LearnWithTouch_ios
._build
Classes
CrashReporter.hCrashReporter.mmDynamicLibEngineAPI-functions.hDynamicLibEngineAPI.mm
Native
Bulk_Assembly-CSharp_0.cppBulk_Assembly-CSharp_1.cppBulk_Generics_0.cppBulk_Generics_1.cppBulk_Generics_10.cppBulk_Generics_11.cppBulk_Generics_12.cppBulk_Generics_13.cppBulk_Generics_14.cppBulk_Generics_15.cppBulk_Generics_2.cppBulk_Generics_3.cppBulk_Generics_4.cppBulk_Generics_5.cppBulk_Generics_6.cppBulk_Generics_7.cppBulk_Generics_8.cppBulk_Generics_9.cppBulk_Mono.Security_0.cppBulk_Mono.Security_1.cppBulk_System.Configuration_0.cppBulk_System.Core_0.cppBulk_System.Diagnostics.StackTrace_0.cppBulk_System.Globalization.Extensions_0.cppBulk_System.IO.Compression_0.cppBulk_System.Xml_0.cppBulk_System.Xml_1.cppBulk_System.Xml_2.cppBulk_System.Xml_3.cppBulk_System.Xml_4.cppBulk_System.Xml_5.cppBulk_System_0.cppBulk_System_1.cppBulk_System_2.cppBulk_System_3.cppBulk_System_4.cppBulk_System_5.cppBulk_System_6.cppBulk_Unity.TextMeshPro_0.cppBulk_Unity.TextMeshPro_1.cppBulk_Unity.TextMeshPro_2.cppBulk_Unity.TextMeshPro_3.cppBulk_UnityEngine.AnimationModule_0.cppBulk_UnityEngine.AudioModule_0.cppBulk_UnityEngine.CoreModule_0.cppBulk_UnityEngine.CoreModule_1.cppBulk_UnityEngine.GameCenterModule_0.cppBulk_UnityEngine.IMGUIModule_0.cppBulk_UnityEngine.Physics2DModule_0.cppBulk_UnityEngine.PhysicsModule_0.cppBulk_UnityEngine.SharedInternalsModule_0.cppBulk_UnityEngine.TextRenderingModule_0.cppBulk_UnityEngine.UIModule_0.cppBulk_UnityEngine.UI_0.cppBulk_UnityEngine.UI_1.cppBulk_UnityEngine.UI_2.cppBulk_UnityEngine.UI_3.cppBulk_UnityEngine.UnityAnalyticsModule_0.cppBulk_UnityEngine.UnityWebRequestModule_0.cppBulk_UnityEngine.VideoModule_0.cppBulk_UnityEngine_0.cppBulk_mscorlib_0.cppBulk_mscorlib_1.cppBulk_mscorlib_10.cppBulk_mscorlib_11.cppBulk_mscorlib_12.cppBulk_mscorlib_13.cppBulk_mscorlib_14.cppBulk_mscorlib_15.cppBulk_mscorlib_16.cppBulk_mscorlib_17.cppBulk_mscorlib_18.cppBulk_mscorlib_2.cppBulk_mscorlib_3.cppBulk_mscorlib_4.cppBulk_mscorlib_5.cppBulk_mscorlib_6.cppBulk_mscorlib_7.cppBulk_mscorlib_8.cppBulk_mscorlib_9.cppBulk_netstandard_0.cppGenericMethods0.cppGenericMethods1.cppGenericMethods2.cppGenericMethods3.cppIl2CppAttributes.cppIl2CppCodeRegistration.cppIl2CppCompilerCalculateTypeValuesTable.cppIl2CppCompilerCalculateTypeValues_0Table.cppIl2CppCompilerCalculateTypeValues_10Table.cppIl2CppCompilerCalculateTypeValues_11Table.cppIl2CppCompilerCalculateTypeValues_12Table.cppIl2CppCompilerCalculateTypeValues_13Table.cppIl2CppCompilerCalculateTypeValues_14Table.cppIl2CppCompilerCalculateTypeValues_15Table.cppIl2CppCompilerCalculateTypeValues_16Table.cppIl2CppCompilerCalculateTypeValues_17Table.cppIl2CppCompilerCalculateTypeValues_18Table.cppIl2CppCompilerCalculateTypeValues_19Table.cppIl2CppCompilerCalculateTypeValues_1Table.cppIl2CppCompilerCalculateTypeValues_20Table.cppIl2CppCompilerCalculateTypeValues_21Table.cppIl2CppCompilerCalculateTypeValues_22Table.cppIl2CppCompilerCalculateTypeValues_23Table.cppIl2CppCompilerCalculateTypeValues_24Table.cppIl2CppCompilerCalculateTypeValues_25Table.cppIl2CppCompilerCalculateTypeValues_26Table.cppIl2CppCompilerCalculateTypeValues_27Table.cppIl2CppCompilerCalculateTypeValues_28Table.cppIl2CppCompilerCalculateTypeValues_29Table.cppIl2CppCompilerCalculateTypeValues_2Table.cppIl2CppCompilerCalculateTypeValues_30Table.cppIl2CppCompilerCalculateTypeValues_31Table.cppIl2CppCompilerCalculateTypeValues_32Table.cppIl2CppCompilerCalculateTypeValues_33Table.cppIl2CppCompilerCalculateTypeValues_34Table.cppIl2CppCompilerCalculateTypeValues_3Table.cppIl2CppCompilerCalculateTypeValues_4Table.cppIl2CppCompilerCalculateTypeValues_5Table.cppIl2CppCompilerCalculateTypeValues_6Table.cppIl2CppCompilerCalculateTypeValues_7Table.cppIl2CppCompilerCalculateTypeValues_8Table.cppIl2CppCompilerCalculateTypeValues_9Table.cppIl2CppGenericClassTable.cppIl2CppGenericComDefinitions0.cppIl2CppGenericInstDefinitions.cppIl2CppGenericMethodDefinitions.cppIl2CppGenericMethodPointerTable.cppIl2CppGenericMethodTable.cppIl2CppInteropDataTable.cppIl2CppInvokerTable.cppIl2CppMetadataRegistration.cppIl2CppMetadataUsage.cppIl2CppMethodPointerTable.cppIl2CppReversePInvokeWrapperTable.cppIl2CppTypeDefinitions.cppUnityClassRegistration.cppUnityICallRegistration.cppUnresolvedVirtualCallStubs.cpp
PLCrashReporter.h
PluginBase
Prefix.pchPreprocessor.hQuaternion4.h
UI
Unity

57
.vscode/settings.json vendored Normal file

@ -0,0 +1,57 @@
{
"files.exclude":
{
"**/.DS_Store":true,
"**/.git":true,
"**/.gitignore":true,
"**/.gitmodules":true,
"**/*.booproj":true,
"**/*.pidb":true,
"**/*.suo":true,
"**/*.user":true,
"**/*.userprefs":true,
"**/*.unityproj":true,
"**/*.dll":true,
"**/*.exe":true,
"**/*.pdf":true,
"**/*.mid":true,
"**/*.midi":true,
"**/*.wav":true,
"**/*.gif":true,
"**/*.ico":true,
"**/*.jpg":true,
"**/*.jpeg":true,
"**/*.png":true,
"**/*.psd":true,
"**/*.tga":true,
"**/*.tif":true,
"**/*.tiff":true,
"**/*.3ds":true,
"**/*.3DS":true,
"**/*.fbx":true,
"**/*.FBX":true,
"**/*.lxo":true,
"**/*.LXO":true,
"**/*.ma":true,
"**/*.MA":true,
"**/*.obj":true,
"**/*.OBJ":true,
"**/*.asset":true,
"**/*.cubemap":true,
"**/*.flare":true,
"**/*.mat":true,
"**/*.meta":true,
"**/*.prefab":true,
"**/*.unity":true,
"build/":true,
"Build/":true,
"Library/":true,
"library/":true,
"obj/":true,
"Obj/":true,
"ProjectSettings/":true,
"temp/":true,
"Temp/":true
},
"git.ignoreLimitWarning": true
}

Binary file not shown.

@ -0,0 +1,32 @@
#pragma once
// Enabling this will force app to do a hard crash instead of a nice exit when UnhandledException
// is thrown. This will force iOS to generate a standard crash report, that can be submitted to
// iTunes by app users and inspected by developers.
#define ENABLE_IOS_CRASH_REPORTING 1
// Enabling this will add a custom Objective-C Uncaught Exception handler, which will print out
// exception information to console.
#define ENABLE_OBJC_UNCAUGHT_EXCEPTION_HANDLER 1
// Enable custom crash reporter to capture crashes. Crash logs will be available to scripts via
// CrashReport API.
#define ENABLE_CUSTOM_CRASH_REPORTER 0
// Enable submission of custom crash reports to Unity servers. This will enable custom crash
// reporter.
#define ENABLE_CRASH_REPORT_SUBMISSION 0
#if ENABLE_CRASH_REPORT_SUBMISSION && !ENABLE_CUSTOM_CRASH_REPORTER
#undef ENABLE_CUSTOM_CRASH_REPORTER
#define ENABLE_CUSTOM_CRASH_REPORTER 0
#endif
#if PLATFORM_TVOS
#undef ENABLE_CUSTOM_CRASH_REPORTER
#define ENABLE_CUSTOM_CRASH_REPORTER 0
#endif
extern "C" void UnityInstallPostCrashCallback();
void InitCrashHandling();

@ -0,0 +1,126 @@
#import "PLCrashReporter.h"
#import "CrashReporter.h"
#include <mach-o/ldsyms.h>
extern "C" NSString* UnityGetCrashReportsPath();
static NSUncaughtExceptionHandler* gsCrashReporterUEHandler = NULL;
extern "C" uint8_t* UnityGetAppLoadAddress()
{
// _mh_execute_header points to a mach header, and is located right at the address of where the
// app is loaded.
return (uint8_t*)&_mh_execute_header;
}
extern "C" const uint8_t * UnityGetAppLoadCommandAddress()
{
return (const uint8_t*)(&_mh_execute_header + 1);
}
extern "C" int UnityGetAppLoadCommandCount()
{
return _mh_execute_header.ncmds;
}
static void SavePendingCrashReport()
{
if (![[UnityPLCrashReporter sharedReporter] hasPendingCrashReport])
return;
NSFileManager *fm = [NSFileManager defaultManager];
NSError *error;
if (![fm createDirectoryAtPath: UnityGetCrashReportsPath() withIntermediateDirectories: YES attributes: nil error: &error])
{
::printf("CrashReporter: could not create crash report directory: %s\n", [[error localizedDescription] UTF8String]);
return;
}
NSData *data = [[UnityPLCrashReporter sharedReporter] loadPendingCrashReportDataAndReturnError: &error];
if (data == nil)
{
::printf("CrashReporter: failed to load crash report data: %s\n", [[error localizedDescription] UTF8String]);
return;
}
NSString* file = [UnityGetCrashReportsPath() stringByAppendingPathComponent: @"crash-"];
unsigned long long seconds = (unsigned long long)[[NSDate date] timeIntervalSince1970];
file = [file stringByAppendingString: [NSString stringWithFormat: @"%llu", seconds]];
file = [file stringByAppendingString: @".plcrash"];
if ([data writeToFile: file atomically: YES])
{
::printf("CrashReporter: saved pending crash report.\n");
if (![[UnityPLCrashReporter sharedReporter] purgePendingCrashReportAndReturnError: &error])
{
::printf("CrashReporter: couldn't remove pending report: %s\n", [[error localizedDescription] UTF8String]);
}
}
else
{
::printf("CrashReporter: couldn't save crash report.\n");
}
// Now copy out a pending version that we can delete if/when we send it
file = [UnityGetCrashReportsPath() stringByAppendingPathComponent: @"crash-pending.plcrash"];
if ([data writeToFile: file atomically: YES])
{
::printf("CrashReporter: saved copy of pending crash report.\n");
}
else
{
::printf("CrashReporter: couldn't save copy of pending crash report.\n");
}
}
static void InitCrashReporter()
{
NSError *error;
UnityInstallPostCrashCallback();
if ([[UnityPLCrashReporter sharedReporter] enableCrashReporterAndReturnError: &error])
::printf("CrashReporter: initialized\n");
else
NSLog(@"CrashReporter: could not enable crash reporter: %@", error);
SavePendingCrashReport();
}
static void UncaughtExceptionHandler(NSException *exception)
{
NSLog(@"Uncaught exception: %@: %@\n%@", [exception name], [exception reason], [exception callStackSymbols]);
if (gsCrashReporterUEHandler)
gsCrashReporterUEHandler(exception);
}
static void InitObjCUEHandler()
{
// Crash reporter sets its own handler, so we have to save it and call it manually
gsCrashReporterUEHandler = NSGetUncaughtExceptionHandler();
NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler);
}
void InitCrashHandling()
{
#if ENABLE_CUSTOM_CRASH_REPORTER
InitCrashReporter();
#endif
#if ENABLE_OBJC_UNCAUGHT_EXCEPTION_HANDLER
InitObjCUEHandler();
#endif
}
// This function will be called when AppDomain.CurrentDomain.UnhandledException event is triggered.
// When running on device the app will do a hard crash and it will generate a crash log.
extern "C" void CrashedCheckBelowForHintsWhy()
{
#if ENABLE_IOS_CRASH_REPORTING || ENABLE_CUSTOM_CRASH_REPORTER
// Make app crash hard here
__builtin_trap();
// Just in case above doesn't work
abort();
#endif
}

@ -0,0 +1,245 @@
// ? TODO: Pavell merge with TrampolineInterface.h to have singe source of truth for a function definitions
UnityExternCall(bool, UnityiOS81orNewer);
UnityExternCall(bool, UnityiOS82orNewer);
UnityExternCall(bool, UnityiOS90orNewer);
UnityExternCall(bool, UnityiOS91orNewer);
UnityExternCall(bool, UnityiOS100orNewer);
UnityExternCall(bool, UnityiOS101orNewer);
UnityExternCall(bool, UnityiOS102orNewer);
UnityExternCall(bool, UnityiOS103orNewer);
UnityExternCall(bool, UnityiOS110orNewer);
UnityExternCall(bool, UnityiOS111orNewer);
UnityExternCall(bool, UnityiOS112orNewer);
// CrashReporter.mm
UnityExternCall(void, CrashedCheckBelowForHintsWhy);
UnityExternCall(uint8_t*, UnityGetAppLoadAddress);
UnityExternCall(const uint8_t*, UnityGetAppLoadCommandAddress);
UnityExternCall(int, UnityGetAppLoadCommandCount);
// iPhone_Sensors.mm
UnityExternCall(void, UnityInitJoysticks);
UnityExternCall(void, UnityCoreMotionStart);
UnityExternCall(void, UnityCoreMotionStop);
UnityExternCall(void, UnityUpdateAccelerometerData);
UnityExternCall(int, UnityIsGyroEnabled, int);
UnityExternCall(int, UnityIsGyroAvailable);
UnityExternCall(void, UnityUpdateGyroData);
UnityExternCall(void, UnitySetGyroUpdateInterval, int, float);
UnityExternCall(float, UnityGetGyroUpdateInterval, int);
UnityExternCall(void, UnityUpdateJoystickData);
UnityExternCall(int, UnityGetJoystickCount);
UnityExternCall(void, UnityGetJoystickName, int, char*, int);
UnityExternCall(void, UnityGetJoystickAxisName, int, int, char*, int);
UnityExternCall(void, UnityGetNiceKeyname, int, char*, int);
UnityExternCall(bool, IsCompensatingSensors);
UnityExternCall(void, SetCompensatingSensors, bool);
UnityExternCall(int, UnityMaxQueuedAccelerationEvents);
// UnityAppController.mm
UnityExternCall(UIViewController*, UnityGetGLViewController);
UnityExternCall(UIView*, UnityGetGLView);
UnityExternCall(UIWindow*, UnityGetMainWindow);
UnityExternCall(void, UnityRequestQuit);
UnityExternCall(void, UnityDestroyDisplayLink);
// UnityAppController+Rendering.mm
UnityExternCall(void, UnityInitMainScreenRenderingCallback);
UnityExternCall(void, UnityGfxInitedCallback);
UnityExternCall(void, UnityPresentContextCallback, UnityFrameStats const*);
UnityExternCall(void, UnityFramerateChangeCallback, int);
UnityExternCall(int, UnitySelectedRenderingAPI);
UnityExternCall(NSBundle*, UnityGetMetalBundle);
UnityExternCall(MTLDeviceRef, UnityGetMetalDevice);
UnityExternCall(MTLCommandQueueRef, UnityGetMetalCommandQueue);
UnityExternCall(MTLCommandQueueRef, UnityGetMetalDrawableCommandQueue);
UnityExternCall(EAGLContext*, UnityGetDataContextEAGL);
UnityExternCall(RenderSurfaceBase*, UnityBackbufferColor);
UnityExternCall(RenderSurfaceBase*, UnityBackbufferDepth);
UnityExternCall(void, DisplayManagerEndFrameRendering);
UnityExternCall(void, UnityPrepareScreenshot);
// Unity/MetalHelper.mm
#if (GFX_SUPPORTS_METAL + 0) || (UNITY_CAN_USE_METAL + 0)
UnityExternCall(void, UnityAddNewMetalAPIImplIfNeeded, MTLDeviceRef);
UnityExternCall(MTLTextureRef, AcquireDrawableMTL, UnityDisplaySurfaceMTL*);
#endif
// EAGLContextHelper.mm
UnityExternCall(void, UnityMakeCurrentContextEAGL, EAGLContext*);
UnityExternCall(EAGLContext*, UnityGetCurrentContextEAGL);
// UI/ActivityIndicator.mm
UnityExternCall(void, UnityStartActivityIndicator);
UnityExternCall(void, UnityStopActivityIndicator);
// UI/Keyboard.mm
UnityExternCall(void, UnityKeyboard_Create, unsigned, int, int , int , int , const char*, const char*, int);
UnityExternCall(void, UnityKeyboard_Show);
UnityExternCall(void, UnityKeyboard_Hide);
UnityExternCall(void, UnityKeyboard_GetRect, float*, float*, float*, float*);
UnityExternCall(void, UnityKeyboard_SetText, const char*);
UnityExternCall(NSString*, UnityKeyboard_GetText);
UnityExternCall(int, UnityKeyboard_IsActive);
UnityExternCall(int, UnityKeyboard_Status);
UnityExternCall(void, UnityKeyboard_SetInputHidden, int);
UnityExternCall(int, UnityKeyboard_IsInputHidden);
UnityExternCall(void, UnityKeyboard_SetCharacterLimit, unsigned);
UnityExternCall(int, UnityKeyboard_CanGetSelection);
UnityExternCall(void, UnityKeyboard_GetSelection, int*, int*);
UnityExternCall(int, UnityKeyboard_CanSetSelection);
UnityExternCall(void, UnityKeyboard_SetSelection, int, int);
// UI/UnityViewControllerBase.mm
UnityExternCall(void, UnityNotifyHideHomeButtonChange);
UnityExternCall(void, UnityNotifyDeferSystemGesturesChange);
// UI/StoreReview.m
#if PLATFORM_IOS
UnityExternCall(bool, UnityRequestStoreReview);
#endif
// Unity/AVCapture.mm
UnityExternCall(int, UnityGetAVCapturePermission, int);
UnityExternCall(void, UnityRequestAVCapturePermission, int);
// Unity/CameraCapture.mm
typedef void(*UnityEnumVideoCaptureDevicesCallback)(void* udata, const char* name, int frontFacing, int autoFocusPointSupported, int kind, const int* resolutions, int resCount);
UnityExternCall(void, UnityEnumVideoCaptureDevices, void*, UnityEnumVideoCaptureDevicesCallback);
UnityExternCall(void*, UnityInitCameraCapture, int, int, int, int, int, void*);
UnityExternCall(void, UnityStartCameraCapture, void*);
UnityExternCall(void, UnityPauseCameraCapture, void*);
UnityExternCall(void, UnityStopCameraCapture, void*);
UnityExternCall(void, UnityCameraCaptureExtents, void*, int*, int*);
UnityExternCall(void, UnityCameraCaptureReadToMemory, void*, void*, int, int);
UnityExternCall(int, UnityCameraCaptureVideoRotationDeg, void*);
UnityExternCall(int, UnityCameraCaptureVerticallyMirrored, void*);
UnityExternCall(int, UnityCameraCaptureSetAutoFocusPoint, void*, float, float);
// Unity/DeviceSettings.mm
UnityExternCall(const char*, UnityDeviceUniqueIdentifier);
UnityExternCall(const char*, UnityVendorIdentifier);
UnityExternCall(const char*, UnityAdvertisingIdentifier);
UnityExternCall(int, UnityAdvertisingTrackingEnabled);
UnityExternCall(const char*, UnityDeviceName);
UnityExternCall(const char*, UnitySystemName);
UnityExternCall(const char*, UnitySystemVersion);
UnityExternCall(const char*, UnityDeviceModel);
UnityExternCall(int, UnityDeviceCPUCount);
UnityExternCall(int, UnityDeviceGeneration);
UnityExternCall(int, UnityDeviceSupportedOrientations);
UnityExternCall(int, UnityDeviceIsStylusTouchSupported);
UnityExternCall(int, UnityDeviceCanShowWideColor);
UnityExternCall(float, UnityDeviceDPI);
UnityExternCall(const char*, UnitySystemLanguage);
// Unity/DisplayManager.mm
UnityExternCall(EAGLContext*, UnityGetMainScreenContextGLES);
UnityExternCall(EAGLContext*, UnityGetContextEAGL);
UnityExternCall(void, UnityStartFrameRendering);
UnityExternCall(void, UnityDestroyUnityRenderSurfaces);
#if SUPPORT_MULTIPLE_DISPLAYS || PLATFORM_IOS
UnityExternCall(int, UnityDisplayManager_DisplayCount);
UnityExternCall(void, UnityDisplayManager_DisplayRenderingResolution, void*, int*, int*);
UnityExternCall(int, UnityDisplayManager_PrimaryDisplayIndex);
UnityExternCall(bool, UnityDisplayManager_DisplayActive, void*);
UnityExternCall(void, UnityDisplayManager_DisplayRenderingBuffers, void*, RenderSurfaceBase**, RenderSurfaceBase**);
UnityExternCall(void, UnityDisplayManager_SetRenderingResolution, void*, int, int);
UnityExternCall(void, UnityDisplayManager_DisplaySystemResolution, void*, int*, int*);
#endif
// Unity/Filesystem.mm
UnityExternCall(const char*, UnityApplicationDir);
UnityExternCall(const char*, UnityDocumentsDir);
UnityExternCall(const char*, UnityLibraryDir);
UnityExternCall(const char*, UnityCachesDir);
UnityExternCall(int, UnityUpdateNoBackupFlag, const char*, int);
// iPhoneMisc.mm
UnityExternCall(const char* const*, UnityFontFallbacks);
// Unity/WWWConnection.mm
UnityExternCall(void*, UnityStartWWWConnectionCustom, void*, const char*, const void*, const char*);
UnityExternCall(void, UnitySendWWWConnection, void*, const void*, unsigned, bool, unsigned long, bool);
UnityExternCall(void, UnityDestroyWWWConnection, void*);
UnityExternCall(void, UnityShouldCancelWWW, const void*);
UnityExternCall(bool, UnityBlockWWWConnectionIsDone, void*);
UnityExternCall(void, UnityWWWClearCookieCache, const char*);
// Unity/FullScreenVideoPlayer.mm
UnityExternCall(void, UnityPlayFullScreenVideo, const char*, const float*, unsigned, unsigned);
UnityExternCall(int, UnityIsFullScreenPlaying);
// Unity/OnDemandResources.mm
struct OnDemandResourcesRequestData;
typedef void (*OnDemandResourcesRequestCompleteHandler)(void* handlerData, const char* error);
UnityExternCall(OnDemandResourcesRequestData*, UnityOnDemandResourcesCreateRequest, NSSet*, OnDemandResourcesRequestCompleteHandler, void*);
UnityExternCall(void, UnityOnDemandResourcesRelease, OnDemandResourcesRequestData*);
UnityExternCall(float, UnityOnDemandResourcesGetProgress, OnDemandResourcesRequestData*);
UnityExternCall(float, UnityOnDemandResourcesGetLoadingPriority, OnDemandResourcesRequestData*);
UnityExternCall(void, UnityOnDemandResourcesSetLoadingPriority, OnDemandResourcesRequestData*, float);
UnityExternCall(NSString*, UnityOnDemandResourcesGetResourcePath, OnDemandResourcesRequestData*, const char*);
// Unity/UnityReplayKit.mm
UnityExternCall(int, UnityReplayKitAPIAvailable);
UnityExternCall(int, UnityReplayKitRecordingAvailable);
UnityExternCall(const char*, UnityReplayKitLastError);
UnityExternCall(int, UnityReplayKitStartRecording, int);
UnityExternCall(int, UnityReplayKitIsRecording);
UnityExternCall(int, UnityReplayKitStopRecording);
UnityExternCall(int, UnityReplayKitDiscard);
UnityExternCall(int, UnityReplayKitPreview);
UnityExternCall(int, UnityReplayKitBroadcastingAPIAvailable);
UnityExternCall(void, UnityReplayKitStartBroadcasting, void*);
UnityExternCall(void, UnityReplayKitStopBroadcasting);
UnityExternCall(int, UnityReplayKitIsBroadcasting);
UnityExternCall(const char*, UnityReplayKitGetBroadcastURL);
UnityExternCall(int, UnityReplayKitIsCameraEnabled);
UnityExternCall(int, UnityReplayKitSetCameraEnabled, bool);
UnityExternCall(int, UnityReplayKitIsMicrophoneEnabled);
UnityExternCall(int, UnityReplayKitSetMicrophoneEnabled, bool);
UnityExternCall(int, UnityReplayKitShowCameraPreviewAt, float, float);
UnityExternCall(void, UnityReplayKitHideCameraPreview);
UnityExternCall(void, UnityReplayKitCreateOverlayWindow);
// LocationService static members to extern c
//UnityExternCall4StaticMember(void, LocationService, SetDistanceFilter,float);
UnityExternCall4StaticMember(void, LocationService, SetDesiredAccuracy, float);
UnityExternCall4StaticMember(float, LocationService, GetDesiredAccuracy);
UnityExternCall4StaticMember(void, LocationService, SetDistanceFilter, float);
UnityExternCall4StaticMember(float, LocationService, GetDistanceFilter);
UnityExternCall4StaticMember(bool, LocationService, IsServiceEnabledByUser);
UnityExternCall4StaticMember(void, LocationService, StartUpdatingLocation);
UnityExternCall4StaticMember(void, LocationService, StopUpdatingLocation);
UnityExternCall4StaticMember(void, LocationService, SetHeadingUpdatesEnabled, bool);
UnityExternCall4StaticMember(bool, LocationService, IsHeadingUpdatesEnabled);
UnityExternCall4StaticMember(LocationServiceStatus, LocationService, GetLocationStatus);
UnityExternCall4StaticMember(LocationServiceStatus, LocationService, GetHeadingStatus);
UnityExternCall4StaticMember(bool, LocationService, IsHeadingAvailable);
//Apple TV Remote
#if PLATFORM_TVOS
UnityExternCall(int, UnityGetAppleTVRemoteAllowExitToMenu);
UnityExternCall(void, UnitySetAppleTVRemoteAllowExitToMenu, int);
UnityExternCall(int, UnityGetAppleTVRemoteAllowRotation);
UnityExternCall(void, UnitySetAppleTVRemoteAllowRotation, int);
UnityExternCall(int, UnityGetAppleTVRemoteReportAbsoluteDpadValues);
UnityExternCall(void, UnitySetAppleTVRemoteReportAbsoluteDpadValues, int);
UnityExternCall(int, UnityGetAppleTVRemoteTouchesEnabled);
UnityExternCall(void, UnitySetAppleTVRemoteTouchesEnabled, int);
#endif
// misc not in trampoline
UnityExternCall(bool, Unity_il2cppNoExceptions);
UnityExternCall(void, RegisterStaticallyLinkedModulesGranular);
UnityExternCall(NSArray<NSString*>*, GetLaunchImageNames, UIUserInterfaceIdiom, const OrientationMask&, const CGSize&, ScreenOrientation, float);

@ -0,0 +1,156 @@
/* SINGLE CPP FILE TO GENERATE SEAMLESS BRIDGE BETWEEN BINARIES < SHARED ENGINE LIBRARY WITH ABSTRACT EXTERN FUNCTIONS> | < PLAYER EXECUTABLE WITH ABSTRACT FUNCTION IMPLEMENTATION >
1. if building shared engine library this file will:
define body for Unity* methods that proxy call to actual method
actual method will be set later from outside with respective call to SetUnity*Body
defines SetUnity*Body method to set actual method for call, theese functions are exported from library
2. if building player against shared engine library this file will:
calls SetUnity*Body providing actual method to be called by shared engine library later
wraps all SetUnity*Body calls in one single method SetAllUnityFunctionsForDynamicPlayerLib
- notes:
file will be included only if development / il2ccp and:
- for xcode project if BuildSettings.UseDynamicPlayerLib is true
- for player if (build.pl staticLib=1, jam BUILD_IOS_DYNAMIC_PLAYER=1)
DynamicLibEngineAPI-functions.h include list of functions to proxy calls from player to trampoline
- each function inlist is defined with UnityExternCall or UnityExternCall4StaticMember
*/
// deal with __VA_ARGS__ to convert them to formated lists with provided M macro
#define VA_ARGS_COUNT(...) INTERNAL_GET_ARG_COUNT_PRIVATE(0, ## __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define INTERNAL_GET_ARG_COUNT_PRIVATE(_0, _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, _10_, _11_, _12_, _13_, _14_, _15_, _16_, _17_, _18_, _19_, _20_, count, ...) count
#define JOIN_VA_ARGS_0(M, ...)
#define JOIN_VA_ARGS_1(M, T1) M(T1,1)
#define JOIN_VA_ARGS_2(M, T1, T2) M(T1,1), M(T2,2)
#define JOIN_VA_ARGS_3(M, T1, T2, T3) M(T1,1), M(T2,2), M(T3,3)
#define JOIN_VA_ARGS_4(M, T1, T2, T3, T4) M(T1,1), M(T2,2), M(T3,3), M(T4,4)
#define JOIN_VA_ARGS_5(M, T1, T2, T3, T4, T5) M(T1,1), M(T2,2), M(T3,3), M(T4,4), M(T5,5)
#define JOIN_VA_ARGS_6(M, T1, T2, T3, T4, T5, T6) M(T1,1), M(T2,2), M(T3,3), M(T4,4), M(T5,5), M(T6,6)
#define JOIN_VA_ARGS_7(M, T1, T2, T3, T4, T5, T6, T7) M(T1,1), M(T2,2), M(T3,3), M(T4,4), M(T5,5), M(T6,6), M(T7,7)
#define JOIN_VA_ARGS_8(M, T1, T2, T3, T4, T5, T6, T7, T8) M(T1,1), M(T2,2), M(T3,3), M(T4,4), M(T5,5), M(T6,6), M(T7,7), M(T8,8)
#define JOIN_VA_ARGS_9(M, T1, T2, T3, T4, T5, T6, T7, T8, T9) M(T1,1), M(T2,2), M(T3,3), M(T4,4), M(T5,5), M(T6,6), M(T7,7), M(T8,8), M(T9,9)
#define JOIN_VA_ARGS___(M, N, ...) JOIN_VA_ARGS_##N(M, __VA_ARGS__ )
#define JOIN_VA_ARGS__(M, N, ...) JOIN_VA_ARGS___(M,N,__VA_ARGS__)
#define JOIN_VA_ARGS_(M, ...) JOIN_VA_ARGS__(M,VA_ARGS_COUNT(__VA_ARGS__), __VA_ARGS__)
#define JOIN_VA_ARGS(M, ...) JOIN_VA_ARGS_(M,__VA_ARGS__)
// convert to function definition params:
// egz: VA_ARGS_TO_PARAMS(int, char, bool) expands to: int p3, char p2, bool p1
#define VA_JOIN_AS_PARAMS(type, index) type p##index
#define VA_ARGS_TO_PARAMS(...) JOIN_VA_ARGS(VA_JOIN_AS_PARAMS,__VA_ARGS__)
// convert to function call params
// egz: VA_ARGS_TO_CALL(int,char,bool) exapnds to: p3, p2, p1
#define VA_JOIN_AS_CALL(type, index) p##index
#define VA_ARGS_TO_CALL(...) JOIN_VA_ARGS(VA_JOIN_AS_CALL,__VA_ARGS__)
#ifndef UNITY_ENGINE_DYNAMICLIB_MODE
#define UNITY_ENGINE_DYNAMICLIB_MODE 0
#endif
#if UNITY_ENGINE_DYNAMICLIB_MODE
// [ part of Unity Player ]
// this part generates Unity* functions that act as proxy to call actual function from trampoline
// for each function in DynamicLibEngineAPI-functions.h will be generated proxy function
// proxy for extern "C" function
// egz: UnityExternCall(int, UnityTestFunctionName, int);
// will expand to:
// static int(*gPtrUnityTestFunctionName)(int) = nullptr;
// extern "C" int UnityTestFunctionName(int p1) {
// assert(gPtrUnityTestFunctionName) != nullptr);
// return gPtrUnityTestFunctionName(p1);
// }
// __attribute__((visibility("default")))
// extern "C" void SetUnityTestFunctionNameBody(decltype(&UnityTestFunctionName) fPtr) {
// gPtrUnityTestFunctionName = fPtr;
// }
#define UnityExternCall(returnType, funcName, ...) \
static returnType(*gPtr##funcName)(__VA_ARGS__) = nullptr; \
extern "C" returnType funcName(VA_ARGS_TO_PARAMS(__VA_ARGS__)) {\
assert(gPtr##funcName != nullptr); \
return gPtr##funcName(VA_ARGS_TO_CALL(__VA_ARGS__)); \
} \
__attribute__((visibility("default"))) \
extern "C" void Set##funcName##Body(decltype(&funcName) fPtr) { \
gPtr##funcName = fPtr; \
}
// proxy for class static methods
// egz: UnityExternCall4StaticMember(int, MyClass MyMethod, int);
// will expand to:
// static int(*gPtrMyClassMyMethod)(int) = nullptr;
// int MyClass::MyMethod(int p1) {
// assert(gPtrMyClassMyMethod) != nullptr);
// return gPtrMyClassMyMethod(p1);
// }
// __attribute__((visibility("default")))
// extern "C" void SetMyClassMyMethodBody(decltype(gPtrMyClassMyMethod) fPtr) {
// gPtrMyClassMyMethod = fPtr;
// }
#define UnityExternCall4StaticMember(returnType, className, funcName, ...) \
static returnType(*gPtr##className##funcName)(__VA_ARGS__) = nullptr; \
returnType className::funcName(VA_ARGS_TO_PARAMS(__VA_ARGS__)) { \
assert(gPtr##className##funcName != nullptr); \
return gPtr##className##funcName(VA_ARGS_TO_CALL(__VA_ARGS__)); \
} \
__attribute__((visibility("default"))) \
extern "C" void Set##className##funcName##Body(decltype(gPtr##className##funcName) fPtr) { \
gPtr##className##funcName = fPtr; \
}
#include "PlatformDependent/iPhonePlayer/Trampoline/Classes/Unity/UnitySharedDecls.h"
#include "PlatformDependent/iPhonePlayer/Trampoline/Classes/Unity/UnityRendering.h"
#include "PlatformDependent/iPhonePlayer/TrampolineInterface.h"
#include "Runtime/Graphics/DisplayManager.h"
#include "Runtime/Input/LocationService.h"
#import <UIKit/UIKit.h>
#include "DynamicLibEngineAPI-functions.h"
#undef UnityExternCall
#undef UnityExternCall4StaticMember
#else
// [ part of Xcode project ]
// for each function defined in DynamicLibEngineAPI-functions.h will be generated SetUnity*Body function
// for extern "C" functions
// egz: UnityExternCall(int, UnityTestFunctionName, int);
// will expand to:
// extern "C" UnityTestFunctionName(int);
// extern "C" SetUnityTestFunctionName(decltype(&UnityTestFunctionName));
#define UnityExternCall(returnType, funcName, ...) \
extern "C" returnType funcName(__VA_ARGS__); \
extern "C" void Set##funcName##Body(decltype(&funcName));
// for class static method
// egz: UnityExternCall4StaticMember(int, MyClass MyMethod, int);
// will expand to:
// extern "C" void SetMyClassMyMethodBody(decltype(&MyClass::MyMethod));
#define UnityExternCall4StaticMember(returnType, className, funcName, ...) \
extern "C" void Set##className##funcName##Body(decltype(&className::funcName));
#include "UnityRendering.h"
#include "Classes/iPhone_Sensors.h"
#include "DynamicLibEngineAPI-functions.h"
#undef UnityExternCall
#undef UnityExternCall4StaticMember
// single function to call every Set*Body function from DynamicLibEngineAPI-functions.h
#define UnityExternCall(returnType, funcName, ...) Set##funcName##Body(funcName);
#define UnityExternCall4StaticMember(returnType, className, funcName, ...) Set##className##funcName##Body(className::funcName)
extern "C" void SetAllUnityFunctionsForDynamicPlayerLib()
{
#include "DynamicLibEngineAPI-functions.h"
}
#undef UnityExternCall
#undef UnityExternCall4StaticMember
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,86 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
#ifndef U3CMODULEU3E_TDE5A299227351E064CF5069210AC8ED1294BD51A_H
#define U3CMODULEU3E_TDE5A299227351E064CF5069210AC8ED1294BD51A_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_tDE5A299227351E064CF5069210AC8ED1294BD51A
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_TDE5A299227351E064CF5069210AC8ED1294BD51A_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

@ -0,0 +1,86 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
#ifndef U3CMODULEU3E_T410187D184BFEA098C57AA90C1EEBB14DCD72176_H
#define U3CMODULEU3E_T410187D184BFEA098C57AA90C1EEBB14DCD72176_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t410187D184BFEA098C57AA90C1EEBB14DCD72176
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_T410187D184BFEA098C57AA90C1EEBB14DCD72176_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

@ -0,0 +1,86 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
#ifndef U3CMODULEU3E_T56CA3936A9EFABF2ED20401359C40BFE63F85A11_H
#define U3CMODULEU3E_T56CA3936A9EFABF2ED20401359C40BFE63F85A11_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t56CA3936A9EFABF2ED20401359C40BFE63F85A11
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_T56CA3936A9EFABF2ED20401359C40BFE63F85A11_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,878 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
// System.Collections.Generic.List`1<System.Object>
struct List_1_t05CC3C859AB5E6024394EF9A42E3E696628CA02D;
// System.Collections.Generic.List`1<UnityEngine.Rigidbody2D>
struct List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D;
// System.String
struct String_t;
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017;
// UnityEngine.Collider2D
struct Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379;
// UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0;
// UnityEngine.Rigidbody2D[]
struct Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206;
extern RuntimeClass* Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379_il2cpp_TypeInfo_var;
extern RuntimeClass* List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D_il2cpp_TypeInfo_var;
extern RuntimeClass* Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var;
extern RuntimeClass* Physics2D_tB21970F986016656D66D2922594F336E1EE7D5C7_il2cpp_TypeInfo_var;
extern const RuntimeMethod* List_1__ctor_m215607BDEE600B30300565B4E05FFAA8EDF9A94D_RuntimeMethod_var;
extern const uint32_t Physics2D__cctor_mC0D622F2EAF13BF0513DB2969E50EEC5631CDBFC_MetadataUsageId;
extern const uint32_t RaycastHit2D_get_collider_m6A7EC53B2E179C2EFF4F29018A132B2979CBE976_MetadataUsageId;
#ifndef U3CMODULEU3E_T11B36CEBA37CA1FF7C21746E808B860B676A8ECD_H
#define U3CMODULEU3E_T11B36CEBA37CA1FF7C21746E808B860B676A8ECD_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t11B36CEBA37CA1FF7C21746E808B860B676A8ECD
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_T11B36CEBA37CA1FF7C21746E808B860B676A8ECD_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifndef LIST_1_TB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D_H
#define LIST_1_TB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.Rigidbody2D>
struct List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D, ____items_1)); }
inline Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206* get__items_1() const { return ____items_1; }
inline Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((&____syncRoot_4), value);
}
};
struct List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D_StaticFields, ____emptyArray_5)); }
inline Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206* get__emptyArray_5() const { return ____emptyArray_5; }
inline Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(Rigidbody2DU5BU5D_t6283E1D3B1656D573E695711466E6E426ACA3206* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((&____emptyArray_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_TB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D_H
#ifndef VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#define VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_com
{
};
#endif // VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifndef PHYSICS2D_TB21970F986016656D66D2922594F336E1EE7D5C7_H
#define PHYSICS2D_TB21970F986016656D66D2922594F336E1EE7D5C7_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Physics2D
struct Physics2D_tB21970F986016656D66D2922594F336E1EE7D5C7 : public RuntimeObject
{
public:
public:
};
struct Physics2D_tB21970F986016656D66D2922594F336E1EE7D5C7_StaticFields
{
public:
// System.Collections.Generic.List`1<UnityEngine.Rigidbody2D> UnityEngine.Physics2D::m_LastDisabledRigidbody2D
List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D * ___m_LastDisabledRigidbody2D_0;
public:
inline static int32_t get_offset_of_m_LastDisabledRigidbody2D_0() { return static_cast<int32_t>(offsetof(Physics2D_tB21970F986016656D66D2922594F336E1EE7D5C7_StaticFields, ___m_LastDisabledRigidbody2D_0)); }
inline List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D * get_m_LastDisabledRigidbody2D_0() const { return ___m_LastDisabledRigidbody2D_0; }
inline List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D ** get_address_of_m_LastDisabledRigidbody2D_0() { return &___m_LastDisabledRigidbody2D_0; }
inline void set_m_LastDisabledRigidbody2D_0(List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D * value)
{
___m_LastDisabledRigidbody2D_0 = value;
Il2CppCodeGenWriteBarrier((&___m_LastDisabledRigidbody2D_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PHYSICS2D_TB21970F986016656D66D2922594F336E1EE7D5C7_H
#ifndef INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#define INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Int32
struct Int32_t585191389E07734F19F3156FF88FB3EF4800D102
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_t585191389E07734F19F3156FF88FB3EF4800D102, ___m_value_0)); }
inline int32_t get_m_value_0() const { return ___m_value_0; }
inline int32_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(int32_t value)
{
___m_value_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#ifndef INTPTR_T_H
#define INTPTR_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INTPTR_T_H
#ifndef SINGLE_TDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1_H
#define SINGLE_TDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Single
struct Single_tDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1
{
public:
// System.Single System.Single::m_value
float ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Single_tDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1, ___m_value_0)); }
inline float get_m_value_0() const { return ___m_value_0; }
inline float* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(float value)
{
___m_value_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SINGLE_TDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1_H
#ifndef VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#define VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017
{
public:
union
{
struct
{
};
uint8_t Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017__padding[1];
};
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifndef VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#define VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector2
struct Vector2_tA85D2DD88578276CA8A8796756458277E72D073D
{
public:
// System.Single UnityEngine.Vector2::x
float ___x_0;
// System.Single UnityEngine.Vector2::y
float ___y_1;
public:
inline static int32_t get_offset_of_x_0() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D, ___x_0)); }
inline float get_x_0() const { return ___x_0; }
inline float* get_address_of_x_0() { return &___x_0; }
inline void set_x_0(float value)
{
___x_0 = value;
}
inline static int32_t get_offset_of_y_1() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D, ___y_1)); }
inline float get_y_1() const { return ___y_1; }
inline float* get_address_of_y_1() { return &___y_1; }
inline void set_y_1(float value)
{
___y_1 = value;
}
};
struct Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields
{
public:
// UnityEngine.Vector2 UnityEngine.Vector2::zeroVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___zeroVector_2;
// UnityEngine.Vector2 UnityEngine.Vector2::oneVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___oneVector_3;
// UnityEngine.Vector2 UnityEngine.Vector2::upVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___upVector_4;
// UnityEngine.Vector2 UnityEngine.Vector2::downVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___downVector_5;
// UnityEngine.Vector2 UnityEngine.Vector2::leftVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___leftVector_6;
// UnityEngine.Vector2 UnityEngine.Vector2::rightVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___rightVector_7;
// UnityEngine.Vector2 UnityEngine.Vector2::positiveInfinityVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___positiveInfinityVector_8;
// UnityEngine.Vector2 UnityEngine.Vector2::negativeInfinityVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___negativeInfinityVector_9;
public:
inline static int32_t get_offset_of_zeroVector_2() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___zeroVector_2)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_zeroVector_2() const { return ___zeroVector_2; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_zeroVector_2() { return &___zeroVector_2; }
inline void set_zeroVector_2(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___zeroVector_2 = value;
}
inline static int32_t get_offset_of_oneVector_3() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___oneVector_3)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_oneVector_3() const { return ___oneVector_3; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_oneVector_3() { return &___oneVector_3; }
inline void set_oneVector_3(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___oneVector_3 = value;
}
inline static int32_t get_offset_of_upVector_4() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___upVector_4)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_upVector_4() const { return ___upVector_4; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_upVector_4() { return &___upVector_4; }
inline void set_upVector_4(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___upVector_4 = value;
}
inline static int32_t get_offset_of_downVector_5() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___downVector_5)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_downVector_5() const { return ___downVector_5; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_downVector_5() { return &___downVector_5; }
inline void set_downVector_5(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___downVector_5 = value;
}
inline static int32_t get_offset_of_leftVector_6() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___leftVector_6)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_leftVector_6() const { return ___leftVector_6; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_leftVector_6() { return &___leftVector_6; }
inline void set_leftVector_6(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___leftVector_6 = value;
}
inline static int32_t get_offset_of_rightVector_7() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___rightVector_7)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_rightVector_7() const { return ___rightVector_7; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_rightVector_7() { return &___rightVector_7; }
inline void set_rightVector_7(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___rightVector_7 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___positiveInfinityVector_8)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_positiveInfinityVector_8() const { return ___positiveInfinityVector_8; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_positiveInfinityVector_8() { return &___positiveInfinityVector_8; }
inline void set_positiveInfinityVector_8(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___positiveInfinityVector_8 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_9() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___negativeInfinityVector_9)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_negativeInfinityVector_9() const { return ___negativeInfinityVector_9; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_negativeInfinityVector_9() { return &___negativeInfinityVector_9; }
inline void set_negativeInfinityVector_9(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___negativeInfinityVector_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#ifndef OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#define OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Object::m_CachedPtr
intptr_t ___m_CachedPtr_0;
public:
inline static int32_t get_offset_of_m_CachedPtr_0() { return static_cast<int32_t>(offsetof(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0, ___m_CachedPtr_0)); }
inline intptr_t get_m_CachedPtr_0() const { return ___m_CachedPtr_0; }
inline intptr_t* get_address_of_m_CachedPtr_0() { return &___m_CachedPtr_0; }
inline void set_m_CachedPtr_0(intptr_t value)
{
___m_CachedPtr_0 = value;
}
};
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_StaticFields
{
public:
// System.Int32 UnityEngine.Object::OffsetOfInstanceIDInCPlusPlusObject
int32_t ___OffsetOfInstanceIDInCPlusPlusObject_1;
public:
inline static int32_t get_offset_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return static_cast<int32_t>(offsetof(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_StaticFields, ___OffsetOfInstanceIDInCPlusPlusObject_1)); }
inline int32_t get_OffsetOfInstanceIDInCPlusPlusObject_1() const { return ___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline int32_t* get_address_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return &___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline void set_OffsetOfInstanceIDInCPlusPlusObject_1(int32_t value)
{
___OffsetOfInstanceIDInCPlusPlusObject_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_marshaled_pinvoke
{
intptr_t ___m_CachedPtr_0;
};
// Native definition for COM marshalling of UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_marshaled_com
{
intptr_t ___m_CachedPtr_0;
};
#endif // OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#ifndef RAYCASTHIT2D_T5E8A7F96317BAF2033362FC780F4D72DC72764BE_H
#define RAYCASTHIT2D_T5E8A7F96317BAF2033362FC780F4D72DC72764BE_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RaycastHit2D
struct RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE
{
public:
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::m_Centroid
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___m_Centroid_0;
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::m_Point
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___m_Point_1;
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::m_Normal
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___m_Normal_2;
// System.Single UnityEngine.RaycastHit2D::m_Distance
float ___m_Distance_3;
// System.Single UnityEngine.RaycastHit2D::m_Fraction
float ___m_Fraction_4;
// System.Int32 UnityEngine.RaycastHit2D::m_Collider
int32_t ___m_Collider_5;
public:
inline static int32_t get_offset_of_m_Centroid_0() { return static_cast<int32_t>(offsetof(RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE, ___m_Centroid_0)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_m_Centroid_0() const { return ___m_Centroid_0; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_m_Centroid_0() { return &___m_Centroid_0; }
inline void set_m_Centroid_0(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___m_Centroid_0 = value;
}
inline static int32_t get_offset_of_m_Point_1() { return static_cast<int32_t>(offsetof(RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE, ___m_Point_1)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_m_Point_1() const { return ___m_Point_1; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_m_Point_1() { return &___m_Point_1; }
inline void set_m_Point_1(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___m_Point_1 = value;
}
inline static int32_t get_offset_of_m_Normal_2() { return static_cast<int32_t>(offsetof(RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE, ___m_Normal_2)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_m_Normal_2() const { return ___m_Normal_2; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_m_Normal_2() { return &___m_Normal_2; }
inline void set_m_Normal_2(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___m_Normal_2 = value;
}
inline static int32_t get_offset_of_m_Distance_3() { return static_cast<int32_t>(offsetof(RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE, ___m_Distance_3)); }
inline float get_m_Distance_3() const { return ___m_Distance_3; }
inline float* get_address_of_m_Distance_3() { return &___m_Distance_3; }
inline void set_m_Distance_3(float value)
{
___m_Distance_3 = value;
}
inline static int32_t get_offset_of_m_Fraction_4() { return static_cast<int32_t>(offsetof(RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE, ___m_Fraction_4)); }
inline float get_m_Fraction_4() const { return ___m_Fraction_4; }
inline float* get_address_of_m_Fraction_4() { return &___m_Fraction_4; }
inline void set_m_Fraction_4(float value)
{
___m_Fraction_4 = value;
}
inline static int32_t get_offset_of_m_Collider_5() { return static_cast<int32_t>(offsetof(RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE, ___m_Collider_5)); }
inline int32_t get_m_Collider_5() const { return ___m_Collider_5; }
inline int32_t* get_address_of_m_Collider_5() { return &___m_Collider_5; }
inline void set_m_Collider_5(int32_t value)
{
___m_Collider_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RAYCASTHIT2D_T5E8A7F96317BAF2033362FC780F4D72DC72764BE_H
#ifndef COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#define COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Component
struct Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 : public Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#ifndef BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#define BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Behaviour
struct Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8 : public Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#ifndef RIGIDBODY2D_TBDC6900A76D3C47E291446FF008D02B817C81CDE_H
#define RIGIDBODY2D_TBDC6900A76D3C47E291446FF008D02B817C81CDE_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rigidbody2D
struct Rigidbody2D_tBDC6900A76D3C47E291446FF008D02B817C81CDE : public Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RIGIDBODY2D_TBDC6900A76D3C47E291446FF008D02B817C81CDE_H
#ifndef COLLIDER2D_TD64BE58E48B95D89D349FEAB54D0FE2EEBF83379_H
#define COLLIDER2D_TD64BE58E48B95D89D349FEAB54D0FE2EEBF83379_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Collider2D
struct Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379 : public Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLLIDER2D_TD64BE58E48B95D89D349FEAB54D0FE2EEBF83379_H
// System.Void System.Collections.Generic.List`1<System.Object>::.ctor()
extern "C" IL2CPP_METHOD_ATTR void List_1__ctor_mC832F1AC0F814BAEB19175F5D7972A7507508BC3_gshared (List_1_t05CC3C859AB5E6024394EF9A42E3E696628CA02D * __this, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<UnityEngine.Rigidbody2D>::.ctor()
inline void List_1__ctor_m215607BDEE600B30300565B4E05FFAA8EDF9A94D (List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D * __this, const RuntimeMethod* method)
{
(( void (*) (List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D *, const RuntimeMethod*))List_1__ctor_mC832F1AC0F814BAEB19175F5D7972A7507508BC3_gshared)(__this, method);
}
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::get_point()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D RaycastHit2D_get_point_mC567E234B1B673C3A9819023C3DC97C781443098 (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method);
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::get_normal()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D RaycastHit2D_get_normal_m9F0974E4514AD56C00FCF6FF4CDF10AED62FE6E4 (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method);
// System.Single UnityEngine.RaycastHit2D::get_distance()
extern "C" IL2CPP_METHOD_ATTR float RaycastHit2D_get_distance_m2D9F391717ECACFDA8E01A4126E0F8F59F7E774F (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method);
// UnityEngine.Object UnityEngine.Object::FindObjectFromInstanceID(System.Int32)
extern "C" IL2CPP_METHOD_ATTR Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * Object_FindObjectFromInstanceID_m7594ED98F525AAE38FEC80052729ECAF3E821350 (int32_t p0, const RuntimeMethod* method);
// UnityEngine.Collider2D UnityEngine.RaycastHit2D::get_collider()
extern "C" IL2CPP_METHOD_ATTR Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379 * RaycastHit2D_get_collider_m6A7EC53B2E179C2EFF4F29018A132B2979CBE976 (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.Physics2D::.cctor()
extern "C" IL2CPP_METHOD_ATTR void Physics2D__cctor_mC0D622F2EAF13BF0513DB2969E50EEC5631CDBFC (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (Physics2D__cctor_mC0D622F2EAF13BF0513DB2969E50EEC5631CDBFC_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D * L_0 = (List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D *)il2cpp_codegen_object_new(List_1_tB50CA57CD5918BF3026A6E1A2873B6699FDC3A8D_il2cpp_TypeInfo_var);
List_1__ctor_m215607BDEE600B30300565B4E05FFAA8EDF9A94D(L_0, /*hidden argument*/List_1__ctor_m215607BDEE600B30300565B4E05FFAA8EDF9A94D_RuntimeMethod_var);
((Physics2D_tB21970F986016656D66D2922594F336E1EE7D5C7_StaticFields*)il2cpp_codegen_static_fields_for(Physics2D_tB21970F986016656D66D2922594F336E1EE7D5C7_il2cpp_TypeInfo_var))->set_m_LastDisabledRigidbody2D_0(L_0);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::get_point()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D RaycastHit2D_get_point_mC567E234B1B673C3A9819023C3DC97C781443098 (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method)
{
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D V_0;
memset(&V_0, 0, sizeof(V_0));
{
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_0 = __this->get_m_Point_1();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_1 = V_0;
return L_1;
}
}
extern "C" Vector2_tA85D2DD88578276CA8A8796756458277E72D073D RaycastHit2D_get_point_mC567E234B1B673C3A9819023C3DC97C781443098_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * _thisAdjusted = reinterpret_cast<RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE *>(__this + 1);
return RaycastHit2D_get_point_mC567E234B1B673C3A9819023C3DC97C781443098(_thisAdjusted, method);
}
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::get_normal()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D RaycastHit2D_get_normal_m9F0974E4514AD56C00FCF6FF4CDF10AED62FE6E4 (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method)
{
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D V_0;
memset(&V_0, 0, sizeof(V_0));
{
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_0 = __this->get_m_Normal_2();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_1 = V_0;
return L_1;
}
}
extern "C" Vector2_tA85D2DD88578276CA8A8796756458277E72D073D RaycastHit2D_get_normal_m9F0974E4514AD56C00FCF6FF4CDF10AED62FE6E4_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * _thisAdjusted = reinterpret_cast<RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE *>(__this + 1);
return RaycastHit2D_get_normal_m9F0974E4514AD56C00FCF6FF4CDF10AED62FE6E4(_thisAdjusted, method);
}
// System.Single UnityEngine.RaycastHit2D::get_distance()
extern "C" IL2CPP_METHOD_ATTR float RaycastHit2D_get_distance_m2D9F391717ECACFDA8E01A4126E0F8F59F7E774F (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method)
{
float V_0 = 0.0f;
{
float L_0 = __this->get_m_Distance_3();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
float L_1 = V_0;
return L_1;
}
}
extern "C" float RaycastHit2D_get_distance_m2D9F391717ECACFDA8E01A4126E0F8F59F7E774F_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * _thisAdjusted = reinterpret_cast<RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE *>(__this + 1);
return RaycastHit2D_get_distance_m2D9F391717ECACFDA8E01A4126E0F8F59F7E774F(_thisAdjusted, method);
}
// UnityEngine.Collider2D UnityEngine.RaycastHit2D::get_collider()
extern "C" IL2CPP_METHOD_ATTR Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379 * RaycastHit2D_get_collider_m6A7EC53B2E179C2EFF4F29018A132B2979CBE976 (RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RaycastHit2D_get_collider_m6A7EC53B2E179C2EFF4F29018A132B2979CBE976_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379 * V_0 = NULL;
{
int32_t L_0 = __this->get_m_Collider_5();
IL2CPP_RUNTIME_CLASS_INIT(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var);
Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * L_1 = Object_FindObjectFromInstanceID_m7594ED98F525AAE38FEC80052729ECAF3E821350(L_0, /*hidden argument*/NULL);
V_0 = ((Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379 *)IsInstClass((RuntimeObject*)L_1, Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379_il2cpp_TypeInfo_var));
goto IL_0017;
}
IL_0017:
{
Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379 * L_2 = V_0;
return L_2;
}
}
extern "C" Collider2D_tD64BE58E48B95D89D349FEAB54D0FE2EEBF83379 * RaycastHit2D_get_collider_m6A7EC53B2E179C2EFF4F29018A132B2979CBE976_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE * _thisAdjusted = reinterpret_cast<RaycastHit2D_t5E8A7F96317BAF2033362FC780F4D72DC72764BE *>(__this + 1);
return RaycastHit2D_get_collider_m6A7EC53B2E179C2EFF4F29018A132B2979CBE976(_thisAdjusted, method);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,871 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
// System.Char[]
struct CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2;
// System.Collections.Generic.List`1<UnityEngine.RectTransform>
struct List_1_t0CD9761E1DF9817484CF4FB4253C6A626DC2311C;
// System.String
struct String_t;
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017;
// UnityEngine.RectOffset
struct RectOffset_tED44B1176E93501050480416699D1F11BAE8C87A;
// UnityEngine.RectTransform
struct RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20;
// UnityEngine.UI.HorizontalOrVerticalLayoutGroup
struct HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB;
// UnityEngine.UI.LayoutGroup
struct LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4;
// UnityEngine.UI.VerticalLayoutGroup
struct VerticalLayoutGroup_tAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11;
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifndef VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#define VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_com
{
};
#endif // VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifndef BOOLEAN_TB53F6830F670160873277339AA58F15CAED4399C_H
#define BOOLEAN_TB53F6830F670160873277339AA58F15CAED4399C_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean
struct Boolean_tB53F6830F670160873277339AA58F15CAED4399C
{
public:
// System.Boolean System.Boolean::m_value
bool ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_tB53F6830F670160873277339AA58F15CAED4399C, ___m_value_0)); }
inline bool get_m_value_0() const { return ___m_value_0; }
inline bool* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(bool value)
{
___m_value_0 = value;
}
};
struct Boolean_tB53F6830F670160873277339AA58F15CAED4399C_StaticFields
{
public:
// System.String System.Boolean::TrueString
String_t* ___TrueString_5;
// System.String System.Boolean::FalseString
String_t* ___FalseString_6;
public:
inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_tB53F6830F670160873277339AA58F15CAED4399C_StaticFields, ___TrueString_5)); }
inline String_t* get_TrueString_5() const { return ___TrueString_5; }
inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; }
inline void set_TrueString_5(String_t* value)
{
___TrueString_5 = value;
Il2CppCodeGenWriteBarrier((&___TrueString_5), value);
}
inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_tB53F6830F670160873277339AA58F15CAED4399C_StaticFields, ___FalseString_6)); }
inline String_t* get_FalseString_6() const { return ___FalseString_6; }
inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; }
inline void set_FalseString_6(String_t* value)
{
___FalseString_6 = value;
Il2CppCodeGenWriteBarrier((&___FalseString_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOOLEAN_TB53F6830F670160873277339AA58F15CAED4399C_H
#ifndef ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#define ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521 : public ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF
{
public:
public:
};
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields
{
public:
// System.Char[] System.Enum::enumSeperatorCharArray
CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* ___enumSeperatorCharArray_0;
public:
inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields, ___enumSeperatorCharArray_0)); }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; }
inline void set_enumSeperatorCharArray_0(CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* value)
{
___enumSeperatorCharArray_0 = value;
Il2CppCodeGenWriteBarrier((&___enumSeperatorCharArray_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_com
{
};
#endif // ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#ifndef INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#define INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Int32
struct Int32_t585191389E07734F19F3156FF88FB3EF4800D102
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_t585191389E07734F19F3156FF88FB3EF4800D102, ___m_value_0)); }
inline int32_t get_m_value_0() const { return ___m_value_0; }
inline int32_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(int32_t value)
{
___m_value_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#ifndef INTPTR_T_H
#define INTPTR_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INTPTR_T_H
#ifndef VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#define VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017
{
public:
union
{
struct
{
};
uint8_t Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017__padding[1];
};
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifndef DRIVENRECTTRANSFORMTRACKER_TB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03_H
#define DRIVENRECTTRANSFORMTRACKER_TB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.DrivenRectTransformTracker
struct DrivenRectTransformTracker_tB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03
{
public:
union
{
struct
{
};
uint8_t DrivenRectTransformTracker_tB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03__padding[1];
};
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DRIVENRECTTRANSFORMTRACKER_TB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03_H
#ifndef VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#define VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector2
struct Vector2_tA85D2DD88578276CA8A8796756458277E72D073D
{
public:
// System.Single UnityEngine.Vector2::x
float ___x_0;
// System.Single UnityEngine.Vector2::y
float ___y_1;
public:
inline static int32_t get_offset_of_x_0() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D, ___x_0)); }
inline float get_x_0() const { return ___x_0; }
inline float* get_address_of_x_0() { return &___x_0; }
inline void set_x_0(float value)
{
___x_0 = value;
}
inline static int32_t get_offset_of_y_1() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D, ___y_1)); }
inline float get_y_1() const { return ___y_1; }
inline float* get_address_of_y_1() { return &___y_1; }
inline void set_y_1(float value)
{
___y_1 = value;
}
};
struct Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields
{
public:
// UnityEngine.Vector2 UnityEngine.Vector2::zeroVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___zeroVector_2;
// UnityEngine.Vector2 UnityEngine.Vector2::oneVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___oneVector_3;
// UnityEngine.Vector2 UnityEngine.Vector2::upVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___upVector_4;
// UnityEngine.Vector2 UnityEngine.Vector2::downVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___downVector_5;
// UnityEngine.Vector2 UnityEngine.Vector2::leftVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___leftVector_6;
// UnityEngine.Vector2 UnityEngine.Vector2::rightVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___rightVector_7;
// UnityEngine.Vector2 UnityEngine.Vector2::positiveInfinityVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___positiveInfinityVector_8;
// UnityEngine.Vector2 UnityEngine.Vector2::negativeInfinityVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___negativeInfinityVector_9;
public:
inline static int32_t get_offset_of_zeroVector_2() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___zeroVector_2)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_zeroVector_2() const { return ___zeroVector_2; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_zeroVector_2() { return &___zeroVector_2; }
inline void set_zeroVector_2(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___zeroVector_2 = value;
}
inline static int32_t get_offset_of_oneVector_3() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___oneVector_3)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_oneVector_3() const { return ___oneVector_3; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_oneVector_3() { return &___oneVector_3; }
inline void set_oneVector_3(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___oneVector_3 = value;
}
inline static int32_t get_offset_of_upVector_4() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___upVector_4)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_upVector_4() const { return ___upVector_4; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_upVector_4() { return &___upVector_4; }
inline void set_upVector_4(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___upVector_4 = value;
}
inline static int32_t get_offset_of_downVector_5() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___downVector_5)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_downVector_5() const { return ___downVector_5; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_downVector_5() { return &___downVector_5; }
inline void set_downVector_5(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___downVector_5 = value;
}
inline static int32_t get_offset_of_leftVector_6() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___leftVector_6)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_leftVector_6() const { return ___leftVector_6; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_leftVector_6() { return &___leftVector_6; }
inline void set_leftVector_6(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___leftVector_6 = value;
}
inline static int32_t get_offset_of_rightVector_7() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___rightVector_7)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_rightVector_7() const { return ___rightVector_7; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_rightVector_7() { return &___rightVector_7; }
inline void set_rightVector_7(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___rightVector_7 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___positiveInfinityVector_8)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_positiveInfinityVector_8() const { return ___positiveInfinityVector_8; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_positiveInfinityVector_8() { return &___positiveInfinityVector_8; }
inline void set_positiveInfinityVector_8(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___positiveInfinityVector_8 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_9() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___negativeInfinityVector_9)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_negativeInfinityVector_9() const { return ___negativeInfinityVector_9; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_negativeInfinityVector_9() { return &___negativeInfinityVector_9; }
inline void set_negativeInfinityVector_9(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___negativeInfinityVector_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#ifndef OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#define OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Object::m_CachedPtr
intptr_t ___m_CachedPtr_0;
public:
inline static int32_t get_offset_of_m_CachedPtr_0() { return static_cast<int32_t>(offsetof(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0, ___m_CachedPtr_0)); }
inline intptr_t get_m_CachedPtr_0() const { return ___m_CachedPtr_0; }
inline intptr_t* get_address_of_m_CachedPtr_0() { return &___m_CachedPtr_0; }
inline void set_m_CachedPtr_0(intptr_t value)
{
___m_CachedPtr_0 = value;
}
};
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_StaticFields
{
public:
// System.Int32 UnityEngine.Object::OffsetOfInstanceIDInCPlusPlusObject
int32_t ___OffsetOfInstanceIDInCPlusPlusObject_1;
public:
inline static int32_t get_offset_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return static_cast<int32_t>(offsetof(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_StaticFields, ___OffsetOfInstanceIDInCPlusPlusObject_1)); }
inline int32_t get_OffsetOfInstanceIDInCPlusPlusObject_1() const { return ___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline int32_t* get_address_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return &___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline void set_OffsetOfInstanceIDInCPlusPlusObject_1(int32_t value)
{
___OffsetOfInstanceIDInCPlusPlusObject_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_marshaled_pinvoke
{
intptr_t ___m_CachedPtr_0;
};
// Native definition for COM marshalling of UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_marshaled_com
{
intptr_t ___m_CachedPtr_0;
};
#endif // OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#ifndef TEXTANCHOR_TEC19034D476659A5E05366C63564F34DD30E7C57_H
#define TEXTANCHOR_TEC19034D476659A5E05366C63564F34DD30E7C57_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TextAnchor
struct TextAnchor_tEC19034D476659A5E05366C63564F34DD30E7C57
{
public:
// System.Int32 UnityEngine.TextAnchor::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(TextAnchor_tEC19034D476659A5E05366C63564F34DD30E7C57, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TEXTANCHOR_TEC19034D476659A5E05366C63564F34DD30E7C57_H
#ifndef COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#define COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Component
struct Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 : public Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#ifndef BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#define BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Behaviour
struct Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8 : public Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#ifndef MONOBEHAVIOUR_T4A60845CF505405AF8BE8C61CC07F75CADEF6429_H
#define MONOBEHAVIOUR_T4A60845CF505405AF8BE8C61CC07F75CADEF6429_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.MonoBehaviour
struct MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429 : public Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MONOBEHAVIOUR_T4A60845CF505405AF8BE8C61CC07F75CADEF6429_H
#ifndef UIBEHAVIOUR_T3C3C339CD5677BA7FC27C352FED8B78052A3FE70_H
#define UIBEHAVIOUR_T3C3C339CD5677BA7FC27C352FED8B78052A3FE70_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.EventSystems.UIBehaviour
struct UIBehaviour_t3C3C339CD5677BA7FC27C352FED8B78052A3FE70 : public MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UIBEHAVIOUR_T3C3C339CD5677BA7FC27C352FED8B78052A3FE70_H
#ifndef LAYOUTGROUP_T9E072B95DA6476C487C0B07A815291249025C0E4_H
#define LAYOUTGROUP_T9E072B95DA6476C487C0B07A815291249025C0E4_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.LayoutGroup
struct LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4 : public UIBehaviour_t3C3C339CD5677BA7FC27C352FED8B78052A3FE70
{
public:
// UnityEngine.RectOffset UnityEngine.UI.LayoutGroup::m_Padding
RectOffset_tED44B1176E93501050480416699D1F11BAE8C87A * ___m_Padding_4;
// UnityEngine.TextAnchor UnityEngine.UI.LayoutGroup::m_ChildAlignment
int32_t ___m_ChildAlignment_5;
// UnityEngine.RectTransform UnityEngine.UI.LayoutGroup::m_Rect
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * ___m_Rect_6;
// UnityEngine.DrivenRectTransformTracker UnityEngine.UI.LayoutGroup::m_Tracker
DrivenRectTransformTracker_tB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03 ___m_Tracker_7;
// UnityEngine.Vector2 UnityEngine.UI.LayoutGroup::m_TotalMinSize
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___m_TotalMinSize_8;
// UnityEngine.Vector2 UnityEngine.UI.LayoutGroup::m_TotalPreferredSize
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___m_TotalPreferredSize_9;
// UnityEngine.Vector2 UnityEngine.UI.LayoutGroup::m_TotalFlexibleSize
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___m_TotalFlexibleSize_10;
// System.Collections.Generic.List`1<UnityEngine.RectTransform> UnityEngine.UI.LayoutGroup::m_RectChildren
List_1_t0CD9761E1DF9817484CF4FB4253C6A626DC2311C * ___m_RectChildren_11;
public:
inline static int32_t get_offset_of_m_Padding_4() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_Padding_4)); }
inline RectOffset_tED44B1176E93501050480416699D1F11BAE8C87A * get_m_Padding_4() const { return ___m_Padding_4; }
inline RectOffset_tED44B1176E93501050480416699D1F11BAE8C87A ** get_address_of_m_Padding_4() { return &___m_Padding_4; }
inline void set_m_Padding_4(RectOffset_tED44B1176E93501050480416699D1F11BAE8C87A * value)
{
___m_Padding_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Padding_4), value);
}
inline static int32_t get_offset_of_m_ChildAlignment_5() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_ChildAlignment_5)); }
inline int32_t get_m_ChildAlignment_5() const { return ___m_ChildAlignment_5; }
inline int32_t* get_address_of_m_ChildAlignment_5() { return &___m_ChildAlignment_5; }
inline void set_m_ChildAlignment_5(int32_t value)
{
___m_ChildAlignment_5 = value;
}
inline static int32_t get_offset_of_m_Rect_6() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_Rect_6)); }
inline RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * get_m_Rect_6() const { return ___m_Rect_6; }
inline RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 ** get_address_of_m_Rect_6() { return &___m_Rect_6; }
inline void set_m_Rect_6(RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * value)
{
___m_Rect_6 = value;
Il2CppCodeGenWriteBarrier((&___m_Rect_6), value);
}
inline static int32_t get_offset_of_m_Tracker_7() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_Tracker_7)); }
inline DrivenRectTransformTracker_tB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03 get_m_Tracker_7() const { return ___m_Tracker_7; }
inline DrivenRectTransformTracker_tB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03 * get_address_of_m_Tracker_7() { return &___m_Tracker_7; }
inline void set_m_Tracker_7(DrivenRectTransformTracker_tB8FBBE24EEE9618CA32E4B3CF52F4AD7FDDEBE03 value)
{
___m_Tracker_7 = value;
}
inline static int32_t get_offset_of_m_TotalMinSize_8() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_TotalMinSize_8)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_m_TotalMinSize_8() const { return ___m_TotalMinSize_8; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_m_TotalMinSize_8() { return &___m_TotalMinSize_8; }
inline void set_m_TotalMinSize_8(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___m_TotalMinSize_8 = value;
}
inline static int32_t get_offset_of_m_TotalPreferredSize_9() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_TotalPreferredSize_9)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_m_TotalPreferredSize_9() const { return ___m_TotalPreferredSize_9; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_m_TotalPreferredSize_9() { return &___m_TotalPreferredSize_9; }
inline void set_m_TotalPreferredSize_9(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___m_TotalPreferredSize_9 = value;
}
inline static int32_t get_offset_of_m_TotalFlexibleSize_10() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_TotalFlexibleSize_10)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_m_TotalFlexibleSize_10() const { return ___m_TotalFlexibleSize_10; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_m_TotalFlexibleSize_10() { return &___m_TotalFlexibleSize_10; }
inline void set_m_TotalFlexibleSize_10(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___m_TotalFlexibleSize_10 = value;
}
inline static int32_t get_offset_of_m_RectChildren_11() { return static_cast<int32_t>(offsetof(LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4, ___m_RectChildren_11)); }
inline List_1_t0CD9761E1DF9817484CF4FB4253C6A626DC2311C * get_m_RectChildren_11() const { return ___m_RectChildren_11; }
inline List_1_t0CD9761E1DF9817484CF4FB4253C6A626DC2311C ** get_address_of_m_RectChildren_11() { return &___m_RectChildren_11; }
inline void set_m_RectChildren_11(List_1_t0CD9761E1DF9817484CF4FB4253C6A626DC2311C * value)
{
___m_RectChildren_11 = value;
Il2CppCodeGenWriteBarrier((&___m_RectChildren_11), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAYOUTGROUP_T9E072B95DA6476C487C0B07A815291249025C0E4_H
#ifndef HORIZONTALORVERTICALLAYOUTGROUP_TFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB_H
#define HORIZONTALORVERTICALLAYOUTGROUP_TFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.HorizontalOrVerticalLayoutGroup
struct HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB : public LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4
{
public:
// System.Single UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_Spacing
float ___m_Spacing_12;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildForceExpandWidth
bool ___m_ChildForceExpandWidth_13;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildForceExpandHeight
bool ___m_ChildForceExpandHeight_14;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildControlWidth
bool ___m_ChildControlWidth_15;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildControlHeight
bool ___m_ChildControlHeight_16;
public:
inline static int32_t get_offset_of_m_Spacing_12() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB, ___m_Spacing_12)); }
inline float get_m_Spacing_12() const { return ___m_Spacing_12; }
inline float* get_address_of_m_Spacing_12() { return &___m_Spacing_12; }
inline void set_m_Spacing_12(float value)
{
___m_Spacing_12 = value;
}
inline static int32_t get_offset_of_m_ChildForceExpandWidth_13() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB, ___m_ChildForceExpandWidth_13)); }
inline bool get_m_ChildForceExpandWidth_13() const { return ___m_ChildForceExpandWidth_13; }
inline bool* get_address_of_m_ChildForceExpandWidth_13() { return &___m_ChildForceExpandWidth_13; }
inline void set_m_ChildForceExpandWidth_13(bool value)
{
___m_ChildForceExpandWidth_13 = value;
}
inline static int32_t get_offset_of_m_ChildForceExpandHeight_14() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB, ___m_ChildForceExpandHeight_14)); }
inline bool get_m_ChildForceExpandHeight_14() const { return ___m_ChildForceExpandHeight_14; }
inline bool* get_address_of_m_ChildForceExpandHeight_14() { return &___m_ChildForceExpandHeight_14; }
inline void set_m_ChildForceExpandHeight_14(bool value)
{
___m_ChildForceExpandHeight_14 = value;
}
inline static int32_t get_offset_of_m_ChildControlWidth_15() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB, ___m_ChildControlWidth_15)); }
inline bool get_m_ChildControlWidth_15() const { return ___m_ChildControlWidth_15; }
inline bool* get_address_of_m_ChildControlWidth_15() { return &___m_ChildControlWidth_15; }
inline void set_m_ChildControlWidth_15(bool value)
{
___m_ChildControlWidth_15 = value;
}
inline static int32_t get_offset_of_m_ChildControlHeight_16() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB, ___m_ChildControlHeight_16)); }
inline bool get_m_ChildControlHeight_16() const { return ___m_ChildControlHeight_16; }
inline bool* get_address_of_m_ChildControlHeight_16() { return &___m_ChildControlHeight_16; }
inline void set_m_ChildControlHeight_16(bool value)
{
___m_ChildControlHeight_16 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // HORIZONTALORVERTICALLAYOUTGROUP_TFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB_H
#ifndef VERTICALLAYOUTGROUP_TAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11_H
#define VERTICALLAYOUTGROUP_TAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.VerticalLayoutGroup
struct VerticalLayoutGroup_tAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11 : public HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VERTICALLAYOUTGROUP_TAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11_H
// System.Void UnityEngine.UI.HorizontalOrVerticalLayoutGroup::.ctor()
extern "C" IL2CPP_METHOD_ATTR void HorizontalOrVerticalLayoutGroup__ctor_mB5A4A35A5BE3FE1278AFBBC8121AFC6E35EA175D (HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB * __this, const RuntimeMethod* method);
// System.Void UnityEngine.UI.LayoutGroup::CalculateLayoutInputHorizontal()
extern "C" IL2CPP_METHOD_ATTR void LayoutGroup_CalculateLayoutInputHorizontal_mAB1D93890FB765721FE662D8E55D26D9E0D9C64F (LayoutGroup_t9E072B95DA6476C487C0B07A815291249025C0E4 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.UI.HorizontalOrVerticalLayoutGroup::CalcAlongAxis(System.Int32,System.Boolean)
extern "C" IL2CPP_METHOD_ATTR void HorizontalOrVerticalLayoutGroup_CalcAlongAxis_m35F0EC164222C3962EDAF3400ED98485D8070F1E (HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB * __this, int32_t ___axis0, bool ___isVertical1, const RuntimeMethod* method);
// System.Void UnityEngine.UI.HorizontalOrVerticalLayoutGroup::SetChildrenAlongAxis(System.Int32,System.Boolean)
extern "C" IL2CPP_METHOD_ATTR void HorizontalOrVerticalLayoutGroup_SetChildrenAlongAxis_m51F74CE5A0B39F3C724F995C2B572E17899ED27D (HorizontalOrVerticalLayoutGroup_tFE5C3DB19C2CC4906B3E5D5F4E1966CB585174AB * __this, int32_t ___axis0, bool ___isVertical1, const RuntimeMethod* method);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.UI.VerticalLayoutGroup::.ctor()
extern "C" IL2CPP_METHOD_ATTR void VerticalLayoutGroup__ctor_m3EC63506FC41844092A548135D20A460E7E4E6A3 (VerticalLayoutGroup_tAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11 * __this, const RuntimeMethod* method)
{
{
HorizontalOrVerticalLayoutGroup__ctor_mB5A4A35A5BE3FE1278AFBBC8121AFC6E35EA175D(__this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.UI.VerticalLayoutGroup::CalculateLayoutInputHorizontal()
extern "C" IL2CPP_METHOD_ATTR void VerticalLayoutGroup_CalculateLayoutInputHorizontal_mBD58CD0DB5FC62541B9138F1A2F06DD13891C09E (VerticalLayoutGroup_tAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11 * __this, const RuntimeMethod* method)
{
{
LayoutGroup_CalculateLayoutInputHorizontal_mAB1D93890FB765721FE662D8E55D26D9E0D9C64F(__this, /*hidden argument*/NULL);
HorizontalOrVerticalLayoutGroup_CalcAlongAxis_m35F0EC164222C3962EDAF3400ED98485D8070F1E(__this, 0, (bool)1, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.UI.VerticalLayoutGroup::CalculateLayoutInputVertical()
extern "C" IL2CPP_METHOD_ATTR void VerticalLayoutGroup_CalculateLayoutInputVertical_mF06FF0EF1AA383EF8A9D373D3AD8F65E302D6C55 (VerticalLayoutGroup_tAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11 * __this, const RuntimeMethod* method)
{
{
HorizontalOrVerticalLayoutGroup_CalcAlongAxis_m35F0EC164222C3962EDAF3400ED98485D8070F1E(__this, 1, (bool)1, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.UI.VerticalLayoutGroup::SetLayoutHorizontal()
extern "C" IL2CPP_METHOD_ATTR void VerticalLayoutGroup_SetLayoutHorizontal_mDBAB0E860D28A07621CFF5FD811FE46681835454 (VerticalLayoutGroup_tAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11 * __this, const RuntimeMethod* method)
{
{
HorizontalOrVerticalLayoutGroup_SetChildrenAlongAxis_m51F74CE5A0B39F3C724F995C2B572E17899ED27D(__this, 0, (bool)1, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.UI.VerticalLayoutGroup::SetLayoutVertical()
extern "C" IL2CPP_METHOD_ATTR void VerticalLayoutGroup_SetLayoutVertical_m0C9CCFE9C74945FF3F45073528EEE427260B79C8 (VerticalLayoutGroup_tAAEE0BAA82E9A110591DEC9A3FFC25A01C2FFA11 * __this, const RuntimeMethod* method)
{
{
HorizontalOrVerticalLayoutGroup_SetChildrenAlongAxis_m51F74CE5A0B39F3C724F995C2B572E17899ED27D(__this, 1, (bool)1, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,86 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
#ifndef U3CMODULEU3E_TB308A2384DEB86F8845A4E61970976B8944B5DC4_H
#define U3CMODULEU3E_TB308A2384DEB86F8845A4E61970976B8944B5DC4_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_tB308A2384DEB86F8845A4E61970976B8944B5DC4
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_TB308A2384DEB86F8845A4E61970976B8944B5DC4_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,86 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
#ifndef U3CMODULEU3E_TCE4B768174CDE0294B05DD8ED59A7763FF34E99B_H
#define U3CMODULEU3E_TCE4B768174CDE0294B05DD8ED59A7763FF34E99B_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_tCE4B768174CDE0294B05DD8ED59A7763FF34E99B
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_TCE4B768174CDE0294B05DD8ED59A7763FF34E99B_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,64 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
extern const Il2CppMethodPointer g_MethodPointers[];
extern const Il2CppMethodPointer g_ReversePInvokeWrapperPointers[];
extern const Il2CppMethodPointer g_Il2CppGenericMethodPointers[];
extern const InvokerMethod g_Il2CppInvokerPointers[];
extern const CustomAttributesCacheGenerator g_AttributeGenerators[];
extern const Il2CppMethodPointer g_UnresolvedVirtualMethodPointers[];
extern Il2CppInteropData g_Il2CppInteropData[];
extern const Il2CppCodeRegistration g_CodeRegistration =
{
20110,
g_MethodPointers,
6,
g_ReversePInvokeWrapperPointers,
10370,
g_Il2CppGenericMethodPointers,
2727,
g_Il2CppInvokerPointers,
4073,
g_AttributeGenerators,
468,
g_UnresolvedVirtualMethodPointers,
238,
g_Il2CppInteropData,
};
extern const Il2CppMetadataRegistration g_MetadataRegistration;
static const Il2CppCodeGenOptions s_Il2CppCodeGenOptions =
{
true,
};
void s_Il2CppCodegenRegistration()
{
il2cpp_codegen_register (&g_CodeRegistration, &g_MetadataRegistration, &s_Il2CppCodeGenOptions);
}
#if RUNTIME_IL2CPP
static il2cpp::utils::RegisterRuntimeInitializeAndCleanup s_Il2CppCodegenRegistrationVariable (&s_Il2CppCodegenRegistration, NULL);
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,21 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,55 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
extern Il2CppGenericClass* const s_Il2CppGenericTypes[];
extern const Il2CppGenericInst* const g_Il2CppGenericInstTable[];
extern const Il2CppGenericMethodFunctionsDefinitions s_Il2CppGenericMethodFunctions[];
extern const RuntimeType* const g_Il2CppTypeTable[];
extern const Il2CppMethodSpec g_Il2CppMethodSpecTable[];
extern const int32_t* g_FieldOffsetTable[];
extern const Il2CppTypeDefinitionSizes* g_Il2CppTypeDefinitionSizesTable[];
extern void** const g_MetadataUsages[];
extern const Il2CppMetadataRegistration g_MetadataRegistration =
{
7643,
s_Il2CppGenericTypes,
1266,
g_Il2CppGenericInstTable,
11667,
s_Il2CppGenericMethodFunctions,
18628,
g_Il2CppTypeTable,
12333,
g_Il2CppMethodSpecTable,
3471,
g_FieldOffsetTable,
3471,
g_Il2CppTypeDefinitionSizesTable,
12899,
g_MetadataUsages,
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,266 @@
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
// System.Char[]
struct CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2;
// System.String
struct String_t;
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017;
struct unitytls_errorstate_t64FA817A583B1CD3CB1AFCFF9606F1F2782ABBE6 ;
struct unitytls_key_ref_tE908606656A7C49CA1EB734722E4C3DED7CE6E5B ;
struct unitytls_tlsctx_t6B948536BDFA3AAC0135FF136ABD7779A0B96A74 ;
struct unitytls_x509list_ref_tF01A6BF5ADA9C454E6B975D2669AF22D27555BF6 ;
struct unitytls_x509name_t551F433869F1BAA39C78962C7ACA1BAB9A4D6337 ;
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
#ifndef VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#define VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_com
{
};
#endif // VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifndef UNITYTLS_X509LIST_REF_TF01A6BF5ADA9C454E6B975D2669AF22D27555BF6_H
#define UNITYTLS_X509LIST_REF_TF01A6BF5ADA9C454E6B975D2669AF22D27555BF6_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Mono.Unity.UnityTls_unitytls_x509list_ref
struct unitytls_x509list_ref_tF01A6BF5ADA9C454E6B975D2669AF22D27555BF6
{
public:
// System.UInt64 Mono.Unity.UnityTls_unitytls_x509list_ref::handle
uint64_t ___handle_0;
public:
inline static int32_t get_offset_of_handle_0() { return static_cast<int32_t>(offsetof(unitytls_x509list_ref_tF01A6BF5ADA9C454E6B975D2669AF22D27555BF6, ___handle_0)); }
inline uint64_t get_handle_0() const { return ___handle_0; }
inline uint64_t* get_address_of_handle_0() { return &___handle_0; }
inline void set_handle_0(uint64_t value)
{
___handle_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNITYTLS_X509LIST_REF_TF01A6BF5ADA9C454E6B975D2669AF22D27555BF6_H
#ifndef ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#define ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521 : public ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF
{
public:
public:
};
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields
{
public:
// System.Char[] System.Enum::enumSeperatorCharArray
CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* ___enumSeperatorCharArray_0;
public:
inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields, ___enumSeperatorCharArray_0)); }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; }
inline void set_enumSeperatorCharArray_0(CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* value)
{
___enumSeperatorCharArray_0 = value;
Il2CppCodeGenWriteBarrier((&___enumSeperatorCharArray_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_com
{
};
#endif // ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#ifndef INTPTR_T_H
#define INTPTR_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INTPTR_T_H
#ifndef VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#define VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017
{
public:
union
{
struct
{
};
uint8_t Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017__padding[1];
};
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifndef UNITYTLS_X509VERIFY_RESULT_T835FEA0265EFD70F0762B220C663474E03402278_H
#define UNITYTLS_X509VERIFY_RESULT_T835FEA0265EFD70F0762B220C663474E03402278_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Mono.Unity.UnityTls_unitytls_x509verify_result
struct unitytls_x509verify_result_t835FEA0265EFD70F0762B220C663474E03402278
{
public:
// System.UInt32 Mono.Unity.UnityTls_unitytls_x509verify_result::value__
uint32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(unitytls_x509verify_result_t835FEA0265EFD70F0762B220C663474E03402278, ___value___2)); }
inline uint32_t get_value___2() const { return ___value___2; }
inline uint32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(uint32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNITYTLS_X509VERIFY_RESULT_T835FEA0265EFD70F0762B220C663474E03402278_H
extern "C" intptr_t CDECL ReversePInvokeWrapper_UnityTlsContext_WriteCallback_m5F0468BDEFF636D45C1C6F1C76704F11CDED387F(void* ___userData0, uint8_t* ___data1, intptr_t ___bufferLen2, unitytls_errorstate_t64FA817A583B1CD3CB1AFCFF9606F1F2782ABBE6 * ___errorState3);
extern "C" intptr_t CDECL ReversePInvokeWrapper_UnityTlsContext_ReadCallback_m0B14F0D383551A47EE106C1A94B86D951C20C8BB(void* ___userData0, uint8_t* ___buffer1, intptr_t ___bufferLen2, unitytls_errorstate_t64FA817A583B1CD3CB1AFCFF9606F1F2782ABBE6 * ___errorState3);
extern "C" uint32_t CDECL ReversePInvokeWrapper_UnityTlsContext_VerifyCallback_m13D57FD52BD264F536F4CA7E84BC54CCE5E01850(void* ___userData0, unitytls_x509list_ref_tF01A6BF5ADA9C454E6B975D2669AF22D27555BF6 ___chain1, unitytls_errorstate_t64FA817A583B1CD3CB1AFCFF9606F1F2782ABBE6 * ___errorState2);
extern "C" void CDECL ReversePInvokeWrapper_UnityTlsContext_CertificateCallback_m4CF8B88233EDA0609216D4F30A2C1F0966022347(void* ___userData0, unitytls_tlsctx_t6B948536BDFA3AAC0135FF136ABD7779A0B96A74 * ___ctx1, uint8_t* ___cn2, intptr_t ___cnLen3, unitytls_x509name_t551F433869F1BAA39C78962C7ACA1BAB9A4D6337 * ___caList4, intptr_t ___caListLen5, unitytls_x509list_ref_tF01A6BF5ADA9C454E6B975D2669AF22D27555BF6 * ___chain6, unitytls_key_ref_tE908606656A7C49CA1EB734722E4C3DED7CE6E5B * ___key7, unitytls_errorstate_t64FA817A583B1CD3CB1AFCFF9606F1F2782ABBE6 * ___errorState8);
extern "C" int32_t CDECL ReversePInvokeWrapper_DeflateStreamNative_UnmanagedRead_mFD20677F91EBF121ACA3C4236C108B356BF376FA(intptr_t ___buffer0, int32_t ___length1, intptr_t ___data2);
extern "C" int32_t CDECL ReversePInvokeWrapper_DeflateStreamNative_UnmanagedWrite_mC98CAEEAFE9482472AB4D5D78F733ADB7972A87C(intptr_t ___buffer0, int32_t ___length1, intptr_t ___data2);
extern const Il2CppMethodPointer g_ReversePInvokeWrapperPointers[6] =
{
reinterpret_cast<Il2CppMethodPointer>(ReversePInvokeWrapper_UnityTlsContext_WriteCallback_m5F0468BDEFF636D45C1C6F1C76704F11CDED387F),
reinterpret_cast<Il2CppMethodPointer>(ReversePInvokeWrapper_UnityTlsContext_ReadCallback_m0B14F0D383551A47EE106C1A94B86D951C20C8BB),
reinterpret_cast<Il2CppMethodPointer>(ReversePInvokeWrapper_UnityTlsContext_VerifyCallback_m13D57FD52BD264F536F4CA7E84BC54CCE5E01850),
reinterpret_cast<Il2CppMethodPointer>(ReversePInvokeWrapper_UnityTlsContext_CertificateCallback_m4CF8B88233EDA0609216D4F30A2C1F0966022347),
reinterpret_cast<Il2CppMethodPointer>(ReversePInvokeWrapper_DeflateStreamNative_UnmanagedRead_mFD20677F91EBF121ACA3C4236C108B356BF376FA),
reinterpret_cast<Il2CppMethodPointer>(ReversePInvokeWrapper_DeflateStreamNative_UnmanagedWrite_mC98CAEEAFE9482472AB4D5D78F733ADB7972A87C),
};

File diff suppressed because it is too large Load Diff

@ -0,0 +1,437 @@
extern "C" void RegisterStaticallyLinkedModulesGranular()
{
void RegisterModule_SharedInternals();
RegisterModule_SharedInternals();
void RegisterModule_Core();
RegisterModule_Core();
void RegisterModule_Animation();
RegisterModule_Animation();
void RegisterModule_Audio();
RegisterModule_Audio();
void RegisterModule_Physics();
RegisterModule_Physics();
void RegisterModule_TextRendering();
RegisterModule_TextRendering();
void RegisterModule_UI();
RegisterModule_UI();
void RegisterModule_UnityConnect();
RegisterModule_UnityConnect();
void RegisterModule_Video();
RegisterModule_Video();
void RegisterModule_IMGUI();
RegisterModule_IMGUI();
void RegisterModule_UnityWebRequest();
RegisterModule_UnityWebRequest();
void RegisterModule_UnityAnalytics();
RegisterModule_UnityAnalytics();
void RegisterModule_GameCenter();
RegisterModule_GameCenter();
void RegisterModule_TLS();
RegisterModule_TLS();
void RegisterModule_JSONSerialize();
RegisterModule_JSONSerialize();
void RegisterModule_ImageConversion();
RegisterModule_ImageConversion();
}
template <typename T> void RegisterUnityClass(const char*);
template <typename T> void RegisterStrippedType(int, const char*, const char*);
void InvokeRegisterStaticallyLinkedModuleClasses()
{
// Do nothing (we're in stripping mode)
}
class EditorExtension; template <> void RegisterUnityClass<EditorExtension>(const char*);
namespace Unity { class Component; } template <> void RegisterUnityClass<Unity::Component>(const char*);
class Behaviour; template <> void RegisterUnityClass<Behaviour>(const char*);
class Animation;
class Animator; template <> void RegisterUnityClass<Animator>(const char*);
class AudioBehaviour; template <> void RegisterUnityClass<AudioBehaviour>(const char*);
class AudioListener; template <> void RegisterUnityClass<AudioListener>(const char*);
class AudioSource; template <> void RegisterUnityClass<AudioSource>(const char*);
class AudioFilter;
class AudioChorusFilter;
class AudioDistortionFilter;
class AudioEchoFilter;
class AudioHighPassFilter;
class AudioLowPassFilter;
class AudioReverbFilter;
class AudioReverbZone;
class Camera; template <> void RegisterUnityClass<Camera>(const char*);
namespace UI { class Canvas; } template <> void RegisterUnityClass<UI::Canvas>(const char*);
namespace UI { class CanvasGroup; } template <> void RegisterUnityClass<UI::CanvasGroup>(const char*);
namespace Unity { class Cloth; }
class Collider2D;
class BoxCollider2D;
class CapsuleCollider2D;
class CircleCollider2D;
class CompositeCollider2D;
class EdgeCollider2D;
class PolygonCollider2D;
class TilemapCollider2D;
class ConstantForce;
class Effector2D;
class AreaEffector2D;
class BuoyancyEffector2D;
class PlatformEffector2D;
class PointEffector2D;
class SurfaceEffector2D;
class FlareLayer; template <> void RegisterUnityClass<FlareLayer>(const char*);
class GUIElement; template <> void RegisterUnityClass<GUIElement>(const char*);
namespace TextRenderingPrivate { class GUIText; }
class GUITexture;
class GUILayer; template <> void RegisterUnityClass<GUILayer>(const char*);
class GridLayout;
class Grid;
class Tilemap;
class Halo;
class HaloLayer;
class IConstraint;
class AimConstraint;
class LookAtConstraint;
class ParentConstraint;
class PositionConstraint;
class RotationConstraint;
class ScaleConstraint;
class Joint2D;
class AnchoredJoint2D;
class DistanceJoint2D;
class FixedJoint2D;
class FrictionJoint2D;
class HingeJoint2D;
class SliderJoint2D;
class SpringJoint2D;
class WheelJoint2D;
class RelativeJoint2D;
class TargetJoint2D;
class LensFlare;
class Light; template <> void RegisterUnityClass<Light>(const char*);
class LightProbeGroup;
class LightProbeProxyVolume;
class MonoBehaviour; template <> void RegisterUnityClass<MonoBehaviour>(const char*);
class NavMeshAgent;
class NavMeshObstacle;
class OffMeshLink;
class ParticleSystemForceField;
class PhysicsUpdateBehaviour2D;
class ConstantForce2D;
class PlayableDirector;
class Projector;
class ReflectionProbe; template <> void RegisterUnityClass<ReflectionProbe>(const char*);
class Skybox;
class SortingGroup;
class StreamingController;
class Terrain;
class VideoPlayer; template <> void RegisterUnityClass<VideoPlayer>(const char*);
class VisualEffect;
class WindZone;
namespace UI { class CanvasRenderer; } template <> void RegisterUnityClass<UI::CanvasRenderer>(const char*);
class Collider; template <> void RegisterUnityClass<Collider>(const char*);
class BoxCollider;
class CapsuleCollider;
class CharacterController;
class MeshCollider;
class SphereCollider;
class TerrainCollider;
class WheelCollider;
namespace Unity { class Joint; }
namespace Unity { class CharacterJoint; }
namespace Unity { class ConfigurableJoint; }
namespace Unity { class FixedJoint; }
namespace Unity { class HingeJoint; }
namespace Unity { class SpringJoint; }
class LODGroup;
class MeshFilter; template <> void RegisterUnityClass<MeshFilter>(const char*);
class OcclusionArea;
class OcclusionPortal;
class ParticleSystem;
class Renderer; template <> void RegisterUnityClass<Renderer>(const char*);
class BillboardRenderer;
class LineRenderer;
class MeshRenderer; template <> void RegisterUnityClass<MeshRenderer>(const char*);
class ParticleSystemRenderer;
class SkinnedMeshRenderer;
class SpriteMask;
class SpriteRenderer; template <> void RegisterUnityClass<SpriteRenderer>(const char*);
class SpriteShapeRenderer;
class TilemapRenderer;
class TrailRenderer;
class VFXRenderer;
class Rigidbody; template <> void RegisterUnityClass<Rigidbody>(const char*);
class Rigidbody2D;
namespace TextRenderingPrivate { class TextMesh; } template <> void RegisterUnityClass<TextRenderingPrivate::TextMesh>(const char*);
class Transform; template <> void RegisterUnityClass<Transform>(const char*);
namespace UI { class RectTransform; } template <> void RegisterUnityClass<UI::RectTransform>(const char*);
class Tree;
class WorldAnchor;
class GameObject; template <> void RegisterUnityClass<GameObject>(const char*);
class NamedObject; template <> void RegisterUnityClass<NamedObject>(const char*);
class AssetBundle;
class AssetBundleManifest;
class ScriptedImporter;
class AssetImporterLog;
class AudioMixer;
class AudioMixerController;
class AudioMixerGroup;
class AudioMixerGroupController;
class AudioMixerSnapshot;
class AudioMixerSnapshotController;
class Avatar;
class AvatarMask;
class BillboardAsset;
class ComputeShader; template <> void RegisterUnityClass<ComputeShader>(const char*);
class Flare;
namespace TextRendering { class Font; } template <> void RegisterUnityClass<TextRendering::Font>(const char*);
class GameObjectRecorder;
class LightProbes; template <> void RegisterUnityClass<LightProbes>(const char*);
class LocalizationAsset;
class Material; template <> void RegisterUnityClass<Material>(const char*);
class ProceduralMaterial;
class Mesh; template <> void RegisterUnityClass<Mesh>(const char*);
class Motion; template <> void RegisterUnityClass<Motion>(const char*);
class AnimationClip; template <> void RegisterUnityClass<AnimationClip>(const char*);
class PreviewAnimationClip;
class NavMeshData;
class OcclusionCullingData;
class PhysicMaterial;
class PhysicsMaterial2D;
class PreloadData; template <> void RegisterUnityClass<PreloadData>(const char*);
class RuntimeAnimatorController; template <> void RegisterUnityClass<RuntimeAnimatorController>(const char*);
class AnimatorController; template <> void RegisterUnityClass<AnimatorController>(const char*);
class AnimatorOverrideController; template <> void RegisterUnityClass<AnimatorOverrideController>(const char*);
class SampleClip; template <> void RegisterUnityClass<SampleClip>(const char*);
class AudioClip; template <> void RegisterUnityClass<AudioClip>(const char*);
class Shader; template <> void RegisterUnityClass<Shader>(const char*);
class ShaderVariantCollection;
class SpeedTreeWindAsset;
class Sprite; template <> void RegisterUnityClass<Sprite>(const char*);
class SpriteAtlas; template <> void RegisterUnityClass<SpriteAtlas>(const char*);
class SubstanceArchive;
class TerrainData;
class TerrainLayer;
class TextAsset; template <> void RegisterUnityClass<TextAsset>(const char*);
class CGProgram; template <> void RegisterUnityClass<CGProgram>(const char*);
class MonoScript; template <> void RegisterUnityClass<MonoScript>(const char*);
class Texture; template <> void RegisterUnityClass<Texture>(const char*);
class BaseVideoTexture;
class MovieTexture;
class WebCamTexture;
class CubemapArray; template <> void RegisterUnityClass<CubemapArray>(const char*);
class LowerResBlitTexture; template <> void RegisterUnityClass<LowerResBlitTexture>(const char*);
class ProceduralTexture;
class RenderTexture; template <> void RegisterUnityClass<RenderTexture>(const char*);
class CustomRenderTexture;
class SparseTexture;
class Texture2D; template <> void RegisterUnityClass<Texture2D>(const char*);
class Cubemap; template <> void RegisterUnityClass<Cubemap>(const char*);
class Texture2DArray; template <> void RegisterUnityClass<Texture2DArray>(const char*);
class Texture3D; template <> void RegisterUnityClass<Texture3D>(const char*);
class VideoClip; template <> void RegisterUnityClass<VideoClip>(const char*);
class VisualEffectAsset;
class VisualEffectResource;
class GameManager; template <> void RegisterUnityClass<GameManager>(const char*);
class GlobalGameManager; template <> void RegisterUnityClass<GlobalGameManager>(const char*);
class AudioManager; template <> void RegisterUnityClass<AudioManager>(const char*);
class BuildSettings; template <> void RegisterUnityClass<BuildSettings>(const char*);
class DelayedCallManager; template <> void RegisterUnityClass<DelayedCallManager>(const char*);
class GraphicsSettings; template <> void RegisterUnityClass<GraphicsSettings>(const char*);
class InputManager; template <> void RegisterUnityClass<InputManager>(const char*);
class MonoManager; template <> void RegisterUnityClass<MonoManager>(const char*);
class NavMeshProjectSettings;
class Physics2DSettings;
class PhysicsManager; template <> void RegisterUnityClass<PhysicsManager>(const char*);
class PlayerSettings; template <> void RegisterUnityClass<PlayerSettings>(const char*);
class QualitySettings; template <> void RegisterUnityClass<QualitySettings>(const char*);
class ResourceManager; template <> void RegisterUnityClass<ResourceManager>(const char*);
class RuntimeInitializeOnLoadManager; template <> void RegisterUnityClass<RuntimeInitializeOnLoadManager>(const char*);
class ScriptMapper; template <> void RegisterUnityClass<ScriptMapper>(const char*);
class StreamingManager;
class TagManager; template <> void RegisterUnityClass<TagManager>(const char*);
class TimeManager; template <> void RegisterUnityClass<TimeManager>(const char*);
class UnityConnectSettings; template <> void RegisterUnityClass<UnityConnectSettings>(const char*);
class VFXManager;
class LevelGameManager; template <> void RegisterUnityClass<LevelGameManager>(const char*);
class LightmapSettings; template <> void RegisterUnityClass<LightmapSettings>(const char*);
class NavMeshSettings;
class OcclusionCullingSettings;
class RenderSettings; template <> void RegisterUnityClass<RenderSettings>(const char*);
class RenderPassAttachment;
void RegisterAllClasses()
{
void RegisterBuiltinTypes();
RegisterBuiltinTypes();
//Total: 77 non stripped classes
//0. Animator
RegisterUnityClass<Animator>("Animation");
//1. Behaviour
RegisterUnityClass<Behaviour>("Core");
//2. Unity::Component
RegisterUnityClass<Unity::Component>("Core");
//3. EditorExtension
RegisterUnityClass<EditorExtension>("Core");
//4. AnimatorOverrideController
RegisterUnityClass<AnimatorOverrideController>("Animation");
//5. RuntimeAnimatorController
RegisterUnityClass<RuntimeAnimatorController>("Animation");
//6. NamedObject
RegisterUnityClass<NamedObject>("Core");
//7. Camera
RegisterUnityClass<Camera>("Core");
//8. LowerResBlitTexture
RegisterUnityClass<LowerResBlitTexture>("Core");
//9. Texture
RegisterUnityClass<Texture>("Core");
//10. PreloadData
RegisterUnityClass<PreloadData>("Core");
//11. GUIElement
RegisterUnityClass<GUIElement>("Core");
//12. GUILayer
RegisterUnityClass<GUILayer>("Core");
//13. GameObject
RegisterUnityClass<GameObject>("Core");
//14. QualitySettings
RegisterUnityClass<QualitySettings>("Core");
//15. GlobalGameManager
RegisterUnityClass<GlobalGameManager>("Core");
//16. GameManager
RegisterUnityClass<GameManager>("Core");
//17. Renderer
RegisterUnityClass<Renderer>("Core");
//18. Shader
RegisterUnityClass<Shader>("Core");
//19. Material
RegisterUnityClass<Material>("Core");
//20. Light
RegisterUnityClass<Light>("Core");
//21. MeshFilter
RegisterUnityClass<MeshFilter>("Core");
//22. MeshRenderer
RegisterUnityClass<MeshRenderer>("Core");
//23. Mesh
RegisterUnityClass<Mesh>("Core");
//24. MonoBehaviour
RegisterUnityClass<MonoBehaviour>("Core");
//25. ReflectionProbe
RegisterUnityClass<ReflectionProbe>("Core");
//26. ComputeShader
RegisterUnityClass<ComputeShader>("Core");
//27. TextAsset
RegisterUnityClass<TextAsset>("Core");
//28. Texture2D
RegisterUnityClass<Texture2D>("Core");
//29. Cubemap
RegisterUnityClass<Cubemap>("Core");
//30. Texture3D
RegisterUnityClass<Texture3D>("Core");
//31. Texture2DArray
RegisterUnityClass<Texture2DArray>("Core");
//32. CubemapArray
RegisterUnityClass<CubemapArray>("Core");
//33. RenderTexture
RegisterUnityClass<RenderTexture>("Core");
//34. UI::RectTransform
RegisterUnityClass<UI::RectTransform>("Core");
//35. Transform
RegisterUnityClass<Transform>("Core");
//36. Sprite
RegisterUnityClass<Sprite>("Core");
//37. SpriteAtlas
RegisterUnityClass<SpriteAtlas>("Core");
//38. Rigidbody
RegisterUnityClass<Rigidbody>("Physics");
//39. Collider
RegisterUnityClass<Collider>("Physics");
//40. AudioClip
RegisterUnityClass<AudioClip>("Audio");
//41. SampleClip
RegisterUnityClass<SampleClip>("Audio");
//42. AudioListener
RegisterUnityClass<AudioListener>("Audio");
//43. AudioBehaviour
RegisterUnityClass<AudioBehaviour>("Audio");
//44. AudioSource
RegisterUnityClass<AudioSource>("Audio");
//45. TextRenderingPrivate::TextMesh
RegisterUnityClass<TextRenderingPrivate::TextMesh>("TextRendering");
//46. TextRendering::Font
RegisterUnityClass<TextRendering::Font>("TextRendering");
//47. VideoPlayer
RegisterUnityClass<VideoPlayer>("Video");
//48. UI::Canvas
RegisterUnityClass<UI::Canvas>("UI");
//49. UI::CanvasGroup
RegisterUnityClass<UI::CanvasGroup>("UI");
//50. UI::CanvasRenderer
RegisterUnityClass<UI::CanvasRenderer>("UI");
//51. VideoClip
RegisterUnityClass<VideoClip>("Video");
//52. SpriteRenderer
RegisterUnityClass<SpriteRenderer>("Core");
//53. TagManager
RegisterUnityClass<TagManager>("Core");
//54. GraphicsSettings
RegisterUnityClass<GraphicsSettings>("Core");
//55. DelayedCallManager
RegisterUnityClass<DelayedCallManager>("Core");
//56. InputManager
RegisterUnityClass<InputManager>("Core");
//57. TimeManager
RegisterUnityClass<TimeManager>("Core");
//58. BuildSettings
RegisterUnityClass<BuildSettings>("Core");
//59. MonoScript
RegisterUnityClass<MonoScript>("Core");
//60. PlayerSettings
RegisterUnityClass<PlayerSettings>("Core");
//61. ResourceManager
RegisterUnityClass<ResourceManager>("Core");
//62. RuntimeInitializeOnLoadManager
RegisterUnityClass<RuntimeInitializeOnLoadManager>("Core");
//63. ScriptMapper
RegisterUnityClass<ScriptMapper>("Core");
//64. PhysicsManager
RegisterUnityClass<PhysicsManager>("Physics");
//65. MonoManager
RegisterUnityClass<MonoManager>("Core");
//66. AudioManager
RegisterUnityClass<AudioManager>("Audio");
//67. UnityConnectSettings
RegisterUnityClass<UnityConnectSettings>("UnityConnect");
//68. LevelGameManager
RegisterUnityClass<LevelGameManager>("Core");
//69. FlareLayer
RegisterUnityClass<FlareLayer>("Core");
//70. RenderSettings
RegisterUnityClass<RenderSettings>("Core");
//71. LightmapSettings
RegisterUnityClass<LightmapSettings>("Core");
//72. CGProgram
RegisterUnityClass<CGProgram>("Core");
//73. LightProbes
RegisterUnityClass<LightProbes>("Core");
//74. Motion
RegisterUnityClass<Motion>("Animation");
//75. AnimationClip
RegisterUnityClass<AnimationClip>("Animation");
//76. AnimatorController
RegisterUnityClass<AnimatorController>("Animation");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,102 @@
/*
* Author: Landon Fuller <landonf@plausiblelabs.com>
*
* Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
/**
* @ingroup functions
*
* Prototype of a callback function used to execute additional user code with signal information as provided
* by PLCrashReporter. Called upon completion of crash handling, after the crash report has been written to disk.
*
* @param info The signal info.
* @param uap The crash's threads context.
* @param context The API client's supplied context value.
*
* @sa @ref async_safety
* @sa PLCrashReporter::setPostCrashCallbacks:
*/
typedef void (*UnityPLCrashReporterPostCrashSignalCallback)(siginfo_t *info, ucontext_t *uap, void *context);
/**
* @ingroup types
*
* This structure contains callbacks supported by PLCrashReporter to allow the host application to perform
* additional tasks prior to program termination after a crash has occured.
*
* @sa @ref async_safety
*/
typedef struct UnityPLCrashReporterCallbacks
{
/** The version number of this structure. If not one of the defined version numbers for this type, the behavior
* is undefined. The current version of this structure is 0. */
uint16_t version;
/** An arbitrary user-supplied context value. This value may be NULL. */
void *context;
/** The callback used to report caught signal information. In version 0 of this structure, all crashes will be
* reported via this function. */
UnityPLCrashReporterPostCrashSignalCallback handleSignal;
} UnityPLCrashReporterCallbacks;
@interface UnityPLCrashReporter : NSObject
{
@private
/** YES if the crash reporter has been enabled */
BOOL _enabled;
/** Application identifier */
NSString *_applicationIdentifier;
/** Application version */
NSString *_applicationVersion;
/** Path to the crash reporter internal data directory */
NSString *_crashReportDirectory;
}
+ (UnityPLCrashReporter *)sharedReporter;
- (BOOL)hasPendingCrashReport;
- (NSData *)loadPendingCrashReportData;
- (NSData *)loadPendingCrashReportDataAndReturnError:(NSError **)outError;
- (NSData *)generateLiveReport;
- (NSData *)generateLiveReportAndReturnError:(NSError **)outError;
- (BOOL)purgePendingCrashReport;
- (BOOL)purgePendingCrashReportAndReturnError:(NSError **)outError;
- (BOOL)enableCrashReporter;
- (BOOL)enableCrashReporterAndReturnError:(NSError **)outError;
- (void)setCrashCallbacks:(UnityPLCrashReporterCallbacks *)callbacks;
@end

@ -0,0 +1,60 @@
#pragma once
#include "LifeCycleListener.h"
@protocol AppDelegateListener<LifeCycleListener>
@optional
// these do not have apple defined notifications, so we use our own notifications
// notification will be posted from
// - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
// notification user data is deviceToken
- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSNotification*)notification;
// notification will be posted from
// - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
// notification user data is error
- (void)didFailToRegisterForRemoteNotificationsWithError:(NSNotification*)notification;
// notification will be posted from
// - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
// notification user data is userInfo
- (void)didReceiveRemoteNotification:(NSNotification*)notification;
// notification will be posted from
// - (void)application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification
// notification user data is notification
- (void)didReceiveLocalNotification:(NSNotification*)notification;
// notification will be posted from
// - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
// notification user data is the NSDictionary containing all the params
- (void)onOpenURL:(NSNotification*)notification;
// notification will be posted from
// - (BOOL)application:(UIApplication*)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptions
// notification user data is the NSDictionary containing launchOptions
- (void)applicationWillFinishLaunchingWithOptions:(NSNotification*)notification;
// notification will be posted from
// - (void)application:(UIApplication*)application handleEventsForBackgroundURLSession:(nonnull NSString *)identifier completionHandler:(nonnull void (^)())completionHandler
// notification user data is NSDictionary with one item where key is session identifier and value is completion handler
- (void)onHandleEventsForBackgroundURLSession:(NSNotification*)notification;
// these are just hooks to existing notifications
- (void)applicationDidReceiveMemoryWarning:(NSNotification*)notification;
- (void)applicationSignificantTimeChange:(NSNotification*)notification;
- (void)applicationWillChangeStatusBarFrame:(NSNotification*)notification;
- (void)applicationWillChangeStatusBarOrientation:(NSNotification*)notification;
@end
void UnityRegisterAppDelegateListener(id<AppDelegateListener> obj);
void UnityUnregisterAppDelegateListener(id<AppDelegateListener> obj);
extern "C" __attribute__((visibility("default"))) NSString* const kUnityDidRegisterForRemoteNotificationsWithDeviceToken;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityDidFailToRegisterForRemoteNotificationsWithError;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityDidReceiveRemoteNotification;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityDidReceiveLocalNotification;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityOnOpenURL;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityWillFinishLaunchingWithOptions;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityHandleEventsForBackgroundURLSession;

@ -0,0 +1,62 @@
#include "AppDelegateListener.h"
#define DEFINE_NOTIFICATION(name) extern "C" __attribute__((visibility ("default"))) NSString* const name = @#name;
DEFINE_NOTIFICATION(kUnityDidRegisterForRemoteNotificationsWithDeviceToken);
DEFINE_NOTIFICATION(kUnityDidFailToRegisterForRemoteNotificationsWithError);
DEFINE_NOTIFICATION(kUnityDidReceiveRemoteNotification);
DEFINE_NOTIFICATION(kUnityDidReceiveLocalNotification);
DEFINE_NOTIFICATION(kUnityOnOpenURL);
DEFINE_NOTIFICATION(kUnityWillFinishLaunchingWithOptions);
DEFINE_NOTIFICATION(kUnityHandleEventsForBackgroundURLSession);
#undef DEFINE_NOTIFICATION
void UnityRegisterAppDelegateListener(id<AppDelegateListener> obj)
{
#define REGISTER_SELECTOR(sel, notif_name) \
if([obj respondsToSelector:sel]) \
[[NSNotificationCenter defaultCenter] addObserver:obj \
selector:sel \
name:notif_name \
object:nil \
]; \
UnityRegisterLifeCycleListener(obj);
REGISTER_SELECTOR(@selector(didRegisterForRemoteNotificationsWithDeviceToken:), kUnityDidRegisterForRemoteNotificationsWithDeviceToken);
REGISTER_SELECTOR(@selector(didFailToRegisterForRemoteNotificationsWithError:), kUnityDidFailToRegisterForRemoteNotificationsWithError);
REGISTER_SELECTOR(@selector(didReceiveRemoteNotification:), kUnityDidReceiveRemoteNotification);
REGISTER_SELECTOR(@selector(didReceiveLocalNotification:), kUnityDidReceiveLocalNotification);
REGISTER_SELECTOR(@selector(onOpenURL:), kUnityOnOpenURL);
REGISTER_SELECTOR(@selector(applicationDidReceiveMemoryWarning:), UIApplicationDidReceiveMemoryWarningNotification);
REGISTER_SELECTOR(@selector(applicationSignificantTimeChange:), UIApplicationSignificantTimeChangeNotification);
#if !PLATFORM_TVOS
REGISTER_SELECTOR(@selector(applicationWillChangeStatusBarFrame:), UIApplicationWillChangeStatusBarFrameNotification);
REGISTER_SELECTOR(@selector(applicationWillChangeStatusBarOrientation:), UIApplicationWillChangeStatusBarOrientationNotification);
#endif
REGISTER_SELECTOR(@selector(applicationWillFinishLaunchingWithOptions:), kUnityWillFinishLaunchingWithOptions);
REGISTER_SELECTOR(@selector(onHandleEventsForBackgroundURLSession:), kUnityHandleEventsForBackgroundURLSession);
#undef REGISTER_SELECTOR
}
void UnityUnregisterAppDelegateListener(id<AppDelegateListener> obj)
{
UnityUnregisterLifeCycleListener(obj);
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityDidRegisterForRemoteNotificationsWithDeviceToken object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityDidFailToRegisterForRemoteNotificationsWithError object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityDidReceiveRemoteNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityDidReceiveLocalNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityOnOpenURL object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationDidReceiveMemoryWarningNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationSignificantTimeChangeNotification object: nil];
#if !PLATFORM_TVOS
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationWillChangeStatusBarFrameNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationWillChangeStatusBarOrientationNotification object: nil];
#endif
}

@ -0,0 +1,16 @@
#pragma once
// important app life-cycle events
@protocol LifeCycleListener<NSObject>
@optional
- (void)didFinishLaunching:(NSNotification*)notification;
- (void)didBecomeActive:(NSNotification*)notification;
- (void)willResignActive:(NSNotification*)notification;
- (void)didEnterBackground:(NSNotification*)notification;
- (void)willEnterForeground:(NSNotification*)notification;
- (void)willTerminate:(NSNotification*)notification;
@end
void UnityRegisterLifeCycleListener(id<LifeCycleListener> obj);
void UnityUnregisterLifeCycleListener(id<LifeCycleListener> obj);

@ -0,0 +1,32 @@
#include "LifeCycleListener.h"
void UnityRegisterLifeCycleListener(id<LifeCycleListener> obj)
{
#define REGISTER_SELECTOR(sel, notif_name) \
if([obj respondsToSelector:sel]) \
[[NSNotificationCenter defaultCenter] addObserver:obj \
selector:sel \
name:notif_name \
object:nil \
]; \
REGISTER_SELECTOR(@selector(didFinishLaunching:), UIApplicationDidFinishLaunchingNotification);
REGISTER_SELECTOR(@selector(didBecomeActive:), UIApplicationDidBecomeActiveNotification);
REGISTER_SELECTOR(@selector(willResignActive:), UIApplicationWillResignActiveNotification);
REGISTER_SELECTOR(@selector(didEnterBackground:), UIApplicationDidEnterBackgroundNotification);
REGISTER_SELECTOR(@selector(willEnterForeground:), UIApplicationWillEnterForegroundNotification);
REGISTER_SELECTOR(@selector(willTerminate:), UIApplicationWillTerminateNotification);
#undef REGISTER_SELECTOR
}
void UnityUnregisterLifeCycleListener(id<LifeCycleListener> obj)
{
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationDidFinishLaunchingNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationDidBecomeActiveNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationWillResignActiveNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationDidEnterBackgroundNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationWillEnterForegroundNotification object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: UIApplicationWillTerminateNotification object: nil];
}

@ -0,0 +1,68 @@
#pragma once
#include "LifeCycleListener.h"
struct UnityDisplaySurfaceBase; // Unity/UnityRendering.h
struct RenderingSurfaceParams; // Unity/DisplayManager.h
// due to delicate nature of render loop we have just one delegate in app
// if you need to use several rendering delegates you need to do one of:
// 1. create custom delegate that will have code to combine effects by itself
// 2. use helper that simply holds array of delegates (which will work only in easiest cases)
@protocol RenderPluginDelegate<LifeCycleListener, NSObject>
@required
// this will be called right after gles intialization.
// surface pointer will never be changed, so you should keep it.
// the only valid fields in there as of now are layer and context
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface;
@optional
// this will be called before recreating main display surface (from [UnityView recreateRenderingSurface])
// you can tweak params here.
// use it for enabling CVTextureCache support and the likes
- (void)onBeforeMainDisplaySurfaceRecreate:(struct RenderingSurfaceParams*)params;
// this will be called right after recreating main display surface (from [UnityView recreateRenderingSurface])
// as [UnityView recreateRenderingSurface] is the only place where unity itself will trigger surface recreate
// you can use this method to update your rendering depending on changes
- (void)onAfterMainDisplaySurfaceRecreate;
// this will be called after frame render and msaa resolve but before blitting to system FB
// you can expect that frame contents are ready (though still in target resolution)
// use it for anylizing/postprocessing rendered frame, taking screenshot and the like
// you should use targetFB if it is not 0
// otherwise use systemFB (covers case of intermediate fb not needed: no msaa, native res, no CVTextureCache involved)
- (void)onFrameResolved;
@end
// simple helper for common plugin stuff
// you can implement protocol directly, but subclassing this will provide some common implementation
@interface RenderPluginDelegate : NSObject<RenderPluginDelegate>
{
struct UnityDisplaySurfaceBase* mainDisplaySurface;
}
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface;
@end
// simple helper to have an array of render delegates.
// be warned that it works in simplest cases only, when there is no interop between delegates
@interface RenderPluginArrayDelegate : RenderPluginDelegate
{
NSArray* delegateArray;
}
@property(nonatomic, retain) NSArray* delegateArray;
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface;
- (void)onBeforeMainDisplaySurfaceRecreate:(struct RenderingSurfaceParams*)params;
- (void)onAfterMainDisplaySurfaceRecreate;
- (void)onFrameResolved;
- (void)didBecomeActive:(NSNotification*)notification;
- (void)willResignActive:(NSNotification*)notification;
- (void)didEnterBackground:(NSNotification*)notification;
- (void)willEnterForeground:(NSNotification*)notification;
- (void)willTerminate:(NSNotification*)notification;
@end

@ -0,0 +1,90 @@
#include "RenderPluginDelegate.h"
@implementation RenderPluginDelegate
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface
{
mainDisplaySurface = surface;
// TODO: move lifecycle to init?
UnityRegisterLifeCycleListener(self);
}
@end
#define CALL_METHOD_ON_ARRAY(method) \
do{ \
for(id<RenderPluginDelegate> del in delegateArray) \
{ \
if([del respondsToSelector:@selector(method)]) \
[del method]; \
} \
} while(0)
#define CALL_METHOD_ON_ARRAY_ARG(method, arg) \
do{ \
for(id<RenderPluginDelegate> del in delegateArray) \
{ \
if([del respondsToSelector:@selector(method:)]) \
[del method:arg]; \
} \
} while(0)
@implementation RenderPluginArrayDelegate
@synthesize delegateArray;
- (void)mainDisplayInited:(struct UnityDisplaySurfaceBase*)surface
{
[super mainDisplayInited: surface];
CALL_METHOD_ON_ARRAY_ARG(mainDisplayInited, surface);
}
- (void)onBeforeMainDisplaySurfaceRecreate:(struct RenderingSurfaceParams*)params
{
CALL_METHOD_ON_ARRAY_ARG(onBeforeMainDisplaySurfaceRecreate, params);
}
- (void)onAfterMainDisplaySurfaceRecreate;
{
CALL_METHOD_ON_ARRAY(onAfterMainDisplaySurfaceRecreate);
}
- (void)onFrameResolved;
{
CALL_METHOD_ON_ARRAY(onFrameResolved);
}
- (void)didBecomeActive:(NSNotification*)notification
{
CALL_METHOD_ON_ARRAY_ARG(didBecomeActive, notification);
}
- (void)willResignActive:(NSNotification*)notification
{
CALL_METHOD_ON_ARRAY_ARG(willResignActive, notification);
}
- (void)didEnterBackground:(NSNotification*)notification
{
CALL_METHOD_ON_ARRAY_ARG(didEnterBackground, notification);
}
- (void)willEnterForeground:(NSNotification*)notification
{
CALL_METHOD_ON_ARRAY_ARG(willEnterForeground, notification);
}
- (void)willTerminate:(NSNotification*)notification
{
CALL_METHOD_ON_ARRAY_ARG(willTerminate, notification);
}
@end
#undef CALL_METHOD_ON_ARRAY
#undef CALL_METHOD_ON_ARRAY_ARG

@ -0,0 +1,30 @@
#pragma once
#import <Foundation/NSNotification.h>
// view changes on the main view controller
@protocol UnityViewControllerListener<NSObject>
@optional
- (void)viewWillLayoutSubviews:(NSNotification*)notification;
- (void)viewDidLayoutSubviews:(NSNotification*)notification;
- (void)viewWillDisappear:(NSNotification*)notification;
- (void)viewDidDisappear:(NSNotification*)notification;
- (void)viewWillAppear:(NSNotification*)notification;
- (void)viewDidAppear:(NSNotification*)notification;
- (void)interfaceWillChangeOrientation:(NSNotification*)notification;
- (void)interfaceDidChangeOrientation:(NSNotification*)notification;
@end
void UnityRegisterViewControllerListener(id<UnityViewControllerListener> obj);
void UnityUnregisterViewControllerListener(id<UnityViewControllerListener> obj);
extern "C" __attribute__((visibility("default"))) NSString* const kUnityViewWillLayoutSubviews;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityViewDidLayoutSubviews;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityViewWillDisappear;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityViewDidDisappear;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityViewWillAppear;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityViewDidAppear;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityInterfaceWillChangeOrientation;
extern "C" __attribute__((visibility("default"))) NSString* const kUnityInterfaceDidChangeOrientation;

@ -0,0 +1,45 @@
#include "UnityViewControllerListener.h"
#include <UIKit/UIApplication.h>
#define DEFINE_NOTIFICATION(name) extern "C" __attribute__((visibility ("default"))) NSString* const name = @#name;
DEFINE_NOTIFICATION(kUnityViewWillLayoutSubviews);
DEFINE_NOTIFICATION(kUnityViewDidLayoutSubviews);
DEFINE_NOTIFICATION(kUnityViewWillDisappear);
DEFINE_NOTIFICATION(kUnityViewDidDisappear);
DEFINE_NOTIFICATION(kUnityViewWillAppear);
DEFINE_NOTIFICATION(kUnityViewDidAppear);
DEFINE_NOTIFICATION(kUnityInterfaceWillChangeOrientation);
DEFINE_NOTIFICATION(kUnityInterfaceDidChangeOrientation);
#undef DEFINE_NOTIFICATION
void UnityRegisterViewControllerListener(id<UnityViewControllerListener> obj)
{
#define REGISTER_SELECTOR(sel, notif_name) \
if([obj respondsToSelector:sel]) \
[[NSNotificationCenter defaultCenter] addObserver:obj selector:sel name:notif_name object:nil]; \
REGISTER_SELECTOR(@selector(viewWillLayoutSubviews:), kUnityViewWillLayoutSubviews);
REGISTER_SELECTOR(@selector(viewDidLayoutSubviews:), kUnityViewDidLayoutSubviews);
REGISTER_SELECTOR(@selector(viewWillDisappear:), kUnityViewWillDisappear);
REGISTER_SELECTOR(@selector(viewDidDisappear:), kUnityViewDidDisappear);
REGISTER_SELECTOR(@selector(viewWillAppear:), kUnityViewWillAppear);
REGISTER_SELECTOR(@selector(viewDidAppear:), kUnityViewDidAppear);
REGISTER_SELECTOR(@selector(interfaceWillChangeOrientation:), kUnityInterfaceWillChangeOrientation);
REGISTER_SELECTOR(@selector(interfaceDidChangeOrientation:), kUnityInterfaceDidChangeOrientation);
#undef REGISTER_SELECTOR
}
void UnityUnregisterViewControllerListener(id<UnityViewControllerListener> obj)
{
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityViewWillLayoutSubviews object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityViewDidLayoutSubviews object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityViewWillDisappear object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityViewDidDisappear object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityViewWillAppear object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityViewDidAppear object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityInterfaceWillChangeOrientation object: nil];
[[NSNotificationCenter defaultCenter] removeObserver: obj name: kUnityInterfaceDidChangeOrientation object: nil];
}

@ -0,0 +1,25 @@
//
// Prefix header
//
#include "Preprocessor.h"
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
#include "UnityTrampolineConfigure.h"
#include "UnityInterface.h"
#ifndef __OBJC__
#if USE_IL2CPP_PCH
#include "il2cpp_precompiled_header.h"
#endif
#endif
#ifndef TARGET_IPHONE_SIMULATOR
#define TARGET_IPHONE_SIMULATOR 0
#endif
#define printf_console printf

@ -0,0 +1,147 @@
#pragma once
#include <Availability.h>
#include <TargetConditionals.h>
//------------------------------------------------------------------------------
//
// ensuring proper compiler/xcode/whatever selection
//
#ifndef __clang__
#error Please use clang compiler.
#endif
// NOT the best way but apple do not care about adding extensions properly
#if __clang_major__ < 7
#error Please use Xcode 7.0 or newer
#endif
#if !defined(__IPHONE_9_0) || __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_9_0
#error Please use iOS SDK 9.0 or newer
#endif
#if defined(TARGET_OS_TV) && TARGET_OS_TV && !defined(__TVOS_9_0)
#error Please use tvOS SDK 9.0 or newer
#endif
#if !defined(__IPHONE_9_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
#error Please target iOS 9.0 or newer
#endif
//------------------------------------------------------------------------------
//
// defines for target platform
//
#define UNITY_TRAMPOLINE_IN_USE 1
#if defined(TARGET_OS_TV) && TARGET_OS_TV
#define PLATFORM_TVOS 0
#define PLATFORM_IOS 1
#else
#define PLATFORM_TVOS 0
#define PLATFORM_IOS 1
#endif
#define PLATFORM_OSX 0
//------------------------------------------------------------------------------
//
// defines for sdk/target version
//
#if !TARGET_IPHONE_SIMULATOR && !TARGET_TVOS_SIMULATOR
#define UNITY_CAN_USE_METAL 1
#else
#define UNITY_CAN_USE_METAL 0
#endif
// It's hard to figure out which SDK we are using as the availability macros defined in the SDK
// have various quirks.
//
// It's not possible to use *_VERSION_MAX_ALLOWED macros because they not always corresponded to
// the SDK version. In particular, __TV_OS_VERSION_MAX_ALLOWED was out of sync in all Xcode dot
// releases except the first so far.
//
// The highest __IPHONE_X_Y or __TVOS_X_Y macro that is defined in Availability.h correctly
// corresponds to the version of the SDK (at least in each Xcode version since 6.0 up to 9.0).
// However, some other headers (e.g. System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h
// in SDKs up to 9.3) may define the macros itself and this does not correspond to the what's in
// Availability.h. Thus we make sure to include "Preprocessor.h" before the CABase.h header.
#if defined(CABASE_H)
#error "Please include Preprocessor.h before other includes"
#endif
#if defined(__IPHONE_10_0)
#define UNITY_HAS_IOSSDK_10_0 1
#else
#define UNITY_HAS_IOSSDK_10_0 0
#endif
#if defined(__IPHONE_10_2)
#define UNITY_HAS_IOSSDK_10_2 1
#else
#define UNITY_HAS_IOSSDK_10_2 0
#endif
#if defined(__IPHONE_10_3)
#define UNITY_HAS_IOSSDK_10_3 1
#else
#define UNITY_HAS_IOSSDK_10_3 0
#endif
#if defined(__IPHONE_11_0)
#define UNITY_HAS_IOSSDK_11_0 1
#else
#define UNITY_HAS_IOSSDK_11_0 0
#endif
#if defined(__IPHONE_11_1)
#define UNITY_HAS_IOSSDK_11_1 1
#else
#define UNITY_HAS_IOSSDK_11_1 0
#endif
#if defined(__TVOS_10_0)
#define UNITY_HAS_TVOSSDK_10_0 1
#else
#define UNITY_HAS_TVOSSDK_10_0 0
#endif
#if defined(__TVOS_10_2)
#define UNITY_HAS_TVOSSDK_10_2 1
#else
#define UNITY_HAS_TVOSSDK_10_2 0
#endif
#if defined(__TVOS_11_0)
#define UNITY_HAS_TVOSSDK_11_0 1
#else
#define UNITY_HAS_TVOSSDK_11_0 0
#endif
// The following UNITY_USES_* flags disable functionality in the trampoline project
// whenever the user does not use it from his scripts. We detect the API usage and
// adjust the value of these flags whenever the project is built (including when the
// project is appended)
#define UNITY_USES_REMOTE_NOTIFICATIONS 0
#define UNITY_USES_WEBCAM 0
#define UNITY_USES_MICROPHONE 0
#define UNITY_USES_REPLAY_KIT 0
#define UNITY_SNAPSHOT_VIEW_ON_APPLICATION_PAUSE 0
#define UNITY_DEVELOPER_BUILD 0
#define UNITY_USES_DYNAMIC_PLAYER_LIB 0
#define UNITY_USES_LOCATION 0
#define USE_IL2CPP_PCH 0
#define UNITY_SUPPORT_ROTATION PLATFORM_IOS
#if PLATFORM_TVOS
#define UNITY_TVOS_ORIENTATION landscapeLeft
#endif
#if PLATFORM_IOS // available in ios9 sdk which is min requirement
#define UNITY_REPLAY_KIT_AVAILABLE UNITY_USES_REPLAY_KIT
#elif PLATFORM_TVOS // available in tvos10 sdk which is min requirement
#define UNITY_REPLAY_KIT_AVAILABLE UNITY_USES_REPLAY_KIT && defined(__TVOS_10_0)
#else
#define UNITY_REPLAY_KIT_AVAILABLE 0
#endif
// On tvOS simulator we implement a fake remote as tvOS simulator does not support controllers (yet)
#define UNITY_TVOS_SIMULATOR_FAKE_REMOTE (PLATFORM_TVOS && TARGET_TVOS_SIMULATOR)

@ -0,0 +1,118 @@
#pragma once
struct Quaternion4f
{
float x, y, z, w;
};
static Quaternion4f gQuatRot[4] =
{ // { x*sin(theta/2), y*sin(theta/2), z*sin(theta/2), cos(theta/2) }
// => { 0, 0, sin(theta/2), cos(theta/2) } (since <vec> = { 0, 0, +/-1})
{ 0.f, 0.f, 0.f /*sin(0)*/, 1.f /*cos(0)*/}, // ROTATION_0, theta = 0 rad
{ 0.f, 0.f, (float)sqrt(2) * 0.5f /*sin(pi/4)*/, -(float)sqrt(2) * 0.5f /*cos(pi/4)*/}, // ROTATION_90, theta = pi/4 rad
{ 0.f, 0.f, 1.f /*sin(pi/2)*/, 0.f /*cos(pi/2)*/}, // ROTATION_180, theta = pi rad
{ 0.f, 0.f, -(float)sqrt(2) * 0.5f /*sin(3pi/4)*/, -(float)sqrt(2) * 0.5f /*cos(3pi/4)*/} // ROTATION_270, theta = 3pi/2 rad
};
inline void QuatMultiply(Quaternion4f& result, const Quaternion4f& lhs, const Quaternion4f& rhs)
{
result.x = lhs.w * rhs.x + lhs.x * rhs.w + lhs.y * rhs.z - lhs.z * rhs.y;
result.y = lhs.w * rhs.y + lhs.y * rhs.w + lhs.z * rhs.x - lhs.x * rhs.z;
result.z = lhs.w * rhs.z + lhs.z * rhs.w + lhs.x * rhs.y - lhs.y * rhs.x;
result.w = lhs.w * rhs.w - lhs.x * rhs.x - lhs.y * rhs.y - lhs.z * rhs.z;
}
inline Quaternion4f QuatMultiply(const Quaternion4f& lhs, const Quaternion4f& rhs)
{
Quaternion4f output;
QuatMultiply(output, lhs, rhs);
return output;
}
inline Quaternion4f QuatMake(float x, float y, float z, float w)
{
Quaternion4f q = {x, y, z, w};
return q;
}
inline Quaternion4f QuatIdentity()
{
return gQuatRot[0];
}
inline Quaternion4f QuatScale(const Quaternion4f& q, float s)
{
return QuatMake(s * q.x, s * q.y, s * q.z, s * q.w);
}
inline float QuatNormSquared(const Quaternion4f& q)
{
return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
}
inline Quaternion4f QuatConjugate(const Quaternion4f& q)
{
return QuatMake(-q.x, -q.y, -q.z, q.w);
}
inline Quaternion4f QuatInverse(const Quaternion4f& q)
{
return QuatScale(QuatConjugate(q), 1.0f / QuatNormSquared(q));
}
inline Vector3f QuatToEuler(const Quaternion4f& q)
{
return VecMake(
atan2f(2.0f * (q.w * q.y + q.x * q.z),
1.0f - 2.0f * (q.y * q.y + q.x * q.x)),
asinf(2.0f * (q.w * q.x - q.z * q.y)),
atan2f(2.0f * (q.w * q.z + q.y * q.x),
1.0f - 2.0f * (q.x * q.x + q.z * q.z)));
}
inline float QuatNorm(const Quaternion4f& q)
{
return sqrtf(QuatNormSquared(q));
}
inline Quaternion4f QuatNormalize(const Quaternion4f& q)
{
return QuatScale(q, 1.0f / QuatNorm(q));
}
inline Quaternion4f QuatDifference(const Quaternion4f& a, const Quaternion4f& b)
{
return QuatMultiply(QuatInverse(b), a);
}
inline Quaternion4f QuatRotationFromTo(const Vector3f& src, const Vector3f& dest)
{
// Based on Stan Melax's article in Game Programming Gems
float mag0 = VecMagnitude(src);
if (mag0 < FLT_EPSILON)
return QuatIdentity();
float mag1 = VecMagnitude(dest);
if (mag1 < FLT_EPSILON)
return QuatIdentity();
Vector3f v0 = VecScale(1.0f / mag0, src);
Vector3f v1 = VecScale(1.0f / mag1, dest);
float d = VecDotProduct(v0, v1);
// If dot == 1, vectors are the same
if (d >= (1.0f - 1e-6f))
return QuatIdentity();
if (d < (1e-6f - 1.0f))
return gQuatRot[2];
float s = sqrtf((1.0f + d) * 2.0f);
float i = 1.0f / s;
Vector3f c = VecCrossProduct(v0, v1);
return QuatNormalize(QuatMake(
c.x * i, c.y * i, c.z * i, s * 0.5f));
}

@ -0,0 +1,5 @@
#pragma once
void ShowActivityIndicator(UIView* parent, int style);
void ShowActivityIndicator(UIView* parent);
void HideActivityIndicator();

@ -0,0 +1,66 @@
#include "ActivityIndicator.h"
#include "OrientationSupport.h"
@interface ActivityIndicator : UIActivityIndicatorView
{
UIView* _parent;
}
@end
static ActivityIndicator* _activityIndicator = nil;
@implementation ActivityIndicator
- (void)show:(UIView*)parent
{
_parent = parent;
[parent addSubview: self];
[self startAnimating];
}
- (void)layoutSubviews
{
self.center = CGPointMake([_parent bounds].size.width / 2, [_parent bounds].size.height / 2);
}
@end
void ShowActivityIndicator(UIView* parent, int style)
{
if (_activityIndicator != nil)
return;
if (style >= 0)
{
_activityIndicator = [[ActivityIndicator alloc] initWithActivityIndicatorStyle: (UIActivityIndicatorViewStyle)style];
_activityIndicator.contentScaleFactor = [UIScreen mainScreen].scale;
}
if (_activityIndicator != nil)
[_activityIndicator show: parent];
}
void ShowActivityIndicator(UIView* parent)
{
ShowActivityIndicator(parent, UnityGetShowActivityIndicatorOnLoading());
}
void HideActivityIndicator()
{
if (_activityIndicator)
{
[_activityIndicator stopAnimating];
[_activityIndicator removeFromSuperview];
_activityIndicator = nil;
}
}
extern "C" void UnityStartActivityIndicator()
{
// AppleTV does not support activity indicators
ShowActivityIndicator(UnityGetGLView());
}
extern "C" void UnityStopActivityIndicator()
{
HideActivityIndicator();
}

@ -0,0 +1,58 @@
#pragma once
typedef struct
{
const char* text;
const char* placeholder;
UIKeyboardType keyboardType;
UITextAutocorrectionType autocorrectionType;
UIKeyboardAppearance appearance;
BOOL multiline;
BOOL secure;
int characterLimit;
}
KeyboardShowParam;
@interface KeyboardDelegate : NSObject<UITextFieldDelegate, UITextViewDelegate>
{
}
- (BOOL)textFieldShouldReturn:(UITextField*)textField;
- (void)textInputDone:(id)sender;
- (void)textInputCancel:(id)sender;
- (void)textInputLostFocus;
- (void)keyboardWillShow:(NSNotification*)notification;
- (void)keyboardDidShow:(NSNotification*)notification;
- (void)keyboardWillHide:(NSNotification*)notification;
// on older devices initial keyboard creation might be slow, so it is good to init in on initial loading.
// on the other hand, if you dont use keyboard (or use it rarely), you can avoid having all related stuff in memory:
// keyboard will be created on demand anyway (in Instance method)
+ (void)Initialize;
+ (KeyboardDelegate*)Instance;
- (id)init;
- (void)setKeyboardParams:(KeyboardShowParam)param;
- (void)show;
- (void)hide;
- (void)positionInput:(CGRect)keyboardRect x:(float)x y:(float)y;
- (void)shouldHideInput:(BOOL)hide;
+ (void)StartReorientation;
+ (void)FinishReorientation;
- (CGRect)queryArea;
- (NSString*)getText;
- (void)setText:(NSString*)newText;
@property (readonly, nonatomic, getter = queryArea) CGRect area;
@property (readonly, nonatomic) BOOL active;
@property (readonly, nonatomic) KeyboardStatus status;
@property (retain, nonatomic, getter = getText, setter = setText:) NSString* text;
@property (assign, nonatomic) int characterLimit;
@property (readonly, nonatomic) BOOL canGetSelection;
@property (nonatomic, getter = querySelection, setter = assignSelection:) NSRange selection;
@end

@ -0,0 +1,861 @@
#include "Keyboard.h"
#include "DisplayManager.h"
#include "UnityAppController.h"
#include "UnityForwardDecls.h"
#include <string>
#ifndef FILTER_EMOJIS_IOS_KEYBOARD
#define FILTER_EMOJIS_IOS_KEYBOARD 0
#endif
static KeyboardDelegate* _keyboard = nil;
static bool _shouldHideInput = false;
static bool _shouldHideInputChanged = false;
static const unsigned kToolBarHeight = 40;
static const unsigned kSystemButtonsSpace = 2 * 60 + 3 * 18; // empirical value, there is no way to know the exact widths of the system bar buttons
@implementation KeyboardDelegate
{
// UI handling
// in case of single line we use UITextField inside UIToolbar
// in case of multi-line input we use UITextView with UIToolbar as accessory view
// toolbar buttons are kept around to prevent releasing them
// tvOS does not support multiline input thus only UITextField option is implemented
#if PLATFORM_IOS
UITextView* textView;
UIToolbar* viewToolbar;
NSArray* viewToolbarItems;
NSLayoutConstraint* widthConstraint;
#endif
UITextField* textField;
// keep toolbar items for both single- and multi- line edit in NSArray to make sure they are kept around
#if PLATFORM_IOS
UIToolbar* fieldToolbar;
NSArray* fieldToolbarItems;
#endif
// inputView is view used for actual input (it will be responder): UITextField [single-line] or UITextView [multi-line]
// editView is the "root" view for keyboard: UIToolbar [single-line] or UITextView [multi-line]
UIView* inputView;
UIView* editView;
KeyboardShowParam cachedKeyboardParam;
CGRect _area;
NSString* initialText;
UIKeyboardType keyboardType;
BOOL _multiline;
BOOL _inputHidden;
BOOL _active;
KeyboardStatus _status;
int _characterLimit;
// not pretty but seems like easiest way to keep "we are rotating" status
BOOL _rotating;
}
@synthesize area;
@synthesize active = _active;
@synthesize status = _status;
@synthesize text;
@synthesize selection;
- (BOOL)textFieldShouldReturn:(UITextField*)textFieldObj
{
[self textInputDone: nil];
return YES;
}
- (void)textInputDone:(id)sender
{
if (_status == Visible)
_status = Done;
[self hide];
}
- (void)textInputCancel:(id)sender
{
_status = Canceled;
[self hide];
}
- (void)textInputLostFocus
{
if (_status == Visible)
_status = LostFocus;
[self hide];
}
- (BOOL)textViewShouldBeginEditing:(UITextView*)view
{
#if !PLATFORM_TVOS
view.inputAccessoryView = viewToolbar;
#endif
return YES;
}
#if PLATFORM_IOS
- (void)keyboardWillShow:(NSNotification *)notification
{
if (notification.userInfo == nil || inputView == nil)
return;
CGRect srcRect = [[notification.userInfo objectForKey: UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect rect = [UnityGetGLView() convertRect: srcRect fromView: nil];
rect.origin.y = [UnityGetGLView() frame].size.height - rect.size.height; // iPhone X sometimes reports wrong y value for keyboard
[self positionInput: rect x: rect.origin.x y: rect.origin.y];
}
- (void)keyboardDidShow:(NSNotification*)notification
{
_active = YES;
}
- (void)keyboardWillHide:(NSNotification*)notification
{
[self systemHideKeyboard];
}
- (void)keyboardDidChangeFrame:(NSNotification*)notification
{
_active = true;
CGRect srcRect = [[notification.userInfo objectForKey: UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect rect = [UnityGetGLView() convertRect: srcRect fromView: nil];
if (rect.origin.y >= [UnityGetGLView() bounds].size.height)
[self systemHideKeyboard];
else
{
rect.origin.y = [UnityGetGLView() frame].size.height - rect.size.height; // iPhone X sometimes reports wrong y value for keyboard
[self positionInput: rect x: rect.origin.x y: rect.origin.y];
}
}
#endif
+ (void)Initialize
{
NSAssert(_keyboard == nil, @"[KeyboardDelegate Initialize] called after creating keyboard");
if (!_keyboard)
_keyboard = [[KeyboardDelegate alloc] init];
}
+ (KeyboardDelegate*)Instance
{
if (!_keyboard)
_keyboard = [[KeyboardDelegate alloc] init];
return _keyboard;
}
#if PLATFORM_IOS
struct CreateToolbarResult
{
UIToolbar* toolbar;
NSArray* items;
};
- (CreateToolbarResult)createToolbarWithView:(UIView*)view
{
UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame: CGRectMake(0, 840, 320, kToolBarHeight)];
UnitySetViewTouchProcessing(toolbar, touchesIgnored);
toolbar.hidden = NO;
UIBarButtonItem* inputItem = view ? [[UIBarButtonItem alloc] initWithCustomView: view] : nil;
UIBarButtonItem* doneItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target: self action: @selector(textInputDone:)];
UIBarButtonItem* cancelItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemCancel target: self action: @selector(textInputCancel:)];
NSArray* items = view ? @[inputItem, doneItem, cancelItem] : @[doneItem, cancelItem];
toolbar.items = items;
inputItem = nil;
doneItem = nil;
cancelItem = nil;
CreateToolbarResult ret = {toolbar, items};
return ret;
}
#endif
- (id)init
{
NSAssert(_keyboard == nil, @"You can have only one instance of KeyboardDelegate");
self = [super init];
if (self)
{
#if PLATFORM_IOS
textView = [[UITextView alloc] initWithFrame: CGRectMake(0, 840, 480, 30)];
textView.delegate = self;
textView.font = [UIFont systemFontOfSize: 18.0];
textView.hidden = YES;
#endif
textField = [[UITextField alloc] initWithFrame: CGRectMake(0, 0, 120, 30)];
textField.delegate = self;
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.font = [UIFont systemFontOfSize: 20.0];
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
#if PLATFORM_IOS
widthConstraint = [NSLayoutConstraint constraintWithItem: textField attribute: NSLayoutAttributeWidth relatedBy: NSLayoutRelationEqual toItem: nil attribute: NSLayoutAttributeNotAnAttribute multiplier: 1.0 constant: textField.frame.size.width];
[textField addConstraint: widthConstraint];
#endif
#define CREATE_TOOLBAR(t, i, v) \
do { \
CreateToolbarResult res = [self createToolbarWithView:v]; \
t = res.toolbar; \
i = res.items; \
} while(0)
#if PLATFORM_IOS
CREATE_TOOLBAR(viewToolbar, viewToolbarItems, nil);
CREATE_TOOLBAR(fieldToolbar, fieldToolbarItems, textField);
#endif
#undef CREATE_TOOLBAR
#if PLATFORM_IOS
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardWillShow:) name: UIKeyboardWillShowNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardDidShow:) name: UIKeyboardDidShowNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardWillHide:) name: UIKeyboardWillHideNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyboardDidChangeFrame:) name: UIKeyboardDidChangeFrameNotification object: nil];
#endif
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(textInputDone:) name: UITextFieldTextDidEndEditingNotification object: nil];
}
return self;
}
- (void)setTextInputTraits:(id<UITextInputTraits>)traits
withParam:(KeyboardShowParam)param
withCap:(UITextAutocapitalizationType)capitalization
{
traits.keyboardType = param.keyboardType;
traits.autocorrectionType = param.autocorrectionType;
traits.secureTextEntry = param.secure;
traits.keyboardAppearance = param.appearance;
traits.autocapitalizationType = capitalization;
}
- (void)setKeyboardParams:(KeyboardShowParam)param
{
if (!editView.hidden)
{
[NSObject cancelPreviousPerformRequestsWithTarget: self];
if (cachedKeyboardParam.multiline != param.multiline ||
cachedKeyboardParam.secure != param.secure ||
cachedKeyboardParam.keyboardType != param.keyboardType ||
cachedKeyboardParam.autocorrectionType != param.autocorrectionType ||
cachedKeyboardParam.appearance != param.appearance)
{
[self hideUIDelayed];
}
}
cachedKeyboardParam = param;
if (_active)
[self hide];
initialText = param.text ? [[NSString alloc] initWithUTF8String: param.text] : @"";
_characterLimit = param.characterLimit;
UITextAutocapitalizationType capitalization = UITextAutocapitalizationTypeSentences;
if (param.keyboardType == UIKeyboardTypeURL || param.keyboardType == UIKeyboardTypeEmailAddress || param.keyboardType == UIKeyboardTypeWebSearch)
capitalization = UITextAutocapitalizationTypeNone;
#if PLATFORM_IOS
_multiline = param.multiline;
if (_multiline)
{
textView.text = initialText;
[self setTextInputTraits: textView withParam: param withCap: capitalization];
UITextPosition* end = [textView endOfDocument];
UITextRange* endTextRange = [textView textRangeFromPosition: end toPosition: end];
[textView setSelectedTextRange: endTextRange];
}
else
{
textField.text = initialText;
[self setTextInputTraits: textField withParam: param withCap: capitalization];
textField.placeholder = [NSString stringWithUTF8String: param.placeholder];
UITextPosition* end = [textField endOfDocument];
UITextRange* endTextRange = [textField textRangeFromPosition: end toPosition: end];
[textField setSelectedTextRange: endTextRange];
}
inputView = _multiline ? textView : textField;
editView = _multiline ? textView : fieldToolbar;
#else // PLATFORM_TVOS
textField.text = initialText;
[self setTextInputTraits: textField withParam: param withCap: capitalization];
textField.placeholder = [NSString stringWithUTF8String: param.placeholder];
inputView = textField;
editView = textField;
UITextPosition* end = [textField endOfDocument];
UITextRange* endTextRange = [textField textRangeFromPosition: end toPosition: end];
[textField setSelectedTextRange: endTextRange];
#endif
[self shouldHideInput: _shouldHideInput];
_status = Visible;
_active = YES;
}
// we need to show/hide keyboard to react to orientation too, so extract we extract UI fiddling
- (void)showUI
{
// if we unhide everything now the input will be shown smaller then needed quickly (and resized later)
// so unhide only when keyboard is actually shown (we will update it when reacting to ios notifications)
[NSObject cancelPreviousPerformRequestsWithTarget: self];
if (!inputView.isFirstResponder)
{
editView.hidden = YES;
[UnityGetGLView() addSubview: editView];
[inputView becomeFirstResponder];
}
}
- (void)hideUI
{
[NSObject cancelPreviousPerformRequestsWithTarget: self];
[self performSelector: @selector(hideUIDelayed) withObject: nil afterDelay: 0.05]; // to avoid unnecessary hiding
}
- (void)hideUIDelayed
{
[inputView resignFirstResponder];
[editView removeFromSuperview];
editView.hidden = YES;
}
- (void)systemHideKeyboard
{
// when we are rotating os will bombard us with keyboardWillHide: and keyboardDidChangeFrame:
// ignore all of them (we do it here only to simplify code: we call systemHideKeyboard only from these notification handlers)
if (_rotating)
return;
_active = editView.isFirstResponder;
editView.hidden = YES;
_area = CGRectMake(0, 0, 0, 0);
}
- (void)show
{
[self showUI];
}
- (void)hide
{
[self hideUI];
}
- (void)updateInputHidden
{
if (_shouldHideInputChanged)
{
[self shouldHideInput: _shouldHideInput];
_shouldHideInputChanged = false;
}
textField.returnKeyType = _inputHidden ? UIReturnKeyDone : UIReturnKeyDefault;
editView.hidden = _inputHidden ? YES : NO;
inputView.hidden = _inputHidden ? YES : NO;
}
#if PLATFORM_IOS
- (void)positionInput:(CGRect)kbRect x:(float)x y:(float)y
{
float safeAreaInsetLeft = 0;
float safeAreaInsetRight = 0;
#if UNITY_HAS_IOSSDK_11_0
if (@available(iOS 11.0, *))
{
safeAreaInsetLeft = [UnityGetGLView() safeAreaInsets].left;
safeAreaInsetRight = [UnityGetGLView() safeAreaInsets].right;
}
#endif
if (_multiline)
{
// use smaller area for iphones and bigger one for ipads
int height = UnityDeviceDPI() > 300 ? 75 : 100;
editView.frame = CGRectMake(safeAreaInsetLeft, y - height, kbRect.size.width - safeAreaInsetLeft - safeAreaInsetRight, height);
}
else
{
editView.frame = CGRectMake(0, y - kToolBarHeight, kbRect.size.width, kToolBarHeight);
// old constraint must be removed, changing value while constraint is active causes conflict when changing inputView.frame
[inputView removeConstraint: widthConstraint];
inputView.frame = CGRectMake(inputView.frame.origin.x,
inputView.frame.origin.y,
kbRect.size.width - safeAreaInsetLeft - safeAreaInsetRight - kSystemButtonsSpace,
inputView.frame.size.height);
// required to avoid auto-resizing on iOS 11 in case if input text is too long
widthConstraint.constant = inputView.frame.size.width;
[inputView addConstraint: widthConstraint];
}
_area = CGRectMake(x, y, kbRect.size.width, kbRect.size.height);
[self updateInputHidden];
}
#endif
- (CGRect)queryArea
{
return editView.hidden ? _area : CGRectUnion(_area, editView.frame);
}
- (NSRange)querySelection
{
UIView<UITextInput>* textInput;
#if PLATFORM_TVOS
textInput = textField;
#else
textInput = _multiline ? textView : textField;
#endif
UITextPosition* beginning = textInput.beginningOfDocument;
UITextRange* selectedRange = textInput.selectedTextRange;
UITextPosition* selectionStart = selectedRange.start;
UITextPosition* selectionEnd = selectedRange.end;
const NSInteger location = [textInput offsetFromPosition: beginning toPosition: selectionStart];
const NSInteger length = [textInput offsetFromPosition: selectionStart toPosition: selectionEnd];
return NSMakeRange(location, length);
}
- (void)assignSelection:(NSRange)range
{
UIView<UITextInput>* textInput;
#if PLATFORM_TVOS
textInput = textField;
#else
textInput = _multiline ? textView : textField;
#endif
UITextPosition* begin = [textInput beginningOfDocument];
UITextPosition* caret = [textInput positionFromPosition: begin offset: range.location];
UITextPosition* select = [textInput positionFromPosition: caret offset: range.length];
UITextRange* textRange = [textInput textRangeFromPosition: caret toPosition: select];
[textInput setSelectedTextRange: textRange];
}
+ (void)StartReorientation
{
if (_keyboard && _keyboard.active)
_keyboard->_rotating = YES;
}
+ (void)FinishReorientation
{
if (_keyboard)
_keyboard->_rotating = NO;
}
- (NSString*)getText
{
if (_status == Canceled)
return initialText;
else
{
#if PLATFORM_TVOS
return [textField text];
#else
return _multiline ? [textView text] : [textField text];
#endif
}
}
- (void)setText:(NSString*)newText
{
#if PLATFORM_IOS
if (_multiline)
textView.text = newText;
else
textField.text = newText;
#else
textField.text = newText;
#endif
}
- (void)shouldHideInput:(BOOL)hide
{
if (hide)
{
switch (keyboardType)
{
case UIKeyboardTypeDefault: hide = YES; break;
case UIKeyboardTypeASCIICapable: hide = YES; break;
case UIKeyboardTypeNumbersAndPunctuation: hide = YES; break;
case UIKeyboardTypeURL: hide = YES; break;
case UIKeyboardTypeNumberPad: hide = NO; break;
case UIKeyboardTypePhonePad: hide = NO; break;
case UIKeyboardTypeNamePhonePad: hide = NO; break;
case UIKeyboardTypeEmailAddress: hide = YES; break;
case UIKeyboardTypeTwitter: hide = YES; break;
case UIKeyboardTypeWebSearch: hide = YES; break;
default: hide = NO; break;
}
}
_inputHidden = hide;
}
#if FILTER_EMOJIS_IOS_KEYBOARD
static bool StringContainsEmoji(NSString *string);
- (BOOL)textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string_
{
if (range.length + range.location > textField.text.length)
return NO;
return [self currentText: textField.text shouldChangeInRange: range replacementText: string_] && !StringContainsEmoji(string_);
}
- (BOOL)textView:(UITextView*)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)text_
{
if (range.length + range.location > textView.text.length)
return NO;
return [self currentText: textView.text shouldChangeInRange: range replacementText: text_] && !StringContainsEmoji(text_);
}
#else
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string_
{
if (range.length + range.location > textField.text.length)
return NO;
return [self currentText: textField.text shouldChangeInRange: range replacementText: string_];
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)text_
{
if (range.length + range.location > textView.text.length)
return NO;
return [self currentText: textView.text shouldChangeInRange: range replacementText: text_];
}
#endif // FILTER_EMOJIS_IOS_KEYBOARD
- (BOOL)currentText:(NSString*)currentText shouldChangeInRange:(NSRange)range replacementText:(NSString*)text_
{
NSUInteger newLength = currentText.length + (text_.length - range.length);
if (newLength > _characterLimit && _characterLimit != 0 && newLength >= currentText.length)
{
NSString* newReplacementText = @"";
if ((currentText.length - range.length) < _characterLimit)
newReplacementText = [text_ substringWithRange: NSMakeRange(0, _characterLimit - (currentText.length - range.length))];
NSString* newText = [currentText stringByReplacingCharactersInRange: range withString: newReplacementText];
#if PLATFORM_IOS
if (_multiline)
[textView setText: newText];
else
[textField setText: newText];
#else
[textField setText: newText];
#endif
return NO;
}
else
{
return YES;
}
}
@end
//==============================================================================
//
// Unity Interface:
extern "C" void UnityKeyboard_Create(unsigned keyboardType, int autocorrection, int multiline, int secure, int alert, const char* text, const char* placeholder, int characterLimit)
{
#if PLATFORM_TVOS
// Not supported. The API for showing keyboard for editing multi-line text
// is not available on tvOS
multiline = false;
#endif
static const UIKeyboardType keyboardTypes[] =
{
UIKeyboardTypeDefault,
UIKeyboardTypeASCIICapable,
UIKeyboardTypeNumbersAndPunctuation,
UIKeyboardTypeURL,
UIKeyboardTypeNumberPad,
UIKeyboardTypePhonePad,
UIKeyboardTypeNamePhonePad,
UIKeyboardTypeEmailAddress,
UIKeyboardTypeDefault, // Default is used in case Wii U specific NintendoNetworkAccount type is selected (indexed at 8 in UnityEngine.TouchScreenKeyboardType)
UIKeyboardTypeTwitter,
UIKeyboardTypeWebSearch
};
static const UITextAutocorrectionType autocorrectionTypes[] =
{
UITextAutocorrectionTypeNo,
UITextAutocorrectionTypeDefault,
};
static const UIKeyboardAppearance keyboardAppearances[] =
{
UIKeyboardAppearanceDefault,
UIKeyboardAppearanceAlert,
};
KeyboardShowParam param =
{
text, placeholder,
keyboardTypes[keyboardType],
autocorrectionTypes[autocorrection],
keyboardAppearances[alert],
(BOOL)multiline, (BOOL)secure,
characterLimit
};
[[KeyboardDelegate Instance] setKeyboardParams: param];
}
extern "C" void UnityKeyboard_Show()
{
// do not send hide if didnt create keyboard
// TODO: probably assert?
if (!_keyboard)
return;
[[KeyboardDelegate Instance] show];
}
extern "C" void UnityKeyboard_Hide()
{
// do not send hide if didnt create keyboard
// TODO: probably assert?
if (!_keyboard)
return;
[[KeyboardDelegate Instance] textInputLostFocus];
}
extern "C" void UnityKeyboard_SetText(const char* text)
{
[KeyboardDelegate Instance].text = [NSString stringWithUTF8String: text];
}
extern "C" NSString* UnityKeyboard_GetText()
{
return [KeyboardDelegate Instance].text;
}
extern "C" int UnityKeyboard_IsActive()
{
return (_keyboard && _keyboard.active) ? 1 : 0;
}
extern "C" int UnityKeyboard_Status()
{
return _keyboard ? _keyboard.status : Canceled;
}
extern "C" void UnityKeyboard_SetInputHidden(int hidden)
{
_shouldHideInput = hidden;
_shouldHideInputChanged = true;
// update hidden status only if keyboard is on screen to avoid showing input view out of nowhere
if (_keyboard && _keyboard.active)
[_keyboard updateInputHidden];
}
extern "C" int UnityKeyboard_IsInputHidden()
{
return _shouldHideInput ? 1 : 0;
}
extern "C" void UnityKeyboard_GetRect(float* x, float* y, float* w, float* h)
{
CGRect area = _keyboard ? _keyboard.area : CGRectMake(0, 0, 0, 0);
// convert to unity coord system
float multX = (float)GetMainDisplaySurface()->targetW / UnityGetGLView().bounds.size.width;
float multY = (float)GetMainDisplaySurface()->targetH / UnityGetGLView().bounds.size.height;
*x = 0;
*y = area.origin.y * multY;
*w = area.size.width * multX;
*h = area.size.height * multY;
}
extern "C" void UnityKeyboard_SetCharacterLimit(unsigned characterLimit)
{
[KeyboardDelegate Instance].characterLimit = characterLimit;
}
extern "C" int UnityKeyboard_CanGetSelection()
{
return (_keyboard) ? 1 : 0;
}
extern "C" void UnityKeyboard_GetSelection(int* location, int* length)
{
if (_keyboard)
{
NSRange selection = _keyboard.selection;
*location = (int)selection.location;
*length = (int)selection.length;
}
else
{
*location = 0;
*length = 0;
}
}
extern "C" int UnityKeyboard_CanSetSelection()
{
return (_keyboard) ? 1 : 0;
}
extern "C" void UnityKeyboard_SetSelection(int location, int length)
{
if (_keyboard)
{
NSRange range = NSMakeRange(location, length);
_keyboard.selection = range;
}
}
//==============================================================================
//
// Emoji Filtering: unicode magic
#if FILTER_EMOJIS_IOS_KEYBOARD
static bool StringContainsEmoji(NSString *string)
{
__block BOOL returnValue = NO;
[string enumerateSubstringsInRange: NSMakeRange(0, string.length)
options: NSStringEnumerationByComposedCharacterSequences
usingBlock:^(NSString* substring, NSRange substringRange, NSRange enclosingRange, BOOL* stop)
{
const unichar hs = [substring characterAtIndex: 0];
const unichar ls = substring.length > 1 ? [substring characterAtIndex: 1] : 0;
#define IS_IN(val, min, max) (((val) >= (min)) && ((val) <= (max)))
if (IS_IN(hs, 0xD800, 0xDBFF))
{
if (substring.length > 1)
{
const int uc = ((hs - 0xD800) * 0x400) + (ls - 0xDC00) + 0x10000;
// Musical: [U+1D000, U+1D24F]
// Enclosed Alphanumeric Supplement: [U+1F100, U+1F1FF]
// Enclosed Ideographic Supplement: [U+1F200, U+1F2FF]
// Miscellaneous Symbols and Pictographs: [U+1F300, U+1F5FF]
// Supplemental Symbols and Pictographs: [U+1F900, U+1F9FF]
// Emoticons: [U+1F600, U+1F64F]
// Transport and Map Symbols: [U+1F680, U+1F6FF]
if (IS_IN(uc, 0x1D000, 0x1F9FF))
returnValue = YES;
}
}
else if (substring.length > 1 && ls == 0x20E3)
{
// emojis for numbers: number + modifier ls = U+20E3
returnValue = YES;
}
else
{
if ( // Latin-1 Supplement
hs == 0x00A9 || hs == 0x00AE
// General Punctuation
|| hs == 0x203C || hs == 0x2049
// Letterlike Symbols
|| hs == 0x2122 || hs == 0x2139
// Arrows
|| IS_IN(hs, 0x2194, 0x2199) || IS_IN(hs, 0x21A9, 0x21AA)
// Miscellaneous Technical
|| IS_IN(hs, 0x231A, 0x231B) || IS_IN(hs, 0x23E9, 0x23F3) || IS_IN(hs, 0x23F8, 0x23FA) || hs == 0x2328 || hs == 0x23CF
// Geometric Shapes
|| IS_IN(hs, 0x25AA, 0x25AB) || IS_IN(hs, 0x25FB, 0x25FE) || hs == 0x25B6 || hs == 0x25C0
// Miscellaneous Symbols
|| IS_IN(hs, 0x2600, 0x2604) || IS_IN(hs, 0x2614, 0x2615) || IS_IN(hs, 0x2622, 0x2623) || IS_IN(hs, 0x262E, 0x262F)
|| IS_IN(hs, 0x2638, 0x263A) || IS_IN(hs, 0x2648, 0x2653) || IS_IN(hs, 0x2665, 0x2666) || IS_IN(hs, 0x2692, 0x2694)
|| IS_IN(hs, 0x2696, 0x2697) || IS_IN(hs, 0x269B, 0x269C) || IS_IN(hs, 0x26A0, 0x26A1) || IS_IN(hs, 0x26AA, 0x26AB)
|| IS_IN(hs, 0x26B0, 0x26B1) || IS_IN(hs, 0x26BD, 0x26BE) || IS_IN(hs, 0x26C4, 0x26C5) || IS_IN(hs, 0x26CE, 0x26CF)
|| IS_IN(hs, 0x26D3, 0x26D4) || IS_IN(hs, 0x26D3, 0x26D4) || IS_IN(hs, 0x26E9, 0x26EA) || IS_IN(hs, 0x26F0, 0x26F5)
|| IS_IN(hs, 0x26F7, 0x26FA)
|| hs == 0x260E || hs == 0x2611 || hs == 0x2618 || hs == 0x261D || hs == 0x2620 || hs == 0x2626 || hs == 0x262A
|| hs == 0x2660 || hs == 0x2663 || hs == 0x2668 || hs == 0x267B || hs == 0x267F || hs == 0x2699 || hs == 0x26C8
|| hs == 0x26D1 || hs == 0x26FD
// Dingbats
|| IS_IN(hs, 0x2708, 0x270D) || IS_IN(hs, 0x2733, 0x2734) || IS_IN(hs, 0x2753, 0x2755)
|| IS_IN(hs, 0x2763, 0x2764) || IS_IN(hs, 0x2795, 0x2797)
|| hs == 0x2702 || hs == 0x2705 || hs == 0x270F || hs == 0x2712 || hs == 0x2714 || hs == 0x2716 || hs == 0x271D
|| hs == 0x2721 || hs == 0x2728 || hs == 0x2744 || hs == 0x2747 || hs == 0x274C || hs == 0x274E || hs == 0x2757
|| hs == 0x27A1 || hs == 0x27B0 || hs == 0x27BF
// CJK Symbols and Punctuation
|| hs == 0x3030 || hs == 0x303D
// Enclosed CJK Letters and Months
|| hs == 0x3297 || hs == 0x3299
// Supplemental Arrows-B
|| IS_IN(hs, 0x2934, 0x2935)
// Miscellaneous Symbols and Arrows
|| IS_IN(hs, 0x2B05, 0x2B07) || IS_IN(hs, 0x2B1B, 0x2B1C) || hs == 0x2B50 || hs == 0x2B55
)
{
returnValue = YES;
}
}
#undef IS_IN
}];
return returnValue;
}
#endif // FILTER_EMOJIS_IOS_KEYBOARD

@ -0,0 +1,20 @@
#pragma once
#include <CoreGraphics/CGAffineTransform.h>
#if !PLATFORM_TVOS
ScreenOrientation ConvertToUnityScreenOrientation(UIInterfaceOrientation hwOrient);
UIInterfaceOrientation ConvertToIosScreenOrientation(ScreenOrientation orient);
#endif
#if !PLATFORM_TVOS
UIInterfaceOrientation UIViewControllerInterfaceOrientation(UIViewController* controller);
#endif
ScreenOrientation UIViewControllerOrientation(UIViewController* controller);
CGAffineTransform TransformForOrientation(ScreenOrientation curOrient);
CGAffineTransform TransformBetweenOrientations(ScreenOrientation fromOrient, ScreenOrientation toOrient);
ScreenOrientation OrientationAfterTransform(ScreenOrientation curOrient, CGAffineTransform transform);
void OrientView(UIViewController* host, UIView* view, ScreenOrientation to);

@ -0,0 +1,159 @@
#include "OrientationSupport.h"
#include <math.h>
CGAffineTransform TransformForOrientation(ScreenOrientation orient)
{
switch (orient)
{
case portrait: return CGAffineTransformIdentity;
case portraitUpsideDown: return CGAffineTransformMakeRotation(M_PI);
case landscapeLeft: return CGAffineTransformMakeRotation(M_PI_2);
case landscapeRight: return CGAffineTransformMakeRotation(-M_PI_2);
default: return CGAffineTransformIdentity;
}
return CGAffineTransformIdentity;
}
CGAffineTransform TransformBetweenOrientations(ScreenOrientation fromOrient, ScreenOrientation toOrient)
{
CGAffineTransform fromTransform = TransformForOrientation(fromOrient);
CGAffineTransform toTransform = TransformForOrientation(toOrient);
return CGAffineTransformConcat(CGAffineTransformInvert(fromTransform), toTransform);
}
#if !PLATFORM_TVOS
UIInterfaceOrientation ConvertToIosScreenOrientation(ScreenOrientation orient)
{
switch (orient)
{
case portrait: return UIInterfaceOrientationPortrait;
case portraitUpsideDown: return UIInterfaceOrientationPortraitUpsideDown;
// landscape left/right have switched values in device/screen orientation
// though unity docs are adjusted with device orientation values, so swap here
case landscapeLeft: return UIInterfaceOrientationLandscapeRight;
case landscapeRight: return UIInterfaceOrientationLandscapeLeft;
case orientationUnknown: return (UIInterfaceOrientation)UIInterfaceOrientationUnknown;
default: return UIInterfaceOrientationPortrait;
}
return UIInterfaceOrientationPortrait;
}
ScreenOrientation ConvertToUnityScreenOrientation(UIInterfaceOrientation orient)
{
switch (orient)
{
case UIInterfaceOrientationPortrait: return portrait;
case UIInterfaceOrientationPortraitUpsideDown: return portraitUpsideDown;
// landscape left/right have switched values in device/screen orientation
// though unity docs are adjusted with device orientation values, so swap here
case UIInterfaceOrientationLandscapeLeft: return landscapeRight;
case UIInterfaceOrientationLandscapeRight: return landscapeLeft;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch"
case UIInterfaceOrientationUnknown: return orientationUnknown;
#pragma clang diagnostic pop
default: return portrait;
}
}
// Replacement for UIViewController.interfaceOrientation which is obsolete since iOS 8.0
UIInterfaceOrientation UIViewControllerInterfaceOrientation(UIViewController* c)
{
CGPoint fixedPoint = [c.view.window.screen.coordinateSpace convertPoint: CGPointMake(0.0, 0.0) toCoordinateSpace: c.view.window.screen.fixedCoordinateSpace];
if (fabs(fixedPoint.x) < FLT_EPSILON)
{
if (fabs(fixedPoint.y) < FLT_EPSILON)
return UIInterfaceOrientationPortrait;
else
return UIInterfaceOrientationLandscapeLeft;
}
else
{
if (fabs(fixedPoint.y) < FLT_EPSILON)
return UIInterfaceOrientationLandscapeRight;
else
return UIInterfaceOrientationPortraitUpsideDown;
}
}
#endif
ScreenOrientation UIViewControllerOrientation(UIViewController* controller)
{
#if PLATFORM_TVOS
return UNITY_TVOS_ORIENTATION;
#else
return ConvertToUnityScreenOrientation(UIViewControllerInterfaceOrientation(controller));
#endif
}
ScreenOrientation OrientationAfterTransform(ScreenOrientation curOrient, CGAffineTransform transform)
{
int rotDeg = (int)::roundf(::atan2f(transform.b, transform.a) * (180 / M_PI));
assert(rotDeg == 0 || rotDeg == 90 || rotDeg == -90 || rotDeg == 180 || rotDeg == -180);
if (rotDeg == 0)
{
return curOrient;
}
else if ((rotDeg == 180) || (rotDeg == -180))
{
if (curOrient == portrait)
return portraitUpsideDown;
else if (curOrient == portraitUpsideDown)
return portrait;
else if (curOrient == landscapeRight)
return landscapeLeft;
else if (curOrient == landscapeLeft)
return landscapeRight;
}
else if (rotDeg == 90)
{
if (curOrient == portrait)
return landscapeLeft;
else if (curOrient == portraitUpsideDown)
return landscapeRight;
else if (curOrient == landscapeRight)
return portrait;
else if (curOrient == landscapeLeft)
return portraitUpsideDown;
}
else if (rotDeg == -90)
{
if (curOrient == portrait)
return landscapeRight;
else if (curOrient == portraitUpsideDown)
return landscapeLeft;
else if (curOrient == landscapeRight)
return portraitUpsideDown;
else if (curOrient == landscapeLeft)
return portrait;
}
::printf("rotation unhandled: %d\n", rotDeg);
return curOrient;
}
void OrientView(UIViewController* host, UIView* view, ScreenOrientation to)
{
ScreenOrientation fromController = UIViewControllerOrientation(host);
CGAffineTransform transform = TransformBetweenOrientations(fromController, to);
// this is for unity-inited orientation. In that case we need to manually adjust bounds if changing portrait/landscape
// the easiest way would be to manually rotate current bounds (to acknowledge the fact that we do NOT rotate controller itself)
// NB: as we use current view bounds we need to use view transform to properly adjust them
CGRect rect = view.bounds;
CGSize ext = CGSizeApplyAffineTransform(rect.size, CGAffineTransformConcat(CGAffineTransformInvert(view.transform), transform));
view.transform = transform;
view.bounds = CGRectMake(0, 0, ::fabs(ext.width), ::fabs(ext.height));
}

@ -0,0 +1,20 @@
#pragma once
#include "UnityViewControllerBase.h"
@interface SplashScreen : UIImageView
{
}
+ (SplashScreen*)Instance;
@end
@interface SplashScreenController : UnityViewControllerBase
{
}
+ (SplashScreenController*)Instance;
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator;
@end
void ShowSplashScreen(UIWindow* window);
void HideSplashScreen();

@ -0,0 +1,420 @@
#define UnityGetLaunchScreenXib MyUnityGetLaunchScreenXib
static const char *MyUnityGetLaunchScreenXib() { return NULL; }
#include "SplashScreen.h"
#include "UnityViewControllerBase.h"
#include "OrientationSupport.h"
#include "Unity/ObjCRuntime.h"
#include "UI/UnityView.h"
#include <cstring>
#include "Classes/Unity/UnitySharedDecls.h"
extern "C" const char* UnityGetLaunchScreenXib();
#include <utility>
static SplashScreen* _splash = nil;
static SplashScreenController* _controller = nil;
static bool _isOrientable = false; // true for iPads and iPhone 6+
static bool _usesLaunchscreen = false;
static ScreenOrientation _nonOrientableDefaultOrientation = portrait;
#if !PLATFORM_TVOS
typedef id (*WillRotateToInterfaceOrientationSendFunc)(struct objc_super*, SEL, UIInterfaceOrientation, NSTimeInterval);
typedef id (*DidRotateFromInterfaceOrientationSendFunc)(struct objc_super*, SEL, UIInterfaceOrientation);
#endif
typedef id (*ViewWillTransitionToSizeSendFunc)(struct objc_super*, SEL, CGSize, id<UIViewControllerTransitionCoordinator>);
static const char* GetScaleSuffix(float scale, float maxScale)
{
if (scale > maxScale)
scale = maxScale;
if (scale <= 1.0)
return "";
if (scale <= 2.0)
return "@2x";
return "@3x";
}
static const char* GetOrientationSuffix(const OrientationMask& supportedOrientations, ScreenOrientation orient)
{
bool orientPortrait = (orient == portrait || orient == portraitUpsideDown);
bool orientLandscape = (orient == landscapeLeft || orient == landscapeRight);
bool supportsPortrait = supportedOrientations.portrait || supportedOrientations.portraitUpsideDown;
bool supportsLandscape = supportedOrientations.landscapeLeft || supportedOrientations.landscapeRight;
if (orientPortrait && supportsPortrait)
return "-Portrait";
else if (orientLandscape && supportsLandscape)
return "-Landscape";
else if (supportsPortrait)
return "-Portrait";
else
return "-Landscape";
}
// Returns a launch image name for launch images stored on file system or asset catalog
extern "C" NSArray<NSString*>* GetLaunchImageNames(UIUserInterfaceIdiom idiom, const OrientationMask&supportedOrientations,
const CGSize&screenSize, ScreenOrientation orient, float scale)
{
NSMutableArray<NSString*>* ret = [[NSMutableArray<NSString *> alloc] init];
if (idiom == UIUserInterfaceIdiomPad)
{
// iPads
const char* iOSSuffix = "-700";
const char* orientSuffix = GetOrientationSuffix(supportedOrientations, orient);
const char* scaleSuffix = GetScaleSuffix(scale, 2.0);
[ret addObject: [NSString stringWithFormat: @"LaunchImage%s%s%s~ipad",
iOSSuffix, orientSuffix, scaleSuffix]];
}
else
{
// iPhones
// Note that on pre-iOS 11 using modifiers such as LaunchImage~568h works. Since
// iOS launch image support is quite hard to get right and has _many_ gotchas, we
// just use the old code path on these devices.
if (screenSize.height == 568 || screenSize.width == 568) // iPhone 5
{
[ret addObject: @"LaunchImage-700-568h@2x"];
[ret addObject: @"LaunchImage~568h"];
}
else if (screenSize.height == 667 || screenSize.width == 667) // iPhone 6
{
// note that scale may be 3.0 if display zoom is enabled
if (scale < 2.0) // not expected, but handle just in case. Image name is valid
[ret addObject: @"LaunchImage-800-667h"];
[ret addObject: @"LaunchImage-800-667h@2x"];
[ret addObject: @"LaunchImage~667h"];
}
else if (screenSize.height == 736 || screenSize.width == 736) // iPhone 6+
{
const char* orientSuffix = GetOrientationSuffix(supportedOrientations, orient);
if (scale < 3.0) // not expected, but handle just in case. Image name is valid
[ret addObject: [NSString stringWithFormat: @"LaunchImage-800%s-736h", orientSuffix]];
[ret addObject: [NSString stringWithFormat: @"LaunchImage-800%s-736h@3x", orientSuffix]];
[ret addObject: @"LaunchImage~736h"];
}
else if (screenSize.height == 812 || screenSize.width == 812) // iPhone X
{
const char* orientSuffix = GetOrientationSuffix(supportedOrientations, orient);
if (scale < 3.0) // not expected, but handle just in case. Image name is valid
[ret addObject: [NSString stringWithFormat: @"LaunchImage-1100%s-2436h", orientSuffix]];
[ret addObject: [NSString stringWithFormat: @"LaunchImage-1100%s-2436h@3x", orientSuffix]];
}
if (scale > 1.0)
[ret addObject: @"LaunchImage@2x"];
}
[ret addObject: @"LaunchImage"];
return ret;
}
@implementation SplashScreen
{
UIImageView* m_ImageView;
UIView* m_XibView;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame: frame];
return self;
}
/* The following launch images are produced by Xcode6:
LaunchImage.png
LaunchImage@2x.png
LaunchImage-568h@2x.png
LaunchImage-700@2x.png
LaunchImage-700-568h@2x.png
LaunchImage-700-Landscape@2x~ipad.png
LaunchImage-700-Landscape~ipad.png
LaunchImage-700-Portrait@2x~ipad.png
LaunchImage-700-Portrait~ipad.png
LaunchImage-800-667h@2x.png
LaunchImage-800-Landscape-736h@3x.png
LaunchImage-800-Portrait-736h@3x.png
LaunchImage-1100-Landscape-2436h@3x.png
LaunchImage-1100-Portrait-2436h@3x.png
LaunchImage-Landscape@2x~ipad.png
LaunchImage-Landscape~ipad.png
LaunchImage-Portrait@2x~ipad.png
LaunchImage-Portrait~ipad.png
*/
- (void)updateOrientation:(ScreenOrientation)orient withSupportedOrientations:(const OrientationMask&)supportedOrientations
{
CGFloat scale = UnityScreenScaleFactor([UIScreen mainScreen]);
UnityReportResizeView(self.bounds.size.width * scale, self.bounds.size.height * scale, orient);
// Storyboards should have a view controller to automatically configure orientation
bool hasStoryboard = [[NSBundle mainBundle] pathForResource: @"LaunchScreen" ofType: @"storyboardc"] != nullptr;
if (hasStoryboard)
return;
UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom];
NSString* xibName = nil;
if (idiom == UIUserInterfaceIdiomPhone)
xibName = @"LaunchScreen-iPhone";
else if (idiom == UIUserInterfaceIdiomPad)
xibName = @"LaunchScreen-iPad";
bool hasLaunchScreen = [[NSBundle mainBundle] pathForResource: xibName ofType: @"nib"] != nullptr;
if (hasLaunchScreen)
{
// Launch screen uses the same aspect-filled image for all iPhone and/or
// all iPads, as configured in Unity. We need a special case if there's
// a launch screen and iOS is configured to use it.
if (self->m_XibView == nil)
{
self->m_XibView = [[[NSBundle mainBundle] loadNibNamed: xibName owner: nil options: nil] objectAtIndex: 0];
[self addSubview: self->m_XibView];
}
return;
}
UIImage* image = nil;
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
CGFloat screenScale = [UIScreen mainScreen].scale;
// For launch images we implement fallback order with multiple images. First we try images via
// [UIImage imageNamed] method and if this fails, we try to load from filesystem directly.
// Note that file system resource names and image names accepted by UIImage are the same.
// Multiple fallbacks are implemented because different iOS versions behave differently and have
// many gotchas that are hard to get right. So we use the images that are present on app bundles
// made with latest version of Xcode as the first priority and then fall back to any image that we
// have used at some time in the past.
NSArray<NSString*>* imageNames = GetLaunchImageNames(idiom, supportedOrientations, screenSize, orient, screenScale);
for (NSString* imageName in imageNames)
{
image = [UIImage imageNamed: imageName];
if (image)
break;
}
if (image == nil)
{
// Old launch image from file
for (NSString* imageName in imageNames)
{
image = [UIImage imageNamed: imageName];
if (image)
break;
NSString* imagePath = [[NSBundle mainBundle] pathForResource: imageName ofType: @"png"];
image = [UIImage imageWithContentsOfFile: imagePath];
if (image)
break;
}
}
// should not ever happen, but just in case
if (image == nil)
return;
if (self->m_ImageView == nil)
{
self->m_ImageView = [[UIImageView alloc] initWithImage: image];
[self addSubview: self->m_ImageView];
}
else
{
self->m_ImageView.image = image;
}
}
- (void)layoutSubviews
{
if (self->m_XibView)
self->m_XibView.frame = self.bounds;
else if (self->m_ImageView)
self->m_ImageView.frame = self.bounds;
}
+ (SplashScreen*)Instance
{
return _splash;
}
- (void)FreeSubviews
{
m_ImageView = nil;
m_XibView = nil;
}
@end
@implementation SplashScreenController
{
OrientationMask _supportedOrientations;
}
- (id)init
{
self = [super init];
if (self)
{
self->_supportedOrientations = { false, false, false, false };
}
return self;
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
ScreenOrientation curOrient = UIViewControllerOrientation(self);
ScreenOrientation newOrient = OrientationAfterTransform(curOrient, [coordinator targetTransform]);
if (_isOrientable)
[_splash updateOrientation: newOrient withSupportedOrientations: self->_supportedOrientations];
[coordinator animateAlongsideTransition: nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if (!_isOrientable)
OrientView(self, _splash, _nonOrientableDefaultOrientation);
}];
[super viewWillTransitionToSize: size withTransitionCoordinator: coordinator];
}
- (void)create:(UIWindow*)window
{
NSArray* supportedOrientation = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"UISupportedInterfaceOrientations"];
bool isIphone = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone;
bool isIpad = !isIphone;
// splash will be shown way before unity is inited so we need to override autorotation handling with values read from info.plist
self->_supportedOrientations.portrait = [supportedOrientation containsObject: @"UIInterfaceOrientationPortrait"];
self->_supportedOrientations.portraitUpsideDown = [supportedOrientation containsObject: @"UIInterfaceOrientationPortraitUpsideDown"];
self->_supportedOrientations.landscapeLeft = [supportedOrientation containsObject: @"UIInterfaceOrientationLandscapeRight"];
self->_supportedOrientations.landscapeRight = [supportedOrientation containsObject: @"UIInterfaceOrientationLandscapeLeft"];
CGSize size = [[UIScreen mainScreen] bounds].size;
// iPads and iPhone Plus models and iOS11 have orientable splash screen
_isOrientable = isIpad || (size.height == 736 || size.width == 736) || UnityiOS110orNewer();
// Launch screens are used only on iOS8+ iPhones
const char* xib = UnityGetLaunchScreenXib();
#if !PLATFORM_TVOS
_usesLaunchscreen = false;
if (xib != NULL)
{
const char* expectedName = isIphone ? "LaunchScreen-iPhone" : "LaunchScreen-iPad";
if (std::strcmp(xib, expectedName) == 0)
_usesLaunchscreen = true;
}
#else
_usesLaunchscreen = false;
#endif
if (!(self->_supportedOrientations.portrait || self->_supportedOrientations.portraitUpsideDown))
_nonOrientableDefaultOrientation = landscapeLeft;
else
_nonOrientableDefaultOrientation = portrait;
_splash = [[SplashScreen alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
_splash.contentScaleFactor = [UIScreen mainScreen].scale;
if (_isOrientable)
{
_splash.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_splash.autoresizesSubviews = YES;
}
else if (self->_supportedOrientations.portrait || self->_supportedOrientations.portraitUpsideDown)
{
self->_supportedOrientations.landscapeLeft = false;
self->_supportedOrientations.landscapeRight = false;
}
// On non-orientable devices with launch screens, landscapeLeft is always used if both
// landscapeRight and landscapeLeft are enabled
if (!_isOrientable && _supportedOrientations.landscapeRight)
{
if (self->_supportedOrientations.landscapeLeft)
self->_supportedOrientations.landscapeRight = false;
else
_nonOrientableDefaultOrientation = landscapeRight;
}
window.rootViewController = self;
self.view = _splash;
[window addSubview: _splash];
[window bringSubviewToFront: _splash];
ScreenOrientation orient = UIViewControllerOrientation(self);
[_splash updateOrientation: orient withSupportedOrientations: self->_supportedOrientations];
if (!_isOrientable)
orient = _nonOrientableDefaultOrientation;
// fix iPhone 5,6 launch images (only in portrait) from being stretched
if (isIphone && _isOrientable && !((size.height == 568 || size.width == 568) || (size.height == 667 || size.width == 667)))
orient = portrait;
OrientView([SplashScreenController Instance], _splash, orient);
}
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger ret = 0;
if (self->_supportedOrientations.portrait)
ret |= (1 << UIInterfaceOrientationPortrait);
if (self->_supportedOrientations.portraitUpsideDown)
ret |= (1 << UIInterfaceOrientationPortraitUpsideDown);
if (self->_supportedOrientations.landscapeLeft)
ret |= (1 << UIInterfaceOrientationLandscapeRight);
if (self->_supportedOrientations.landscapeRight)
ret |= (1 << UIInterfaceOrientationLandscapeLeft);
return ret;
}
+ (SplashScreenController*)Instance
{
return _controller;
}
@end
void ShowSplashScreen(UIWindow* window)
{
bool hasStoryboard = [[NSBundle mainBundle] pathForResource: @"LaunchScreen" ofType: @"storyboardc"] != nullptr;
if (hasStoryboard)
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName: @"LaunchScreen" bundle: [NSBundle mainBundle]];
_controller = [storyboard instantiateInitialViewController];
window.rootViewController = _controller;
}
else
{
_controller = [[SplashScreenController alloc] init];
[_controller create: window];
}
[window makeKeyAndVisible];
}
void HideSplashScreen()
{
if (_splash)
{
[_splash removeFromSuperview];
[_splash FreeSubviews];
}
_splash = nil;
_controller = nil;
}

@ -0,0 +1,18 @@
#if PLATFORM_IOS
// This definition is here only for compiler to know about selector requestReview
@interface UnityStoreReviewController
+ requestReview;
@end
bool UnityRequestStoreReview()
{
Class classSKStoreReviewController = NSClassFromString(@"SKStoreReviewController");
if (!classSKStoreReviewController || ![classSKStoreReviewController respondsToSelector: @selector(requestReview)])
return false;
[classSKStoreReviewController performSelector: @selector(requestReview)];
return true;
}
#endif

@ -0,0 +1,105 @@
#pragma once
#include "UnityAppController.h"
#include <AvailabilityMacros.h>
@interface UnityAppController (ViewHandling)
// tweaking view hierarchy and handling of orientation
// there are 3 main uses cases regarding UI handling:
//
// 1. normal game case: you shouldnt care about all this at all
//
// 2. you need some not-so-trivial overlayed views and/or minor UI tweaking
// most likely all you need is to subscribe to "orientation changed" notification
// or in case you have per-orientation UI logic override willTransitionToViewController
//
// 3. you create UI-rich app where unity view is just one of many
// in that case you might want to create your own controllers and implement transitions on top
// also instead of orientUnity: (and Screen.orientation in script) you should use orientInterface
// override this if you need customized unityview (subclassing)
// if you simply want different root view, tweak view hierarchy in createAutorotatingUnityViewController
- (UnityView*)createUnityView;
// for view controllers we discern between platforms that do support orientation (e.g. iOS) and the ones that dont (e.g. tvOS)
// both have concept of "default" view controller: for iOS it will be auto-rotating one (with possible constraints) and "simple" controller otherwise
// in case of supporting orientation we will discern case of fixed-orientation view controller (that seems to be the only way to handle it robustly)
// _unityView will be inited at the point of calling any of "create view controller" methods
// please note that these are actual "create" methods: there is no need to tweak hierarchy right away
- (UIViewController*)createUnityViewControllerDefault;
#if UNITY_SUPPORT_ROTATION
- (UIViewController*)createUnityViewControllerForOrientation:(UIInterfaceOrientation)orient;
#endif
#if UNITY_SUPPORT_ROTATION
// if you override these you need to call super
// if your root controller is not subclassed from UnityViewControllerBase, call these when rotation is happening
- (void)interfaceWillChangeOrientationTo:(UIInterfaceOrientation)toInterfaceOrientation;
- (void)interfaceDidChangeOrientationFrom:(UIInterfaceOrientation)fromInterfaceOrientation;
#endif
// handling of changing ViewControllers:
// willStartWithViewController: will be called on startup, when creating view hierarchy
// willTransitionToViewController:fromViewController: didTransitionToViewController:fromViewController:
// are called before/after we are doing some magic to switch to new root controller due to forced orientation change
// by default:
// willStartWithViewController: will make _unityView as root view
// willTransitionToViewController:fromViewController: will do nothing
// didTransitionToViewController:fromViewController: will send orientation events to unity view
// you can use them to tweak view hierarchy if needed
- (void)willStartWithViewController:(UIViewController*)controller;
- (void)willTransitionToViewController:(UIViewController*)toController fromViewController:(UIViewController*)fromController;
- (void)didTransitionToViewController:(UIViewController*)toController fromViewController:(UIViewController*)fromController;
// override this if you want to have custom snapshot view.
// by default it will capture the frame drawn inside applicationWillResignActive specifically to let app respond to OnApplicationPause
// will be called on every applicationWillResignActive; returned view will be released in applicationDidBecomeActive
// NB: case of returning nil will be handled gracefully
- (UIView*)createSnapshotView;
// you should not override these methods
// creates initial UI hierarchy (e.g. splash screen) and calls willStartWithViewController
- (void)createUI;
// shows game itself (hides splash, and bring _rootView to front)
- (void)showGameUI;
// returns the topmost presentedViewController if there is one, or just rootViewController
- (UIViewController*)topMostController;
// will create or return from cache correct view controller for requested orientation
- (UIViewController*)createRootViewController;
// old deprecated methods: no longer used
// the caveat is: there are some issues in clang related to method deprecation
// which results in warnings not being generated for overriding deprecated methods (in some circumstances).
// so instead of deprecating these methods we just remove them and will check at runtime if user have them and whine about it
//- (UnityView*)createUnityViewImpl DEPRECATED_MSG_ATTRIBUTE("Will not be called. Override createUnityView");
//- (void)createViewHierarchyImpl DEPRECATED_MSG_ATTRIBUTE("Will not be called. Override willStartWithViewController");
//- (void)createViewHierarchy DEPRECATED_MSG_ATTRIBUTE("Is not implemented. Use createUI");
@end
#if UNITY_SUPPORT_ROTATION
@interface UnityAppController (OrientationSupport)
// will create or return from cache correct view controller for given orientation
- (UIViewController*)createRootViewControllerForOrientation:(UIInterfaceOrientation)orientation;
// forcibly orient interface
- (void)orientInterface:(UIInterfaceOrientation)orient;
// check unity requested orientation and applies it
- (void)checkOrientationRequest;
- (void)orientUnity:(UIInterfaceOrientation)orient __deprecated_msg("use orientInterface instead.");
@end
#endif

@ -0,0 +1,418 @@
#include "UnityAppController+ViewHandling.h"
#include "UnityAppController+Rendering.h"
#include "UI/OrientationSupport.h"
#include "UI/UnityView.h"
#include "UI/UnityViewControllerBase.h"
#include "Unity/DisplayManager.h"
// TEMP: ?
#include "UI/ActivityIndicator.h"
#include "UI/SplashScreen.h"
#include "UI/Keyboard.h"
#include <utility>
extern bool _skipPresent;
extern bool _unityAppReady;
@implementation UnityAppController (ViewHandling)
#if UNITY_SUPPORT_ROTATION
// special case for when we DO know the app orientation, but dont get it through normal mechanism (UIViewController orientation handling)
// how can this happen:
// 1. On startup: ios is not sending "change orientation" notifications on startup (but rather we "start" in correct one already)
// 2. When using presentation controller it can override orientation constraints, so on dismissing we need to tweak app orientation;
// pretty much like startup situation UIViewController would have correct orientation, and app will be out-of-sync
- (void)updateAppOrientation:(UIInterfaceOrientation)orientation
{
_curOrientation = orientation;
[_unityView willRotateToOrientation: orientation fromOrientation: (UIInterfaceOrientation)UIInterfaceOrientationUnknown];
[_unityView didRotate];
}
#endif
- (UnityView*)createUnityView
{
return [[UnityView alloc] initFromMainScreen];
}
- (UIViewController*)createUnityViewControllerDefault
{
UnityDefaultViewController* ret = [[UnityDefaultViewController alloc] init];
#if PLATFORM_TVOS
// This enables game controller use in on-screen keyboard
ret.controllerUserInteractionEnabled = YES;
#endif
return ret;
}
#if UNITY_SUPPORT_ROTATION
- (UIViewController*)createUnityViewControllerForOrientation:(UIInterfaceOrientation)orient
{
switch (orient)
{
case UIInterfaceOrientationPortrait: return [[UnityPortraitOnlyViewController alloc] init];
case UIInterfaceOrientationPortraitUpsideDown: return [[UnityPortraitUpsideDownOnlyViewController alloc] init];
case UIInterfaceOrientationLandscapeLeft: return [[UnityLandscapeLeftOnlyViewController alloc] init];
case UIInterfaceOrientationLandscapeRight: return [[UnityLandscapeRightOnlyViewController alloc] init];
default: NSAssert(false, @"bad UIInterfaceOrientation provided");
}
return nil;
}
#endif
- (UIViewController*)createRootViewController
{
UIViewController* ret = nil;
if (!UNITY_SUPPORT_ROTATION || UnityShouldAutorotate())
{
if (_viewControllerForOrientation[0] == nil)
_viewControllerForOrientation[0] = [self createUnityViewControllerDefault];
ret = _viewControllerForOrientation[0];
}
#if UNITY_SUPPORT_ROTATION
if (ret == nil)
{
UIInterfaceOrientation orientation = ConvertToIosScreenOrientation((ScreenOrientation)UnityRequestedScreenOrientation());
ret = [self createRootViewControllerForOrientation: orientation];
}
#endif
return ret;
}
- (UIViewController*)topMostController
{
UIViewController *topController = self.window.rootViewController;
while (topController.presentedViewController)
topController = topController.presentedViewController;
return topController;
}
- (void)willStartWithViewController:(UIViewController*)controller
{
_unityView.contentScaleFactor = UnityScreenScaleFactor([UIScreen mainScreen]);
_unityView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_rootController.view = _rootView = _unityView;
}
- (void)willTransitionToViewController:(UIViewController*)toController fromViewController:(UIViewController*)fromController
{
}
- (void)didTransitionToViewController:(UIViewController*)toController fromViewController:(UIViewController*)fromController
{
#if UNITY_SUPPORT_ROTATION
// when transitioning between view controllers ios will not send reorient events (because they are bound to controllers, not view)
// so we imitate them here so unity view can update its size/orientation
[_unityView willRotateToOrientation: UIViewControllerInterfaceOrientation(toController) fromOrientation: ConvertToIosScreenOrientation(_unityView.contentOrientation)];
[_unityView didRotate];
// NB: this is both important and insane at the same time (that we have several places to keep current orentation and we need to sync them)
_curOrientation = UIViewControllerInterfaceOrientation(toController);
#endif
}
- (UIView*)createSnapshotView
{
// Snapshot API appeared on iOS 7, however before iOS 8 tweaking hierarchy like that on going to
// background results in all kind of weird things when going back to foreground so we do snapshotting
// only on iOS 8 and newer.
// Note that on iPads with iOS 9 or later (up to iOS 10.2 at least) there's a bug in the iOS
// compositor: any use of -[UIView snapshotViewAfterScreenUpdates] causes black screen being shown
// temporarily when 4 finger gesture to swipe to another app in the task switcher is being performed slowly
#if UNITY_SNAPSHOT_VIEW_ON_APPLICATION_PAUSE
return [_rootView snapshotViewAfterScreenUpdates: YES];
#else
return nil;
#endif
}
- (void)createUI
{
NSAssert(_unityView != nil, @"_unityView should be inited at this point");
NSAssert(_window != nil, @"_window should be inited at this point");
_rootController = [self createRootViewController];
[self willStartWithViewController: _rootController];
NSAssert(_rootView != nil, @"_rootView should be inited at this point");
NSAssert(_rootController != nil, @"_rootController should be inited at this point");
[_window makeKeyAndVisible];
[UIView setAnimationsEnabled: NO];
// TODO: extract it?
ShowSplashScreen(_window);
#if UNITY_SUPPORT_ROTATION
// to be able to query orientation from view controller we should actually show it.
// at this point we can only show splash screen, so update app orientation after we started showing it
// NB: _window.rootViewController = splash view controller (not _rootController)
[self updateAppOrientation: ConvertToIosScreenOrientation(UIViewControllerOrientation(_window.rootViewController))];
#endif
NSNumber* style = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"Unity_LoadingActivityIndicatorStyle"];
ShowActivityIndicator([SplashScreen Instance], style ? [style intValue] : -1);
NSNumber* vcControlled = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"UIViewControllerBasedStatusBarAppearance"];
if (vcControlled && ![vcControlled boolValue])
printf_console("\nSetting UIViewControllerBasedStatusBarAppearance to NO is no longer supported.\n"
"Apple actively discourages that, and all application-wide methods of changing status bar appearance are deprecated\n\n"
);
}
- (void)showGameUI
{
HideActivityIndicator();
HideSplashScreen();
// make sure that we start up with correctly created/inited rendering surface
// NB: recreateRenderingSurface won't go into rendering because _unityAppReady is false
#if UNITY_SUPPORT_ROTATION
[self checkOrientationRequest];
#endif
[_unityView recreateRenderingSurface];
// UI hierarchy
[_window addSubview: _rootView];
_window.rootViewController = _rootController;
[_window bringSubviewToFront: _rootView];
#if UNITY_SUPPORT_ROTATION
// to be able to query orientation from view controller we should actually show it.
// at this point we finally started to show game view controller. Just in case update orientation again
[self updateAppOrientation: ConvertToIosScreenOrientation(UIViewControllerOrientation(_rootController))];
#endif
// why we set level ready only now:
// surface recreate will try to repaint if this var is set (poking unity to do it)
// but this frame now is actually the first one we want to process/draw
// so all the recreateSurface before now (triggered by reorientation) should simply change extents
_unityAppReady = true;
// why we skip present:
// this will be the first frame to draw, so Start methods will be called
// and we want to properly handle resolution request in Start (which might trigger surface recreate)
// NB: we want to draw right after showing window, to avoid black frame creeping in
_skipPresent = true;
if (!UnityIsPaused())
UnityRepaint();
_skipPresent = false;
[self repaint];
[UIView setAnimationsEnabled: YES];
}
- (void)transitionToViewController:(UIViewController*)vc
{
[self willTransitionToViewController: vc fromViewController: _rootController];
// first: remove from view hierarchy.
// if we simply hide the window before assigning the new view controller, it will cause black frame flickering
// on the other hand, hiding the window is important by itself to better signal the intent to iOS
// e.g. unless we hide the window view, safeArea might stop working (due to bug in iOS if we're to speculate)
// due to that we do this hide/unhide sequence: we want to to make it hidden, but still unhide it before changing window view controller.
_window.hidden = YES;
_window.hidden = NO;
_rootController.view = nil;
_window.rootViewController = nil;
// second: assign new root controller (and view hierarchy with that), restore bounds
_rootController = _window.rootViewController = vc;
_rootController.view = _rootView;
_window.bounds = [UIScreen mainScreen].bounds;
// required for iOS 8, otherwise view bounds will be incorrect
_rootView.bounds = _window.bounds;
_rootView.center = _window.center;
// third: restore window as key and layout subviews to finalize size changes
[_window makeKeyAndVisible];
[_window layoutSubviews];
[self didTransitionToViewController: vc fromViewController: _rootController];
}
#if UNITY_SUPPORT_ROTATION
- (void)interfaceWillChangeOrientationTo:(UIInterfaceOrientation)toInterfaceOrientation
{
UIInterfaceOrientation fromInterfaceOrientation = _curOrientation;
_curOrientation = toInterfaceOrientation;
[_unityView willRotateToOrientation: toInterfaceOrientation fromOrientation: fromInterfaceOrientation];
}
- (void)interfaceDidChangeOrientationFrom:(UIInterfaceOrientation)fromInterfaceOrientation
{
[_unityView didRotate];
}
#endif
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
- (void)executeForEveryViewController:(void(^)(UIViewController*))callback
{
for (unsigned i = 0; i < ARRAY_SIZE(_viewControllerForOrientation); ++i)
{
UIViewController* vc = _viewControllerForOrientation[i];
if (vc)
callback(vc);
}
}
- (void)notifyHideHomeButtonChange
{
// Note that we need to update all view controllers because UIKit won't necessarily
// update the properties of view controllers when orientation is changed.
#if PLATFORM_IOS && UNITY_HAS_IOSSDK_11_0
if (@available(iOS 11.0, *))
{
[self executeForEveryViewController: ^(UIViewController* vc)
{
// setNeedsUpdateOfHomeIndicatorAutoHidden is not implemented on iOS 11.0.
// The bug has been fixed in iOS 11.0.1. See http://www.openradar.me/35127134
if ([vc respondsToSelector: @selector(setNeedsUpdateOfHomeIndicatorAutoHidden)])
[vc setNeedsUpdateOfHomeIndicatorAutoHidden];
}];
}
#endif
}
- (void)notifyDeferSystemGesturesChange
{
#if PLATFORM_IOS && UNITY_HAS_IOSSDK_11_0
if (@available(iOS 11.0, *))
{
[self executeForEveryViewController: ^(UIViewController* vc)
{
[vc setNeedsUpdateOfScreenEdgesDeferringSystemGestures];
}];
}
#endif
}
@end
#if UNITY_SUPPORT_ROTATION
@implementation UnityAppController (OrientationSupport)
- (UIViewController*)createRootViewControllerForOrientation:(UIInterfaceOrientation)orientation
{
NSAssert(orientation != 0, @"Bad UIInterfaceOrientation provided");
if (_viewControllerForOrientation[orientation] == nil)
_viewControllerForOrientation[orientation] = [self createUnityViewControllerForOrientation: orientation];
return _viewControllerForOrientation[orientation];
}
- (void)checkOrientationRequest
{
if (!UnityHasOrientationRequest() && !UnityShouldChangeAllowedOrientations())
return;
// normally we want to call attemptRotationToDeviceOrientation to tell iOS that we changed orientation constraints
// but if the current orientation is disabled we need special processing, as iOS will simply ignore us
// the only good/robust way is to simply recreate "autorotating" view controller and transition to it if needed
// please note that we want to trigger "orientation request" code path if we recreate autorotating view controller
bool changeOrient = UnityHasOrientationRequest();
if (UnityShouldChangeAllowedOrientations())
{
// so we can say that the only corner case is when we are autorotating and will autorotate
// AND changed allowed orientations while keeping current allowed
// in that case we simply trigger attemptRotationToDeviceOrientation and we are done
// please note that it this can happen when current *device* orientation is disabled (and we want to enable it)
NSUInteger rootOrient = 1 << UIViewControllerInterfaceOrientation(self.rootViewController);
if (UnityShouldAutorotate() && _rootController == _viewControllerForOrientation[0] && (rootOrient & EnabledAutorotationInterfaceOrientations()))
{
[UIViewController attemptRotationToDeviceOrientation];
return;
}
// otherwise we recreate default autorotating view controller
// please note that below we will check if root controller still equals _viewControllerForOrientation[0]
// in that case (we update _viewControllerForOrientation[0]) the check will fail and trigger transition (as expected)
// you may look at this check as "are we autorotating with same constraints"
_viewControllerForOrientation[0] = [self createUnityViewControllerDefault];
changeOrient = true;
}
if (changeOrient)
{
if (UnityShouldAutorotate())
{
if (_viewControllerForOrientation[0] == nil)
_viewControllerForOrientation[0] = [self createUnityViewControllerDefault];
if (_rootController != _viewControllerForOrientation[0])
[self transitionToViewController: _viewControllerForOrientation[0]];
[UIViewController attemptRotationToDeviceOrientation];
}
else
{
ScreenOrientation requestedOrient = (ScreenOrientation)UnityRequestedScreenOrientation();
[self orientInterface: ConvertToIosScreenOrientation(requestedOrient)];
}
}
UnityOrientationRequestWasCommitted();
}
- (void)orientInterface:(UIInterfaceOrientation)orient
{
if (_unityAppReady)
UnityFinishRendering();
[KeyboardDelegate StartReorientation];
[CATransaction begin];
{
UIInterfaceOrientation oldOrient = _curOrientation;
UIInterfaceOrientation newOrient = orient;
[self interfaceWillChangeOrientationTo: newOrient];
[self transitionToViewController: [self createRootViewControllerForOrientation: newOrient]];
[self interfaceDidChangeOrientationFrom: oldOrient];
[UIApplication sharedApplication].statusBarOrientation = orient;
}
[CATransaction commit];
[KeyboardDelegate FinishReorientation];
}
- (void)orientUnity:(UIInterfaceOrientation)orient
{
[self orientInterface: orient];
}
@end
#endif
extern "C" void UnityNotifyHideHomeButtonChange()
{
[GetAppController() notifyHideHomeButtonChange];
}
extern "C" void UnityNotifyDeferSystemGesturesChange()
{
[GetAppController() notifyDeferSystemGesturesChange];
}

@ -0,0 +1,222 @@
#import "UnityView.h"
#include "UI/Keyboard.h"
static NSArray* keyboardCommands = nil;
static int pressedButton = 0;
@interface UnityView (Keyboard)
@end
@implementation UnityView (Keyboard)
- (void)createKeyboard
{
// only English keyboard layout is supported
NSString* baseLayout = @"1234567890-=qwertyuiop[]asdfghjkl;'\\`zxcvbnm,./!@#$%^&*()_+{}:\"|<>?~ \t\r\b\\";
NSString* numpadLayout = @"1234567890-=*+/.\r";
size_t sizeOfKeyboardCommands = baseLayout.length + numpadLayout.length + 11;
NSMutableArray* commands = [NSMutableArray arrayWithCapacity: sizeOfKeyboardCommands];
for (NSInteger i = 0; i < baseLayout.length; ++i)
{
NSString* input = [baseLayout substringWithRange: NSMakeRange(i, 1)];
[commands addObject: [UIKeyCommand keyCommandWithInput: input modifierFlags: kNilOptions action: @selector(handleCommand:)]];
}
for (NSInteger i = 0; i < numpadLayout.length; ++i)
{
NSString* input = [numpadLayout substringWithRange: NSMakeRange(i, 1)];
[commands addObject: [UIKeyCommand keyCommandWithInput: input modifierFlags: UIKeyModifierNumericPad action: @selector(handleCommand:)]];
}
// up, down, left, right, esc
[commands addObject: [UIKeyCommand keyCommandWithInput: UIKeyInputUpArrow modifierFlags: kNilOptions action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: UIKeyInputDownArrow modifierFlags: kNilOptions action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: UIKeyInputLeftArrow modifierFlags: kNilOptions action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: UIKeyInputRightArrow modifierFlags: kNilOptions action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: UIKeyInputEscape modifierFlags: kNilOptions action: @selector(handleCommand:)]];
// caps Lock, shift, control, option, command
[commands addObject: [UIKeyCommand keyCommandWithInput: @"" modifierFlags: UIKeyModifierAlphaShift action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: @"" modifierFlags: UIKeyModifierShift action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: @"" modifierFlags: UIKeyModifierControl action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: @"" modifierFlags: UIKeyModifierAlternate action: @selector(handleCommand:)]];
[commands addObject: [UIKeyCommand keyCommandWithInput: @"" modifierFlags: UIKeyModifierCommand action: @selector(handleCommand:)]];
keyboardCommands = commands.copy;
}
// UIKeyCommand can't handle key up events,
// So we're simulating key up event in case if any other button is pressed or UIView calls keyCommands method.
// Because of this there is no way to handle simultanious key presses.
- (void)releaseButton
{
if (pressedButton != 0)
{
UnitySetKeyState(pressedButton, false);
pressedButton = 0;
}
}
- (NSArray*)keyCommands
{
[self releaseButton];
//keyCommands take controll of buttons over UITextView, that's why need to return nil if text input field is active
if ([[KeyboardDelegate Instance] status] == Visible)
{
return nil;
}
if (keyboardCommands == nil)
{
[self createKeyboard];
}
return keyboardCommands;
}
- (bool)isValidCodeForButton:(int)code
{
return (code > 0 && code < 128);
}
- (void)handleCommand:(UIKeyCommand *)command
{
[self releaseButton];
NSString* input = command.input;
UIKeyModifierFlags modifierFlags = command.modifierFlags;
char inputChar = ([input length] > 0) ? [input characterAtIndex: 0] : 0;
int code = (int)inputChar; // ASCII code
if (![self isValidCodeForButton: code])
{
code = 0;
}
if ((modifierFlags & UIKeyModifierAlphaShift) != 0)
code = UnityStringToKey("caps lock");
if ((modifierFlags & UIKeyModifierShift) != 0)
code = UnityStringToKey("left shift");
if ((modifierFlags & UIKeyModifierControl) != 0)
code = UnityStringToKey("left ctrl");
if ((modifierFlags & UIKeyModifierAlternate) != 0)
code = UnityStringToKey("left alt");
if ((modifierFlags & UIKeyModifierCommand) != 0)
code = UnityStringToKey("left cmd");
if ((modifierFlags & UIKeyModifierNumericPad) != 0)
{
switch (inputChar)
{
case '0':
code = UnityStringToKey("[0]");
break;
case '1':
code = UnityStringToKey("[1]");
break;
case '2':
code = UnityStringToKey("[2]");
break;
case '3':
code = UnityStringToKey("[3]");
break;
case '4':
code = UnityStringToKey("[4]");
break;
case '5':
code = UnityStringToKey("[5]");
break;
case '6':
code = UnityStringToKey("[6]");
break;
case '7':
code = UnityStringToKey("[7]");
break;
case '8':
code = UnityStringToKey("[8]");
break;
case '9':
code = UnityStringToKey("[9]");
break;
case '-':
code = UnityStringToKey("[-]");
break;
case '=':
code = UnityStringToKey("equals");
break;
case '*':
code = UnityStringToKey("[*]");
break;
case '+':
code = UnityStringToKey("[+]");
break;
case '/':
code = UnityStringToKey("[/]");
break;
case '.':
code = UnityStringToKey("[.]");
break;
case '\r':
code = UnityStringToKey("enter");
break;
default:
break;
}
}
if (input == UIKeyInputUpArrow)
code = UnityStringToKey("up");
else if (input == UIKeyInputDownArrow)
code = UnityStringToKey("down");
else if (input == UIKeyInputRightArrow)
code = UnityStringToKey("right");
else if (input == UIKeyInputLeftArrow)
code = UnityStringToKey("left");
else if (input == UIKeyInputEscape)
code = UnityStringToKey("escape");
UnitySetKeyState(code, true);
pressedButton = code;
}
#if PLATFORM_TVOS
- (int)pressTypeToCode:(UIPress *)press
{
if ([press type] == UIPressTypeUpArrow)
return UnityStringToKey("up");
else if ([press type] == UIPressTypeDownArrow)
return UnityStringToKey("down");
else if ([press type] == UIPressTypeRightArrow)
return UnityStringToKey("right");
else if ([press type] == UIPressTypeLeftArrow)
return UnityStringToKey("left");
else if ([press type] == UIPressTypeSelect)
return UnityStringToKey("joystick button 14");
else if ([press type] == UIPressTypePlayPause)
return UnityStringToKey("joystick button 15");
else if ([press type] == UIPressTypeMenu)
return UnityStringToKey("joystick button 0");
return 0;
}
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
{
for (UIPress *press in presses)
{
UnitySetKeyState([self pressTypeToCode: press], true);
}
}
- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
{
for (UIPress *press in presses)
{
UnitySetKeyState([self pressTypeToCode: press], false);
}
}
#endif
@end

@ -0,0 +1,15 @@
#pragma once
@interface UnityView (iOS)
// will simply update content orientation (it might be tweaked in layoutSubviews, due to disagreement between unity and view controller)
- (void)willRotateToOrientation:(UIInterfaceOrientation)toOrientation fromOrientation:(UIInterfaceOrientation)fromOrientation;
// will recreate gles backing if needed and repaint once to make sure we dont have black frame creeping in
- (void)didRotate;
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event;
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event;
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event;
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event;
@end

@ -0,0 +1,49 @@
#if PLATFORM_IOS
#import "UnityView.h"
#import "UnityAppController+Rendering.h"
#include "OrientationSupport.h"
extern bool _unityAppReady;
@interface UnityView ()
@property (nonatomic, readwrite) ScreenOrientation contentOrientation;
@end
@implementation UnityView (iOS)
- (void)willRotateToOrientation:(UIInterfaceOrientation)toOrientation fromOrientation:(UIInterfaceOrientation)fromOrientation;
{
// to support the case of interface and unity content orientation being different
// we will cheat a bit:
// we will calculate transform between interface orientations and apply it to unity view orientation
// you can still tweak unity view as you see fit in AppController, but this is what you want in 99% of cases
ScreenOrientation to = ConvertToUnityScreenOrientation(toOrientation);
ScreenOrientation from = ConvertToUnityScreenOrientation(fromOrientation);
if (fromOrientation == UIInterfaceOrientationUnknown)
_curOrientation = to;
else
_curOrientation = OrientationAfterTransform(_curOrientation, TransformBetweenOrientations(from, to));
_viewIsRotating = YES;
}
- (void)didRotate
{
if (_shouldRecreateView)
{
[self recreateRenderingSurface];
}
_viewIsRotating = NO;
}
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { UnitySendTouchesBegin(touches, event); }
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { UnitySendTouchesEnded(touches, event); }
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { UnitySendTouchesCancelled(touches, event); }
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { UnitySendTouchesMoved(touches, event); }
@end
#endif // PLATFORM_IOS

@ -0,0 +1,15 @@
#pragma once
@interface UnityView (tvOS)
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event;
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event;
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event;
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event;
#if UNITY_TVOS_SIMULATOR_FAKE_REMOTE
- (void)pressesBegan:(NSSet<UIPress*>*)presses withEvent:(UIEvent*)event;
- (void)pressesEnded:(NSSet<UIPress*>*)presses withEvent:(UIEvent*)event;
#endif
@end

@ -0,0 +1,66 @@
#if PLATFORM_TVOS
#import "UnityView.h"
#include "iphone_Sensors.h"
@implementation UnityView (tvOS)
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
#if UNITY_TVOS_SIMULATOR_FAKE_REMOTE
ReportSimulatedRemoteTouchesBegan(self, touches);
#endif
if (UnityGetAppleTVRemoteTouchesEnabled())
UnitySendTouchesBegin(touches, event);
}
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
#if UNITY_TVOS_SIMULATOR_FAKE_REMOTE
ReportSimulatedRemoteTouchesEnded(self, touches);
#endif
if (UnityGetAppleTVRemoteTouchesEnabled())
UnitySendTouchesEnded(touches, event);
}
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event
{
#if UNITY_TVOS_SIMULATOR_FAKE_REMOTE
ReportSimulatedRemoteTouchesEnded(self, touches);
#endif
if (UnityGetAppleTVRemoteTouchesEnabled())
UnitySendTouchesCancelled(touches, event);
}
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
#if UNITY_TVOS_SIMULATOR_FAKE_REMOTE
ReportSimulatedRemoteTouchesMoved(self, touches);
#endif
if (UnityGetAppleTVRemoteTouchesEnabled())
UnitySendTouchesMoved(touches, event);
}
#if UNITY_TVOS_SIMULATOR_FAKE_REMOTE
- (void)pressesBegan:(NSSet<UIPress*>*)presses withEvent:(UIEvent*)event
{
for (UIPress *press in presses)
ReportSimulatedRemoteButtonPress(press.type);
}
- (void)pressesEnded:(NSSet<UIPress*>*)presses withEvent:(UIEvent*)event
{
for (UIPress *press in presses)
ReportSimulatedRemoteButtonRelease(press.type);
}
#endif
@end
#endif // PLATFORM_TVOS

@ -0,0 +1,48 @@
#pragma once
@interface UnityRenderingView : UIView
{
}
+ (void)InitializeForAPI:(UnityRenderingAPI)api;
@end
@interface UnityView : UnityRenderingView
{
@private ScreenOrientation _curOrientation;
@private BOOL _shouldRecreateView;
@private BOOL _viewIsRotating;
}
// we take scale factor into account because gl backbuffer size depends on it
- (id)initWithFrame:(CGRect)frame scaleFactor:(CGFloat)scale;
- (id)initWithFrame:(CGRect)frame;
- (id)initFromMainScreen;
// in here we will go through subviews and call onUnityUpdateViewLayout selector (if present)
// that allows to handle simple overlay child view layout without doing view controller magic
- (void)layoutSubviews;
- (void)recreateRenderingSurfaceIfNeeded;
- (void)recreateRenderingSurface;
// will match script-side Screen.orientation
@property (nonatomic, readonly) ScreenOrientation contentOrientation;
@end
@interface UnityView (Deprecated)
- (void)recreateGLESSurfaceIfNeeded __deprecated_msg("use recreateRenderingSurfaceIfNeeded instead.");
- (void)recreateGLESSurface __deprecated_msg("use recreateRenderingSurface instead.");
@end
#if PLATFORM_IOS
#include "UnityView+iOS.h"
#elif PLATFORM_TVOS
#include "UnityView+tvOS.h"
#endif
void ReportSafeAreaChangeForView(UIView* view);
// Computes safe area for a view in Unity coordinate system (origin of the view
// is bottom-left, as compared to standard top-left)
CGRect ComputeSafeArea(UIView* view);

@ -0,0 +1,233 @@
#include "UnityView.h"
#include "UnityAppController.h"
#include "UnityAppController+Rendering.h"
#include "OrientationSupport.h"
#include "Unity/DisplayManager.h"
#include "Unity/UnityMetalSupport.h"
#include "Unity/ObjCRuntime.h"
extern bool _renderingInited;
extern bool _unityAppReady;
extern bool _skipPresent;
extern bool _supportsMSAA;
@implementation UnityView
{
CGSize _surfaceSize;
}
@synthesize contentOrientation = _curOrientation;
- (void)onUpdateSurfaceSize:(CGSize)size
{
_surfaceSize = size;
CGSize systemRenderSize = CGSizeMake(size.width * self.contentScaleFactor, size.height * self.contentScaleFactor);
_curOrientation = (ScreenOrientation)UnityReportResizeView(systemRenderSize.width, systemRenderSize.height, _curOrientation);
ReportSafeAreaChangeForView(self);
#if UNITY_CAN_USE_METAL
if (UnitySelectedRenderingAPI() == apiMetal)
((CAMetalLayer*)self.layer).drawableSize = systemRenderSize;
#endif
}
- (void)initImpl:(CGRect)frame scaleFactor:(CGFloat)scale
{
#if !PLATFORM_TVOS
self.multipleTouchEnabled = YES;
self.exclusiveTouch = YES;
#endif
self.contentScaleFactor = scale;
self.isAccessibilityElement = TRUE;
self.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction;
#if UNITY_TVOS
_curOrientation = UNITY_TVOS_ORIENTATION;
#endif
[self onUpdateSurfaceSize: frame.size];
}
- (id)initWithFrame:(CGRect)frame scaleFactor:(CGFloat)scale;
{
if ((self = [super initWithFrame: frame]))
[self initImpl: frame scaleFactor: scale];
return self;
}
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame: frame]))
[self initImpl: frame scaleFactor: 1.0f];
return self;
}
- (id)initFromMainScreen
{
CGRect frame = [UIScreen mainScreen].bounds;
CGFloat scale = UnityScreenScaleFactor([UIScreen mainScreen]);
if ((self = [super initWithFrame: frame]))
[self initImpl: frame scaleFactor: scale];
return self;
}
- (void)layoutSubviews
{
if (_surfaceSize.width != self.bounds.size.width || _surfaceSize.height != self.bounds.size.height)
_shouldRecreateView = YES;
[self onUpdateSurfaceSize: self.bounds.size];
for (UIView* subView in self.subviews)
{
if ([subView respondsToSelector: @selector(onUnityUpdateViewLayout)])
[subView performSelector: @selector(onUnityUpdateViewLayout)];
}
[super layoutSubviews];
}
- (void)safeAreaInsetsDidChange
{
ReportSafeAreaChangeForView(self);
}
- (void)recreateRenderingSurfaceIfNeeded
{
unsigned requestedW, requestedH; UnityGetRenderingResolution(&requestedW, &requestedH);
int requestedMSAA = UnityGetDesiredMSAASampleCount(MSAA_DEFAULT_SAMPLE_COUNT);
int requestedSRGB = UnityGetSRGBRequested();
int requestedWideColor = UnityGetWideColorRequested();
int requestedMemorylessDepth = UnityMetalMemorylessDepth();
UnityDisplaySurfaceBase* surf = GetMainDisplaySurface();
if (_shouldRecreateView == YES
|| surf->targetW != requestedW || surf->targetH != requestedH
|| surf->disableDepthAndStencil != UnityDisableDepthAndStencilBuffers()
|| (_supportsMSAA && surf->msaaSamples != requestedMSAA)
|| surf->srgb != requestedSRGB
|| surf->wideColor != requestedWideColor
|| surf->memorylessDepth != requestedMemorylessDepth
)
{
[self recreateRenderingSurface];
}
}
- (void)recreateRenderingSurface
{
if (_renderingInited)
{
unsigned requestedW, requestedH;
UnityGetRenderingResolution(&requestedW, &requestedH);
RenderingSurfaceParams params =
{
.msaaSampleCount = UnityGetDesiredMSAASampleCount(MSAA_DEFAULT_SAMPLE_COUNT),
.renderW = (int)requestedW,
.renderH = (int)requestedH,
.srgb = UnityGetSRGBRequested(),
.wideColor = UnityGetWideColorRequested(),
.metalFramebufferOnly = UnityMetalFramebufferOnly(),
.metalMemorylessDepth = UnityMetalMemorylessDepth(),
.disableDepthAndStencil = UnityDisableDepthAndStencilBuffers(),
.useCVTextureCache = 0,
};
APP_CONTROLLER_RENDER_PLUGIN_METHOD_ARG(onBeforeMainDisplaySurfaceRecreate, &params);
[GetMainDisplay() recreateSurface: params];
// actually poke unity about updated back buffer and notify that extents were changed
UnityReportBackbufferChange(GetMainDisplaySurface()->unityColorBuffer, GetMainDisplaySurface()->unityDepthBuffer);
APP_CONTROLLER_RENDER_PLUGIN_METHOD(onAfterMainDisplaySurfaceRecreate);
if (_unityAppReady)
{
// seems like ios sometimes got confused about abrupt swap chain destroy
// draw 2 times to fill both buffers
// present only once to make sure correct image goes to CA
// if we are calling this from inside repaint, second draw and present will be done automatically
_skipPresent = true;
if (!UnityIsPaused())
{
UnityRepaint();
// we are not inside repaint so we need to draw second time ourselves
if (_viewIsRotating)
UnityRepaint();
}
_skipPresent = false;
}
}
_shouldRecreateView = NO;
}
@end
@implementation UnityView (Deprecated)
- (void)recreateGLESSurfaceIfNeeded { [self recreateRenderingSurfaceIfNeeded]; }
- (void)recreateGLESSurface { [self recreateRenderingSurface]; }
@end
static Class UnityRenderingView_LayerClassGLES(id self_, SEL _cmd)
{
return [CAEAGLLayer class];
}
static Class UnityRenderingView_LayerClassMTL(id self_, SEL _cmd)
{
return [[NSBundle bundleWithPath: @"/System/Library/Frameworks/QuartzCore.framework"] classNamed: @"CAMetalLayer"];
}
@implementation UnityRenderingView
+ (Class)layerClass
{
return nil;
}
+ (void)InitializeForAPI:(UnityRenderingAPI)api
{
IMP layerClassImpl = 0;
if (api == apiOpenGLES2 || api == apiOpenGLES3)
layerClassImpl = (IMP)UnityRenderingView_LayerClassGLES;
else if (api == apiMetal)
layerClassImpl = (IMP)UnityRenderingView_LayerClassMTL;
class_replaceMethod(object_getClass([UnityRenderingView class]), @selector(layerClass), layerClassImpl, UIView_LayerClass_Enc);
}
@end
void ReportSafeAreaChangeForView(UIView* view)
{
CGRect safeArea = ComputeSafeArea(view);
UnityReportSafeAreaChange(safeArea.origin.x, safeArea.origin.y,
safeArea.size.width, safeArea.size.height);
}
CGRect ComputeSafeArea(UIView* view)
{
CGSize screenSize = view.bounds.size;
CGRect screenRect = CGRectMake(0, 0, screenSize.width, screenSize.height);
UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 0, 0);
#if UNITY_HAS_IOSSDK_11_0 || UNITY_HAS_TVOSSDK_11_0
if (@available(iOS 11.0, tvOS 11.0, *))
insets = [view safeAreaInsets];
#endif
screenRect.origin.x += insets.left;
screenRect.origin.y += insets.bottom; // Unity uses bottom left as the origin
screenRect.size.width -= insets.left + insets.right;
screenRect.size.height -= insets.top + insets.bottom;
float scale = view.contentScaleFactor;
// Truncate safe area size because in some cases (for example when Display zoom is turned on)
// it might become larger than Screen.width/height which are returned as ints.
screenRect.origin.x = (unsigned)(screenRect.origin.x * scale);
screenRect.origin.y = (unsigned)(screenRect.origin.y * scale);
screenRect.size.width = (unsigned)(screenRect.size.width * scale);
screenRect.size.height = (unsigned)(screenRect.size.height * scale);
return screenRect;
}

@ -0,0 +1,40 @@
#pragma once
@interface UnityViewControllerBase (iOS)
- (BOOL)shouldAutorotate;
- (BOOL)prefersStatusBarHidden;
- (UIStatusBarStyle)preferredStatusBarStyle;
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator;
@end
// for better handling of user-imposed screen orientation we will have specific ViewController implementations
// view controllers constrained to one orientation
@interface UnityPortraitOnlyViewController : UnityViewControllerBase
{
}
@end
@interface UnityPortraitUpsideDownOnlyViewController : UnityViewControllerBase
{
}
@end
@interface UnityLandscapeLeftOnlyViewController : UnityViewControllerBase
{
}
@end
@interface UnityLandscapeRightOnlyViewController : UnityViewControllerBase
{
}
@end
// this is default view controller implementation (autorotation enabled)
@interface UnityDefaultViewController : UnityViewControllerBase
{
}
@end
NSUInteger EnabledAutorotationInterfaceOrientations();

@ -0,0 +1,190 @@
#if PLATFORM_IOS
#import "UnityViewControllerBase.h"
#import "UnityAppController.h"
#include "OrientationSupport.h"
#include "Keyboard.h"
#include "UnityView.h"
#include "PluginBase/UnityViewControllerListener.h"
#include "UnityAppController.h"
#include "UnityAppController+ViewHandling.h"
#include "Unity/ObjCRuntime.h"
// when returning from presenting UIViewController we might need to update app orientation to "correct" one, as we wont get rotation notification
@interface UnityAppController ()
- (void)updateAppOrientation:(UIInterfaceOrientation)orientation;
@end
@implementation UnityViewControllerBase (iOS)
- (BOOL)shouldAutorotate
{
return YES;
}
- (BOOL)prefersStatusBarHidden
{
static bool _PrefersStatusBarHidden = true;
static bool _PrefersStatusBarHiddenInited = false;
if (!_PrefersStatusBarHiddenInited)
{
NSNumber* hidden = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"UIStatusBarHidden"];
_PrefersStatusBarHidden = hidden ? [hidden boolValue] : YES;
_PrefersStatusBarHiddenInited = true;
}
return _PrefersStatusBarHidden;
}
- (UIStatusBarStyle)preferredStatusBarStyle
{
static UIStatusBarStyle _PreferredStatusBarStyle = UIStatusBarStyleDefault;
static bool _PreferredStatusBarStyleInited = false;
if (!_PreferredStatusBarStyleInited)
{
NSString* style = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"UIStatusBarStyle"];
if (style && [style isEqualToString: @"UIStatusBarStyleLightContent"])
_PreferredStatusBarStyle = UIStatusBarStyleLightContent;
_PreferredStatusBarStyleInited = true;
}
return _PreferredStatusBarStyle;
}
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
{
UIRectEdge res = UIRectEdgeNone;
if (UnityGetDeferSystemGesturesTopEdge())
res |= UIRectEdgeTop;
if (UnityGetDeferSystemGesturesBottomEdge())
res |= UIRectEdgeBottom;
if (UnityGetDeferSystemGesturesLeftEdge())
res |= UIRectEdgeLeft;
if (UnityGetDeferSystemGesturesRightEdge())
res |= UIRectEdgeRight;
return res;
}
- (BOOL)prefersHomeIndicatorAutoHidden
{
return UnityGetHideHomeButton();
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
ScreenOrientation curOrient = UIViewControllerOrientation(self);
ScreenOrientation newOrient = OrientationAfterTransform(curOrient, [coordinator targetTransform]);
// in case of presentation controller it will take control over orientations
// so to avoid crazy corner cases, make default view controller to ignore "wrong" orientations
// as they will come only in case of presentation view controller and will be reverted anyway
// NB: we still want to pass message to super, we just want to skip unity-specific magic
NSUInteger targetMask = 1 << ConvertToIosScreenOrientation(newOrient);
if (([self supportedInterfaceOrientations] & targetMask) != 0)
{
[UIView setAnimationsEnabled: UnityUseAnimatedAutorotation() ? YES : NO];
[KeyboardDelegate StartReorientation];
[GetAppController() interfaceWillChangeOrientationTo: ConvertToIosScreenOrientation(newOrient)];
[coordinator animateAlongsideTransition: nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self.view setNeedsLayout];
[GetAppController() interfaceDidChangeOrientationFrom: ConvertToIosScreenOrientation(curOrient)];
[KeyboardDelegate FinishReorientation];
[UIView setAnimationsEnabled: YES];
}];
}
[super viewWillTransitionToSize: size withTransitionCoordinator: coordinator];
}
@end
@implementation UnityDefaultViewController
- (NSUInteger)supportedInterfaceOrientations
{
NSAssert(UnityShouldAutorotate(), @"UnityDefaultViewController should be used only if unity is set to autorotate");
return EnabledAutorotationInterfaceOrientations();
}
@end
@implementation UnityPortraitOnlyViewController
- (NSUInteger)supportedInterfaceOrientations
{
return 1 << UIInterfaceOrientationPortrait;
}
- (void)viewWillAppear:(BOOL)animated
{
[GetAppController() updateAppOrientation: UIInterfaceOrientationPortrait];
[super viewWillAppear: animated];
}
@end
@implementation UnityPortraitUpsideDownOnlyViewController
- (NSUInteger)supportedInterfaceOrientations
{
return 1 << UIInterfaceOrientationPortraitUpsideDown;
}
- (void)viewWillAppear:(BOOL)animated
{
[GetAppController() updateAppOrientation: UIInterfaceOrientationPortraitUpsideDown];
[super viewWillAppear: animated];
}
@end
@implementation UnityLandscapeLeftOnlyViewController
- (NSUInteger)supportedInterfaceOrientations
{
return 1 << UIInterfaceOrientationLandscapeLeft;
}
- (void)viewWillAppear:(BOOL)animated
{
[GetAppController() updateAppOrientation: UIInterfaceOrientationLandscapeLeft];
[super viewWillAppear: animated];
}
@end
@implementation UnityLandscapeRightOnlyViewController
- (NSUInteger)supportedInterfaceOrientations
{
return 1 << UIInterfaceOrientationLandscapeRight;
}
- (void)viewWillAppear:(BOOL)animated
{
[GetAppController() updateAppOrientation: UIInterfaceOrientationLandscapeRight];
[super viewWillAppear: animated];
}
@end
NSUInteger EnabledAutorotationInterfaceOrientations()
{
NSUInteger ret = 0;
if (UnityIsOrientationEnabled(portrait))
ret |= (1 << UIInterfaceOrientationPortrait);
if (UnityIsOrientationEnabled(portraitUpsideDown))
ret |= (1 << UIInterfaceOrientationPortraitUpsideDown);
if (UnityIsOrientationEnabled(landscapeLeft))
ret |= (1 << UIInterfaceOrientationLandscapeRight);
if (UnityIsOrientationEnabled(landscapeRight))
ret |= (1 << UIInterfaceOrientationLandscapeLeft);
return ret;
}
#endif // PLATFORM_IOS

@ -0,0 +1,7 @@
#pragma once
//for tvOS we need just one view controller subclass as there is no screen orientation here
@interface UnityDefaultViewController : UnityViewControllerBase
{
}
@end

@ -0,0 +1,9 @@
#if PLATFORM_TVOS
#import "UnityViewControllerBase.h"
#import "UnityAppController.h"
@implementation UnityDefaultViewController
@end
#endif // PLATFORM_TVOS

@ -0,0 +1,27 @@
#pragma once
#import <UIKit/UIKit.h>
#if PLATFORM_IOS
#define UNITY_VIEW_CONTROLLER_BASE_CLASS UIViewController
#elif PLATFORM_TVOS
#import <GameController/GCController.h>
#define UNITY_VIEW_CONTROLLER_BASE_CLASS GCEventViewController
#endif
@interface UnityViewControllerBase : UNITY_VIEW_CONTROLLER_BASE_CLASS
{
}
- (void)viewWillLayoutSubviews;
- (void)viewDidLayoutSubviews;
- (void)viewDidDisappear:(BOOL)animated;
- (void)viewWillDisappear:(BOOL)animated;
- (void)viewDidAppear:(BOOL)animated;
- (void)viewWillAppear:(BOOL)animated;
@end
#if PLATFORM_IOS
#include "UnityViewControllerBase+iOS.h"
#elif PLATFORM_TVOS
#include "UnityViewControllerBase+tvOS.h"
#endif

@ -0,0 +1,44 @@
#import "UnityViewControllerBase.h"
#import "UnityAppController.h"
#import "UnityAppController+ViewHandling.h"
#import "PluginBase/UnityViewControllerListener.h"
@implementation UnityViewControllerBase
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
AppController_SendUnityViewControllerNotification(kUnityViewWillLayoutSubviews);
}
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
AppController_SendUnityViewControllerNotification(kUnityViewDidLayoutSubviews);
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear: animated];
AppController_SendUnityViewControllerNotification(kUnityViewDidDisappear);
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear: animated];
AppController_SendUnityViewControllerNotification(kUnityViewWillDisappear);
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear: animated];
AppController_SendUnityViewControllerNotification(kUnityViewDidAppear);
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear: animated];
AppController_SendUnityViewControllerNotification(kUnityViewWillAppear);
}
@end

@ -0,0 +1,16 @@
#pragma once
enum
{
avCapturePermissionUnknown = 0,
avCapturePermissionGranted = 1,
avCapturePermissionDenied = 2,
};
enum
{
avVideoCapture = 1,
avAudioCapture = 2,
};
extern "C" int UnityGetAVCapturePermission(int captureType);
extern "C" void UnityRequestAVCapturePermission(int captureType);

@ -0,0 +1,45 @@
#include "AVCapture.h"
#include <AVFoundation/AVFoundation.h>
static NSString* MediaTypeFromEnum(int captureType)
{
if (captureType == avAudioCapture)
return AVMediaTypeAudio;
else if (captureType == avVideoCapture)
return AVMediaTypeVideo;
return nil;
}
extern "C" int UnityGetAVCapturePermission(int captureType)
{
NSString* mediaType = MediaTypeFromEnum(captureType);
if (mediaType == nil)
return avCapturePermissionDenied;
#if !PLATFORM_TVOS && (UNITY_USES_WEBCAM || UNITY_USES_MICROPHONE)
NSInteger status = AVAuthorizationStatusAuthorized;
status = [AVCaptureDevice authorizationStatusForMediaType: mediaType];
if (status == AVAuthorizationStatusNotDetermined)
return avCapturePermissionUnknown;
else if (status == AVAuthorizationStatusAuthorized)
return avCapturePermissionGranted;
#endif
return avCapturePermissionDenied;
}
extern "C" void UnityRequestAVCapturePermission(int captureType)
{
#if !PLATFORM_TVOS && (UNITY_USES_WEBCAM || UNITY_USES_MICROPHONE)
NSString* mediaType = MediaTypeFromEnum(captureType);
if (mediaType == nil)
return;
[AVCaptureDevice requestAccessForMediaType: mediaType completionHandler:^(BOOL granted) {
UnityReportAVCapturePermission();
}];
#endif
}

@ -0,0 +1,19 @@
#pragma once
// small helper for getting texture from CMSampleBuffer
typedef struct
CMVideoSampling
{
void* cvTextureCache;
void* cvTextureCacheTexture;
void* cvImageBuffer;
}
CMVideoSampling;
void CMVideoSampling_Initialize(CMVideoSampling* sampling);
void CMVideoSampling_Uninitialize(CMVideoSampling* sampling);
intptr_t CMVideoSampling_ImageBuffer(CMVideoSampling* sampling, CVImageBufferRef buffer, size_t* w, size_t* h);
intptr_t CMVideoSampling_SampleBuffer(CMVideoSampling* sampling, void* buffer, size_t* w, size_t* h); // buffer is CMSampleBufferRef
intptr_t CMVideoSampling_LastSampledTexture(CMVideoSampling* sampling);

@ -0,0 +1,96 @@
#include "CMVideoSampling.h"
#include "CVTextureCache.h"
#include "GlesHelper.h"
#include <OpenGLES/ES3/glext.h>
#include <AVFoundation/AVFoundation.h>
void CMVideoSampling_Initialize(CMVideoSampling* sampling)
{
::memset(sampling, 0x00, sizeof(CMVideoSampling));
sampling->cvTextureCache = CreateCVTextureCache();
}
void CMVideoSampling_Uninitialize(CMVideoSampling* sampling)
{
if (sampling->cvImageBuffer)
{
CFRelease(sampling->cvImageBuffer);
sampling->cvImageBuffer = 0;
}
if (sampling->cvTextureCacheTexture)
{
CFRelease(sampling->cvTextureCacheTexture);
sampling->cvTextureCacheTexture = 0;
}
if (sampling->cvTextureCache)
{
CFRelease(sampling->cvTextureCache);
sampling->cvTextureCache = 0;
}
}
intptr_t CMVideoSampling_ImageBuffer(CMVideoSampling* sampling, CVImageBufferRef buffer, size_t* w, size_t* h)
{
intptr_t retTex = 0;
if (sampling->cvImageBuffer)
CFRelease(sampling->cvImageBuffer);
sampling->cvImageBuffer = buffer;
CFRetain(sampling->cvImageBuffer);
*w = CVPixelBufferGetWidth((CVImageBufferRef)sampling->cvImageBuffer);
*h = CVPixelBufferGetHeight((CVImageBufferRef)sampling->cvImageBuffer);
if (sampling->cvTextureCacheTexture)
{
CFRelease(sampling->cvTextureCacheTexture);
FlushCVTextureCache(sampling->cvTextureCache);
sampling->cvTextureCacheTexture = nil;
}
OSType pixelFormat = CVPixelBufferGetPixelFormatType(buffer);
switch (pixelFormat)
{
case kCVPixelFormatType_32BGRA:
sampling->cvTextureCacheTexture = CreateBGRA32TextureFromCVTextureCache(sampling->cvTextureCache, sampling->cvImageBuffer, *w, *h);
break;
#if UNITY_HAS_IOSSDK_11_0
case kCVPixelFormatType_DepthFloat16:
sampling->cvTextureCacheTexture = CreateHalfFloatTextureFromCVTextureCache(sampling->cvTextureCache, sampling->cvImageBuffer, *w, *h);
break;
#endif
default:
#define FourCC2Str(fourcc) (const char[]){*(((char*)&fourcc)+3), *(((char*)&fourcc)+2), *(((char*)&fourcc)+1), *(((char*)&fourcc)+0),0}
::printf("CMVideoSampling_SampleBuffer: unexpected pixel format \'%s\'\n", FourCC2Str(pixelFormat));
break;
}
if (sampling->cvTextureCacheTexture)
retTex = GetTextureFromCVTextureCache(sampling->cvTextureCacheTexture);
if (UnitySelectedRenderingAPI() == apiOpenGLES2 || UnitySelectedRenderingAPI() == apiOpenGLES3)
{
GLint oldTexBinding = 0;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexBinding);
glBindTexture(GL_TEXTURE_2D, (GLuint)retTex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindTexture(GL_TEXTURE_2D, oldTexBinding);
}
return retTex;
}
intptr_t CMVideoSampling_SampleBuffer(CMVideoSampling* sampling, void* buffer, size_t* w, size_t* h)
{
return CMVideoSampling_ImageBuffer(sampling, CMSampleBufferGetImageBuffer((CMSampleBufferRef)buffer), w, h);
}
intptr_t CMVideoSampling_LastSampledTexture(CMVideoSampling* sampling)
{
return GetTextureFromCVTextureCache(sampling->cvTextureCacheTexture);
}

@ -0,0 +1,35 @@
#pragma once
// depending on selected rendering api it will be or GLES or Metal texture cache
// returns CVOpenGLESTextureCacheRef/CVMetalTextureCacheRef
void* CreateCVTextureCache();
// cache = CVOpenGLESTextureCacheRef/CVMetalTextureCacheRef
void FlushCVTextureCache(void* cache);
// returns CVOpenGLESTextureRef/CVMetalTextureRef
// cache = CVOpenGLESTextureCacheRef/CVMetalTextureCacheRef
// image = CVImageBufferRef/CVPixelBufferRef
void* CreateBGRA32TextureFromCVTextureCache(void* cache, void* image, size_t w, size_t h);
void* CreateHalfFloatTextureFromCVTextureCache(void* cache, void* image, size_t w, size_t h);
// texture = CVOpenGLESTextureRef
unsigned GetGLTextureFromCVTextureCache(void* texture);
// texture = CVMetalTextureRef
MTLTextureRef GetMetalTextureFromCVTextureCache(void* texture);
// texture = CVOpenGLESTextureRef/CVMetalTextureRef
uintptr_t GetTextureFromCVTextureCache(void* texture);
// returns CVPixelBufferRef
// enforces kCVPixelFormatType_32BGRA
void* CreatePixelBufferForCVTextureCache(size_t w, size_t h);
// returns CVOpenGLESTextureRef
// cache = CVOpenGLESTextureCacheRef
// pb = CVPixelBufferRef (out)
// enforces rgba texture with bgra backing
void* CreateReadableRTFromCVTextureCache(void* cache, size_t w, size_t h, void** pb);
// texture = CVOpenGLESTextureRef/CVMetalTextureRef
int IsCVTextureFlipped(void* texture);

@ -0,0 +1,164 @@
#include "CVTextureCache.h"
#include "DisplayManager.h"
#include <OpenGLES/ES2/glext.h>
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
#include <CoreVideo/CVOpenGLESTextureCache.h>
#include "UnityMetalSupport.h"
#if UNITY_CAN_USE_METAL
#include <CoreVideo/CVMetalTextureCache.h>
#else
const CFStringRef kCVPixelBufferMetalCompatibilityKey = CFSTR("MetalCompatibility");
typedef void* CVMetalTextureCacheRef;
typedef void* CVMetalTextureRef;
inline CVReturn CVMetalTextureCacheCreate(CFAllocatorRef, CFDictionaryRef, MTLDeviceRef, CFDictionaryRef, CVMetalTextureCacheRef*) { return 0; }
inline CVReturn CVMetalTextureCacheCreateTextureFromImage(CFAllocatorRef, CVMetalTextureCacheRef, CVImageBufferRef, CFDictionaryRef, MTLPixelFormat, size_t, size_t, size_t, CVMetalTextureRef*) { return 0; }
inline void CVMetalTextureCacheFlush(CVMetalTextureCacheRef, uint64_t options) {}
inline MTLTextureRef CVMetalTextureGetTexture(CVMetalTextureRef) { return nil; }
inline Boolean CVMetalTextureIsFlipped(CVMetalTextureRef) { return 0; }
#endif
void* CreateCVTextureCache()
{
void* ret = 0;
CVReturn err = 0;
if (UnitySelectedRenderingAPI() == apiMetal)
err = CVMetalTextureCacheCreate(kCFAllocatorDefault, 0, UnityGetMetalDevice(), 0, (CVMetalTextureCacheRef*)&ret);
else
err = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, 0, UnityGetMainScreenContextGLES(), 0, (CVOpenGLESTextureCacheRef*)&ret);
if (err)
{
::printf("Error at CVOpenGLESTextureCacheCreate: %d", err);
ret = 0;
}
return ret;
}
void FlushCVTextureCache(void* cache)
{
if (UnitySelectedRenderingAPI() == apiMetal)
CVMetalTextureCacheFlush((CVMetalTextureCacheRef)cache, 0);
else
CVOpenGLESTextureCacheFlush((CVOpenGLESTextureCacheRef)cache, 0);
}
void* CreateBGRA32TextureFromCVTextureCache(void* cache, void* image, size_t w, size_t h)
{
void* texture = 0;
CVReturn err = 0;
if (UnitySelectedRenderingAPI() == apiMetal)
{
err = CVMetalTextureCacheCreateTextureFromImage(
kCFAllocatorDefault, (CVMetalTextureCacheRef)cache, (CVImageBufferRef)image, 0,
(MTLPixelFormat)((UnityDisplaySurfaceMTL*)GetMainDisplaySurface())->colorFormat, w, h, 0, (CVMetalTextureRef*)&texture
);
}
else
{
err = CVOpenGLESTextureCacheCreateTextureFromImage(
kCFAllocatorDefault, (CVOpenGLESTextureCacheRef)cache, (CVImageBufferRef)image, 0,
GL_TEXTURE_2D, GL_RGBA, (GLsizei)w, (GLsizei)h, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
0, (CVOpenGLESTextureRef*)&texture
);
}
if (err)
{
::printf("Error at CVOpenGLESTextureCacheCreateTextureFromImage: %d\n", err);
texture = 0;
}
return texture;
}
void* CreateHalfFloatTextureFromCVTextureCache(void* cache, void* image, size_t w, size_t h)
{
void* texture = 0;
CVReturn err = 0;
if (UnitySelectedRenderingAPI() == apiMetal)
{
err = CVMetalTextureCacheCreateTextureFromImage(
kCFAllocatorDefault, (CVMetalTextureCacheRef)cache, (CVImageBufferRef)image, 0,
MTLPixelFormatR16Float, w, h, 0, (CVMetalTextureRef*)&texture
);
}
else if (UnitySelectedRenderingAPI() == apiOpenGLES3)
{
err = CVOpenGLESTextureCacheCreateTextureFromImage(
kCFAllocatorDefault, (CVOpenGLESTextureCacheRef)cache, (CVImageBufferRef)image, 0,
GL_TEXTURE_2D, GL_R16F, (GLsizei)w, (GLsizei)h, GL_RED, GL_HALF_FLOAT,
0, (CVOpenGLESTextureRef*)&texture
);
}
else // OpenGLES2
{
err = CVOpenGLESTextureCacheCreateTextureFromImage(
kCFAllocatorDefault, (CVOpenGLESTextureCacheRef)cache, (CVImageBufferRef)image, 0,
GL_TEXTURE_2D, GL_RED_EXT, (GLsizei)w, (GLsizei)h, GL_RED_EXT, GL_HALF_FLOAT_OES,
0, (CVOpenGLESTextureRef*)&texture
);
}
if (err)
{
::printf("Error at CVOpenGLESTextureCacheCreateTextureFromImage: %d\n", err);
texture = 0;
}
return texture;
}
unsigned GetGLTextureFromCVTextureCache(void* texture)
{
assert(UnitySelectedRenderingAPI() != apiMetal);
return CVOpenGLESTextureGetName((CVOpenGLESTextureRef)texture);
}
id<MTLTexture> GetMetalTextureFromCVTextureCache(void* texture)
{
assert(UnitySelectedRenderingAPI() == apiMetal);
return CVMetalTextureGetTexture((CVMetalTextureRef)texture);
}
uintptr_t GetTextureFromCVTextureCache(void* texture)
{
if (UnitySelectedRenderingAPI() == apiMetal)
return (uintptr_t)(__bridge void*)GetMetalTextureFromCVTextureCache(texture);
else
return (uintptr_t)GetGLTextureFromCVTextureCache(texture);
}
void* CreatePixelBufferForCVTextureCache(size_t w, size_t h)
{
NSString* apiKey = UnitySelectedRenderingAPI() == apiMetal ? (__bridge NSString*)kCVPixelBufferMetalCompatibilityKey
: (__bridge NSString*)kCVPixelBufferOpenGLESCompatibilityKey;
CVPixelBufferRef pb = 0;
NSDictionary* options = @{ (__bridge NSString*)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA),
(__bridge NSString*)kCVPixelBufferWidthKey: @(w),
(__bridge NSString*)kCVPixelBufferHeightKey: @(h),
apiKey: @(YES),
(__bridge NSString*)kCVPixelBufferIOSurfacePropertiesKey: @{}};
CVPixelBufferCreate(kCFAllocatorDefault, w, h, kCVPixelFormatType_32BGRA, (__bridge CFDictionaryRef)options, &pb);
return pb;
}
void* CreateReadableRTFromCVTextureCache(void* cache, size_t w, size_t h, void** pb)
{
*pb = CreatePixelBufferForCVTextureCache(w, h);
return CreateBGRA32TextureFromCVTextureCache(cache, *pb, w, h);
}
int IsCVTextureFlipped(void* texture)
{
if (UnitySelectedRenderingAPI() == apiMetal)
return CVMetalTextureIsFlipped((CVMetalTextureRef)texture);
else
return CVOpenGLESTextureIsFlipped((CVOpenGLESTextureRef)texture);
}

@ -0,0 +1,74 @@
#pragma once
#import <AVFoundation/AVFoundation.h>
#if UNITY_HAS_IOSSDK_11_0
#define UNITY_HAS_COLORANDDEPTH_CAMERA 1
#else
#define UNITY_HAS_COLORANDDEPTH_CAMERA 0
#endif
@interface CameraCaptureController : NSObject<AVCaptureVideoDataOutputSampleBufferDelegate
#if UNITY_HAS_COLORANDDEPTH_CAMERA
, AVCaptureDataOutputSynchronizerDelegate
#endif
>
- (bool)initCapture:(AVCaptureDevice*)device;
- (bool)initCapture:(AVCaptureDevice*)device preset:(NSString*)preset fps:(float)fps;
- (void)setCaptureFPS:(float)fps;
#if UNITY_HAS_COLORANDDEPTH_CAMERA
- (bool)initColorAndDepthCameraCapture:(AVCaptureDevice*)device preset:(NSString*)preset fps:(float)fps isDepth:(bool)isDepth;
- (void)initColorAndDepthCameraCaptureSession;
- (void)clearColorAndDepthCameraCaptureSession;
- (void)captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection;
- (void)depthDataOutput:(AVCaptureDepthDataOutput*)captureDepthOutput didOutputDepthData:(AVDepthData*)depthData timestamp:(CMTime)timestamp connection:(AVCaptureConnection*)connection;
- (void)dataOutputSynchronizer:(AVCaptureDataOutputSynchronizer *)synchronizer didOutputSynchronizedDataCollection:(AVCaptureSynchronizedDataCollection *)synchronizedDataCollection;
+ (NSMutableArray<CameraCaptureController*>*)getActiveColorAndDepthCameraControllers;
+ (void)addColorAndDepthCameraController:(CameraCaptureController*)controller;
+ (void)removeColorAndDepthCameraController:(CameraCaptureController*)controller;
+ (void)clearColorAndDepthCameraControllers;
+ (CameraCaptureController*)findColorAndDepthCameraController:(AVCaptureDevice*)device isDepth:(bool)isDepth;
#endif
- (void)capturePixelBufferToMemBuffer:(uint8_t*)dst;
- (int)isCVTextureFlipped;
+ (BOOL)focusPointSupported:(AVCaptureDevice*)captureDevice withFocusMode:(AVCaptureFocusMode)focusMode;
- (int)setFocusPointWithX:(float)x Y:(float)y;
- (int)setFocusPoint;
- (void)start;
- (void)pause;
- (void)stop;
@property (nonatomic, retain) AVCaptureDevice* captureDevice;
@property (nonatomic, retain) AVCaptureSession* captureSession;
@property (nonatomic, retain) AVCaptureDeviceInput* captureInput;
@property (nonatomic, retain) AVCaptureVideoDataOutput* captureOutput;
#if UNITY_HAS_COLORANDDEPTH_CAMERA
@property (nonatomic, retain) AVCaptureDepthDataOutput* captureDepthOutput;
@property (nonatomic, retain) AVCaptureDataOutputSynchronizer* captureSynchronizer;
#endif
- (float)pickAvailableFrameRate:(float)fps;
@end
enum WebCamKind
{
kWebCamWideAngle = 1,
kWebCamTelephoto = 2,
kWebCamColorAndDepth = 3,
};
@interface CameraCaptureDevice : NSObject
- (bool)isColorAndDepthCaptureDevice;
- (WebCamKind)getKind;
- (void)fillCaptureDeviceResolutions;
- (NSString*)pickPresetFromWidth:(int)w height:(int)h;
- (bool)initCaptureForController:(CameraCaptureController*)controller width:(int)w height:(int)h fps:(float)fps isDepth:(bool)isDepth;
+ (bool)initialized;
+ (void)createCameraCaptureDevicesArray;
+ (void)addCameraCaptureDevice:(AVCaptureDevice*)device;
@end

@ -0,0 +1,773 @@
#if !PLATFORM_TVOS && UNITY_USES_WEBCAM
#include "CameraCapture.h"
#include "AVCapture.h"
#include "CMVideoSampling.h"
#include "CVTextureCache.h"
#import <CoreVideo/CoreVideo.h>
#include <cmath>
#if UNITY_HAS_COLORANDDEPTH_CAMERA
static NSMutableArray<CameraCaptureController*> *activeColorAndDepthCameraControllers = nil;
#endif
@implementation CameraCaptureController
{
AVCaptureDevice* _captureDevice;
AVCaptureSession* _captureSession;
AVCaptureDeviceInput* _captureInput;
AVCaptureVideoDataOutput* _captureOutput;
#if UNITY_HAS_COLORANDDEPTH_CAMERA
AVCaptureDepthDataOutput* _captureDepthOutput;
AVCaptureDataOutputSynchronizer* _captureSynchronizer;
@public bool _isDepth;
#endif
uint8_t* _pixelBufferCopy;
CMVideoSampling _cmVideoSampling;
NSString* _preset;
CGPoint _focusPoint;
AVCaptureFocusMode _focusMode;
@public void* _userData;
@public size_t _width, _height;
}
- (bool)initCapture:(AVCaptureDevice*)device
{
if (UnityGetAVCapturePermission(avVideoCapture) == avCapturePermissionDenied)
return false;
self.captureDevice = device;
self.captureInput = [AVCaptureDeviceInput deviceInputWithDevice: device error: nil];
self.captureOutput = [[AVCaptureVideoDataOutput alloc] init];
if (self.captureOutput == nil || self.captureInput == nil)
return false;
self.captureOutput.alwaysDiscardsLateVideoFrames = YES;
NSDictionary* options = @{ (NSString*)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) };
[self.captureOutput setVideoSettings: options];
CMVideoSampling_Initialize(&self->_cmVideoSampling);
_width = _height = 0;
_focusPoint = CGPointMake(0.5, 0.5); // default focus point is center
_focusMode = AVCaptureFocusModeContinuousAutoFocus;
_pixelBufferCopy = nullptr;
return true;
}
- (void)setCaptureFPS:(float)fps
{
if ([self.captureDevice lockForConfiguration: nil])
{
if (self.captureDevice.activeFormat)
{
fps = [self pickAvailableFrameRate: fps];
self.captureDevice.activeVideoMinFrameDuration = CMTimeMake(1, fps);
self.captureDevice.activeVideoMaxFrameDuration = CMTimeMake(1, fps);
}
else
{
// In some corner cases (seeing this on iPod iOS 6.1.5) activeFormat is null.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
self.captureOutput.minFrameDuration = CMTimeMake(1, fps);
#pragma clang diagnostic pop
}
[self.captureDevice unlockForConfiguration];
}
}
- (bool)initCapture:(AVCaptureDevice*)device preset:(NSString*)preset fps:(float)fps
{
if (![self initCapture: device])
return false;
self.captureSession = [[AVCaptureSession alloc] init];
[self.captureSession addInput: self.captureInput];
[self.captureSession addOutput: self.captureOutput];
// queue on main thread to simplify gles life
[self.captureOutput setSampleBufferDelegate: self queue: dispatch_get_main_queue()];
self->_preset = preset;
[self.captureSession setSessionPreset: preset];
[self setCaptureFPS: fps];
return true;
}
- (void)captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection
{
intptr_t tex = (intptr_t)CMVideoSampling_SampleBuffer(&self->_cmVideoSampling, sampleBuffer, &_width, &_height);
UnityDidCaptureVideoFrame(tex, self->_userData);
}
- (void)capturePixelBufferToMemBuffer:(uint8_t*)dst
{
CVPixelBufferRef pbuf = (CVPixelBufferRef)self->_cmVideoSampling.cvImageBuffer;
const size_t srcRowSize = CVPixelBufferGetBytesPerRow(pbuf);
const size_t bufSize = srcRowSize * self->_height;
if (self->_pixelBufferCopy == nullptr)
{
self->_pixelBufferCopy = (uint8_t*)::malloc(bufSize);
}
// while not the best way memory-wise, we want to minimize stalling
CVPixelBufferLockBaseAddress(pbuf, kCVPixelBufferLock_ReadOnly);
{
::memcpy(self->_pixelBufferCopy, CVPixelBufferGetBaseAddress(pbuf), bufSize);
}
CVPixelBufferUnlockBaseAddress(pbuf, kCVPixelBufferLock_ReadOnly);
OSType pixelFormat = CVPixelBufferGetPixelFormatType(pbuf);
size_t bpp = 0;
switch (pixelFormat)
{
case kCVPixelFormatType_32BGRA:
bpp = 4;
break;
#if UNITY_HAS_IOSSDK_11_0
case kCVPixelFormatType_DepthFloat16:
bpp = 2;
break;
#endif
default:
assert(false);
break;
}
const size_t dstRowSize = self->_width * bpp;
uint8_t* src = self->_pixelBufferCopy + (self->_height - 1) * srcRowSize;
for (size_t i = 0; i < self->_height; ++i)
{
::memcpy(dst, src, dstRowSize);
dst += dstRowSize;
src -= srcRowSize;
}
}
- (int)isCVTextureFlipped
{
return IsCVTextureFlipped(self->_cmVideoSampling.cvTextureCacheTexture);
}
+ (BOOL)focusPointSupported:(AVCaptureDevice*)captureDevice withFocusMode:(AVCaptureFocusMode)focusMode
{
return captureDevice.focusPointOfInterestSupported && [captureDevice isFocusModeSupported: focusMode];
}
- (int)setFocusPointWithX:(float)x Y:(float)y
{
if (x < 0 || x > 1 || y < 0 || y > 1)
{
_focusPoint = CGPointMake(0.5, 0.5); // default value for iOS
_focusMode = AVCaptureFocusModeContinuousAutoFocus;
}
else
{
_focusPoint = CGPointMake(x, 1.0 - y);
_focusMode = AVCaptureFocusModeAutoFocus;
}
return [self setFocusPoint];
}
- (int)setFocusPoint
{
if (self.captureDevice != nil && [CameraCaptureController focusPointSupported: self.captureDevice withFocusMode: _focusMode])
{
if ([self.captureDevice lockForConfiguration: nil])
{
self.captureDevice.focusPointOfInterest = _focusPoint;
self.captureDevice.focusMode = _focusMode;
[self.captureDevice unlockForConfiguration];
return 1;
}
}
return 0;
}
#if UNITY_HAS_COLORANDDEPTH_CAMERA
+ (NSMutableArray<CameraCaptureController*>*)getActiveColorAndDepthCameraControllers
{
if (activeColorAndDepthCameraControllers == nil)
{
activeColorAndDepthCameraControllers = [[NSMutableArray alloc] init];
}
return activeColorAndDepthCameraControllers;
}
+ (void)addColorAndDepthCameraController:(CameraCaptureController*)controller
{
CameraCaptureController* prevController = [self findColorAndDepthCameraController: controller.captureDevice isDepth: controller->_isDepth];
if (prevController != nil)
[prevController pause];
CameraCaptureController* otherController = [self findColorAndDepthCameraController: controller.captureDevice isDepth: !controller->_isDepth];
if (otherController != nil)
{
[otherController.captureSession stopRunning];
[otherController clearColorAndDepthCameraCaptureSession];
}
[[self getActiveColorAndDepthCameraControllers] addObject: controller];
}
+ (void)removeColorAndDepthCameraController:(CameraCaptureController*)controller
{
[[self getActiveColorAndDepthCameraControllers] removeObject: controller];
CameraCaptureController* otherController = [self findColorAndDepthCameraController: controller.captureDevice isDepth: !controller->_isDepth];
if (otherController != nil)
{
[otherController initColorAndDepthCameraCaptureSession];
[otherController.captureSession startRunning];
}
}
+ (void)clearColorAndDepthCameraControllers
{
NSMutableArray<CameraCaptureController*>* activeColorAndDepthCameraControllers = [self getActiveColorAndDepthCameraControllers];
for (CameraCaptureController *controller in activeColorAndDepthCameraControllers)
{
if (controller.captureSession != nil)
{
[controller.captureSession stopRunning];
[controller clearColorAndDepthCameraCaptureSession];
}
}
[activeColorAndDepthCameraControllers removeAllObjects];
}
+ (CameraCaptureController*)findColorAndDepthCameraController:(AVCaptureDevice*)device isDepth:(bool)isDepth
{
for (CameraCaptureController *controller in [self getActiveColorAndDepthCameraControllers])
{
if (controller.captureDevice == device && controller->_isDepth == isDepth)
return controller;
}
return nil;
}
- (bool)initColorAndDepthCameraCapture:(AVCaptureDevice*)device preset:(NSString*)preset fps:(float)fps isDepth:(bool)isDepth
{
if (!UnityiOS110orNewer())
return false;
if (![self initCapture: device])
return false;
self.captureDepthOutput = [[AVCaptureDepthDataOutput alloc] init];
if (self.captureDepthOutput == nil)
return false;
self.captureDepthOutput.filteringEnabled = YES; // getting filtered depth data to avoid invalid values
self.captureDepthOutput.alwaysDiscardsLateDepthData = YES;
self->_preset = preset;
[self initColorAndDepthCameraCaptureSession];
[self setCaptureFPS: fps];
NSArray<AVCaptureOutput*> *outputs = [NSArray arrayWithObjects: self.captureOutput, self.captureDepthOutput, nil];
self.captureSynchronizer = [[AVCaptureDataOutputSynchronizer alloc] initWithDataOutputs: outputs];
// queue on main thread to simplify gles life
[self.captureSynchronizer setDelegate: self queue: dispatch_get_main_queue()];
_isDepth = isDepth;
return true;
}
- (void)initColorAndDepthCameraCaptureSession
{
if (!UnityiOS110orNewer())
return;
self.captureSession = [[AVCaptureSession alloc] init];
[self.captureSession setSessionPreset: self->_preset];
[self.captureSession addInput: self.captureInput];
[self.captureSession addOutput: self.captureOutput];
[self.captureSession addOutput: self.captureDepthOutput];
}
- (void)clearColorAndDepthCameraCaptureSession
{
if (!UnityiOS110orNewer())
return;
[self.captureSession removeInput: self.captureInput];
[self.captureSession removeOutput: self.captureOutput];
[self.captureSession removeOutput: self.captureDepthOutput];
self.captureSession = nil;
}
- (void)dataOutputSynchronizer:(AVCaptureDataOutputSynchronizer *)synchronizer didOutputSynchronizedDataCollection:(AVCaptureSynchronizedDataCollection *)synchronizedDataCollection
{
AVCaptureSynchronizedSampleBufferData *sampleData = (AVCaptureSynchronizedSampleBufferData*)[synchronizedDataCollection synchronizedDataForCaptureOutput: self.captureOutput];
if (CMSampleBufferGetImageBuffer(sampleData.sampleBuffer) != nil)
{
CameraCaptureController* colorController = !self->_isDepth ? self : [CameraCaptureController findColorAndDepthCameraController: self.captureDevice isDepth: false];
if (colorController != nil)
{
intptr_t tex = (intptr_t)CMVideoSampling_SampleBuffer(&colorController->_cmVideoSampling, sampleData.sampleBuffer, &(colorController->_width), &(colorController->_height));
UnityDidCaptureVideoFrame(tex, colorController->_userData);
}
}
AVCaptureSynchronizedDepthData *depthData = (AVCaptureSynchronizedDepthData*)[synchronizedDataCollection synchronizedDataForCaptureOutput: self.captureDepthOutput];
if (depthData.depthData.depthDataMap != nil)
{
CameraCaptureController* depthController = self->_isDepth ? self : [CameraCaptureController findColorAndDepthCameraController: self.captureDevice isDepth: true];
if (depthController != nil)
{
intptr_t tex = (intptr_t)CMVideoSampling_ImageBuffer(&depthController->_cmVideoSampling, [depthData.depthData depthDataByConvertingToDepthDataType: kCVPixelFormatType_DepthFloat16].depthDataMap, &(depthController->_width), &(depthController->_height));
UnityDidCaptureVideoFrame(tex, depthController->_userData);
}
}
}
#endif
- (void)start
{
#if UNITY_HAS_COLORANDDEPTH_CAMERA
if (self.captureDepthOutput != nil)
{
[CameraCaptureController addColorAndDepthCameraController: self];
}
else
{
[CameraCaptureController clearColorAndDepthCameraControllers];
}
#endif
[self.captureSession startRunning];
}
- (void)pause
{
[self.captureSession stopRunning];
#if UNITY_HAS_COLORANDDEPTH_CAMERA
if (self.captureDepthOutput != nil)
{
[CameraCaptureController removeColorAndDepthCameraController: self];
}
#endif
}
- (void)stop
{
[self.captureSession stopRunning];
[self.captureSession removeInput: self.captureInput];
[self.captureSession removeOutput: self.captureOutput];
self.captureInput = nil;
self.captureOutput = nil;
#if UNITY_HAS_COLORANDDEPTH_CAMERA
if (self.captureDepthOutput != nil)
{
self.captureSynchronizer = nil;
[self.captureSession removeOutput: self.captureDepthOutput];
self.captureDepthOutput = nil;
[CameraCaptureController removeColorAndDepthCameraController: self];
}
#endif
self.captureDevice = nil;
self.captureSession = nil;
if (self->_pixelBufferCopy != nullptr)
{
::free(self->_pixelBufferCopy);
self->_pixelBufferCopy = nullptr;
}
CMVideoSampling_Uninitialize(&self->_cmVideoSampling);
}
- (float)pickAvailableFrameRate:(float)fps
{
AVFrameRateRange* bestRange = nil;
float minDiff = INFINITY;
float epsilon = 0.1;
fps = fps > epsilon ? fps : 24;
for (AVFrameRateRange* rate in self.captureDevice.activeFormat.videoSupportedFrameRateRanges)
{
if (fps + epsilon > rate.minFrameRate && fps - epsilon < rate.maxFrameRate)
return fps;
else
{
float diff = ::fmin(::fabs(fps - rate.minFrameRate), ::fabs(fps - rate.maxFrameRate));
if (diff < minDiff)
{
minDiff = diff;
bestRange = rate;
}
}
}
return fps > bestRange.maxFrameRate ? bestRange.maxFrameRate : bestRange.minFrameRate;
}
@synthesize captureDevice = _captureDevice;
@synthesize captureSession = _captureSession;
@synthesize captureOutput = _captureOutput;
@synthesize captureInput = _captureInput;
#if UNITY_HAS_COLORANDDEPTH_CAMERA
@synthesize captureDepthOutput = _captureDepthOutput;
@synthesize captureSynchronizer = _captureSynchronizer;
#endif
@end
#if UNITY_HAS_COLORANDDEPTH_CAMERA
// Preset for getting depth data with max resolution available
static NSString* const depthCaptureSessionPreset = AVCaptureSessionPresetPhoto;
#endif
static NSMutableArray<CameraCaptureDevice*> *videoCaptureDevices = nil;
@implementation CameraCaptureDevice
{
@public AVCaptureDevice* _device;
@public int _frontFacing;
@public int _autoFocusPointSupported;
@public WebCamKind _kind;
@public NSMutableArray<NSValue*>* _resolutions;
NSMutableArray<NSString*>* _resPresets;
}
- (bool)isColorAndDepthCaptureDevice
{
#if UNITY_HAS_COLORANDDEPTH_CAMERA
if (UnityiOS110orNewer())
{
for (AVCaptureDeviceFormat *format in [self->_device formats])
{
if ([format supportedDepthDataFormats].count > 0)
return true;
}
}
#endif
return false;
}
- (WebCamKind)getKind
{
if ([self->_device.localizedName containsString: @"Telephoto"])
return kWebCamTelephoto;
if ([self->_device.localizedName containsString: @"Dual"] && [self isColorAndDepthCaptureDevice])
return kWebCamColorAndDepth;
if ([self->_device.localizedName containsString: @"TrueDepth"] && [self isColorAndDepthCaptureDevice])
return kWebCamColorAndDepth;
return kWebCamWideAngle;
}
- (void)fillCaptureDeviceResolutions
{
static NSString* preset[] =
{
AVCaptureSessionPresetLow, // usually 192x144
AVCaptureSessionPreset352x288,
AVCaptureSessionPresetMedium, // usually 480x320
AVCaptureSessionPreset640x480,
AVCaptureSessionPreset1280x720,
AVCaptureSessionPreset1920x1080, // usually the same as AVCaptureSessionPresetHigh
AVCaptureSessionPreset3840x2160,
};
const int count = sizeof(preset) / sizeof(preset[0]);
self->_resolutions = [NSMutableArray arrayWithCapacity: count];
self->_resPresets = [NSMutableArray arrayWithCapacity: count];
AVCaptureInput* captureInput = [AVCaptureDeviceInput deviceInputWithDevice: self->_device error: nil];
AVCaptureSession* captureSession = [[AVCaptureSession alloc] init];
[captureSession addInput: captureInput];
#if UNITY_HAS_COLORANDDEPTH_CAMERA
if (self->_kind == kWebCamColorAndDepth)
{
AVCaptureDepthDataOutput* captureDepthOutput = [[AVCaptureDepthDataOutput alloc] init];
if ([captureSession canSetSessionPreset: depthCaptureSessionPreset])
{
[captureSession setSessionPreset: AVCaptureSessionPresetPhoto];
[captureSession addOutput: captureDepthOutput];
CMVideoDimensions dim = CMVideoFormatDescriptionGetDimensions(self->_device.activeDepthDataFormat.formatDescription); // for ColorAndDepth camera return depth buffer resolution
[self->_resolutions addObject: [NSValue valueWithCGSize: CGSizeMake(dim.width, dim.height)]];
[self->_resPresets addObject: AVCaptureSessionPresetPhoto];
}
}
else
#endif
{
for (int i = 0; i < count; ++i)
{
if ([captureSession canSetSessionPreset: preset[i]])
{
[captureSession setSessionPreset: preset[i]];
CMVideoDimensions dim = CMVideoFormatDescriptionGetDimensions(self->_device.activeFormat.formatDescription);
[self->_resolutions addObject: [NSValue valueWithCGSize: CGSizeMake(dim.width, dim.height)]];
[self->_resPresets addObject: preset[i]];
}
}
}
}
- (NSString*)pickPresetFromWidth:(int)w height:(int)h
{
#if UNITY_HAS_COLORANDDEPTH_CAMERA
if (self->_kind == kWebCamColorAndDepth)
{
return depthCaptureSessionPreset;
}
#endif
int requestedWidth = w > 0 ? w : 640;
int requestedHeight = h > 0 ? h : 480;
if (requestedHeight > requestedWidth) // hardware camera frame is landscape oriented
std::swap(requestedWidth, requestedHeight);
NSInteger ret = -1;
double bestMatch = std::numeric_limits<double>::max();
for (NSInteger i = 0, n = [_resolutions count]; i < n; ++i)
{
double width = [self->_resolutions[i] CGSizeValue].width;
double height = [self->_resolutions[i] CGSizeValue].height;
double match = std::abs(std::log(requestedWidth / width)) + std::abs(std::log(requestedHeight / height));
if (match < bestMatch)
{
ret = i;
bestMatch = match;
}
}
NSAssert(ret != -1, @"Cannot pick capture preset");
return ret != -1 ? self->_resPresets[ret] : AVCaptureSessionPresetHigh;
}
- (CameraCaptureDevice*)initWithDevice:(AVCaptureDevice*)device
{
self->_device = device;
self->_frontFacing = device.position == AVCaptureDevicePositionFront ? 1 : 0;
self->_autoFocusPointSupported = [CameraCaptureController focusPointSupported: device withFocusMode: AVCaptureFocusModeAutoFocus] ? 1 : 0;
self->_kind = [self getKind];
[self fillCaptureDeviceResolutions];
return self;
}
- (bool)initCaptureForController:(CameraCaptureController*)controller width:(int)w height:(int)h fps:(float)fps isDepth:(bool)isDepth
{
bool initResult = false;
NSString *preset = [self pickPresetFromWidth: w height: h];
#if UNITY_HAS_COLORANDDEPTH_CAMERA
if (UnityiOS110orNewer() && [self isColorAndDepthCaptureDevice])
{
initResult = [controller initColorAndDepthCameraCapture: self->_device preset: preset fps: fps isDepth: isDepth];
}
else
#endif
{
assert(!isDepth);
initResult = [controller initCapture: self->_device preset: preset fps: fps];
}
return initResult;
}
+ (bool)initialized
{
return videoCaptureDevices != nil;
}
+ (void)createCameraCaptureDevicesArray
{
videoCaptureDevices = [NSMutableArray arrayWithCapacity: 2];
}
+ (void)addCameraCaptureDevice:(AVCaptureDevice*)device
{
[videoCaptureDevices addObject: [[CameraCaptureDevice alloc] initWithDevice: device]];
}
@end
extern "C" void UnityEnumVideoCaptureDevices(void* udata, void(*callback)(void* udata, const char* name, int frontFacing, int autoFocusPointSupported, int kind, const int* resolutions, int resCount))
{
AVCaptureDevice* device;
if (![CameraCaptureDevice initialized])
{
[CameraCaptureDevice createCameraCaptureDevicesArray];
for (device in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo])
{
[CameraCaptureDevice addCameraCaptureDevice: device];
}
#if UNITY_HAS_IOSSDK_10_0
if (UnityiOS100orNewer())
{
device = [AVCaptureDevice defaultDeviceWithDeviceType: AVCaptureDeviceTypeBuiltInTelephotoCamera mediaType: AVMediaTypeVideo position: AVCaptureDevicePositionBack];
if (device != nil)
[CameraCaptureDevice addCameraCaptureDevice: device];
}
#endif
#if UNITY_HAS_IOSSDK_10_2
if (UnityiOS102orNewer())
{
device = [AVCaptureDevice defaultDeviceWithDeviceType: AVCaptureDeviceTypeBuiltInDualCamera mediaType: AVMediaTypeVideo position: AVCaptureDevicePositionBack];
if (device != nil)
[CameraCaptureDevice addCameraCaptureDevice: device];
}
#endif
#if UNITY_HAS_IOSSDK_11_1
if (UnityiOS111orNewer())
{
device = [AVCaptureDevice defaultDeviceWithDeviceType: AVCaptureDeviceTypeBuiltInTrueDepthCamera mediaType: AVMediaTypeVideo position: AVCaptureDevicePositionFront];
if (device != nil)
[CameraCaptureDevice addCameraCaptureDevice: device];
}
#endif
}
for (CameraCaptureDevice *cameraCaptureDevice in videoCaptureDevices)
{
int resCount = [cameraCaptureDevice->_resolutions count];
int *resolutions = new int[resCount * 2];
for (int i = 0; i < resCount; ++i)
{
resolutions[i * 2] = [cameraCaptureDevice->_resolutions[i] CGSizeValue].width;
resolutions[i * 2 + 1] = [cameraCaptureDevice->_resolutions[i] CGSizeValue].height;
}
callback(udata, [cameraCaptureDevice->_device.localizedName UTF8String], cameraCaptureDevice->_frontFacing, cameraCaptureDevice->_autoFocusPointSupported, cameraCaptureDevice->_kind, resolutions, resCount);
delete[] resolutions;
}
}
extern "C" void* UnityInitCameraCapture(int deviceIndex, int w, int h, int fps, int isDepth, void* udata)
{
if (videoCaptureDevices != nil && deviceIndex < videoCaptureDevices.count)
{
CameraCaptureController* controller = [CameraCaptureController alloc];
bool initResult = [videoCaptureDevices[deviceIndex] initCaptureForController: controller width: w height: h fps: (float)fps isDepth: (isDepth != 0)];
if (initResult)
{
controller->_userData = udata;
return (__bridge_retained void*)controller;
}
controller = nil;
}
return 0;
}
extern "C" void UnityStartCameraCapture(void* capture)
{
[(__bridge CameraCaptureController*)capture start];
}
extern "C" void UnityPauseCameraCapture(void* capture)
{
[(__bridge CameraCaptureController*)capture pause];
}
extern "C" void UnityStopCameraCapture(void* capture)
{
CameraCaptureController* controller = (__bridge_transfer CameraCaptureController*)capture;
[controller stop];
controller = nil;
}
extern "C" void UnityCameraCaptureExtents(void* capture, int* w, int* h)
{
CameraCaptureController* controller = (__bridge CameraCaptureController*)capture;
if (controller == nil)
return;
*w = (int)controller->_width;
*h = (int)controller->_height;
}
extern "C" void UnityCameraCaptureReadToMemory(void* capture, void* dst_, int w, int h)
{
CameraCaptureController* controller = (__bridge CameraCaptureController*)capture;
if (controller == nil)
return;
assert(w == controller->_width && h == controller->_height);
[controller capturePixelBufferToMemBuffer: (uint8_t*)dst_];
}
extern "C" int UnityCameraCaptureVideoRotationDeg(void* capture)
{
CameraCaptureController* controller = (__bridge CameraCaptureController*)capture;
if (controller == nil)
return 0;
// all cams are landscape.
switch (UnityCurrentOrientation())
{
case portrait: return 90;
case portraitUpsideDown: return 270;
case landscapeLeft: return controller.captureDevice.position == AVCaptureDevicePositionFront ? 180 : 0;
case landscapeRight: return controller.captureDevice.position == AVCaptureDevicePositionFront ? 0 : 180;
default: assert(false && "bad orientation returned from UnityCurrentOrientation()"); break;
}
return 0;
}
extern "C" int UnityCameraCaptureVerticallyMirrored(void* capture)
{
CameraCaptureController* controller = (__bridge CameraCaptureController*)capture;
if (controller == nil)
return 0;
return [controller isCVTextureFlipped];
}
extern "C" int UnityCameraCaptureSetAutoFocusPoint(void* capture, float x, float y)
{
CameraCaptureController* controller = (__bridge CameraCaptureController*)capture;
if (controller == nil)
return 0;
return [controller setFocusPointWithX: x Y: y];
}
#else
// STUBBED OUT UNTIL DEVELOPER FINDs AN AWESOME CAMERA SOLUTION FOR APPLE TV //
extern "C" void UnityEnumVideoCaptureDevices(void* udata, void(*callback)(void* udata, const char* name, int frontFacing, int autoFocusPointSupported, int kind, const int* resolutions, int resCount))
{
}
extern "C" void* UnityInitCameraCapture(int deviceIndex, int w, int h, int fps, int isDepth, void* udata)
{
return 0;
}
extern "C" void UnityStartCameraCapture(void* capture)
{
}
extern "C" void UnityPauseCameraCapture(void* capture)
{
}
extern "C" void UnityStopCameraCapture(void* capture)
{
}
extern "C" void UnityCameraCaptureExtents(void* capture, int* w, int* h)
{
}
extern "C" void UnityCameraCaptureReadToMemory(void* capture, void* dst_, int w, int h)
{
}
extern "C" int UnityCameraCaptureVideoRotationDeg(void* capture)
{
return 0;
}
extern "C" int UnityCameraCaptureVerticallyMirrored(void* capture)
{
return 0;
}
extern "C" int UnityCameraCaptureSetAutoFocusPoint(void* capture, float x, float y)
{
return 0;
}
#endif

@ -0,0 +1,423 @@
#include <sys/types.h>
#include <sys/sysctl.h>
#include <AdSupport/ASIdentifierManager.h>
#include "DisplayManager.h"
// ad/vendor ids
static id QueryASIdentifierManager()
{
NSBundle* bundle = [NSBundle bundleWithPath: @"/System/Library/Frameworks/AdSupport.framework"];
if (bundle)
{
[bundle load];
Class retClass = [bundle classNamed: @"ASIdentifierManager"];
return [retClass performSelector: @selector(sharedManager)];
}
return nil;
}
extern "C" const char* UnityAdvertisingIdentifier()
{
static const char* _ADID = NULL;
static const NSString* _ADIDNSString = nil;
// ad id can be reset during app lifetime
id manager = QueryASIdentifierManager();
if (manager)
{
NSString* adid = [[manager performSelector: @selector(advertisingIdentifier)] UUIDString];
// Do stuff to avoid UTF8String leaks. We still leak if ADID changes, but that shouldn't happen too often.
if (![_ADIDNSString isEqualToString: adid])
{
_ADIDNSString = adid;
free((void*)_ADID);
_ADID = AllocCString(adid);
}
}
return _ADID;
}
extern "C" int UnityAdvertisingTrackingEnabled()
{
bool _AdTrackingEnabled = false;
// ad tracking can be changed during app lifetime
id manager = QueryASIdentifierManager();
if (manager)
_AdTrackingEnabled = [manager performSelector: @selector(isAdvertisingTrackingEnabled)];
return _AdTrackingEnabled ? 1 : 0;
}
extern "C" const char* UnityVendorIdentifier()
{
static const char* _VendorID = NULL;
if (_VendorID == NULL)
_VendorID = AllocCString([[UIDevice currentDevice].identifierForVendor UUIDString]);
return _VendorID;
}
// UIDevice properties
#define QUERY_UIDEVICE_PROPERTY(FUNC, PROP) \
extern "C" const char* FUNC() \
{ \
static const char* value = NULL; \
if (value == NULL && [UIDevice instancesRespondToSelector:@selector(PROP)]) \
value = AllocCString([UIDevice currentDevice].PROP); \
return value; \
}
QUERY_UIDEVICE_PROPERTY(UnityDeviceName, name)
QUERY_UIDEVICE_PROPERTY(UnitySystemName, systemName)
QUERY_UIDEVICE_PROPERTY(UnitySystemVersion, systemVersion)
#undef QUERY_UIDEVICE_PROPERTY
// hw info
extern "C" const char* UnityDeviceModel()
{
static const char* _DeviceModel = NULL;
if (_DeviceModel == NULL)
{
size_t size;
::sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char* model = (char*)::malloc(size + 1);
::sysctlbyname("hw.machine", model, &size, NULL, 0);
model[size] = 0;
#if TARGET_OS_SIMULATOR
if (!strncmp(model, "i386", 4) || !strncmp(model, "x86_64", 6))
{
NSString* simModel = [[NSProcessInfo processInfo] environment][@"SIMULATOR_MODEL_IDENTIFIER"];
if ([simModel length] > 0)
{
_DeviceModel = AllocCString(simModel);
::free(model);
return _DeviceModel;
}
}
#endif
_DeviceModel = AllocCString([NSString stringWithUTF8String: model]);
::free(model);
}
return _DeviceModel;
}
extern "C" int UnityDeviceCPUCount()
{
static int _DeviceCPUCount = -1;
if (_DeviceCPUCount <= 0)
{
// maybe would be better to use HW_AVAILCPU
int ctlName[] = {CTL_HW, HW_NCPU};
size_t dataLen = sizeof(_DeviceCPUCount);
::sysctl(ctlName, 2, &_DeviceCPUCount, &dataLen, NULL, 0);
}
return _DeviceCPUCount;
}
// misc
extern "C" const char* UnitySystemLanguage()
{
static const char* _SystemLanguage = NULL;
if (_SystemLanguage == NULL)
{
NSArray* lang = [[NSUserDefaults standardUserDefaults] objectForKey: @"AppleLanguages"];
if (lang.count > 0)
_SystemLanguage = AllocCString(lang[0]);
}
return _SystemLanguage;
}
extern "C" int ParseDeviceGeneration(const char* model)
{
#if PLATFORM_IOS
if (!strcmp(model, "iPhone2,1"))
return deviceiPhone3GS;
else if (!strncmp(model, "iPhone3,", 8))
return deviceiPhone4;
else if (!strncmp(model, "iPhone4,", 8))
return deviceiPhone4S;
else if (!strncmp(model, "iPhone5,", 8))
{
int rev = atoi(model + 8);
if (rev >= 3)
return deviceiPhone5C; // iPhone5,3
else
return deviceiPhone5;
}
else if (!strncmp(model, "iPhone6,", 8))
return deviceiPhone5S;
else if (!strncmp(model, "iPhone7,2", 9))
return deviceiPhone6;
else if (!strncmp(model, "iPhone7,1", 9))
return deviceiPhone6Plus;
else if (!strncmp(model, "iPhone8,1", 9))
return deviceiPhone6S;
else if (!strncmp(model, "iPhone8,2", 9))
return deviceiPhone6SPlus;
else if (!strncmp(model, "iPhone8,4", 9))
return deviceiPhoneSE1Gen;
else if (!strncmp(model, "iPhone9,1", 9) || !strncmp(model, "iPhone9,3", 9))
return deviceiPhone7;
else if (!strncmp(model, "iPhone9,2", 9) || !strncmp(model, "iPhone9,4", 9))
return deviceiPhone7Plus;
else if (!strncmp(model, "iPhone10,1", 10) || !strncmp(model, "iPhone10,4", 10))
return deviceiPhone8;
else if (!strncmp(model, "iPhone10,2", 10) || !strncmp(model, "iPhone10,5", 10))
return deviceiPhone8Plus;
else if (!strncmp(model, "iPhone10,3", 10) || !strncmp(model, "iPhone10,6", 10))
return deviceiPhoneX;
else if (!strncmp(model, "iPhone11,8", 10))
return deviceiPhoneXR;
else if (!strncmp(model, "iPhone11,2", 10))
return deviceiPhoneXS;
else if (!strncmp(model, "iPhone11,4", 10) || !strncmp(model, "iPhone11,6", 10))
return deviceiPhoneXSMax;
else if (!strcmp(model, "iPod4,1"))
return deviceiPodTouch4Gen;
else if (!strncmp(model, "iPod5,", 6))
return deviceiPodTouch5Gen;
else if (!strncmp(model, "iPod7,", 6))
return deviceiPodTouch6Gen;
else if (!strncmp(model, "iPad2,", 6))
{
int rev = atoi(model + 6);
if (rev >= 5)
return deviceiPadMini1Gen; // iPad2,5
else
return deviceiPad2Gen;
}
else if (!strncmp(model, "iPad3,", 6))
{
int rev = atoi(model + 6);
if (rev >= 4)
return deviceiPad4Gen; // iPad3,4
else
return deviceiPad3Gen;
}
else if (!strncmp(model, "iPad4,", 6))
{
int rev = atoi(model + 6);
if (rev >= 7)
return deviceiPadMini3Gen;
else if (rev >= 4)
return deviceiPadMini2Gen; // iPad4,4
else
return deviceiPadAir1;
}
else if (!strncmp(model, "iPad5,", 6))
{
int rev = atoi(model + 6);
if (rev == 1 || rev == 2)
return deviceiPadMini4Gen;
else if (rev >= 3)
return deviceiPadAir2;
}
else if (!strncmp(model, "iPad6,", 6))
{
int rev = atoi(model + 6);
if (rev == 7 || rev == 8)
return deviceiPadPro1Gen;
else if (rev == 3 || rev == 4)
return deviceiPadPro10Inch1Gen;
else if (rev == 11 || rev == 12)
return deviceiPad5Gen;
}
else if (!strncmp(model, "iPad7,", 6))
{
int rev = atoi(model + 6);
if (rev == 1 || rev == 2)
return deviceiPadPro2Gen;
else if (rev == 3 || rev == 4)
return deviceiPadPro10Inch2Gen;
}
else if (!strncmp(model, "iPad8,", 6))
{
int rev = atoi(model + 6);
if (rev >= 1 && rev <= 4)
return deviceiPadPro11Inch;
else if (rev >= 5)
return deviceiPadPro3Gen;
}
// completely unknown hw - just determine form-factor
else
{
if (!strncmp(model, "iPhone", 6))
return deviceiPhoneUnknown;
else if (!strncmp(model, "iPad", 4))
return deviceiPadUnknown;
else if (!strncmp(model, "iPod", 4))
return deviceiPodTouchUnknown;
else
return deviceUnknown;
}
#elif PLATFORM_TVOS
if (!strncmp(model, "AppleTV5,", 9))
return deviceAppleTV1Gen;
else if (!strncmp(model, "AppleTV6,", 9))
return deviceAppleTV2Gen;
else
return deviceUnknown;
#endif
}
extern "C" int UnityDeviceGeneration()
{
static int _DeviceGeneration = deviceUnknown;
if (_DeviceGeneration == deviceUnknown)
{
const char* model = UnityDeviceModel();
_DeviceGeneration = ParseDeviceGeneration(model);
}
return _DeviceGeneration;
}
extern "C" int UnityDeviceSupportedOrientations()
{
int device = UnityDeviceGeneration();
int orientations = 0;
orientations |= (1 << portrait);
orientations |= (1 << landscapeLeft);
orientations |= (1 << landscapeRight);
if (device != deviceiPhoneX)
{
orientations |= (1 << portraitUpsideDown);
}
return orientations;
}
extern "C" int UnityDeviceIsStylusTouchSupported()
{
int deviceGen = UnityDeviceGeneration();
return (deviceGen == deviceiPadPro1Gen ||
deviceGen == deviceiPadPro10Inch1Gen ||
deviceGen == deviceiPadPro2Gen ||
deviceGen == deviceiPadPro10Inch2Gen) ? 1 : 0;
}
extern "C" int UnityDeviceCanShowWideColor()
{
UIScreen* mainScreen = [UIScreen mainScreen];
UITraitCollection* traits = mainScreen.traitCollection;
if (![traits respondsToSelector: @selector(displayGamut)])
return false;
#if UNITY_HAS_IOSSDK_10_0 || UNITY_HAS_TVOSSDK_10_0
return traits.displayGamut == UIDisplayGamutP3;
#else
return false;
#endif
}
extern "C" float UnityDeviceDPI()
{
static float _DeviceDPI = -1.0f;
if (_DeviceDPI < 0.0f)
{
switch (UnityDeviceGeneration())
{
// iPhone
case deviceiPhone3GS:
_DeviceDPI = 163.0f; break;
case deviceiPhone4:
case deviceiPhone4S:
case deviceiPhone5:
case deviceiPhone5C:
case deviceiPhone5S:
case deviceiPhone6:
case deviceiPhone6S:
case deviceiPhoneSE1Gen:
case deviceiPhone7:
case deviceiPhone8:
case deviceiPhoneXR:
_DeviceDPI = 326.0f; break;
case deviceiPhone6Plus:
case deviceiPhone6SPlus:
case deviceiPhone7Plus:
case deviceiPhone8Plus:
_DeviceDPI = 401.0f; break;
case deviceiPhoneX:
case deviceiPhoneXS:
case deviceiPhoneXSMax:
_DeviceDPI = 458.0f; break;
// iPad
case deviceiPad2Gen:
_DeviceDPI = 132.0f; break;
case deviceiPad3Gen:
case deviceiPad4Gen: // iPad retina
case deviceiPadAir1:
case deviceiPadAir2:
case deviceiPadPro1Gen:
case deviceiPadPro10Inch1Gen:
case deviceiPadPro2Gen:
case deviceiPadPro10Inch2Gen:
case deviceiPad5Gen:
case deviceiPadPro11Inch:
case deviceiPadPro3Gen:
_DeviceDPI = 264.0f; break;
// iPad mini
case deviceiPadMini1Gen:
_DeviceDPI = 163.0f; break;
case deviceiPadMini2Gen:
case deviceiPadMini3Gen:
case deviceiPadMini4Gen:
_DeviceDPI = 326.0f; break;
// iPod
case deviceiPodTouch4Gen:
case deviceiPodTouch5Gen:
case deviceiPodTouch6Gen:
_DeviceDPI = 326.0f; break;
// unknown (new) devices
case deviceiPhoneUnknown:
_DeviceDPI = 326.0f; break;
case deviceiPadUnknown:
_DeviceDPI = 264.0f; break;
case deviceiPodTouchUnknown:
_DeviceDPI = 326.0f; break;
}
// If we didn't find DPI, set it to "unknown" value.
if (_DeviceDPI < 0.0f)
_DeviceDPI = 0.0f;
}
return _DeviceDPI;
}
// device id with fallback for pre-ios7
extern "C" const char* UnityDeviceUniqueIdentifier()
{
static const char* _DeviceID = NULL;
if (_DeviceID == NULL)
_DeviceID = UnityVendorIdentifier();
return _DeviceID;
}

@ -0,0 +1,64 @@
#pragma once
#include "UnityRendering.h"
#include "GlesHelper.h"
#include <UIKit/UIKit.h>
@class EAGLContext;
@class UnityView;
@interface DisplayConnection : NSObject
- (id)init:(UIScreen*)targetScreen;
- (void)dealloc;
- (void)createView:(BOOL)useForRendering showRightAway:(BOOL)showRightAway;
- (void)createView:(BOOL)useForRendering;
- (void)createWithWindow:(UIWindow*)window andView:(UIView*)view;
- (void)initRendering;
- (void)recreateSurface:(RenderingSurfaceParams)params;
- (void)shouldShowWindow:(BOOL)show;
- (void)requestRenderingResolution:(CGSize)res;
- (void)present;
@property (readonly, copy, nonatomic) UIScreen* screen;
@property (readonly, copy, nonatomic) UIWindow* window;
@property (readonly, copy, nonatomic) UIView* view;
@property (readonly, nonatomic) CGSize screenSize;
@property (readonly, nonatomic) UnityDisplaySurfaceBase* surface;
@end
@interface DisplayManager : NSObject
- (id)objectForKeyedSubscript:(id)key;
- (BOOL)displayAvailable:(UIScreen*)targetScreen;
- (void)updateDisplayListCacheInUnity;
- (void)startFrameRendering;
- (void)present;
- (void)endFrameRendering;
- (void)enumerateDisplaysWithBlock:(void (^)(DisplayConnection* conn))block;
- (void)enumerateNonMainDisplaysWithBlock:(void (^)(DisplayConnection* conn))block;
+ (void)Initialize;
+ (DisplayManager*)Instance;
@property (readonly, nonatomic) DisplayConnection* mainDisplay;
@property (readonly, nonatomic) NSUInteger displayCount;
@end
inline DisplayConnection* GetMainDisplay()
{
return [DisplayManager Instance].mainDisplay;
}
inline UnityDisplaySurfaceBase* GetMainDisplaySurface()
{
return GetMainDisplay().surface;
}

@ -0,0 +1,611 @@
#include "DisplayManager.h"
#include "EAGLContextHelper.h"
#include "GlesHelper.h"
#include "UI/UnityView.h"
#include "UnityAppController.h"
#include "UI/UnityAppController+ViewHandling.h"
#import <QuartzCore/QuartzCore.h>
#import <CoreGraphics/CoreGraphics.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#include "UnityMetalSupport.h"
static DisplayManager* _DisplayManager = nil;
@interface DisplayConnection ()
@property (readonly, nonatomic) UnityDisplaySurfaceGLES* surfaceGLES;
@property (readonly, nonatomic) UnityDisplaySurfaceMTL* surfaceMTL;
@end
@implementation DisplayConnection
{
BOOL _needRecreateSurface;
CGSize _requestedRenderingSize;
UIScreen* _screen;
UIWindow* _window;
UIView* _view;
CGSize _screenSize;
UnityDisplaySurfaceBase* _surface;
}
@synthesize screen = _screen;
@synthesize window = _window;
@synthesize view = _view;
@synthesize screenSize = _screenSize;
@synthesize surface = _surface;
@synthesize surfaceGLES;
- (UnityDisplaySurfaceGLES*)surfaceGLES { assert(_surface->api != apiMetal); return (UnityDisplaySurfaceGLES*)_surface; }
@synthesize surfaceMTL;
- (UnityDisplaySurfaceMTL*)surfaceMTL { assert(_surface->api == apiMetal); return (UnityDisplaySurfaceMTL*)_surface; }
- (id)init:(UIScreen*)targetScreen
{
if ((self = [super init]))
{
self->_screen = targetScreen;
#if !PLATFORM_TVOS
targetScreen.currentMode = targetScreen.preferredMode;
#endif
// UIScreenOverscanCompensationNone == UIScreenOverscanCompensationInsetApplicationFrame so it will work with pre-ios9 just fine
targetScreen.overscanCompensation = UIScreenOverscanCompensationNone;
self->_screenSize = targetScreen.currentMode.size;
self->_needRecreateSurface = NO;
self->_requestedRenderingSize = CGSizeMake(-1, -1);
}
return self;
}
- (void)createWithWindow:(UIWindow*)window andView:(UIView*)view
{
_window = window;
_view = view;
CGSize layerSize = _view.layer.bounds.size;
_screenSize = CGSizeMake(roundf(layerSize.width) * _view.contentScaleFactor, roundf(layerSize.height) * _view.contentScaleFactor);
}
- (void)createView:(BOOL)useForRendering
{
[self createView: useForRendering showRightAway: YES];
}
- (void)createView:(BOOL)useForRendering showRightAway:(BOOL)showRightAway;
{
NSAssert(_screen != [UIScreen mainScreen], @"DisplayConnection for mainScreen should be created with createWithWindow:andView:");
if (_view == nil)
{
UIWindow* window = [[UIWindow alloc] initWithFrame: _screen.bounds];
window.screen = _screen;
UIView* view = [(useForRendering ? [UnityRenderingView alloc] : [UIView alloc]) initWithFrame: _screen.bounds];
view.contentScaleFactor = UnityScreenScaleFactor(_screen);
[self createWithWindow: window andView: view];
if (showRightAway)
{
[window addSubview: view];
window.hidden = NO;
}
}
}
- (void)shouldShowWindow:(BOOL)show
{
_window.hidden = show ? NO : YES;
_window.screen = show ? _screen : nil;
}
- (void)initRendering
{
if (_surface == 0)
{
int api = UnitySelectedRenderingAPI();
if (api == apiMetal)
{
UnityDisplaySurfaceMTL* surf = new UnityDisplaySurfaceMTL();
surf->writeCount = 0;
surf->layer = (CAMetalLayer*)_view.layer;
surf->device = UnityGetMetalDevice();
surf->commandQueue = [surf->device newCommandQueue];
surf->drawableCommandQueue = [surf->device newCommandQueue];
_surface = surf;
}
else
{
UnityDisplaySurfaceGLES* surf = new UnityDisplaySurfaceGLES();
surf->layer = (CAEAGLLayer*)_view.layer;
surf->context = UnityCreateContextEAGL(UnityGetDataContextGLES(), 0);
_surface = surf;
}
_surface->api = api;
}
}
- (void)recreateSurface:(RenderingSurfaceParams)params
{
[self initRendering];
CGSize layerSize = _view.layer.bounds.size;
float scale = _view.contentScaleFactor;
_screenSize = CGSizeMake(layerSize.width * scale, layerSize.height * scale);
bool systemSizeChanged = _surface->systemW != _screenSize.width || _surface->systemH != _screenSize.height;
bool msaaChanged = _supportsMSAA && (_surface->msaaSamples != params.msaaSampleCount);
bool depthFmtChanged = _surface->disableDepthAndStencil != params.disableDepthAndStencil;
bool cvCacheChanged = _surface->useCVTextureCache != params.useCVTextureCache;
bool memorylessChanged = _surface->memorylessDepth != params.metalMemorylessDepth;
bool renderSizeChanged = false;
if ((params.renderW > 0 && _surface->targetW != params.renderW) // changed resolution
|| (params.renderH > 0 && _surface->targetH != params.renderH) // changed resolution
|| (params.renderW <= 0 && _surface->targetW != _surface->systemW) // no longer need intermediate fb
|| (params.renderH <= 0 && _surface->targetH != _surface->systemH) // no longer need intermediate fb
)
{
renderSizeChanged = true;
}
bool recreateSystemSurface = systemSizeChanged;
bool recreateRenderingSurface = systemSizeChanged || renderSizeChanged || msaaChanged || cvCacheChanged;
bool recreateDepthbuffer = systemSizeChanged || renderSizeChanged || msaaChanged || depthFmtChanged || memorylessChanged;
_surface->disableDepthAndStencil = params.disableDepthAndStencil;
_surface->systemW = _screenSize.width;
_surface->systemH = _screenSize.height;
_surface->targetW = params.renderW > 0 ? params.renderW : _surface->systemW;
_surface->targetH = params.renderH > 0 ? params.renderH : _surface->systemH;
_surface->msaaSamples = _supportsMSAA ? params.msaaSampleCount : 0;
_surface->srgb = params.srgb;
_surface->wideColor = params.wideColor;
_surface->useCVTextureCache = params.useCVTextureCache;
_surface->memorylessDepth = params.metalMemorylessDepth;
if (UnitySelectedRenderingAPI() == apiMetal)
{
recreateSystemSurface = recreateSystemSurface || self.surfaceMTL->systemColorRB == 0;
self.surfaceMTL->framebufferOnly = params.metalFramebufferOnly;
}
else
recreateSystemSurface = recreateSystemSurface || self.surfaceGLES->systemFB == 0;
if (recreateSystemSurface)
CreateSystemRenderingSurface(_surface);
if (recreateRenderingSurface)
CreateRenderingSurface(_surface);
if (recreateDepthbuffer)
CreateSharedDepthbuffer(_surface);
if (recreateSystemSurface || recreateRenderingSurface || recreateDepthbuffer)
CreateUnityRenderBuffers(_surface);
UnityInvalidateDisplayDataCache((__bridge void*)_screen);
}
- (void)dealloc
{
if (_surface)
{
DestroySystemRenderingSurface(_surface);
DestroyRenderingSurface(_surface);
DestroySharedDepthbuffer(_surface);
DestroyUnityRenderBuffers(_surface);
if (UnitySelectedRenderingAPI() == apiMetal)
{
self.surfaceMTL->device = nil;
self.surfaceMTL->layer = nil;
}
else
{
self.surfaceGLES->context = nil;
self.surfaceGLES->layer = nil;
}
}
delete _surface;
_surface = 0;
_view = nil;
_window = nil;
}
- (void)present
{
PreparePresent(self.surface);
Present(self.surface);
if (_needRecreateSurface)
{
RenderingSurfaceParams params =
{
.msaaSampleCount = _surface->msaaSamples,
.renderW = (int)_requestedRenderingSize.width,
.renderH = (int)_requestedRenderingSize.height,
.srgb = _surface->srgb,
.wideColor = _surface->wideColor,
.metalFramebufferOnly = 0,
.metalMemorylessDepth = 0,
.disableDepthAndStencil = _surface->disableDepthAndStencil,
.useCVTextureCache = self.surface->cvTextureCache != 0,
};
[self recreateSurface: params];
_needRecreateSurface = NO;
_requestedRenderingSize = CGSizeMake(_surface->targetW, _surface->targetH);
}
}
- (void)requestRenderingResolution:(CGSize)res
{
_requestedRenderingSize = res;
_needRecreateSurface = YES;
}
@end
@implementation DisplayManager
{
NSMapTable* _displayConnection;
DisplayConnection* _mainDisplay;
}
@synthesize mainDisplay = _mainDisplay;
@synthesize displayCount;
- (NSUInteger)displayCount { return _displayConnection.count; }
- (void)registerScreen:(UIScreen*)screen
{
[_displayConnection setObject: [[DisplayConnection alloc] init: screen] forKey: screen];
}
- (id)init
{
if ((self = [super init]))
{
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(screenDidConnect:)
name: UIScreenDidConnectNotification
object: nil
];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(screenDidDisconnect:)
name: UIScreenDidDisconnectNotification
object: nil
];
_displayConnection = [NSMapTable
mapTableWithKeyOptions: NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPointerPersonality
valueOptions: NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPointerPersonality
];
for (UIScreen* screen in [UIScreen screens])
[self registerScreen: screen];
_mainDisplay = self[[UIScreen mainScreen]];
}
return self;
}
- (BOOL)displayAvailable:(UIScreen*)targetScreen;
{
return self[targetScreen] != nil;
}
- (DisplayConnection*)display:(UIScreen*)targetScreen
{
return self[targetScreen];
}
- (id)objectForKeyedSubscript:(id)key
{
NSAssert([key isKindOfClass: [UIScreen class]], @"DisplayManager allows only UIScreen as subscript");
return [_displayConnection objectForKey: (UIScreen*)key];
}
- (void)updateDisplayListCacheInUnity;
{
// [UIScreen screens] might be out of sync to what is indicated to the
// application via UIScreenDidConnectNotification and UIScreenDidDisconnectNotification
// notifications. For example, on disconnection [UIScreen screens] might still
// have the screen that the display manager no longer knows about.
const unsigned MAX_DISPLAYS_SUPPORTED = 8; // sync this to the value on Unity side
void* screens[MAX_DISPLAYS_SUPPORTED];
unsigned screenCount = 0;
UIScreen* mainScreen = [UIScreen mainScreen];
screens[screenCount++] = (__bridge void*)mainScreen;
for (UIScreen* screen in _displayConnection)
{
if (screen == mainScreen)
continue;
screens[screenCount++] = (__bridge void*)screen;
}
UnityUpdateDisplayListCache(screens, screenCount);
}
- (void)enumerateDisplaysWithBlock:(void (^)(DisplayConnection* conn))block
{
for (UIScreen* screen in _displayConnection)
{
// if we want simple mirroring unity wont create rendering backing for display
// in that case we dont want to touch Display
DisplayConnection* conn = [_displayConnection objectForKey: screen];
if (conn.surface != nil)
block(conn);
}
}
- (void)enumerateNonMainDisplaysWithBlock:(void (^)(DisplayConnection* conn))block
{
for (UIScreen* screen in _displayConnection)
{
DisplayConnection* conn = [_displayConnection objectForKey: screen];
if (conn != _mainDisplay && conn.surface != nil)
block(conn);
}
}
- (void)startFrameRendering
{
[self enumerateDisplaysWithBlock:^(DisplayConnection* conn) {
StartFrameRendering(conn.surface);
}];
}
- (void)endFrameRendering
{
[self enumerateDisplaysWithBlock:^(DisplayConnection* conn) {
EndFrameRendering(conn.surface);
}];
}
- (void)present
{
[self enumerateDisplaysWithBlock:^(DisplayConnection* conn) {
[conn present];
}];
}
- (void)screenDidConnect:(NSNotification*)notification
{
[self registerScreen: (UIScreen*)[notification object]];
[self updateDisplayListCacheInUnity];
}
- (void)screenDidDisconnect:(NSNotification*)notification
{
UIScreen* screen = (UIScreen*)[notification object];
DisplayConnection* conn = (DisplayConnection*)self[screen];
if (conn != nil && conn.surface != nil)
UnityDisableRenderBuffers(conn.surface->unityColorBuffer, conn.surface->unityDepthBuffer);
[_displayConnection removeObjectForKey: screen];
conn = nil;
[self updateDisplayListCacheInUnity];
}
+ (void)Initialize
{
NSAssert(_DisplayManager == nil, @"[DisplayManager Initialize] called after creating handler");
if (!_DisplayManager)
_DisplayManager = [[DisplayManager alloc] init];
}
+ (DisplayManager*)Instance
{
if (!_DisplayManager)
_DisplayManager = [[DisplayManager alloc] init];
return _DisplayManager;
}
@end
//==============================================================================
//
// Unity Interface:
static void EnsureDisplayIsInited(DisplayConnection* conn)
{
// main screen view will be created in AppController,
// so we can assume that we need to init secondary display from script
// meaning: gles + show right away
if (conn.view == nil)
[conn createView: YES];
int api = UnitySelectedRenderingAPI();
bool needRecreate = false;
if (conn.surface == 0)
needRecreate = true;
else if (api == apiMetal)
needRecreate = conn.surfaceMTL->layer == nil;
else
needRecreate = conn.surfaceGLES->systemFB == 0;
if (needRecreate)
{
RenderingSurfaceParams params =
{
.msaaSampleCount = UnityGetDesiredMSAASampleCount(MSAA_DEFAULT_SAMPLE_COUNT),
.renderW = -1, // native resolution at first (can be changed later)
.renderH = -1, // native resolution at first (can be changed later)
.srgb = UnityGetSRGBRequested(),
.wideColor = 0, // i am not sure how to handle wide color here (and if it is even supported for airplay)
.metalFramebufferOnly = UnityMetalFramebufferOnly(),
.metalMemorylessDepth = UnityMetalMemorylessDepth(),
.disableDepthAndStencil = UnityDisableDepthAndStencilBuffers(),
.useCVTextureCache = 0,
};
[conn recreateSurface: params];
{
DisplayConnection* main = [DisplayManager Instance].mainDisplay;
if (api != apiMetal)
[EAGLContext setCurrentContext: UnityGetMainScreenContextGLES()];
StartFrameRendering(main.surface);
}
}
}
#if !PLATFORM_TVOS
extern "C" int UnityDisplayManager_DisplayCount()
{
return (int)[DisplayManager Instance].displayCount;
}
extern "C" bool UnityDisplayManager_DisplayAvailable(void* nativeDisplay)
{
return [[DisplayManager Instance] displayAvailable: (__bridge UIScreen*)nativeDisplay];
}
extern "C" bool UnityDisplayManager_DisplayActive(void* nativeDisplay)
{
return UnityDisplayManager_DisplayAvailable(nativeDisplay);
}
extern "C" void UnityDisplayManager_DisplaySystemResolution(void* nativeDisplay, int* w, int* h)
{
if (nativeDisplay == NULL)
return;
DisplayConnection* conn = [DisplayManager Instance][(__bridge UIScreen*)nativeDisplay];
EnsureDisplayIsInited(conn);
*w = (int)conn.surface->systemW;
*h = (int)conn.surface->systemH;
}
extern "C" void UnityDisplayManager_DisplayRenderingResolution(void* nativeDisplay, int* w, int* h)
{
if (nativeDisplay == NULL)
return;
DisplayConnection* conn = [DisplayManager Instance][(__bridge UIScreen*)nativeDisplay];
EnsureDisplayIsInited(conn);
*w = (int)conn.surface->targetW;
*h = (int)conn.surface->targetH;
}
extern "C" void UnityDisplayManager_DisplayRenderingBuffers(void* nativeDisplay, void** colorBuffer, void** depthBuffer)
{
if (nativeDisplay == NULL)
return;
DisplayConnection* conn = [DisplayManager Instance][(__bridge UIScreen*)nativeDisplay];
EnsureDisplayIsInited(conn);
if (colorBuffer)
*colorBuffer = conn.surface->unityColorBuffer;
if (depthBuffer)
*depthBuffer = conn.surface->unityDepthBuffer;
}
extern "C" void UnityDisplayManager_SetRenderingResolution(void* nativeDisplay, int w, int h)
{
if (nativeDisplay == NULL)
return;
UIScreen* screen = (__bridge UIScreen*)nativeDisplay;
DisplayConnection* conn = [DisplayManager Instance][screen];
EnsureDisplayIsInited(conn);
if (screen == [UIScreen mainScreen])
UnityRequestRenderingResolution(w, h);
else
[conn requestRenderingResolution: CGSizeMake(w, h)];
}
extern "C" void UnityDisplayManager_ShouldShowWindowOnDisplay(void* nativeDisplay, bool show)
{
if (nativeDisplay == NULL)
return;
UIScreen* screen = (__bridge UIScreen*)nativeDisplay;
DisplayConnection* conn = [DisplayManager Instance][screen];
EnsureDisplayIsInited(conn);
if (screen != [UIScreen mainScreen])
[conn shouldShowWindow: show];
}
extern "C" int UnityDisplayManager_PrimaryDisplayIndex()
{
return 0;
}
#endif
extern "C" EAGLContext* UnityGetMainScreenContextGLES()
{
return GetMainDisplay().surfaceGLES->context;
}
extern "C" EAGLContext* UnityGetContextEAGL()
{
return GetMainDisplay().surfaceGLES->context;
}
extern "C" float UnityScreenScaleFactor(UIScreen* screen)
{
// NOTE: All views handled by Unity have their contentScaleFactor initialized
// to value returned by this function.
// we should query nativeScale if available to get the true device resolution
// this way we avoid unnecessarily large frame buffers and downscaling.
// e.g. iPhone 6+ pretends to be a x3 device, while its physical screen is x2.6 something.
// it is available on iOS 8.0+, tvOS 9.0+
// for older ios versions we add this selector ourselves (AddNewAPIImplIfNeeded in UnityAppController.mm)
// On AppleTV screen.nativeScale returns NaN when device is in sleep mode and starting from tvOS 10 (?) it returns 0.
if (isnan(screen.nativeScale) || (screen.nativeScale == 0))
return 1.0f;
else
{
float scalingFactor = UnityCalculateScalingFactorFromTargetDPI(screen);
if (scalingFactor > 0.0f)
return scalingFactor;
else
return screen.nativeScale;
}
return screen.scale;
}
extern "C" void UnityStartFrameRendering()
{
[[DisplayManager Instance] startFrameRendering];
}
extern "C" void UnityDestroyUnityRenderSurfaces()
{
[[DisplayManager Instance] enumerateDisplaysWithBlock:^(DisplayConnection* conn) {
DestroyUnityRenderBuffers(conn.surface);
}];
}

@ -0,0 +1,33 @@
#pragma once
struct UnityDisplaySurfaceBase;
#ifdef __OBJC__
@class EAGLContext;
#else
typedef struct objc_object EAGLContext;
#endif
extern "C" bool AllocateRenderBufferStorageFromEAGLLayer(void* eaglContext, void* eaglLayer);
extern "C" void DeallocateRenderBufferStorageFromEAGLLayer(void* eaglContext);
extern "C" EAGLContext* UnityCreateContextEAGL(EAGLContext * parent, int api);
extern "C" void UnityMakeCurrentContextEAGL(EAGLContext* context);
extern "C" EAGLContext* UnityGetCurrentContextEAGL();
#if __OBJC__
class
EAGLContextSetCurrentAutoRestore
{
public:
EAGLContext* old;
EAGLContext* cur;
EAGLContextSetCurrentAutoRestore(EAGLContext* cur);
EAGLContextSetCurrentAutoRestore(UnityDisplaySurfaceBase* surface);
~EAGLContextSetCurrentAutoRestore();
};
#endif // __OBJC__

@ -0,0 +1,64 @@
#include "EAGLContextHelper.h"
#include "UnityRendering.h"
#import <QuartzCore/QuartzCore.h>
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
extern "C" bool AllocateRenderBufferStorageFromEAGLLayer(void* eaglContext, void* eaglLayer)
{
return [(__bridge EAGLContext*)eaglContext renderbufferStorage: GL_RENDERBUFFER fromDrawable: (__bridge CAEAGLLayer*)eaglLayer];
}
extern "C" void DeallocateRenderBufferStorageFromEAGLLayer(void* eaglContext)
{
[(__bridge EAGLContext*)eaglContext renderbufferStorage: GL_RENDERBUFFER fromDrawable: nil];
}
extern "C" EAGLContext* UnityCreateContextEAGL(EAGLContext * parent, int api)
{
const int targetApi = parent ? parent.API : api;
EAGLSharegroup* group = parent ? parent.sharegroup : nil;
return [[EAGLContext alloc] initWithAPI: (EAGLRenderingAPI)targetApi sharegroup: group];
}
extern "C" void UnityMakeCurrentContextEAGL(EAGLContext* context)
{
[EAGLContext setCurrentContext: context];
}
extern "C" EAGLContext* UnityGetCurrentContextEAGL()
{
return [EAGLContext currentContext];
}
EAGLContextSetCurrentAutoRestore::EAGLContextSetCurrentAutoRestore(EAGLContext* cur_) : old([EAGLContext currentContext]), cur(cur_)
{
if (old != cur)
{
[EAGLContext setCurrentContext: cur];
UnityOnSetCurrentGLContext(cur);
}
}
EAGLContextSetCurrentAutoRestore::EAGLContextSetCurrentAutoRestore(UnityDisplaySurfaceBase* surface)
: old(surface->api == apiMetal ? nil : [EAGLContext currentContext]),
cur(surface->api == apiMetal ? nil : ((UnityDisplaySurfaceGLES*)surface)->context)
{
if (old != cur)
{
[EAGLContext setCurrentContext: cur];
UnityOnSetCurrentGLContext(cur);
}
}
EAGLContextSetCurrentAutoRestore::~EAGLContextSetCurrentAutoRestore()
{
if (old != cur)
{
[EAGLContext setCurrentContext: old];
UnityOnSetCurrentGLContext(old);
}
}

@ -0,0 +1,129 @@
#include <sys/xattr.h>
#include "UnityInterface.h"
#include <cstring>
extern "C" const char* UnityApplicationDir()
{
static const char* dir = NULL;
if (dir == NULL)
dir = AllocCString([NSBundle mainBundle].bundlePath);
return dir;
}
#define RETURN_SPECIAL_DIR(dir) \
do { \
static const char* var = NULL; \
if (var == NULL) \
var = AllocCString(NSSearchPathForDirectoriesInDomains(dir, NSUserDomainMask, YES)[0]); \
return var; \
} while (0)
extern "C" const char* UnityDocumentsDir()
{
RETURN_SPECIAL_DIR(NSDocumentDirectory);
}
extern "C" const char* UnityLibraryDir()
{
RETURN_SPECIAL_DIR(NSLibraryDirectory);
}
extern "C" const char* UnityCachesDir()
{
RETURN_SPECIAL_DIR(NSCachesDirectory);
}
#undef RETURN_SPECIAL_DIR
extern "C" int UnityUpdateNoBackupFlag(const char* path, int setFlag)
{
int result;
if (setFlag)
{
u_int8_t b = 1;
result = ::setxattr(path, "com.apple.MobileBackup", &b, 1, 0, 0);
}
else
{
result = ::removexattr(path, "com.apple.MobileBackup", 0);
}
return result == 0 ? 1 : 0;
}
extern "C" const char* const* UnityFontFallbacks()
{
/* The following is the family names of fonts that are used as fallbacks
for characters that were not fount in user-specified fonts. Add more
fonts and/or reorder the list to fit your needs. For certain character
NOTE: Some similar Chinese, Japanese and Korean characters share the
character number in Unicode, but are written differently. To display
such characters properly, correct font must be selected. We reorder
the fonts list on the first run of this function.
*/
static const char** cachedFonts = NULL;
if (cachedFonts == NULL)
{
const int fontsToReorderCount = 4;
static const char* defaultFonts[] =
{
// first fontsToReorderCount items will be reordered if needed.
"Hiragino Kaku Gothic ProN", // Japanese characters
"Heiti TC", // Traditional Chinese characters (on 9.0 OS substitutes this with "PingFang TC")
"Heiti SC", // Simplified Chinese characters (on 9.0 OS substitutes this with "PingFang SC")
"Apple SD Gothic Neo", // Korean characters
".Sukhumvit Set UI", // Thai characters since 8.2 until 9.x
"AppleGothic",
"Noto Sans Yi", // Yi characters on 9.0 (not available on tvOS)
"Helvetica",
"Helvetica Neue",
"Arial Hebrew", // Hebrew since 9.0
"Kohinoor Devanagari", // Hindi since 9.0
"Kohinoor Bangla", // Bengali since 9.0
"Kohinoor Telugu", // Telugu since 9.0
"Lao Sangam MN", // Lao
"Geeza Pro", // Arabic
"Kailasa", // Tibetan since iOS 10.0
".PhoneFallback", // Armenian, Braille, Georgian, Thai, various symbols since iOS 10.0
// Note that iOS itself prefers Thonburi font for the Thai characters, but our font subsystem
// can't display combining characters for some reason
".LastResort",
NULL
};
// The default works for Japanese, we won't reorder in that case
static const char* koFontOrder[] =
{
"Apple SD Gothic Neo", // Korean characters
"Hiragino Kaku Gothic ProN", // Japanese characters
"Heiti TC", // Traditional Chinese characters (on 9.0 OS substitutes this with "PingFang TC")
"Heiti SC", // Simplified Chinese characters (on 9.0 OS substitutes this with "PingFang SC")
};
static const char* zhFontOrder[] =
{
"Heiti TC", // Traditional Chinese characters (on 9.0 OS substitutes this with "PingFang TC")
"Heiti SC", // Simplified Chinese characters (on 9.0 OS substitutes this with "PingFang SC")
"Hiragino Kaku Gothic ProN", // Japanese characters
"Apple SD Gothic Neo", // Korean characters
};
const char* lang = UnitySystemLanguage();
const char** fontOrderOverride = NULL;
if (std::strncmp(lang, "ko", 2) == 0)
fontOrderOverride = koFontOrder;
if (std::strncmp(lang, "zh", 2) == 0)
fontOrderOverride = zhFontOrder;
if (fontOrderOverride)
{
for (int i = 0; i < fontsToReorderCount; ++i)
defaultFonts[i] = fontOrderOverride[i];
}
cachedFonts = defaultFonts;
}
return cachedFonts;
}

@ -0,0 +1,268 @@
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>
#import <UIKit/UIGestureRecognizerSubclass.h>
#include "UnityAppController.h"
#include "UI/UnityView.h"
#include "UI/UnityViewControllerBase.h"
#include "UI/OrientationSupport.h"
#include "UI/UnityAppController+ViewHandling.h"
#include "Unity/ObjCRuntime.h"
#include "Unity/VideoPlayer.h"
#include "PluginBase/UnityViewControllerListener.h"
@interface UICancelGestureRecognizer : UITapGestureRecognizer
@end
@interface AVKitVideoPlayback : NSObject<VideoPlayerDelegate, UIViewControllerTransitioningDelegate, UIGestureRecognizerDelegate>
{
AVPlayerViewController* videoViewController;
VideoPlayer* videoPlayer;
UIColor* bgColor;
const NSString* videoGravity;
BOOL showControls;
BOOL cancelOnTouch;
}
- (void)onPlayerReady;
- (void)onPlayerDidFinishPlayingVideo;
- (id)initAndPlay:(NSURL*)url bgColor:(UIColor*)color showControls:(BOOL)controls videoGravity:(const NSString*)scaling cancelOnTouch:(BOOL)cot;
- (void)actuallyStartTheMovie:(NSURL*)url;
- (void)finish;
@end
static AVKitVideoPlayback* _AVKitVideoPlayback = nil;
@implementation AVKitVideoPlayback
#if PLATFORM_IOS
static void AVPlayerViewController_SetAllowsPictureInPicturePlayback_OldIOSImpl(id self_, SEL _cmd, BOOL allow) {}
static NSUInteger supportedInterfaceOrientations_DefaultImpl(id self_, SEL _cmd)
{
return GetAppController().rootViewController.supportedInterfaceOrientations;
}
static bool prefersStatusBarHidden_DefaultImpl(id self_, SEL _cmd)
{
if (_AVKitVideoPlayback) // video is still playing
return _AVKitVideoPlayback->videoViewController.showsPlaybackControls ? NO : YES;
else // video has beed stopped
return GetAppController().rootViewController.prefersStatusBarHidden;
}
#endif
+ (void)initialize
{
if (self == [AVKitVideoPlayback class])
{
#if PLATFORM_IOS
class_replaceMethod([AVPlayerViewController class], @selector(supportedInterfaceOrientations), (IMP)&supportedInterfaceOrientations_DefaultImpl, UIViewController_supportedInterfaceOrientations_Enc);
class_replaceMethod([AVPlayerViewController class], @selector(prefersStatusBarHidden), (IMP)&prefersStatusBarHidden_DefaultImpl, UIViewController_prefersStatusBarHidden_Enc);
#endif
}
}
- (id)initAndPlay:(NSURL*)url bgColor:(UIColor*)color showControls:(BOOL)controls videoGravity:(const NSString*)scaling cancelOnTouch:(BOOL)cot
{
if ((self = [super init]))
{
UnityPause(1);
showControls = controls;
videoGravity = scaling;
bgColor = color;
cancelOnTouch = cot;
[self performSelector: @selector(actuallyStartTheMovie:) withObject: url afterDelay: 0];
}
return self;
}
- (void)dealloc
{
[self finish];
}
- (void)actuallyStartTheMovie:(NSURL*)url
{
@autoreleasepool
{
videoViewController = [[AVPlayerViewController alloc] init];
videoViewController.showsPlaybackControls = showControls;
videoViewController.view.backgroundColor = bgColor;
videoViewController.videoGravity = (NSString*)videoGravity;
videoViewController.transitioningDelegate = self;
#if PLATFORM_IOS
videoViewController.allowsPictureInPicturePlayback = NO;
#endif
#if PLATFORM_TVOS
// In tvOS clicking Menu button while video is playing will exit the app. So when
// app disables exiting to menu behavior, we need to catch the click and ignore it.
if (!UnityGetAppleTVRemoteAllowExitToMenu())
{
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(handleTap:)];
tapRecognizer.allowedPressTypes = @[@(UIPressTypeMenu)];
[videoViewController.view addGestureRecognizer: tapRecognizer];
}
#endif
if (cancelOnTouch)
{
UICancelGestureRecognizer *cancelTouch = [[UICancelGestureRecognizer alloc] initWithTarget: self action: @selector(handleTap:)];
cancelTouch.delegate = self;
[videoViewController.view addGestureRecognizer: cancelTouch];
}
videoPlayer = [[VideoPlayer alloc] init];
videoPlayer.delegate = self;
[videoPlayer loadVideo: url];
}
}
- (void)handleTap:(UITapGestureRecognizer*)sender
{
if (cancelOnTouch && (sender.state == UIGestureRecognizerStateEnded))
[self finish];
}
- (void)onPlayerReady
{
videoViewController.player = videoPlayer.player;
CGSize screenSize = GetAppController().rootView.bounds.size;
BOOL ret = [VideoPlayer CheckScalingModeAspectFill: videoPlayer.videoSize screenSize: screenSize];
if (ret == YES && [videoViewController.videoGravity isEqualToString: AVLayerVideoGravityResizeAspect] == YES)
{
videoViewController.videoGravity = AVLayerVideoGravityResizeAspectFill;
}
[videoPlayer playVideoPlayer];
#if PLATFORM_TVOS
GetAppController().window.rootViewController = videoViewController;
#else
UIViewController *viewController = [GetAppController() topMostController];
if ([viewController isEqual: videoViewController] == NO && [videoViewController isBeingPresented] == NO)
[viewController presentViewController: videoViewController animated: NO completion: nil];
#endif
}
- (void)onPlayerDidFinishPlayingVideo
{
[self finish];
}
- (void)onPlayerTryResume
{
if (![videoPlayer isPlaying])
[videoPlayer resume];
}
- (void)onPlayerError:(NSError*)error
{
[self finish];
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
if ([dismissed isEqual: videoViewController] == YES)
{
[self finish];
}
return nil;
}
- (void)finish
{
@synchronized(self)
{
#if PLATFORM_TVOS
GetAppController().window.rootViewController = GetAppController().rootViewController;
#else
UIViewController *viewController = [GetAppController() topMostController];
if ([viewController isEqual: videoViewController] == YES && [viewController isBeingDismissed] == NO)
[viewController dismissViewControllerAnimated: NO completion: nil];
#endif
[videoPlayer unloadPlayer];
videoPlayer = nil;
videoViewController = nil;
_AVKitVideoPlayback = nil;
#if PLATFORM_TVOS
UnityCancelTouches();
#endif
if (UnityIsPaused())
UnityPause(0);
}
}
@end
@implementation UICancelGestureRecognizer
//instead of having lots of UITapGestureRecognizers with different finger numbers
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
[self setState: UIGestureRecognizerStateRecognized];
}
@end
extern "C" void UnityPlayFullScreenVideo(const char* path, const float* color, unsigned controls, unsigned scaling)
{
const BOOL cancelOnTouch[] = { NO, NO, YES, NO };
UIColor* bgColor = [UIColor colorWithRed: color[0] green: color[1] blue: color[2] alpha: color[3]];
const bool isURL = ::strstr(path, "://") != 0;
NSURL* url = nil;
if (isURL)
{
url = [NSURL URLWithString: [NSString stringWithUTF8String: path]];
}
else
{
NSString* relPath = path[0] == '/' ? [NSString stringWithUTF8String: path] : [NSString stringWithFormat: @"Data/Raw/%s", path];
NSString* fullPath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent: relPath];
url = [NSURL fileURLWithPath: fullPath];
}
const BOOL showControls[] = { YES, YES, NO, NO };
const NSString* videoGravity[] =
{
AVLayerVideoGravityResizeAspectFill, // ???
AVLayerVideoGravityResizeAspect,
AVLayerVideoGravityResizeAspectFill,
AVLayerVideoGravityResize,
};
if (_AVKitVideoPlayback)
[_AVKitVideoPlayback finish];
_AVKitVideoPlayback = [[AVKitVideoPlayback alloc] initAndPlay: url bgColor: bgColor
showControls: showControls[controls] videoGravity: videoGravity[scaling] cancelOnTouch: cancelOnTouch[controls]];
}
extern "C" void UnityStopFullScreenVideoIfPlaying()
{
if (_AVKitVideoPlayback)
[_AVKitVideoPlayback finish];
}
extern "C" int UnityIsFullScreenPlaying()
{
return _AVKitVideoPlayback ? 1 : 0;
}
extern "C" void TryResumeFullScreenVideo()
{
if (_AVKitVideoPlayback)
[_AVKitVideoPlayback onPlayerTryResume];
}

@ -0,0 +1,31 @@
#pragma once
#ifdef __OBJC__
@class CAEAGLLayer;
@class EAGLContext;
#else
typedef struct objc_object CAEAGLLayer;
typedef struct objc_object EAGLContext;
#endif
#define MSAA_DEFAULT_SAMPLE_COUNT 1
// in case of rendering to non-native resolution the texture filter we will use for upscale blit
#define GLES_UPSCALE_FILTER GL_LINEAR
//#define GLES_UPSCALE_FILTER GL_NEAREST
// if gles support MSAA. We will need to recreate unity view if AA samples count was changed
extern bool _supportsMSAA;
#ifdef __cplusplus
extern "C" {
#endif
void CheckGLESError(const char* file, int line);
#ifdef __cplusplus
} // extern "C"
#endif

@ -0,0 +1,372 @@
#include <QuartzCore/QuartzCore.h>
#include <stdio.h>
#include "GlesHelper.h"
#include "UnityAppController.h"
#include "DisplayManager.h"
#include "EAGLContextHelper.h"
#include "CVTextureCache.h"
#include "InternalProfiler.h"
// here goes some gles magic
// we include gles3 header so we will use gles3 constants.
// sure all the actual gles3 is guarded (and constants are staying same)
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
// here are the prototypes for gles2 ext functions that moved to core in gles3
extern "C" void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments);
extern "C" void glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
extern "C" void glResolveMultisampleFramebufferAPPLE(void);
#define SAFE_GL_DELETE(func, obj) do { if(obj) { func(1,&obj); obj = 0; } } while(0)
#define DISCARD_FBO(ctx, fbo, cnt, att) \
do{ \
if(surface->context.API >= 3) glInvalidateFramebuffer(fbo, cnt, att);\
else if(_supportsDiscard) glDiscardFramebufferEXT(fbo, cnt, att);\
} while(0)
#define CREATE_RB_AA(ctx, aa, fmt, w, h) \
do{ \
if(surface->context.API >= 3) glRenderbufferStorageMultisample(GL_RENDERBUFFER, aa, fmt, w, h); \
else if(_supportsDiscard) glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER, aa, fmt, w, h);\
} while(0)
static bool _supportsDiscard = false;
static bool _supportsPackedStencil = false;
extern "C" void InitRenderingGLES()
{
int api = UnitySelectedRenderingAPI();
assert(api == apiOpenGLES2 || api == apiOpenGLES3);
_supportsDiscard = api == apiOpenGLES2 ? UnityHasRenderingAPIExtension("GL_EXT_discard_framebuffer") : true;
_supportsMSAA = api == apiOpenGLES2 ? UnityHasRenderingAPIExtension("GL_APPLE_framebuffer_multisample") : true;
_supportsPackedStencil = api == apiOpenGLES2 ? UnityHasRenderingAPIExtension("GL_OES_packed_depth_stencil") : true;
}
extern "C" void CreateSystemRenderingSurfaceGLES(UnityDisplaySurfaceGLES* surface)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
DestroySystemRenderingSurfaceGLES(surface);
surface->layer.opaque = YES;
surface->layer.drawableProperties = @{ kEAGLDrawablePropertyRetainedBacking: @(FALSE), kEAGLDrawablePropertyColorFormat: kEAGLColorFormatRGBA8 };
surface->colorFormat = GL_RGBA8;
glGenRenderbuffers(1, &surface->systemColorRB);
glBindRenderbuffer(GL_RENDERBUFFER, surface->systemColorRB);
AllocateRenderBufferStorageFromEAGLLayer((__bridge void*)surface->context, (__bridge void*)surface->layer);
glGenFramebuffers(1, &surface->systemFB);
UnityBindFramebuffer(kDrawFramebuffer, surface->systemFB);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, surface->systemColorRB);
}
extern "C" void CreateRenderingSurfaceGLES(UnityDisplaySurfaceGLES* surface)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
DestroyRenderingSurfaceGLES(surface);
bool needRenderingSurface = surface->targetW != surface->systemW || surface->targetH != surface->systemH || surface->useCVTextureCache;
if (needRenderingSurface)
{
GLint oldTexBinding = 0;
if (surface->useCVTextureCache)
surface->cvTextureCache = CreateCVTextureCache();
if (surface->cvTextureCache)
{
surface->cvTextureCacheTexture = CreateReadableRTFromCVTextureCache(surface->cvTextureCache, surface->targetW, surface->targetH, &surface->cvPixelBuffer);
surface->targetColorRT = GetGLTextureFromCVTextureCache(surface->cvTextureCacheTexture);
}
else
{
glGenTextures(1, &surface->targetColorRT);
}
glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexBinding);
glBindTexture(GL_TEXTURE_2D, surface->targetColorRT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GLES_UPSCALE_FILTER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GLES_UPSCALE_FILTER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if (!surface->cvTextureCache)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->targetW, surface->targetH, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glGenFramebuffers(1, &surface->targetFB);
UnityBindFramebuffer(kDrawFramebuffer, surface->targetFB);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, surface->targetColorRT, 0);
glBindTexture(GL_TEXTURE_2D, oldTexBinding);
}
if (_supportsMSAA && surface->msaaSamples > 1)
{
glGenRenderbuffers(1, &surface->msaaColorRB);
glBindRenderbuffer(GL_RENDERBUFFER, surface->msaaColorRB);
glGenFramebuffers(1, &surface->msaaFB);
UnityBindFramebuffer(kDrawFramebuffer, surface->msaaFB);
CREATE_RB_AA(surface->context, surface->msaaSamples, surface->colorFormat, surface->targetW, surface->targetH);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, surface->msaaColorRB);
}
}
extern "C" void CreateSharedDepthbufferGLES(UnityDisplaySurfaceGLES* surface)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
DestroySharedDepthbufferGLES(surface);
if (surface->disableDepthAndStencil)
return;
surface->depthFormat = GL_DEPTH_COMPONENT24;
if (_supportsPackedStencil)
surface->depthFormat = GL_DEPTH24_STENCIL8;
glGenRenderbuffers(1, &surface->depthRB);
glBindRenderbuffer(GL_RENDERBUFFER, surface->depthRB);
bool needMSAA = _supportsMSAA && surface->msaaSamples > 1;
if (needMSAA)
CREATE_RB_AA(surface->context, surface->msaaSamples, surface->depthFormat, surface->targetW, surface->targetH);
if (!needMSAA)
glRenderbufferStorage(GL_RENDERBUFFER, surface->depthFormat, surface->targetW, surface->targetH);
if (surface->msaaFB)
UnityBindFramebuffer(kDrawFramebuffer, surface->msaaFB);
else if (surface->targetFB)
UnityBindFramebuffer(kDrawFramebuffer, surface->targetFB);
else
UnityBindFramebuffer(kDrawFramebuffer, surface->systemFB);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, surface->depthRB);
if (_supportsPackedStencil)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, surface->depthRB);
}
extern "C" void CreateUnityRenderBuffersGLES(UnityDisplaySurfaceGLES* surface)
{
UnityRenderBufferDesc target_desc = {surface->targetW, surface->targetH, 1, (unsigned int)surface->msaaSamples, 1};
UnityRenderBufferDesc system_desc = {surface->systemW, surface->systemH, 1, 1, 1};
{
unsigned texid = 0, rbid = 0, fbo = 0;
if (surface->msaaFB)
{
rbid = surface->msaaColorRB;
fbo = surface->msaaFB;
}
else if (surface->targetFB)
{
texid = surface->targetColorRT;
fbo = surface->targetFB;
}
else
{
rbid = surface->systemColorRB;
fbo = surface->systemFB;
}
surface->unityColorBuffer = UnityCreateExternalSurfaceGLES(surface->unityColorBuffer, true, texid, rbid, surface->colorFormat, &target_desc);
if (surface->depthRB)
surface->unityDepthBuffer = UnityCreateExternalSurfaceGLES(surface->unityDepthBuffer, false, 0, surface->depthRB, surface->depthFormat, &target_desc);
else
surface->unityDepthBuffer = UnityCreateDummySurface(surface->unityDepthBuffer, false, &target_desc);
UnityRegisterFBO(surface->unityColorBuffer, surface->unityDepthBuffer, fbo);
}
surface->systemColorBuffer = surface->systemDepthBuffer = 0;
if (surface->msaaFB || surface->targetFB)
{
unsigned rbid = surface->systemColorRB;
surface->systemColorBuffer = UnityCreateExternalSurfaceGLES(surface->systemColorBuffer, true, 0, rbid, surface->colorFormat, &system_desc);
surface->systemDepthBuffer = UnityCreateDummySurface(surface->systemDepthBuffer, false, &system_desc);
UnityRegisterFBO(surface->systemColorBuffer, surface->systemDepthBuffer, surface->systemFB);
}
surface->resolvedColorBuffer = 0;
if (surface->msaaFB && surface->targetFB)
surface->resolvedColorBuffer = UnityCreateExternalSurfaceGLES(surface->resolvedColorBuffer, true, surface->targetColorRT, 0, surface->colorFormat, &target_desc);
}
extern "C" void DestroySystemRenderingSurfaceGLES(UnityDisplaySurfaceGLES* surface)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
UnityBindFramebuffer(kDrawFramebuffer, 0);
if (surface->systemColorRB)
{
glBindRenderbuffer(GL_RENDERBUFFER, surface->systemColorRB);
DeallocateRenderBufferStorageFromEAGLLayer((__bridge void*)surface->context);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glDeleteRenderbuffers(1, &surface->systemColorRB);
surface->systemColorRB = 0;
}
if (surface->targetFB == 0 && surface->msaaFB == 0)
SAFE_GL_DELETE(glDeleteRenderbuffers, surface->depthRB);
SAFE_GL_DELETE(glDeleteFramebuffers, surface->systemFB);
}
extern "C" void DestroyRenderingSurfaceGLES(UnityDisplaySurfaceGLES* surface)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
if (surface->targetColorRT && !surface->cvTextureCache)
{
glDeleteTextures(1, &surface->targetColorRT); UnityOnDeleteGLTexture(surface->targetColorRT);
surface->targetColorRT = 0;
}
UnityBindFramebuffer(kDrawFramebuffer, 0);
UnityBindFramebuffer(kReadFramebuffer, 0);
if (surface->cvTextureCacheTexture)
CFRelease(surface->cvTextureCacheTexture);
if (surface->cvPixelBuffer)
CFRelease(surface->cvPixelBuffer);
if (surface->cvTextureCache)
CFRelease(surface->cvTextureCache);
surface->cvTextureCache = 0;
SAFE_GL_DELETE(glDeleteFramebuffers, surface->targetFB);
SAFE_GL_DELETE(glDeleteRenderbuffers, surface->msaaColorRB);
SAFE_GL_DELETE(glDeleteFramebuffers, surface->msaaFB);
}
extern "C" void DestroySharedDepthbufferGLES(UnityDisplaySurfaceGLES* surface)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
SAFE_GL_DELETE(glDeleteRenderbuffers, surface->depthRB);
}
extern "C" void DestroyUnityRenderBuffersGLES(UnityDisplaySurfaceGLES* surface)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
if (surface->unityColorBuffer)
UnityDestroyExternalSurface(surface->unityColorBuffer);
if (surface->systemColorBuffer)
UnityDestroyExternalSurface(surface->systemColorBuffer);
surface->unityColorBuffer = surface->systemColorBuffer = 0;
if (surface->unityDepthBuffer)
UnityDestroyExternalSurface(surface->unityDepthBuffer);
if (surface->systemDepthBuffer)
UnityDestroyExternalSurface(surface->systemDepthBuffer);
surface->unityDepthBuffer = surface->systemDepthBuffer = 0;
if (surface->resolvedColorBuffer)
UnityDestroyExternalSurface(surface->resolvedColorBuffer);
surface->resolvedColorBuffer = 0;
}
extern "C" void PreparePresentGLES(UnityDisplaySurfaceGLES* surface)
{
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
if (_supportsMSAA && surface->msaaSamples > 1)
{
Profiler_StartMSAAResolve();
GLuint targetFB = surface->targetFB ? surface->targetFB : surface->systemFB;
UnityBindFramebuffer(kReadFramebuffer, surface->msaaFB);
UnityBindFramebuffer(kDrawFramebuffer, targetFB);
GLenum discardAttach[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
DISCARD_FBO(surface->context, GL_READ_FRAMEBUFFER, 2, discardAttach);
if (surface->context.API < 3)
{
glResolveMultisampleFramebufferAPPLE();
}
else
{
const GLint w = surface->targetW, h = surface->targetH;
glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
Profiler_EndMSAAResolve();
}
if (surface->allowScreenshot && UnityIsCaptureScreenshotRequested())
{
GLint targetFB = surface->targetFB ? surface->targetFB : surface->systemFB;
UnityBindFramebuffer(kReadFramebuffer, targetFB);
UnityCaptureScreenshot();
}
}
APP_CONTROLLER_RENDER_PLUGIN_METHOD(onFrameResolved);
if (surface->targetColorRT)
{
// shaders are bound to context
EAGLContextSetCurrentAutoRestore autorestore(UnityGetMainScreenContextGLES());
assert(surface->systemColorBuffer != 0 && surface->systemDepthBuffer != 0);
UnityRenderBufferHandle src = surface->resolvedColorBuffer ? surface->resolvedColorBuffer : surface->unityColorBuffer;
UnityBlitToBackbuffer(src, surface->systemColorBuffer, surface->systemDepthBuffer);
}
if (_supportsDiscard)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
GLenum discardAttach[] = {GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
if (surface->msaaFB)
DISCARD_FBO(surface->context, GL_READ_FRAMEBUFFER, 3, discardAttach);
if (surface->targetFB)
{
UnityBindFramebuffer(kDrawFramebuffer, surface->targetFB);
DISCARD_FBO(surface->context, GL_FRAMEBUFFER, 3, discardAttach);
}
UnityBindFramebuffer(kDrawFramebuffer, surface->systemFB);
DISCARD_FBO(surface->context, GL_FRAMEBUFFER, 2, &discardAttach[1]);
}
}
extern "C" void PresentGLES(UnityDisplaySurfaceGLES* surface)
{
if (surface->context && surface->systemColorRB)
{
EAGLContextSetCurrentAutoRestore autorestore(surface->context);
glBindRenderbuffer(GL_RENDERBUFFER, surface->systemColorRB);
[surface->context presentRenderbuffer: GL_RENDERBUFFER];
}
}
extern "C" void StartFrameRenderingGLES(UnityDisplaySurfaceGLES* /*surface*/)
{
}
extern "C" void EndFrameRenderingGLES(UnityDisplaySurfaceGLES* /*surface*/)
{
}
extern "C" void CheckGLESError(const char* file, int line)
{
GLenum e = glGetError();
if (e)
::printf("OpenGLES error 0x%04X in %s:%i\n", e, file, line);
}

@ -0,0 +1,51 @@
#pragma once
#include "IUnityInterface.h"
typedef enum UnityGfxRenderer
{
//kUnityGfxRendererOpenGL = 0, // Legacy OpenGL, removed
//kUnityGfxRendererD3D9 = 1, // Direct3D 9, removed
kUnityGfxRendererD3D11 = 2, // Direct3D 11
kUnityGfxRendererNull = 4, // "null" device (used in batch mode)
kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0
kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.0
//kUnityGfxRendererGXM = 12, // PlayStation Vita, removed
kUnityGfxRendererPS4 = 13, // PlayStation 4
kUnityGfxRendererXboxOne = 14, // Xbox One
kUnityGfxRendererMetal = 16, // iOS Metal
kUnityGfxRendererOpenGLCore = 17, // OpenGL core
kUnityGfxRendererD3D12 = 18, // Direct3D 12
kUnityGfxRendererVulkan = 21, // Vulkan
kUnityGfxRendererNvn = 22, // Nintendo Switch NVN API
kUnityGfxRendererXboxOneD3D12 = 23 // MS XboxOne Direct3D 12
} UnityGfxRenderer;
typedef enum UnityGfxDeviceEventType
{
kUnityGfxDeviceEventInitialize = 0,
kUnityGfxDeviceEventShutdown = 1,
kUnityGfxDeviceEventBeforeReset = 2,
kUnityGfxDeviceEventAfterReset = 3,
} UnityGfxDeviceEventType;
typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType);
// Should only be used on the rendering thread unless noted otherwise.
UNITY_DECLARE_INTERFACE(IUnityGraphics)
{
UnityGfxRenderer(UNITY_INTERFACE_API * GetRenderer)(); // Thread safe
// This callback will be called when graphics device is created, destroyed, reset, etc.
// It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time,
// when the graphics device is already created.
void(UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback);
void(UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback);
int(UNITY_INTERFACE_API * ReserveEventIDRange)(int count); // reserves 'count' event IDs. Plugins should use the result as a base index when issuing events back and forth to avoid event id clashes.
};
UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL, 0x8C5AD4926EB17B11ULL, IUnityGraphics)
// Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins.
// Provide them with an address to a function of this signature.
typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId);
typedef void (UNITY_INTERFACE_API * UnityRenderingEventAndData)(int eventId, void* data);

@ -0,0 +1,68 @@
#pragma once
#include "IUnityInterface.h"
#ifndef __OBJC__
#error metal plugin is objc code.
#endif
#ifndef __clang__
#error only clang compiler is supported.
#endif
@class NSBundle;
@protocol MTLDevice;
@protocol MTLCommandBuffer;
@protocol MTLCommandEncoder;
@protocol MTLTexture;
@class MTLRenderPassDescriptor;
UNITY_DECLARE_INTERFACE(IUnityGraphicsMetalV1)
{
NSBundle* (UNITY_INTERFACE_API * MetalBundle)();
id<MTLDevice>(UNITY_INTERFACE_API * MetalDevice)();
id<MTLCommandBuffer>(UNITY_INTERFACE_API * CurrentCommandBuffer)();
// for custom rendering support there are two scenarios:
// you want to use current in-flight MTLCommandEncoder (NB: it might be nil)
id<MTLCommandEncoder>(UNITY_INTERFACE_API * CurrentCommandEncoder)();
// or you might want to create your own encoder.
// In that case you should end unity's encoder before creating your own and end yours before returning control to unity
void(UNITY_INTERFACE_API * EndCurrentCommandEncoder)();
// returns MTLRenderPassDescriptor used to create current MTLCommandEncoder
MTLRenderPassDescriptor* (UNITY_INTERFACE_API * CurrentRenderPassDescriptor)();
// converting trampoline UnityRenderBufferHandle into native RenderBuffer
UnityRenderBuffer(UNITY_INTERFACE_API * RenderBufferFromHandle)(void* bufferHandle);
// access to RenderBuffer's texure
// NB: you pass here *native* RenderBuffer, acquired by calling (C#) RenderBuffer.GetNativeRenderBufferPtr
// AAResolvedTextureFromRenderBuffer will return nil in case of non-AA RenderBuffer or if called for depth RenderBuffer
// StencilTextureFromRenderBuffer will return nil in case of no-stencil RenderBuffer or if called for color RenderBuffer
id<MTLTexture>(UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer);
id<MTLTexture>(UNITY_INTERFACE_API * AAResolvedTextureFromRenderBuffer)(UnityRenderBuffer buffer);
id<MTLTexture>(UNITY_INTERFACE_API * StencilTextureFromRenderBuffer)(UnityRenderBuffer buffer);
};
UNITY_REGISTER_INTERFACE_GUID(0x29F8F3D03833465EULL, 0x92138551C15D823DULL, IUnityGraphicsMetalV1)
// deprecated: please use versioned interface above
UNITY_DECLARE_INTERFACE(IUnityGraphicsMetal)
{
NSBundle* (UNITY_INTERFACE_API * MetalBundle)();
id<MTLDevice>(UNITY_INTERFACE_API * MetalDevice)();
id<MTLCommandBuffer>(UNITY_INTERFACE_API * CurrentCommandBuffer)();
id<MTLCommandEncoder>(UNITY_INTERFACE_API * CurrentCommandEncoder)();
void(UNITY_INTERFACE_API * EndCurrentCommandEncoder)();
MTLRenderPassDescriptor* (UNITY_INTERFACE_API * CurrentRenderPassDescriptor)();
UnityRenderBuffer(UNITY_INTERFACE_API * RenderBufferFromHandle)(void* bufferHandle);
id<MTLTexture>(UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer);
id<MTLTexture>(UNITY_INTERFACE_API * AAResolvedTextureFromRenderBuffer)(UnityRenderBuffer buffer);
id<MTLTexture>(UNITY_INTERFACE_API * StencilTextureFromRenderBuffer)(UnityRenderBuffer buffer);
};
UNITY_REGISTER_INTERFACE_GUID(0x992C8EAEA95811E5ULL, 0x9A62C4B5B9876117ULL, IUnityGraphicsMetal)

Some files were not shown because too many files have changed in this diff Show More