public void Unserialize(UndertaleReader reader)
 {
     FolderName = reader.ReadUndertaleString();
     Name       = reader.ReadUndertaleString();
     ClassName  = reader.ReadUndertaleString();
     Files      = reader.ReadUndertaleObject <UndertalePointerList <UndertaleExtensionFile> >();
 }
        public void Unserialize(UndertaleReader reader)
        {
            Name              = reader.ReadUndertaleString();
            Playback          = (PlaybackType)reader.ReadUInt32();
            PlaybackSpeed     = reader.ReadSingle();
            PlaybackSpeedType = (AnimSpeedType)reader.ReadUInt32();
            Length            = reader.ReadSingle();
            OriginX           = reader.ReadInt32();
            OriginY           = reader.ReadInt32();
            Volume            = reader.ReadSingle();

            BroadcastMessages = reader.ReadUndertaleObject <UndertaleSimpleList <Keyframe <BroadcastMessage> > >();

            Tracks = reader.ReadUndertaleObject <UndertaleSimpleList <Track> >();

            FunctionIDs = new Dictionary <int, UndertaleString>();
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                int key = reader.ReadInt32();
                FunctionIDs[key] = reader.ReadUndertaleString();
            }

            Moments = reader.ReadUndertaleObject <UndertaleSimpleList <Keyframe <Moment> > >();
        }
    /// <inheritdoc />
    public void Unserialize(UndertaleReader reader)
    {
        Name          = reader.ReadUndertaleString();
        DisplayName   = reader.ReadUndertaleString();
        EmSize        = reader.ReadUInt32();
        EmSizeIsFloat = false;

        // since the float is always written negated, it has the first bit set.
        if ((EmSize & (1 << 31)) != 0)
        {
            float fsize = -BitConverter.ToSingle(BitConverter.GetBytes(EmSize), 0);
            EmSize        = (uint)fsize;
            EmSizeIsFloat = true;
        }

        Bold         = reader.ReadBoolean();
        Italic       = reader.ReadBoolean();
        RangeStart   = reader.ReadUInt16();
        Charset      = reader.ReadByte();
        AntiAliasing = reader.ReadByte();
        RangeEnd     = reader.ReadUInt32();
        Texture      = reader.ReadUndertaleObjectPointer <UndertaleTexturePageItem>();
        ScaleX       = reader.ReadSingle();
        ScaleY       = reader.ReadSingle();
        if (reader.undertaleData.GeneralInfo?.BytecodeVersion >= 17)
        {
            AscenderOffset = reader.ReadInt32();
        }
        if (reader.undertaleData.GMS2022_2)
        {
            Ascender = reader.ReadUInt32();
        }
        Glyphs = reader.ReadUndertaleObject <UndertalePointerList <Glyph> >();
    }
 public void Unserialize(UndertaleReader reader)
 {
     Filename      = reader.ReadUndertaleString();
     CleanupScript = reader.ReadUndertaleString();
     InitScript    = reader.ReadUndertaleString();
     Kind          = (UndertaleExtensionKind)reader.ReadUInt32();
     Functions     = reader.ReadUndertaleObject <UndertalePointerList <UndertaleExtensionFunction> >();
 }
Beispiel #5
0
 public void Unserialize(UndertaleReader reader, uint entryCount)
 {
     Name   = reader.ReadUndertaleString();
     Region = reader.ReadUndertaleString();
     for (uint i = 0; i < entryCount; i++)
     {
         Entries.Add(reader.ReadUndertaleString());
     }
 }
 public void Unserialize(UndertaleReader reader)
 {
     Name      = reader.ReadUndertaleString();
     ID        = reader.ReadUInt32();
     Kind      = reader.ReadUInt32();
     RetType   = (UndertaleExtensionVarType)reader.ReadUInt32();
     ExtName   = reader.ReadUndertaleString();
     Arguments = reader.ReadUndertaleObject <UndertaleSimpleList <UndertaleExtensionFunctionArg> >();
 }
