Beispiel #1
0
 static void LoadNativeType()
 {
     //if (NativeReflection.CachedTypeInfo.Enabled)
     //{
     //    NativeReflection.CachedTypeInfo typeInfo = NativeReflection.CachedTypeInfo.BuildStruct("/Script/Engine.EditorElement");
     //    StructSize = typeInfo.Size;
     //    Indices_IsValid = typeInfo.GetPropertyRefOffsetAndValidate("Indices", ref Indices_PropertyAddress, out Indices_Offset, Classes.UIntProperty);
     //    Weights_IsValid = typeInfo.GetPropertyRefOffsetAndValidate("Weights", ref Weights_PropertyAddress, out Weights_Offset, Classes.UFloatProperty);
     //    FEditorElement_IsValid = typeInfo.Exists && Indices_IsValid && Weights_IsValid;
     //    typeInfo.LogIsValid(FEditorElement_IsValid);
     //}
     //else
     {
         IntPtr classAddress = NativeReflection.GetStruct("/Script/Engine.EditorElement");
         StructSize = NativeReflection.GetStructSize(classAddress);
         NativeReflectionCached.GetPropertyRef(ref Indices_PropertyAddress, classAddress, "Indices");
         Indices_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "Indices");
         Indices_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "Indices", Classes.UIntProperty);
         NativeReflectionCached.GetPropertyRef(ref Weights_PropertyAddress, classAddress, "Weights");
         Weights_Offset         = NativeReflectionCached.GetPropertyOffset(classAddress, "Weights");
         Weights_IsValid        = NativeReflectionCached.ValidatePropertyClass(classAddress, "Weights", Classes.UFloatProperty);
         FEditorElement_IsValid = classAddress != IntPtr.Zero && Indices_IsValid && Weights_IsValid;
         NativeReflection.LogStructIsValid("/Script/Engine.EditorElement", FEditorElement_IsValid);
     }
 }
Beispiel #2
0
 static void LoadNativeType()
 {
     //if (NativeReflection.CachedTypeInfo.Enabled)
     //{
     //    NativeReflection.CachedTypeInfo typeInfo = NativeReflection.CachedTypeInfo.BuildStruct("/Game/Pong/Test/TestSS.TestSS");
     //    StructSize = typeInfo.Size;
     //    MemberVar_0_IsValid = typeInfo.GetPropertyRefOffsetAndValidate("MemberVar_0_B281C27C4F41FBF7A9E425A51E7BD044", ref MemberVar_0_PropertyAddress, out MemberVar_0_Offset, Classes.UBoolProperty);
     //    MemberVar_1_IsValid = typeInfo.GetPropertyRefOffsetAndValidate("MemberVar_1_26_1BA5D22942BB264D88A4B2A9EEF51AC5", ref MemberVar_1_PropertyAddress, out MemberVar_1_Offset, Classes.UArrayProperty);
     //    MemberVar_21_IsValid = typeInfo.GetPropertyOffsetAndValidate("MemberVar_1_26_1BA5D22942BB264D88A4B2A9EEF51AC5", out MemberVar_21_Offset, Classes.UByteProperty);
     //    FTestSS_IsValid = typeInfo.Exists && MemberVar_0_IsValid && MemberVar_1_IsValid && MemberVar_21_IsValid;
     //    typeInfo.LogIsValid(FTestSS_IsValid);
     //}
     //else
     {
         IntPtr classAddress = NativeReflection.GetStruct("/Game/Pong/Test/TestSS.TestSS");
         StructSize = NativeReflection.GetStructSize(classAddress);
         NativeReflectionCached.GetPropertyRef(ref MemberVar_0_PropertyAddress, classAddress, "MemberVar_0_B281C27C4F41FBF7A9E425A51E7BD044");
         MemberVar_0_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "MemberVar_0_B281C27C4F41FBF7A9E425A51E7BD044");
         MemberVar_0_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "MemberVar_0_B281C27C4F41FBF7A9E425A51E7BD044", Classes.UBoolProperty);
         NativeReflectionCached.GetPropertyRef(ref MemberVar_1_PropertyAddress, classAddress, "MemberVar_1_26_1BA5D22942BB264D88A4B2A9EEF51AC5");
         MemberVar_1_Offset   = NativeReflectionCached.GetPropertyOffset(classAddress, "MemberVar_1_26_1BA5D22942BB264D88A4B2A9EEF51AC5");
         MemberVar_1_IsValid  = NativeReflectionCached.ValidatePropertyClass(classAddress, "MemberVar_1_26_1BA5D22942BB264D88A4B2A9EEF51AC5", Classes.UArrayProperty);
         MemberVar_21_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "MemberVar_21_25_B2CA1FFA4E95516B70C7E9A68011B260");
         MemberVar_21_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "MemberVar_21_25_B2CA1FFA4E95516B70C7E9A68011B260", Classes.UByteProperty);
         FTestSS_IsValid      = classAddress != IntPtr.Zero && MemberVar_0_IsValid && MemberVar_1_IsValid && MemberVar_21_IsValid;
         NativeReflection.LogStructIsValid("/Game/Pong/Test/TestSS.TestSS", FTestSS_IsValid);
     }
 }
