Beispiel #1
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8((byte)this.Visibility);
            writer.WriteValueU32((uint)this.Flags);

            if ((this.Flags & FunctionFlags.IsNative) == 0)
            {
                writer.WriteReference(this.SourceFile);
                writer.WriteValueU32(this.SourceLine);
            }

            if ((this.Flags & FunctionFlags.HasReturnValue) != 0)
            {
                writer.WriteReference(this.ReturnType);
                writer.WriteValueB8(this.Unknown50);
            }

            if ((this.Flags & FunctionFlags.Unknown8) != 0)
            {
                writer.WriteReference(this.Unknown58);
            }

            if ((this.Flags & FunctionFlags.HasParameters) != 0)
            {
                writer.WriteReferences(this.Parameters);
            }
            if ((this.Flags & FunctionFlags.HasLocals) != 0)
            {
                writer.WriteReferences(this.Locals);
            }
            if ((this.Flags & FunctionFlags.Unknown6) != 0)
            {
                writer.WriteValueU32(this.Unknown98);
            }
            if ((this.Flags & FunctionFlags.Unknown12) != 0)
            {
                writer.WriteValueU8(this.UnknownA0);
            }
            if ((this.Flags & FunctionFlags.HasBody) != 0)
            {
                var bodySizePosition = writer.Position;
                writer.WriteValueU32(uint.MaxValue);
                var bodySize    = Instructions.Write(writer, this.Body);
                var endPosition = writer.Position;
                writer.Position = bodySizePosition;
                writer.WriteValueU32(bodySize);
                writer.Position = endPosition;
            }
        }
 public static uint Write(object argument, IDefinitionWriter writer)
 {
     var(unknown0, unknown1, unknown2, unknown3, unknown4, unknown5) = ((ushort, uint, ushort, ushort, byte, ulong))argument;
     writer.WriteValueU16(unknown0);
     writer.WriteValueU32(unknown1);
     writer.WriteValueU16(unknown2);
     writer.WriteValueU16(unknown3);
     writer.WriteValueU8(unknown4);
     writer.WriteValueU64(unknown5);
     return(19);
 }
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU32(this.Id);
            writer.WriteValueU64(this.PathHash);
            writer.WriteStringU16(this.Path);
        }
Beispiel #4
0
        internal override void Serialize(IDefinitionWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteValueU8((byte)this.NativeType);

            if (HasBaseType(this.NativeType) == true)
            {
                writer.WriteReference(this.BaseType);
            }

            if (this.NativeType == NativeType.StaticArray)
            {
                writer.WriteValueU32(this.ArraySize);
            }
        }
Beispiel #5
0
 public static uint Write(object argument, IDefinitionWriter writer)
 {
     writer.WriteValueU32((uint)argument);
     return(4);
 }