Beispiel #7
0
 public void Unserialize(UndertaleReader reader)
 {
     Name        = reader.ReadUndertaleString();
     Occurrences = reader.ReadUInt32();
     if (Occurrences > 0)
     {
         if (reader.GMS2_3)
         {
             GMS2_3       = true;
             FirstAddress = reader.GetUndertaleObjectAtAddress <UndertaleInstruction>(reader.ReadUInt32() - 4);
         }
         else
         {
             FirstAddress = reader.ReadUndertaleObjectPointer <UndertaleInstruction>();
         }
         UndertaleInstruction.Reference <UndertaleFunction> .ParseReferenceChain(reader, this);
     }
     else
     {
         if (reader.ReadInt32() != -1)
         {
             throw new Exception("Function with no occurrences, but still has a first occurrence address");
         }
         FirstAddress = null;
     }
 }
 public void Unserialize(UndertaleReader reader)
 {
     Name       = reader.ReadUndertaleString();
     Function   = (FunctionType)reader.ReadUInt32();
     Iterations = reader.ReadUInt32();
     Points     = reader.ReadUndertaleObject <UndertaleSimpleList <Point> >();
 }
Beispiel #9
0
        public void Unserialize(UndertaleReader reader)
        {
            Name = reader.ReadUndertaleString();

            int momentCount = reader.ReadInt32();

            // Read the time points for each moment
            uint[] timePoints          = new uint[momentCount];
            int[]  unnecessaryPointers = new int[momentCount];
            for (int i = 0; i < momentCount; i++)
            {
                timePoints[i]          = reader.ReadUInt32();
                unnecessaryPointers[i] = reader.ReadInt32();
            }

            // Read the actions for each moment
            for (int i = 0; i < momentCount; i++)
            {
                if (reader.Position != unnecessaryPointers[i])
                {
                    throw new UndertaleSerializationException("Invalid action list pointer");
                }

                // Read action list and assign time point (put into list)
                var timeEvent = reader.ReadUndertaleObject <UndertalePointerList <UndertaleGameObject.EventAction> >();
                Moments.Add(new UndertaleTimelineMoment(timePoints[i], timeEvent));
            }
        }
Beispiel #10
0
        public void Unserialize(UndertaleReader reader)
        {
            Name        = reader.ReadUndertaleString();
            Occurrences = reader.ReadUInt32();
            if (Occurrences > 0)
            {
                FirstAddress = reader.ReadUndertaleObjectPointer <UndertaleInstruction>();

                // Parse the chain of references
                UndertaleInstruction.Reference <UndertaleFunction> reference = null;
                uint addr = reader.GetAddressForUndertaleObject(FirstAddress);
                for (int i = 0; i < Occurrences; i++)
                {
                    reference = reader.GetUndertaleObjectAtAddress <UndertaleInstruction>(addr).GetReference <UndertaleFunction>();
                    if (reference == null)
                    {
                        throw new IOException("Failed to find reference at " + addr);
                    }
                    reference.Target = this;
                    addr            += (uint)reference.NextOccurrenceOffset;
                }
                UnknownChainEndingValue = reference.NextOccurrenceOffset;
            }
            else
            {
                if (reader.ReadInt32() != -1)
                {
                    throw new Exception("Function with no occurrences, but still has a first occurrence address");
                }
                FirstAddress = null;
            }
        }
 public void Unserialize(UndertaleReader reader)
 {
     InternalCount = reader.ReadInt32();
     if (InternalCount > 0)
     {
         Event = reader.ReadUndertaleString();
     }
 }
 public void Unserialize(UndertaleReader reader)
 {
     Name      = reader.ReadUndertaleString();
     IsSmooth  = reader.ReadBoolean();
     IsClosed  = reader.ReadBoolean();
     Precision = reader.ReadUInt32();
     Points    = reader.ReadUndertaleObject <UndertaleSimpleList <PathPoint> >();
 }
 /// <summary>
 /// Deserializes from a specified <see cref="UndertaleReader"/> to the current data file.
 /// </summary>
 /// <param name="reader">Where to deserialize from.</param>
 /// <param name="includeName">Whether to include <see cref="Name"/> in the deserialization.</param>
 public void Unserialize(UndertaleReader reader, bool includeName)
 {
     if (includeName)
     {
         Name = reader.ReadUndertaleString();
     }
     GraphType = (GraphTypeEnum)reader.ReadUInt32();
     Channels  = reader.ReadUndertaleObject <UndertaleSimpleList <Channel> >();
 }