Beispiel #3
0
        private void MoveToTransientPackage(IntPtr obj)
        {
            // Copy of UObjectBase.cpp UClassCompiledInDefer

            // Check if rooted?
            Native_UObjectBaseUtility.RemoveFromRoot(obj);
            Native_UObjectBaseUtility.ClearFlags(obj, EObjectFlags.Standalone | EObjectFlags.Public);

            IntPtr defaultObject = Native_UClass.GetDefaultObject(obj, false);

            if (defaultObject != IntPtr.Zero)
            {
                // Check if rooted?
                Native_UObjectBaseUtility.RemoveFromRoot(defaultObject);
                Native_UObjectBaseUtility.ClearFlags(defaultObject, EObjectFlags.Standalone | EObjectFlags.Public);
            }

            FName oldClassRename = NativeReflection.MakeUniqueObjectName(NativeReflection.GetTransientPackage(),
                                                                         Native_UObjectBase.GetClass(obj), new FName("USharpHotReload_" + Native_UObjectBase.GetFName(obj)));

            using (FStringUnsafe oldClassRenameUnsafe = new FStringUnsafe(oldClassRename.ToString()))
            {
                Native_UObject.Rename(obj, ref oldClassRenameUnsafe.Array, NativeReflection.GetTransientPackage(), ERenameFlags.None);
            }

            Native_UObjectBaseUtility.SetFlags(obj, EObjectFlags.Transient);
            Native_UObjectBaseUtility.AddToRoot(obj);
        }
