Beispiel #1
0
        public void ToNative(IntPtr nativeStruct)
        {
            if (!FTestSS_IsValid)
            {
                NativeReflection.LogInvalidStructAccessed("/Game/Pong/Test/TestSS.TestSS");
                return;
            }
            BoolMarshaler.ToNative(IntPtr.Add(nativeStruct, MemberVar_0_Offset), 0, MemberVar_0_PropertyAddress.Address, MemberVar_0);
            TArrayCopyMarshaler <float> MemberVar_1_Marshaler = new TArrayCopyMarshaler <float>(1, MemberVar_1_PropertyAddress, CachedMarshalingDelegates <float, BlittableTypeMarshaler <float> > .FromNative, CachedMarshalingDelegates <float, BlittableTypeMarshaler <float> > .ToNative);

            MemberVar_1_Marshaler.ToNative(IntPtr.Add(nativeStruct, MemberVar_1_Offset), MemberVar_1);
            BlittableTypeMarshaler <byte> .ToNative(IntPtr.Add(nativeStruct, MemberVar_21_Offset), MemberVar_21);
        }
Beispiel #2
0
 public void ToNative(IntPtr nativeStruct)
 {
     if (!FMaterialQualityOverrides_IsValid)
     {
         NativeReflection.LogInvalidStructAccessed("/Script/MaterialShaderQualitySettings.MaterialQualityOverrides");
         return;
     }
     BoolMarshaler.ToNative(IntPtr.Add(nativeStruct, EnableOverride_Offset), 0, EnableOverride_PropertyAddress.Address, EnableOverride);
     BoolMarshaler.ToNative(IntPtr.Add(nativeStruct, ForceFullyRough_Offset), 0, ForceFullyRough_PropertyAddress.Address, ForceFullyRough);
     BoolMarshaler.ToNative(IntPtr.Add(nativeStruct, ForceNonMetal_Offset), 0, ForceNonMetal_PropertyAddress.Address, ForceNonMetal);
     BoolMarshaler.ToNative(IntPtr.Add(nativeStruct, ForceDisableLMDirectionality_Offset), 0, ForceDisableLMDirectionality_PropertyAddress.Address, ForceDisableLMDirectionality);
     BoolMarshaler.ToNative(IntPtr.Add(nativeStruct, ForceLQReflections_Offset), 0, ForceLQReflections_PropertyAddress.Address, ForceLQReflections);
     EnumMarshaler <EMobileCSMQuality> .ToNative(IntPtr.Add(nativeStruct, MobileCSMQuality_Offset), 0, MobileCSMQuality_PropertyAddress.Address, MobileCSMQuality);
 }
Beispiel #3
0
        public void ToNative(IntPtr nativeStruct)
        {
            if (!FDebugFloatHistory_IsValid)
            {
                return;
            }
            BlittableTypeMarshaler <float> .ToNative(IntPtr.Add(nativeStruct, MaxSamples_Offset), MaxSamples);

            BlittableTypeMarshaler <float> .ToNative(IntPtr.Add(nativeStruct, MinValue_Offset), MinValue);

            BlittableTypeMarshaler <float> .ToNative(IntPtr.Add(nativeStruct, MaxValue_Offset), MaxValue);

            BoolMarshaler.ToNative(IntPtr.Add(nativeStruct, AutoAdjustMinMax_Offset), 0, AutoAdjustMinMax_PropertyAddress.Address, AutoAdjustMinMax);
        }
Beispiel #4
0
        public FDebugFloatHistory(IntPtr nativeStruct)
        {
            if (!FDebugFloatHistory_IsValid)
            {
                MaxSamples       = default(float);
                MinValue         = default(float);
                MaxValue         = default(float);
                AutoAdjustMinMax = default(bool);
                return;
            }
            MaxSamples = BlittableTypeMarshaler <float> .FromNative(IntPtr.Add(nativeStruct, MaxSamples_Offset));

            MinValue = BlittableTypeMarshaler <float> .FromNative(IntPtr.Add(nativeStruct, MinValue_Offset));

            MaxValue = BlittableTypeMarshaler <float> .FromNative(IntPtr.Add(nativeStruct, MaxValue_Offset));

            AutoAdjustMinMax = BoolMarshaler.FromNative(IntPtr.Add(nativeStruct, AutoAdjustMinMax_Offset), 0, AutoAdjustMinMax_PropertyAddress.Address);
        }