Beispiel #14
0
 public void Unserialize(UndertaleReader reader)
 {
     DisableDebugger          = reader.ReadByte() != 0 ? true : false;
     BytecodeVersion          = reader.ReadByte();
     Unknown                  = reader.ReadUInt16();
     Filename                 = reader.ReadUndertaleString();
     Config                   = reader.ReadUndertaleString();
     LastObj                  = reader.ReadUInt32();
     LastTile                 = reader.ReadUInt32();
     GameID                   = reader.ReadUInt32();
     Unknown1                 = reader.ReadUInt32();
     Unknown2                 = reader.ReadUInt32();
     Unknown3                 = reader.ReadUInt32();
     Unknown4                 = reader.ReadUInt32();
     Name                     = reader.ReadUndertaleString();
     Major                    = reader.ReadUInt32();
     Minor                    = reader.ReadUInt32();
     Release                  = reader.ReadUInt32();
     Build                    = reader.ReadUInt32();
     DefaultWindowWidth       = reader.ReadUInt32();
     DefaultWindowHeight      = reader.ReadUInt32();
     Info                     = (InfoFlags)reader.ReadUInt32();
     LicenseMD5               = reader.ReadBytes(16);
     LicenseCRC32             = reader.ReadUInt32();
     Timestamp                = reader.ReadUInt64();
     DisplayName              = reader.ReadUndertaleString();
     ActiveTargets1           = reader.ReadUInt32();
     ActiveTargets2           = reader.ReadUInt32();
     FunctionClassifications1 = reader.ReadUInt32();
     FunctionClassifications2 = reader.ReadUInt32();
     SteamAppID               = reader.ReadInt32();
     DebuggerPort             = reader.ReadUInt32();
     RoomOrder                = reader.ReadUndertaleObject <UndertaleSimpleResourcesList <UndertaleRoom, UndertaleChunkROOM> >();
     if (Major >= 2)
     {
         GMS2RandomUID       = reader.ReadBytes(40);
         GMS2FPS             = reader.ReadSingle();
         GMS2AllowStatistics = reader.ReadBoolean();
         GMS2GameGUID        = reader.ReadBytes(16);
     }
     reader.undertaleData.UnsupportedBytecodeVersion = BytecodeVersion < 14 || BytecodeVersion > 17;
     reader.Bytecode14OrLower = BytecodeVersion <= 14;
 }
Beispiel #15
0
        public void Unserialize(UndertaleReader reader)
        {
            uint count = reader.ReadUInt32();

            Name = reader.ReadUndertaleString();
            Locals.Clear();
            for (uint i = 0; i < count; i++)
            {
                Locals.Add(reader.ReadUndertaleObject <LocalVar>());
            }
            Debug.Assert(Locals.Count == count);
        }
        public void Unserialize(UndertaleReader reader)
        {
            uint count = reader.ReadUInt32();

            Clear();
            for (uint i = 0; i < count; i++)
            {
                try
                {
                    Add(reader.ReadUndertaleString());
                }
                catch (UndertaleSerializationException e)
                {
                    throw new UndertaleSerializationException(e.Message + "\nwhile reading item " + (i + 1) + " of " + count + " in a string-list", e);
                }
            }
        }
        public void Unserialize(UndertaleReader reader)
        {
            Name = reader.ReadUndertaleString();

            // Read the pointers
            TexturePages = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleEmbeddedTexture, UndertaleChunkTXTR> >();
            Sprites      = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleSprite, UndertaleChunkSPRT> >();
            SpineSprites = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleSprite, UndertaleChunkSPRT> >();
            Fonts        = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleFont, UndertaleChunkFONT> >();
            Tilesets     = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleBackground, UndertaleChunkBGND> >();

            // Read the objects, throwing an error if the pointers are invalid
            reader.ReadUndertaleObject(TexturePages);
            reader.ReadUndertaleObject(Sprites);
            reader.ReadUndertaleObject(SpineSprites);
            reader.ReadUndertaleObject(Fonts);
            reader.ReadUndertaleObject(Tilesets);
        }