Beispiel #4
0
 static void LoadNativeType()
 {
     //if (NativeReflection.CachedTypeInfo.Enabled)
     //{
     //    NativeReflection.CachedTypeInfo typeInfo = NativeReflection.CachedTypeInfo.BuildStruct("/Script/Engine.DebugFloatHistory");
     //    StructSize = typeInfo.Size;
     //    MaxSamples_IsValid = typeInfo.GetPropertyOffsetAndValidate("MaxSamples", out MaxSamples_Offset, Classes.UFloatProperty);
     //    MinValue_IsValid = typeInfo.GetPropertyOffsetAndValidate("MinValue", out MinValue_Offset, Classes.UFloatProperty);
     //    MaxValue_IsValid = typeInfo.GetPropertyOffsetAndValidate("MaxValue", out MaxValue_Offset, Classes.UFloatProperty);
     //    AutoAdjustMinMax_IsValid = typeInfo.GetPropertyRefOffsetAndValidate("bAutoAdjustMinMax", ref AutoAdjustMinMax_PropertyAddress, out AutoAdjustMinMax_Offset, Classes.UBoolProperty);
     //    FDebugFloatHistory_IsValid = typeInfo.Exists && MaxSamples_IsValid && MaxValue_IsValid && AutoAdjustMinMax_IsValid;
     //    typeInfo.LogIsValid(FDebugFloatHistory_IsValid);
     //}
     //else
     {
         IntPtr classAddress = NativeReflection.GetStruct("/Script/Engine.DebugFloatHistory");
         StructSize         = NativeReflection.GetStructSize(classAddress);
         MaxSamples_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "MaxSamples");
         MaxSamples_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "MaxSamples", Classes.UFloatProperty);
         MinValue_Offset    = NativeReflectionCached.GetPropertyOffset(classAddress, "MinValue");
         MinValue_IsValid   = NativeReflectionCached.ValidatePropertyClass(classAddress, "MinValue", Classes.UFloatProperty);
         MaxValue_Offset    = NativeReflectionCached.GetPropertyOffset(classAddress, "MaxValue");
         MaxValue_IsValid   = NativeReflectionCached.ValidatePropertyClass(classAddress, "MaxValue", Classes.UFloatProperty);
         NativeReflectionCached.GetPropertyRef(ref AutoAdjustMinMax_PropertyAddress, classAddress, "bAutoAdjustMinMax");
         AutoAdjustMinMax_Offset    = NativeReflectionCached.GetPropertyOffset(classAddress, "bAutoAdjustMinMax");
         AutoAdjustMinMax_IsValid   = NativeReflectionCached.ValidatePropertyClass(classAddress, "bAutoAdjustMinMax", Classes.UBoolProperty);
         FDebugFloatHistory_IsValid = classAddress != IntPtr.Zero && MaxSamples_IsValid && MinValue_IsValid && MaxValue_IsValid && AutoAdjustMinMax_IsValid;
         NativeReflection.LogStructIsValid("/Script/Engine.DebugFloatHistory", FDebugFloatHistory_IsValid);
     }
 }
Beispiel #5
0
        private static IntPtr GetStruct(string path, bool canBeNull = false)
        {
            IntPtr address = NativeReflection.FindObject(UScriptStruct, IntPtr.Zero, path, false);

            Debug.Assert(address != IntPtr.Zero || canBeNull);
            return(address);
        }
Beispiel #6
0
        public static void Call()
        {
            IntPtr classAddress = NativeReflection.GetClass("/Script/UnrealEngine_Runtime.MyClass");

            StringTest_FunctionAddress    = NativeReflection.GetFunction(classAddress, "MyTestFunc2");
            StringTest_ParamsSize         = NativeReflection.GetFunctionParamsSize(StringTest_FunctionAddress);
            StringTest_inVal_Offset       = NativeReflection.GetPropertyOffset(StringTest_FunctionAddress, "inVal");
            StringTest_stringTest_Offset  = NativeReflection.GetPropertyOffset(StringTest_FunctionAddress, "stringTest");
            StringTest_ParamResult_Offset = NativeReflection.GetPropertyOffset(StringTest_FunctionAddress, "__return");

            UMyClass myClass = UObject.NewObject <UMyClass>();
            string   refVal  = "inref";
            string   arg     = "hello world";

            unsafe
            {
                byte * ParamsBufferAllocation = stackalloc byte[StringTest_ParamsSize];
                IntPtr ParamsBuffer           = new IntPtr(ParamsBufferAllocation);
                FStringMarshaler.ToNative(IntPtr.Add(ParamsBuffer, StringTest_inVal_Offset), refVal);
                //FStringMarshaler.ToNative(IntPtr.Add(ParamsBuffer, StringTest_stringTest_Offset), arg);

                NativeReflection.InvokeFunction(myClass.Address, StringTest_FunctionAddress, ParamsBuffer, StringTest_ParamsSize);

                refVal = FStringMarshaler.FromNative(IntPtr.Add(ParamsBuffer, StringTest_inVal_Offset));
                arg    = FStringMarshaler.FromNative(IntPtr.Add(ParamsBuffer, StringTest_stringTest_Offset));
                string toReturn = FStringMarshaler.FromNative(IntPtr.Add(ParamsBuffer, StringTest_ParamResult_Offset));
                NativeReflection.InvokeFunction_DestroyAll(StringTest_FunctionAddress, ParamsBuffer);
            }
        }
