private static GMOptions LoadOptions(string _chunk, int _sz, byte[] _buffer, int _offset) { GMOptions result = null; IntPtr ptr = Marshal.UnsafeAddrOfPinnedArrayElement(_buffer, _offset); YYOptions yYOptions = (YYOptions)Marshal.PtrToStructure(ptr, typeof(YYOptions)); Console.WriteLine("{0}", TypeToString(yYOptions, _buffer, _offset)); return(result); }
internal GMAssets(Stream _s) { Magic = _s.ReadInteger(); Version = _s.ReadInteger(); if (Version == 810) { _s.ReadInteger(); } Debug = _s.ReadBoolean(); if (Version == 810) { _s.ReadInteger(); } Options = new GMOptions(this, _s); Name = _s.ReadString(); _s.ReadCompressedStream(); Stream stream = null; byte[] array = null; if (Version != 800 && Version != 810) { array = _s.ReadCompressedStream(); stream = new MemoryStream(array); } else { stream = _s; } if (Version == 800 || Version == 810) { stream = stream.ReadStreamE(); int num = stream.ReadInteger(); for (int i = 1; i <= num; i++) { stream.ReadInteger(); } stream.ReadBoolean(); } else { int num2 = stream.ReadInteger(); int num3 = stream.ReadInteger(); for (int j = 0; j <= num2 - 1; j++) { stream.ReadInteger(); } int key = stream.ReadInteger(); for (int k = 0; k <= num3 - 1; k++) { stream.ReadInteger(); } long position = stream.Position; Decrypt2(key, array, position + 1); stream.ReadInteger(); } GameID = stream.ReadInteger(); GameGUID = stream.ReadGuid(); Extensions = new List <GMExtension>(); Triggers = new List <GMTrigger>(); Sounds = new List <KeyValuePair <string, GMSound> >(); Sprites = new List <KeyValuePair <string, GMSprite> >(); Backgrounds = new List <KeyValuePair <string, GMBackground> >(); Paths = new List <KeyValuePair <string, GMPath> >(); Scripts = new List <KeyValuePair <string, GMScript> >(); Fonts = new List <KeyValuePair <string, GMFont> >(); TimeLines = new List <KeyValuePair <string, GMTimeLine> >(); Objects = new List <KeyValuePair <string, GMObject> >(); Rooms = new List <KeyValuePair <string, GMRoom> >(); DataFiles = new List <KeyValuePair <string, GMDataFile> >(); Libraries = new List <string>(); RoomOrder = new List <int>(); Extensions_Load(stream); if (Version == 800 || Version == 810) { Trigger_Load(stream); Constant_Load(stream); } Sound_Load(stream); Sprite_Load(stream); Background_Load(stream); Path_Load(stream); Script_Load(stream); Font_Load(stream); TimeLine_Load(stream); Object_Load(stream); Room_Load(stream); DataFile_Load(stream); Help = new GMHelp(this, stream); Library_Load(stream); Room_LoadOrder(stream); }
internal GMAssets(Stream _s, bool _gmk) { Magic = _s.ReadInteger(); Version = _s.ReadInteger(); Stream stream = _s; byte[] array = null; if (Version >= 701) { int num = stream.ReadInteger(); int num2 = stream.ReadInteger(); for (int i = 0; i <= num - 1; i++) { stream.ReadInteger(); } int key = stream.ReadInteger(); for (int j = 0; j <= num2 - 1; j++) { stream.ReadInteger(); } long position = stream.Position; array = new byte[stream.Length]; stream.Position = 0L; stream.Read(array, 0, (int)stream.Length); Decrypt2(key, array, position + 1); MemoryStream memoryStream = new MemoryStream(array, false); stream = memoryStream; stream.Position = position; } if (Version < 600) { stream.ReadInteger(); } GameID = stream.ReadInteger(); GameGUID = stream.ReadGuid(); Extensions = new List <GMExtension>(); Triggers = new List <GMTrigger>(); Sounds = new List <KeyValuePair <string, GMSound> >(); Sprites = new List <KeyValuePair <string, GMSprite> >(); Backgrounds = new List <KeyValuePair <string, GMBackground> >(); Paths = new List <KeyValuePair <string, GMPath> >(); Scripts = new List <KeyValuePair <string, GMScript> >(); Fonts = new List <KeyValuePair <string, GMFont> >(); TimeLines = new List <KeyValuePair <string, GMTimeLine> >(); Objects = new List <KeyValuePair <string, GMObject> >(); Rooms = new List <KeyValuePair <string, GMRoom> >(); DataFiles = new List <KeyValuePair <string, GMDataFile> >(); Libraries = new List <string>(); RoomOrder = new List <int>(); Options = new GMOptions(this, stream, true); LoadGMK(Sounds, stream, (GMAssets _t, Stream _st) => new GMSound(_t, _st)); LoadGMK(Sprites, stream, (GMAssets _t, Stream _st) => new GMSprite(_t, _st)); LoadGMK(Backgrounds, stream, (GMAssets _t, Stream _st) => new GMBackground(_t, _st)); LoadGMK(Paths, stream, (GMAssets _t, Stream _st) => new GMPath(_t, _st)); LoadGMK(Scripts, stream, (GMAssets _t, Stream _st) => new GMScript(_t, _st)); LoadGMK(Fonts, stream, (GMAssets _t, Stream _st) => new GMFont(_t, _st)); LoadGMK(TimeLines, stream, (GMAssets _t, Stream _st) => new GMTimeLine(_t, _st)); LoadGMK(Objects, stream, (GMAssets _t, Stream _st) => new GMObject(_t, _st)); LoadGMK(Rooms, stream, (GMAssets _t, Stream _st) => new GMRoom(_t, _st, true)); RoomMaxId = stream.ReadInteger(); RoomMaxTileId = stream.ReadInteger(); LoadGMK_GMDataFile(DataFiles, stream); LoadGMK_GMExtension(Extensions, stream); Help = new GMHelp(this, stream); Library_Load(stream); }
private static void WriteOptions(GMOptions _data, Stream _s, IFF _iff) { _s.WriteBoolean(_data.FullScreen); _s.WriteBoolean(_data.InterpolatePixels); _s.WriteBoolean(_data.NoBorder); _s.WriteBoolean(_data.ShowCursor); _s.WriteInteger(_data.Scale); _s.WriteBoolean(_data.Sizeable); _s.WriteBoolean(_data.StayOnTop); _s.WriteInteger(_data.WindowColour); _s.WriteBoolean(_data.ChangeResolution); _s.WriteInteger(_data.ColorDepth); _s.WriteInteger(_data.Resolution); _s.WriteInteger(_data.Frequency); _s.WriteBoolean(_data.NoButtons); _s.WriteInteger(_data.Sync_Vertex); _s.WriteBoolean(_data.ScreenKey); _s.WriteBoolean(_data.HelpKey); _s.WriteBoolean(_data.QuitKey); _s.WriteBoolean(_data.SaveKey); _s.WriteBoolean(_data.ScreenShotKey); _s.WriteBoolean(_data.CloseSec); _s.WriteInteger(_data.Priority); _s.WriteBoolean(_data.Freeze); _s.WriteBoolean(_data.ShowProgress); if (_data.BackImage != null && !Program.SplashOmit) { TexturePageEntry o = ms_tpageSprites.AddImage(_data.BackImage, true, false); _iff.AddPatch(_s, o); } else { _s.WriteInteger(0); } if (_data.FrontImage != null && !Program.SplashOmit) { TexturePageEntry o2 = ms_tpageSprites.AddImage(_data.FrontImage, true, false); _iff.AddPatch(_s, o2); } else { _s.WriteInteger(0); } if (_data.LoadImage != null && !Program.SplashOmit) { TexturePageEntry o3 = ms_tpageSprites.AddImage(_data.LoadImage, true, false); _iff.AddPatch(_s, o3); } else { _s.WriteInteger(0); } _s.WriteBoolean(_data.LoadTransparent); _s.WriteInteger(_data.LoadAlpha); _s.WriteBoolean(_data.ScaleProgress); _s.WriteBoolean(_data.DisplayErrors); _s.WriteBoolean(_data.WriteErrors); _s.WriteBoolean(_data.AbortErrors); _s.WriteBoolean(_data.VariableErrors); _s.WriteBoolean(_data.CreationEventOrder); int num = 0; foreach (KeyValuePair <string, string> constant in _data.Constants) { int value = 0; if (GMLCompile.ms_ConstantCount.TryGetValue(constant.Key, out value) && value > 0) { num++; } } _s.WriteInteger(num); foreach (KeyValuePair <string, string> constant2 in _data.Constants) { int value2 = 0; if (GMLCompile.ms_ConstantCount.TryGetValue(constant2.Key, out value2) && value2 > 0) { _iff.AddString(_s, constant2.Key); _iff.AddString(_s, constant2.Value); } } }