Beispiel #18
0
        public void Unserialize(UndertaleReader reader)
        {
            Unknown1      = reader.ReadUInt32();
            LanguageCount = reader.ReadUInt32();
            EntryCount    = reader.ReadUInt32();

            // Read the identifiers for each entry
            for (int i = 0; i < EntryCount; i++)
            {
                EntryIDs.Add(reader.ReadUndertaleString());
            }

            // Read the data for each language
            for (int i = 0; i < LanguageCount; i++)
            {
                LanguageData ld = new LanguageData();
                ld.Unserialize(reader, EntryCount);
                Languages.Add(ld);
            }
        }
 public void Unserialize(UndertaleReader reader)
 {
     Name         = reader.ReadUndertaleString();
     InstanceType = (UndertaleInstruction.InstanceType)reader.ReadInt32();
     VarID        = reader.ReadInt32();
     Occurrences  = reader.ReadUInt32();
     if (Occurrences > 0)
     {
         FirstAddress = reader.ReadUndertaleObjectPointer <UndertaleInstruction>();
         UndertaleInstruction.Reference <UndertaleVariable> .ParseReferenceChain(reader, this);
     }
     else
     {
         if (reader.ReadInt32() != -1)
         {
             throw new Exception("Variable with no occurrences, but still has a first occurrence address");
         }
         FirstAddress = null;
     }
 }