Beispiel #7
0
 static void LoadNativeType()
 {
     IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.IntPoint");
     FIntPoint_StructSize = NativeReflection.GetStructSize(classAddress);
     X_Offset = NativeReflectionCached.GetPropertyOffset(classAddress, "X");
     X_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "X", Classes.UIntProperty);
     Y_Offset = NativeReflectionCached.GetPropertyOffset(classAddress, "Y");
     Y_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "Y", Classes.UIntProperty);
     NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FIntPoint));
 }
Beispiel #8
0
 public void ToNative(IntPtr nativeStruct)
 {
     if (!FMyStructCustomCtor_IsValid)
     {
         NativeReflection.LogInvalidStructAccessed("/Script/USharp.MyStructCustomCtor");
         return;
     }
     //BlittableTypeMarshaler<int>.ToNative(IntPtr.Add(nativeStruct, MyValue_Offset), MyValue);
     FStringMarshaler.ToNative(IntPtr.Add(nativeStruct, MyValue_Offset), MyValue);
 }
Beispiel #9
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.FloatInterval");

            FFloatInterval_StructSize = NativeReflection.GetStructSize(classAddress);
            Min_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "Min");
            Min_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "Min", Classes.UFloatProperty);
            Max_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "Max");
            Max_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "Max", Classes.UFloatProperty);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FFloatInterval));
        }
Beispiel #10
0
        public void ToNative(IntPtr nativeStruct)
        {
            if (!FEditorElement_IsValid)
            {
                NativeReflection.LogInvalidStructAccessed("/Script/Engine.EditorElement");
                return;
            }
            TFixedSizeArrayMarshaler <int> .ToNative(IntPtr.Add(nativeStruct, Indices_Offset), 0, Indices_PropertyAddress.Address, Indices);

            TFixedSizeArrayMarshaler <float> .ToNative(IntPtr.Add(nativeStruct, Weights_Offset), 0, Weights_PropertyAddress.Address, Weights);
        }
Beispiel #11
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.TwoVectors");

            FTwoVectors_StructSize = NativeReflection.GetStructSize(classAddress);
            v1_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "v1");
            v1_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "v1", Classes.UStructProperty);
            v2_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "v2");
            v2_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "v2", Classes.UStructProperty);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FTwoVectors));
        }
Beispiel #12
0
 public FMyStructCustomCtor(IntPtr nativeStruct)
 {
     if (!FMyStructCustomCtor_IsValid)
     {
         NativeReflection.LogInvalidStructAccessed("/Script/USharp.MyStructCustomCtor");
         MyValue = FStringMarshaler.DefaultString;
         //MyValue = 0;
         return;
     }
     MyValue = FStringMarshaler.FromNative(IntPtr.Add(nativeStruct, MyValue_Offset));
     //MyValue = BlittableTypeMarshaler<int>.FromNative(IntPtr.Add(nativeStruct, MyValue_Offset));
 }
Beispiel #13
0
        // Is there any benefit of writing a loader for UFunction here? Native types will be loaded in the module
        // is loaded and Blueprint function delegates would be loaded with the owning class.

        /// <summary>
        /// Gets the UFunction address for the given path (e.g. "/Script/Engine.Actor:SetOwner")
        /// </summary>
        /// <param name="path">The path of the UFunction</param>
        /// <returns>The address of the UFunction for the given path</returns>
        public static IntPtr GetFunctionAddress(string path)
        {
            IntPtr address = NativeReflection.FindObject(Classes.UFunction, IntPtr.Zero, path, false);

            if (address == IntPtr.Zero)
            {
                // To resolve this a call to FCoreRedirects.GetRedirectedName would be required with a UProperty type?
                // - Or this just isn't possible to resolve.
                // TODO: Attempt trying to create a redirected delegate in C++ and see what happens and how to resolve it.
            }
            return(address);
        }