Beispiel #5
0
 public FMaterialQualityOverrides(IntPtr nativeStruct)
 {
     if (!FMaterialQualityOverrides_IsValid)
     {
         NativeReflection.LogInvalidStructAccessed("/Script/MaterialShaderQualitySettings.MaterialQualityOverrides");
         EnableOverride  = default(bool);
         ForceFullyRough = default(bool);
         ForceNonMetal   = default(bool);
         ForceDisableLMDirectionality = default(bool);
         ForceLQReflections           = default(bool);
         MobileCSMQuality             = default(EMobileCSMQuality);
         return;
     }
     EnableOverride  = BoolMarshaler.FromNative(IntPtr.Add(nativeStruct, EnableOverride_Offset), 0, EnableOverride_PropertyAddress.Address);
     ForceFullyRough = BoolMarshaler.FromNative(IntPtr.Add(nativeStruct, ForceFullyRough_Offset), 0, ForceFullyRough_PropertyAddress.Address);
     ForceNonMetal   = BoolMarshaler.FromNative(IntPtr.Add(nativeStruct, ForceNonMetal_Offset), 0, ForceNonMetal_PropertyAddress.Address);
     ForceDisableLMDirectionality = BoolMarshaler.FromNative(IntPtr.Add(nativeStruct, ForceDisableLMDirectionality_Offset), 0, ForceDisableLMDirectionality_PropertyAddress.Address);
     ForceLQReflections           = BoolMarshaler.FromNative(IntPtr.Add(nativeStruct, ForceLQReflections_Offset), 0, ForceLQReflections_PropertyAddress.Address);
     MobileCSMQuality             = EnumMarshaler <EMobileCSMQuality> .FromNative(IntPtr.Add(nativeStruct, MobileCSMQuality_Offset), 0, MobileCSMQuality_PropertyAddress.Address);
 }
Beispiel #6
0
        /// <summary>
        /// Register all native functions with managed code
        /// </summary>
        /// <param name="registerFunctionsAddr">The address of the RegisterFunctions method defined in native code</param>
        public static void RegisterFunctions(IntPtr registerFunctionsAddr)
        {
            if (!EntryPoint.Preloaded)
            {
                string namespaceName = typeof(NativeFunctions).Namespace;
                foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
                {
                    if (type.IsClass && type.IsAbstract && type.IsSealed && type.Name.StartsWith("Native_") && type.Namespace == namespaceName)
                    {
                        // Native_FName -> Export_FName_XXXXX
                        string nativeFunctionPrefix = "Export" + type.Name.Replace("Native", string.Empty) + "_";

                        foreach (FieldInfo field in type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static))
                        {
                            if (field.IsStatic && field.FieldType.IsSubclassOf(typeof(Delegate)))
                            {
                                functions.Add(nativeFunctionPrefix + field.Name, field);
                            }
                        }
                    }
                }

                // Call the native RegisterFunctions method with our managed RegisterFunction as the callback
                Del_RegisterFunctions registerFunctions = (Del_RegisterFunctions)Marshal.GetDelegateForFunctionPointer(
                    registerFunctionsAddr, typeof(Del_RegisterFunctions));

                registerFunctions(Marshal.GetFunctionPointerForDelegate(registerFunction));

                // Highest (these may be called from a thread other than the game thread, don't access UObject methods)
                FBuild.OnNativeFunctionsRegistered();
                FGlobals.OnNativeFunctionsRegistered();
                Classes.OnNativeFunctionsRegistered();
                BoolMarshaler.OnNativeFunctionsRegistered();
                FStringMarshaler.OnNativeFunctionsRegistered();
                InputCore.FKey.OnNativeFunctionsRegistered();
                FFrame.OnNativeFunctionsRegistered();

                // Validate native struct sizes match the managed struct sizes before running any handlers
                // NOTE: This MUST come after FStringMarshaler.OnNativeFunctionsRegistered as this requires TCHAR size
                StructValidator.ValidateStructs();
            }

            if (!EntryPoint.Preloading)
            {
                Debug.Assert(FThreading.IsInGameThread(), "Load/hotreload should be on the game thread");

                // Highest = Used for initializing very important data required by other functions.
                // VeryHigh = Used for initializing data before UObject classes are loaded.
                // High = This is when UObject classes are loaded. Don't access UObjects at this or any higher priority.
                // Medium = UObject classes are loaded and available to use at this priority.

                // If GEngine is null we need to bind OnPostEngineInit to load anything which requires GEngine
                if (FGlobals.GEngine == IntPtr.Zero)
                {
                    FCoreDelegates.OnPostEngineInit.Bind(OnPostEngineInit);
                }

                // Highest
                GCHelper.OnNativeFunctionsRegistered();
                FMessage.OnNativeFunctionsRegistered();
                Engine.FTimerManagerCache.OnNativeFunctionsRegistered();
                WorldTimeHelper.OnNativeFunctionsRegistered();
                if (FGlobals.GEngine != IntPtr.Zero)
                {
                    // Needs GEngine for binding delegates
                    StaticVarManager.OnNativeFunctionsRegistered();
                    Coroutine.OnNativeFunctionsRegistered();
                }

                // VeryHigh
                NativeReflection.OnNativeFunctionsRegistered();// Requires Classes to be initialized

                // High
                OnNativeFunctionsRegistered();

                // Low
                EngineLoop.OnNativeFunctionsRegistered();

                // Lowest
                CodeGenerator.OnNativeFunctionsRegistered();
#if WITH_USHARP_TESTS
                Tests.Tests.OnNativeFunctionsRegistered();
#endif
            }
        }