Beispiel #20
0
        public void Unserialize(UndertaleReader reader)
        {
            Name = reader.ReadUndertaleString();

            // Read the pointers
            TexturePages = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleEmbeddedTexture, UndertaleChunkTXTR> >();
            Sprites      = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleSprite, UndertaleChunkSPRT> >();
            SpineSprites = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleSprite, UndertaleChunkSPRT> >();
            Fonts        = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleFont, UndertaleChunkFONT> >();
            Tilesets     = reader.ReadUndertaleObjectPointer <UndertaleSimpleResourcesList <UndertaleBackground, UndertaleChunkBGND> >();

            // Read the objects, throwing an error if the pointers are invalid
            if (reader.ReadUndertaleObject <UndertaleSimpleResourcesList <UndertaleEmbeddedTexture, UndertaleChunkTXTR> >() != TexturePages ||
                reader.ReadUndertaleObject <UndertaleSimpleResourcesList <UndertaleSprite, UndertaleChunkSPRT> >() != Sprites ||
                reader.ReadUndertaleObject <UndertaleSimpleResourcesList <UndertaleSprite, UndertaleChunkSPRT> >() != SpineSprites ||
                reader.ReadUndertaleObject <UndertaleSimpleResourcesList <UndertaleFont, UndertaleChunkFONT> >() != Fonts ||
                reader.ReadUndertaleObject <UndertaleSimpleResourcesList <UndertaleBackground, UndertaleChunkBGND> >() != Tilesets)
            {
                throw new UndertaleSerializationException("Invalid pointer to SimpleResourcesList");
            }
        }
        //private static int id = 0;
        public void Unserialize(UndertaleReader reader)
        {
            Name         = reader.ReadUndertaleString();
            InstanceType = (UndertaleInstruction.InstanceType)reader.ReadInt32();
            VarID        = reader.ReadInt32();
            Occurrences  = reader.ReadUInt32();
            //Debug.WriteLine("Variable " + (id++) + " at " + reader.GetAddressForUndertaleObject(Name).ToString("X8") + " child of " + Unknown);
            if (Occurrences > 0)
            {
                FirstAddress = reader.ReadUndertaleObjectPointer <UndertaleInstruction>();

                // Parse the chain of references
                UndertaleInstruction.Reference <UndertaleVariable> reference = null;
                uint addr = reader.GetAddressForUndertaleObject(FirstAddress);
                for (int i = 0; i < Occurrences; i++)
                {
                    reference = reader.GetUndertaleObjectAtAddress <UndertaleInstruction>(addr).GetReference <UndertaleVariable>();
                    if (reference == null)
                    {
                        throw new IOException("Failed to find reference at " + addr);
                    }
                    reference.Target = this;
                    // Debug.WriteLine("* " + addr.ToString("X8"));
                    addr += (uint)reference.NextOccurrenceOffset;
                }
                //Debug.WriteLine("* " + reference.NextOccurrenceOffset.ToString() + " (ending value)");
                UnknownChainEndingValue = reference.NextOccurrenceOffset;
            }
            else
            {
                if (reader.ReadInt32() != -1)
                {
                    throw new Exception("Variable with no occurrences, but still has a first occurrence address");
                }
                FirstAddress = null;
            }
        }
 public void Unserialize(UndertaleReader reader)
 {
     SourceCode = reader.ReadUndertaleString();
 }
            public void Unserialize(UndertaleReader reader)
            {
                // This reads the string content immediately, if necessary (which it should be)
                UndertaleString ForceReadString()
                {
                    UndertaleString res      = reader.ReadUndertaleString();
                    uint            returnTo = reader.Position;

                    reader.Position = reader.GetOffsetMapRev()[res];
                    reader.ReadUndertaleObject <UndertaleString>();
                    reader.Position = returnTo;
                    return(res);
                }

                ModelName       = ForceReadString();
                Name            = reader.ReadUndertaleString();
                BuiltinName     = reader.ReadInt32();
                Traits          = reader.ReadInt32();
                IsCreationTrack = reader.ReadBoolean();

                int tagCount      = reader.ReadInt32();
                int ownedResCount = reader.ReadInt32();
                int trackCount    = reader.ReadInt32();

                Tags = new List <int>();
                for (int i = 0; i < tagCount; i++)
                {
                    Tags.Add(reader.ReadInt32());
                }

                OwnedResources = new List <UndertaleResource>();
                for (int i = 0; i < ownedResCount; i++)
                {
                    GMAnimCurveString = ForceReadString();
                    if (GMAnimCurveString.Content != "GMAnimCurve")
                    {
                        throw new IOException("Expected GMAnimCurve");
                    }
                    UndertaleAnimationCurve res = new UndertaleAnimationCurve();
                    res.Unserialize(reader);
                    OwnedResources.Add(res);
                }

                Tracks = new List <Track>();
                for (int i = 0; i < trackCount; i++)
                {
                    Tracks.Add(reader.ReadUndertaleObject <Track>());
                }

                // Now, handle specific keyframe/etc. data
                switch (ModelName.Content)
                {
                case "GMAudioTrack":
                    Keyframes = reader.ReadUndertaleObject <AudioKeyframes>();
                    break;

                case "GMInstanceTrack":
                    Keyframes = reader.ReadUndertaleObject <InstanceKeyframes>();
                    break;

                case "GMGraphicTrack":
                    Keyframes = reader.ReadUndertaleObject <GraphicKeyframes>();
                    break;

                case "GMSequenceTrack":
                    Keyframes = reader.ReadUndertaleObject <SequenceKeyframes>();
                    break;

                case "GMSpriteFramesTrack":
                    Keyframes = reader.ReadUndertaleObject <SpriteFramesKeyframes>();
                    break;

                case "GMAssetTrack":     // TODO?
                    throw new NotImplementedException("GMAssetTrack not implemented, report this");

                case "GMBoolTrack":
                    Keyframes = reader.ReadUndertaleObject <BoolKeyframes>();
                    break;

                case "GMStringTrack":
                    Keyframes = reader.ReadUndertaleObject <StringKeyframes>();
                    break;

                // TODO?
                //case "GMIntTrack":
                //  Keyframes = reader.ReadUndertaleObject<IntKeyframes>();
                //  break;
                case "GMRealTrack":
                    Keyframes = reader.ReadUndertaleObject <RealKeyframes>();
                    break;
                }
            }