Beispiel #14
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.Int32RangeBound");

            FInt32RangeBound_StructSize = NativeReflection.GetStructSize(classAddress);
            NativeReflectionCached.GetPropertyRef(ref Type_PropertyAddress, classAddress, "Type");
            Type_Offset   = NativeReflectionCached.GetPropertyOffset(classAddress, "Type");
            Type_IsValid  = NativeReflectionCached.ValidatePropertyClass(classAddress, "Type", Classes.UByteProperty);
            Value_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "Value");
            Value_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "Value", Classes.UFloatProperty);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FInt32RangeBound));
        }
Beispiel #15
0
        internal void Initialize()
        {
            EnsureNotInitialized();

            if (Address == IntPtr.Zero)
            {
                Address = FMemory.Malloc(NativeReflection.GetStructSize(structAddress));
                Native_UStruct.InitializeStruct(structAddress, Address, 1);
            }

            initialized = true;
        }
Beispiel #16
0
 /// <summary>
 /// Checks if the UObject which owns this struct is destroyed (if this struct is contained within a UObject)
 /// </summary>
 protected void CheckDestroyed()
 {
     if (Owner != null && Owner.IsDestroyed)
     {
         throw new UObjectDestroyedException("Trying to access a StructAsClass which points to memory of a destroyed UObject (" +
                                             NativeReflection.GetPathName(structAddress) + ")");
     }
     if (!initialized)
     {
         throw new Exception("Trying to access a StructAsClass which either wasn't initialized or was destroyed (" +
                             NativeReflection.GetPathName(structAddress) + ")");
     }
 }
Beispiel #17
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.Rotator");

            FRotator_StructSize = NativeReflection.GetStructSize(classAddress);
            Pitch_Offset        = NativeReflectionCached.GetPropertyOffset(classAddress, "Pitch");
            Pitch_IsValid       = NativeReflectionCached.ValidatePropertyClass(classAddress, "Pitch", Classes.UFloatProperty);
            Yaw_Offset          = NativeReflectionCached.GetPropertyOffset(classAddress, "Yaw");
            Yaw_IsValid         = NativeReflectionCached.ValidatePropertyClass(classAddress, "Yaw", Classes.UFloatProperty);
            Roll_Offset         = NativeReflectionCached.GetPropertyOffset(classAddress, "Roll");
            Roll_IsValid        = NativeReflectionCached.ValidatePropertyClass(classAddress, "Roll", Classes.UFloatProperty);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FRotator));
        }
Beispiel #18
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.Box");

            FBox_StructSize = NativeReflection.GetStructSize(classAddress);
            Min_Offset      = NativeReflectionCached.GetPropertyOffset(classAddress, "Min");
            Min_IsValid     = NativeReflectionCached.ValidatePropertyClass(classAddress, "Min", Classes.UStructProperty);
            Max_Offset      = NativeReflectionCached.GetPropertyOffset(classAddress, "Max");
            Max_IsValid     = NativeReflectionCached.ValidatePropertyClass(classAddress, "Max", Classes.UStructProperty);
            IsValid_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "IsValid");
            IsValid_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "IsValid", Classes.UByteProperty);
            //NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FBox));
        }
Beispiel #19
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.FloatRange");

            FFloatRange_StructSize = NativeReflection.GetStructSize(classAddress);
            LowerBound_Offset      = NativeReflectionCached.GetPropertyOffset(classAddress, "LowerBound");
            LowerBound_IsValid     = NativeReflectionCached.ValidatePropertyClass(classAddress, "LowerBound", Classes.UStructProperty);
            UpperBound_Offset      = NativeReflectionCached.GetPropertyOffset(classAddress, "UpperBound");
            UpperBound_IsValid     = NativeReflectionCached.ValidatePropertyClass(classAddress, "UpperBound", Classes.UStructProperty);
            FFloatRange_IsValid    = classAddress != IntPtr.Zero && LowerBound_IsValid && UpperBound_IsValid;
            NativeReflection.LogStructIsValid("/Script/CoreUObject.FloatRange", FFloatRange_IsValid);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FFloatRange));
        }
