Ejemplo n.º 1
0
 public void Unserialize(UndertaleReader reader)
 {
     Unknown1    = reader.ReadUInt32();
     Unknown2    = reader.ReadUInt32();
     Info        = (OptionsFlags)reader.ReadUInt64();
     Scale       = reader.ReadInt32();
     WindowColor = reader.ReadUInt32();
     ColorDepth  = reader.ReadUInt32();
     Resolution  = reader.ReadUInt32();
     Frequency   = reader.ReadUInt32();
     VertexSync  = reader.ReadUInt32();
     Priority    = reader.ReadUInt32();
     BackImage   = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
     FrontImage  = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
     LoadImage   = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
     LoadAlpha   = reader.ReadUInt32();
     Constants   = reader.ReadUndertaleObject <UndertaleSimpleList <Constant> >();
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
 }
 public void Unserialize(UndertaleReader reader)
 {
     NewFormat        = reader.ReadInt32() == int.MinValue;
     reader.Position -= 4;
     if (NewFormat)
     {
         Unknown1    = reader.ReadUInt32();
         Unknown2    = reader.ReadUInt32();
         Info        = (OptionsFlags)reader.ReadUInt64();
         Scale       = reader.ReadInt32();
         WindowColor = reader.ReadUInt32();
         ColorDepth  = reader.ReadUInt32();
         Resolution  = reader.ReadUInt32();
         Frequency   = reader.ReadUInt32();
         VertexSync  = reader.ReadUInt32();
         Priority    = reader.ReadUInt32();
         BackImage   = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
         FrontImage  = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
         LoadImage   = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
         LoadAlpha   = reader.ReadUInt32();
         Constants   = reader.ReadUndertaleObject <UndertaleSimpleList <Constant> >();
     }
     else
     {
         Info = 0;
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.FullScreen;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.InterpolatePixels;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.UseNewAudio;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.NoBorder;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.ShowCursor;
         }
         Scale = reader.ReadInt32();
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.Sizeable;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.StayOnTop;
         }
         WindowColor = reader.ReadUInt32();
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.ChangeResolution;
         }
         ColorDepth = reader.ReadUInt32();
         Resolution = reader.ReadUInt32();
         Frequency  = reader.ReadUInt32();
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.NoButtons;
         }
         VertexSync = reader.ReadUInt32();
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.ScreenKey;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.HelpKey;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.QuitKey;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.SaveKey;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.ScreenShotKey;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.CloseSec;
         }
         Priority = reader.ReadUInt32();
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.Freeze;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.ShowProgress;
         }
         BackImage  = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
         FrontImage = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
         LoadImage  = reader.ReadUndertaleObject <UndertaleSprite.TextureEntry>();
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.LoadTransparent;
         }
         LoadAlpha = reader.ReadUInt32();
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.ScaleProgress;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.DisplayErrors;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.WriteErrors;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.AbortErrors;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.VariableErrors;
         }
         if (reader.ReadBoolean())
         {
             Info |= OptionsFlags.CreationEventOrder;
         }
         Constants = reader.ReadUndertaleObject <UndertaleSimpleList <Constant> >();
     }
 }