Beispiel #24
0
 public void Unserialize(UndertaleReader reader)
 {
     Index = reader.ReadUInt32();
     Name  = reader.ReadUndertaleString();
 }
        public void Unserialize(UndertaleReader reader)
        {
            Name = reader.ReadUndertaleString();
            Type = (ShaderType)(reader.ReadUInt32() & 0x7FFFFFFFu); // in big endian?

            GLSL_ES_Vertex = reader.ReadUndertaleString();
            GLSL_ES_Fragment = reader.ReadUndertaleString();
            GLSL_Vertex = reader.ReadUndertaleString();
            GLSL_Fragment = reader.ReadUndertaleString();
            HLSL9_Vertex = reader.ReadUndertaleString();
            HLSL9_Fragment = reader.ReadUndertaleString();

            HLSL11_VertexData.Unserialize(reader, false);
            HLSL11_PixelData.Unserialize(reader, false);

            VertexShaderAttributes = reader.ReadUndertaleObject<UndertaleSimpleList<VertexShaderAttribute>>();

            Version = reader.ReadInt32();

            PSSL_VertexData.Unserialize(reader);
            PSSL_PixelData.Unserialize(reader);
            Cg_PSVita_VertexData.Unserialize(reader);
            Cg_PSVita_PixelData.Unserialize(reader);
            if (Version >= 2)
            {
                Cg_PS3_VertexData.Unserialize(reader);
                Cg_PS3_PixelData.Unserialize(reader);
            }

            if (!HLSL11_VertexData.IsNull)
            {
                ReadPadding(reader, 7);

                // Calculate length of data
                uint next;
                if (!HLSL11_PixelData.IsNull)
                    next = HLSL11_PixelData._Position;
                else
                    next = _EntryEnd;
                int length = (int)(next - reader.Position);
                HLSL11_VertexData.ReadData(reader, length);
            }
            if (!HLSL11_PixelData.IsNull)
            {
                ReadPadding(reader, 7);

                // Calculate length of data
                uint next;
                if (!PSSL_VertexData.IsNull)
                    next = PSSL_VertexData._Position;
                else
                    next = _EntryEnd;
                int length = (int)(next - reader.Position);
                HLSL11_PixelData.ReadData(reader, length);
            }

            if (!PSSL_VertexData.IsNull)
            {
                ReadPadding(reader, 7);

                // Calculate length of data
                uint next;
                if (!PSSL_PixelData.IsNull)
                    next = PSSL_PixelData._Position;
                else
                    next = _EntryEnd;
                int length = (int)(next - reader.Position);
                PSSL_VertexData.ReadData(reader, length);
            }
            if (!PSSL_PixelData.IsNull)
            {
                ReadPadding(reader, 7);

                // Calculate length of data
                uint next;
                if (!Cg_PSVita_VertexData.IsNull)
                    next = Cg_PSVita_VertexData._Position;
                else
                    next = _EntryEnd;
                int length = (int)(next - reader.Position);
                PSSL_PixelData.ReadData(reader, length);
            }

            if (!Cg_PSVita_VertexData.IsNull)
            {
                ReadPadding(reader, 7);

                // Calculate length of data
                uint next;
                if (!Cg_PSVita_PixelData.IsNull)
                    next = Cg_PSVita_PixelData._Position;
                else
                    next = _EntryEnd;
                int length = (int)(next - reader.Position);
                Cg_PSVita_VertexData.ReadData(reader, length);
            }
            if (!Cg_PSVita_PixelData.IsNull)
            {
                ReadPadding(reader, 7);

                // Calculate length of data
                uint next;
                if (!Cg_PS3_VertexData.IsNull)
                    next = Cg_PS3_VertexData._Position;
                else
                    next = _EntryEnd;
                int length = (int)(next - reader.Position);
                Cg_PSVita_PixelData.ReadData(reader, length);
            }

            if (Version >= 2)
            {
                if (!Cg_PS3_VertexData.IsNull)
                {
                    ReadPadding(reader, 15);

                    // Calculate length of data
                    uint next;
                    if (!Cg_PS3_PixelData.IsNull)
                        next = Cg_PS3_PixelData._Position;
                    else
                        next = _EntryEnd;
                    int length = (int)(next - reader.Position);
                    Cg_PS3_VertexData.ReadData(reader, length);
                }
                if (!Cg_PS3_PixelData.IsNull)
                {
                    ReadPadding(reader, 15);

                    // Calculate length of data
                    uint next = _EntryEnd; // final possible data, nothing else to check for
                    int length = (int)(next - reader.Position);
                    Cg_PS3_PixelData.ReadData(reader, length);
                }
            }
        }
Beispiel #26
0
 public void Unserialize(UndertaleReader reader)
 {
     Name  = reader.ReadUndertaleString();
     Value = reader.ReadUndertaleString();
 }