Beispiel #20
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 #21
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.RandomStream");

            FRandomStream_StructSize = NativeReflection.GetStructSize(classAddress);
            InitialSeed_Offset       = NativeReflectionCached.GetPropertyOffset(classAddress, "InitialSeed");
            InitialSeed_IsValid      = NativeReflectionCached.ValidatePropertyClass(classAddress, "InitialSeed", Classes.UIntProperty);
            Seed_Offset           = NativeReflectionCached.GetPropertyOffset(classAddress, "Seed");
            Seed_IsValid          = NativeReflectionCached.ValidatePropertyClass(classAddress, "Seed", Classes.UIntProperty);
            FRandomStream_IsValid = classAddress != IntPtr.Zero && InitialSeed_IsValid && Seed_IsValid;
            NativeReflection.LogStructIsValid("/Script/CoreUObject.RandomStream", FRandomStream_IsValid);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FRandomStream));
        }
Beispiel #22
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.BoxSphereBounds");

            FBoxSphereBounds_StructSize = NativeReflection.GetStructSize(classAddress);
            Origin_Offset        = NativeReflectionCached.GetPropertyOffset(classAddress, "Origin");
            Origin_IsValid       = NativeReflectionCached.ValidatePropertyClass(classAddress, "Origin", Classes.UStructProperty);
            BoxExtent_Offset     = NativeReflectionCached.GetPropertyOffset(classAddress, "BoxExtent");
            BoxExtent_IsValid    = NativeReflectionCached.ValidatePropertyClass(classAddress, "BoxExtent", Classes.UStructProperty);
            SphereRadius_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "SphereRadius");
            SphereRadius_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "SphereRadius", Classes.UFloatProperty);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FBoxSphereBounds));
        }
Beispiel #23
0
        public void Bind(TDelegate evnt)
        {
            IntPtr  functionAddress;
            UObject target;

            if (GetFunctionAddress(evnt, out functionAddress, out target))
            {
                Bind(target, NativeReflection.GetFName(functionAddress));
            }
            else
            {
                OnInvalidDelegate(evnt);
            }
        }
Beispiel #24
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 #25
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.Box2D");

            FBox2D_StructSize = NativeReflection.GetStructSize(classAddress);
            Min_Offset        = NativeReflectionCached.GetPropertyOffset(classAddress, "Min");
            Min_IsValid       = NativeReflectionCached.ValidatePropertyClass(classAddress, "Min", Classes.UStructProperty);
            Max_Offset        = NativeReflectionCached.GetPropertyOffset(classAddress, "Max");
            Max_IsValid       = NativeReflectionCached.ValidatePropertyClass(classAddress, "Max", Classes.UStructProperty);
            bIsValid_Offset   = NativeReflectionCached.GetPropertyOffset(classAddress, "bIsValid");
            bIsValid_IsValid  = NativeReflectionCached.ValidatePropertyClass(classAddress, "bIsValid", Classes.UByteProperty);
            FBox2D_IsValid    = classAddress != IntPtr.Zero && Min_IsValid && Max_IsValid && bIsValid_IsValid;
            NativeReflection.LogStructIsValid("/Script/CoreUObject.Box2D", FBox2D_IsValid);
        }
Beispiel #26
0
        /// <summary>
        /// Gets the UClass address for the given path (e.g. "/Script/Engine.Actor")
        /// </summary>
        /// <param name="path">The path of the object/class</param>
        /// <returns>The UClass address</returns>
        public static IntPtr GetClassAddress(string path)
        {
            IntPtr address = NativeReflection.FindObject(Classes.UClass, IntPtr.Zero, path, false);

            if (address == IntPtr.Zero)
            {
                FName newPath = FLinkerLoad.FindNewNameForClass(new FName(path), false);
                if (newPath != FName.None)
                {
                    address = NativeReflection.FindObject(Classes.UClass, IntPtr.Zero, newPath.ToString(), false);
                }
            }
            return(address);
        }
Beispiel #27
0
        public bool IsTargetBound(TDelegate evnt)
        {
            IntPtr  functionAddress;
            UObject target;

            if (GetFunctionAddress(evnt, out functionAddress, out target))
            {
                return(IsTargetBound(target, NativeReflection.GetFName(functionAddress)));
            }
            else
            {
                OnInvalidDelegate(evnt);
            }
            return(false);
        }
Beispiel #28
0
 static void LoadNativeType()
 {
     //if (NativeReflection.CachedTypeInfo.Enabled)
     //{
     //    NativeReflection.CachedTypeInfo typeInfo = NativeReflection.CachedTypeInfo.BuildClass("/Script/MaterialShaderQualitySettings.ShaderPlatformQualitySettings");
     //    QualityOverrides_IsValid = typeInfo.GetPropertyRefOffsetAndValidate("QualityOverrides", ref QualityOverrides_PropertyAddress, out QualityOverrides_Offset, Classes.UStructProperty);
     //}
     //else
     {
         IntPtr classAddress = NativeReflection.GetClass("/Script/MaterialShaderQualitySettings.ShaderPlatformQualitySettings");
         NativeReflectionCached.GetPropertyRef(ref QualityOverrides_PropertyAddress, classAddress, "QualityOverrides");
         QualityOverrides_Offset  = NativeReflectionCached.GetPropertyOffset(classAddress, "QualityOverrides");
         QualityOverrides_IsValid = NativeReflectionCached.ValidatePropertyClass(classAddress, "QualityOverrides", Classes.UStructProperty);
     }
 }
Beispiel #29
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.Color");

            FColor_StructSize = NativeReflection.GetStructSize(classAddress);
            B_Offset          = NativeReflectionCached.GetPropertyOffset(classAddress, "B");
            B_IsValid         = NativeReflectionCached.ValidatePropertyClass(classAddress, "B", Classes.UByteProperty);
            G_Offset          = NativeReflectionCached.GetPropertyOffset(classAddress, "G");
            G_IsValid         = NativeReflectionCached.ValidatePropertyClass(classAddress, "G", Classes.UByteProperty);
            R_Offset          = NativeReflectionCached.GetPropertyOffset(classAddress, "R");
            R_IsValid         = NativeReflectionCached.ValidatePropertyClass(classAddress, "R", Classes.UByteProperty);
            A_Offset          = NativeReflectionCached.GetPropertyOffset(classAddress, "A");
            A_IsValid         = NativeReflectionCached.ValidatePropertyClass(classAddress, "A", Classes.UByteProperty);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FColor));
        }
Beispiel #30
0
        static void LoadNativeType()
        {
            IntPtr classAddress = NativeReflection.GetStruct("/Script/CoreUObject.Vector4");

            FVector4_StructSize = NativeReflection.GetStructSize(classAddress);
            X_Offset            = NativeReflectionCached.GetPropertyOffset(classAddress, "X");
            X_IsValid           = NativeReflectionCached.ValidatePropertyClass(classAddress, "X", Classes.UFloatProperty);
            Y_Offset            = NativeReflectionCached.GetPropertyOffset(classAddress, "Y");
            Y_IsValid           = NativeReflectionCached.ValidatePropertyClass(classAddress, "Y", Classes.UFloatProperty);
            Z_Offset            = NativeReflectionCached.GetPropertyOffset(classAddress, "Z");
            Z_IsValid           = NativeReflectionCached.ValidatePropertyClass(classAddress, "Z", Classes.UFloatProperty);
            W_Offset            = NativeReflectionCached.GetPropertyOffset(classAddress, "W");
            W_IsValid           = NativeReflectionCached.ValidatePropertyClass(classAddress, "W", Classes.UFloatProperty);
            NativeReflection.ValidateBlittableStructSize(classAddress, typeof(FVector4));
        }