Beispiel #27
0
 public void Unserialize(UndertaleReader reader)
 {
     DisableDebugger = reader.ReadByte() != 0 ? true : false;
     BytecodeVersion = reader.ReadByte();
     Unknown         = reader.ReadUInt16();
     Filename        = reader.ReadUndertaleString();
     Config          = reader.ReadUndertaleString();
     LastObj         = reader.ReadUInt32();
     LastTile        = reader.ReadUInt32();
     GameID          = reader.ReadUInt32();
     byte[] GuidData = reader.ReadBytes(16);
     DirectPlayGuid          = new Guid(GuidData);
     Name                    = reader.ReadUndertaleString();
     Major                   = reader.ReadUInt32();
     Minor                   = reader.ReadUInt32();
     Release                 = reader.ReadUInt32();
     Build                   = reader.ReadUInt32();
     DefaultWindowWidth      = reader.ReadUInt32();
     DefaultWindowHeight     = reader.ReadUInt32();
     Info                    = (InfoFlags)reader.ReadUInt32();
     LicenseMD5              = reader.ReadBytes(16);
     LicenseCRC32            = reader.ReadUInt32();
     Timestamp               = reader.ReadUInt64();
     DisplayName             = reader.ReadUndertaleString();
     ActiveTargets           = reader.ReadUInt64();
     FunctionClassifications = (FunctionClassification)reader.ReadUInt64();
     SteamAppID              = reader.ReadInt32();
     DebuggerPort            = reader.ReadUInt32();
     RoomOrder               = reader.ReadUndertaleObject <UndertaleSimpleResourcesList <UndertaleRoom, UndertaleChunkROOM> >();
     if (Major >= 2)
     {
         // Begin parsing random UID, and verify it based on original algorithm
         GMS2RandomUID = new List <long>();
         Random random      = new Random((int)(Timestamp & 4294967295L));
         long   firstRandom = (long)random.Next() << 32 | (long)random.Next();
         if (reader.ReadInt64() != firstRandom)
         {
             //throw new IOException("Unexpected random UID");
         }
         long  infoNumber = (long)(Timestamp - 1000);
         ulong temp       = (ulong)infoNumber;
         temp = ((temp << 56 & 18374686479671623680UL) | (temp >> 8 & 71776119061217280UL) |
                 (temp << 32 & 280375465082880UL) | (temp >> 16 & 1095216660480UL) | (temp << 8 & 4278190080UL) |
                 (temp >> 24 & 16711680UL) | (temp >> 16 & 65280UL) | (temp >> 32 & 255UL));
         infoNumber  = (long)temp;
         infoNumber ^= firstRandom;
         infoNumber  = ~infoNumber;
         infoNumber ^= ((long)GameID << 32 | (long)GameID);
         infoNumber ^= ((long)(DefaultWindowWidth + (int)Info) << 48 |
                        (long)(DefaultWindowHeight + (int)Info) << 32 |
                        (long)(DefaultWindowHeight + (int)Info) << 16 |
                        (long)(DefaultWindowWidth + (int)Info));
         infoNumber ^= BytecodeVersion;
         int infoLocation = (int)(Math.Abs((int)(Timestamp & 65535L) / 7 + (GameID - DefaultWindowWidth) + RoomOrder.Count) % 4);
         for (int i = 0; i < 4; i++)
         {
             if (i == infoLocation)
             {
                 long curr = reader.ReadInt64();
                 curr = infoNumber;
                 GMS2RandomUID.Add(curr);
             }
             else
             {
                 int first  = reader.ReadInt32();
                 int second = reader.ReadInt32();
                 first  = random.Next();
                 second = random.Next();
                 GMS2RandomUID.Add(((long)first << 32) | (long)second);
             }
         }
         GMS2FPS             = reader.ReadSingle();
         GMS2AllowStatistics = reader.ReadBoolean();
         GMS2GameGUID        = reader.ReadBytes(16);
     }
     reader.undertaleData.UnsupportedBytecodeVersion = BytecodeVersion < 14 || BytecodeVersion > 17;
     reader.Bytecode14OrLower = BytecodeVersion <= 14;
 }
Beispiel #28
0
 /// <inheritdoc />
 public void Unserialize(UndertaleReader reader)
 {
     Name         = reader.ReadUndertaleString();
     TextureEntry = reader.ReadUndertaleObjectPointer <UndertaleTexturePageItem>();
 }