/// <summary> /// Load the chunks in the BLF Table /// </summary> public void LoadChunkTable() { _blfChunks = new List <BLFChunk>(); _blfStream.SeekTo(0x00); bool continueLoading = true; while (continueLoading) { if (_blfStream.Position >= _blfStream.Length) { continueLoading = false; } else { BLFChunk chunk = new BLFChunk(); chunk.ChunkMagic = _blfStream.ReadAscii(0x04); _blfStream.SeekTo(_blfStream.Position - 0x04); chunk.ChunkMagicIdent = _blfStream.ReadInt32(); chunk.ChunkLength = _blfStream.ReadInt32(); chunk.ChunkData = _blfStream.ReadBlock(chunk.ChunkLength - 0x08); _blfChunks.Add(chunk); } } }
public static BitmapSource Deswizzle(string FilePath, int resizeWidth = -1, int resizeHeight = -1, bool onlyResizeIfGreater = false, bool dontSettingsResize = false) { //Open the temp dds var fs = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite); var es = new EndianStream(fs, Endian.LittleEndian); //Read the dds header es.SeekTo(0x0C); int height = es.ReadInt32(); int width = es.ReadInt32(); //Read our random bytes es.SeekTo(0x5C); string randomBuf = BitConverter.ToString(es.ReadBlock(12)).Replace("-", ""); //Read the buffer es.SeekTo(0x80); int size = width * height * 4; byte[] buffer = es.ReadBlock(size); es.Dispose(); Bitmap bitmap = null; //A2R10G10B10 switch (randomBuf) { case "FF03000000FC0F000000F03F": bitmap = DeswizzleA2R10G10B10(buffer, width, height); if (App.AssemblyStorage.AssemblySettings.XdkScreenshotGammaCorrect) { BitmapData imageData = (bitmap).LockBits( new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); GammaCorrect(App.AssemblyStorage.AssemblySettings.XdkScreenshotGammaModifier, imageData); bitmap.UnlockBits(imageData); } break; case "0000FF0000FF0000FF000000": bitmap = DeswizzleA8R8G8B8(buffer, width, height); break; } if (bitmap == null) { return(null); } // Resize if (App.AssemblyStorage.AssemblySettings.XdkResizeImages && !dontSettingsResize) { bitmap = ResizeImage(bitmap); } return(loadBitmap(bitmap)); }
protected void ProcessMapHeader() { using (IReader reader = new EndianStream(new MemoryStream(MapHeader), Endian.LittleEndian)) { reader.SeekTo(MapTypeOffset); MapType = (CacheFileType)reader.ReadInt32(); reader.SeekTo(MapNameOffset); MapName = reader.ReadAscii(); } }
private bool isValidBLF() { _blfStream.SeekTo(0x00); string magic = _blfStream.ReadAscii(0x04); if (magic == "_blf") { return(true); } return(false); }
static void Main(string[] args) { Console.WriteLine("Let's do this shit, go chris brown on the return key"); Console.ReadLine(); string mapInfoFolder = @"C:\Users\Alex\Documents\My Received Files\info\info\"; DirectoryInfo di = new DirectoryInfo(mapInfoFolder); FileInfo[] rgFiles = di.GetFiles("*.mapinfo"); foreach (FileInfo fi in rgFiles) { string fileName = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(fi.Name.ToLower()); EndianStream stream = new EndianStream(new FileStream(fi.FullName, FileMode.OpenOrCreate), Endian.BigEndian); stream.SeekTo(0x3C); Int32 mapID = stream.ReadInt32(); string jsonDB = File.ReadAllText(@"C:/Users/Alex/Desktop/" + fi.Name.Replace(fi.Extension, "") + "_json.h3tagdb"); jsonDB = jsonDB.Replace("\"MapID\":0", "\"MapID\":" + mapID.ToString()); File.WriteAllText(@"C:/Users/Alex/Desktop/" + fi.Name.Replace(fi.Extension, "") + "_json.h3tagdb", jsonDB); Console.WriteLine("Grabbed ID of {0}", fi.Name.Replace(fi.Extension, "")); } Console.WriteLine("All done"); Console.ReadLine(); }
public void Update(EndianStream stream) { stream.SeekTo(Offset); stream.WriteInt32(Ident); stream.WriteByte(RunTimeMinimium); stream.WriteByte(RunTimeMaximium); stream.WriteByte(CountOnMap); stream.WriteByte(DesignTimeMaximium); stream.WriteFloat(Cost); }
public void Update(EndianStream stream) { stream.SeekTo(Offset); stream.WriteInt16((Int16)ChunkType); stream.SeekTo(stream.Position + 0x0A); stream.WriteInt32(TagIndex); stream.WriteFloat(SpawnCoords.X); stream.WriteFloat(SpawnCoords.Y); stream.WriteFloat(SpawnCoords.Z); stream.WriteFloat(SpawnCoords.Pitch); stream.WriteFloat(SpawnCoords.Yaw); stream.WriteFloat(SpawnCoords.Roll); stream.SeekTo(stream.Position + 0x16); stream.Skip(0x01); stream.WriteByte(Team); stream.WriteByte(SpareClips); stream.WriteByte(RespawnTime); stream.SeekTo(stream.Position + 0x12); }
public ItemPlacementChunk(EndianStream stream) { Offset = stream.Position; ChunkType = (ItemChunkType)stream.ReadInt16(); stream.SeekTo(stream.Position + 0x0A); TagIndex = stream.ReadInt32(); SpawnCoords = new ItemSpawnCoords() { X = stream.ReadFloat(), Y = stream.ReadFloat(), Z = stream.ReadFloat(), Yaw = stream.ReadFloat(), Pitch = stream.ReadFloat(), Roll = stream.ReadFloat() }; stream.SeekTo(stream.Position + 0x16); stream.ReadByte(); Team = stream.ReadByte(); SpareClips = stream.ReadByte(); RespawnTime = stream.ReadByte(); stream.SeekTo(stream.Position + 0x12); }
public void Load(EndianStream stream) { Offset = stream.Position; stream.SeekTo(stream.Position + 0x0C); TagIndex = stream.ReadInt32(); SpawnCoordinates = new Coordinates { X = stream.ReadFloat(), Y = stream.ReadFloat(), Z = stream.ReadFloat() }; SpawnPosition = new Position { Right = new Vector3 { X = stream.ReadFloat(), Y = stream.ReadFloat(), Z = stream.ReadFloat() }, Up = new Vector3 { X = stream.ReadFloat(), Y = stream.ReadFloat(), Z = stream.ReadFloat() } }; SpawnPosition.Forward = Vector3.Cross( SpawnPosition.Right, SpawnPosition.Up); stream.SeekTo(stream.Position + 0x0B); Team = stream.ReadByte(); stream.SeekTo(stream.Position + 0x01); RespawnTime = stream.ReadByte(); stream.SeekTo(stream.Position + 0x12); }
public void Update(EndianStream stream) { stream.SeekTo(Offset + 0x0C); stream.WriteInt32(TagIndex); stream.WriteFloat(SpawnCoordinates.X); stream.WriteFloat(SpawnCoordinates.Y); stream.WriteFloat(SpawnCoordinates.Z); stream.WriteFloat(SpawnPosition.Right.X); stream.WriteFloat(SpawnPosition.Right.Y); stream.WriteFloat(SpawnPosition.Right.Z); stream.WriteFloat(SpawnPosition.Up.X); stream.WriteFloat(SpawnPosition.Up.Y); stream.WriteFloat(SpawnPosition.Up.Z); stream.SeekTo(stream.Position + 0x0B); stream.WriteByte(Team); stream.SeekTo(stream.Position + 0x01); stream.WriteByte(RespawnTime); stream.SeekTo(stream.Position + 0x12); }
private byte[] ExtractRawPerm(SoundPermutation permutation) { var data = ExtractRaw(); var permutationData = new List <byte>(); var memoryStream = new MemoryStream(data); var stream = new EndianStream(memoryStream, Endian.BigEndian); foreach (var chunk in permutation.Chunks) { stream.SeekTo(chunk.FileOffset); permutationData.AddRange(stream.ReadBlock(chunk.DecodedSize)); } return(permutationData.ToArray()); }
// TODO: Find a good place to store this public void OpenUserFile(string filePath) { var stream = new EndianStream(new FileStream(filePath, FileMode.Open), Endian.BigEndian); stream.SeekTo(0); switch (stream.ReadAscii(0x04)) { case "CON ": case "PIRS": case "LIVE": break; case "_blf": break; default: throw new InvalidOperationException("The selected file is not a supported file type. Only try to open an Xbox 360 Container file that contains a forge varient (sandbox.map) or the pure sandbox.map extracted from a Xbox 360 Container File."); } }
private void btnExtractInfo_Click(object sender, RoutedEventArgs e) { System.Windows.Clipboard.SetText("Name: " + txtApplyPatchName.Text + "\r\nDescription: " + txtApplyPatchDesc.Text); var messageString = "The patch name and description has been copied to the clipboard."; if (currentPatch.Screenshot != null) { try { var stream = new EndianStream(new MemoryStream(currentPatch.Screenshot), Endian.BigEndian); stream.SeekTo(0x0); ushort imageMagic = stream.ReadUInt16(); var sfd = new SaveFileDialog(); sfd.Title = "Assembly - Save Patch Image"; switch (imageMagic) { case 0x8950: sfd.Filter = "PNG Image (*.png)|*.png"; break; default: sfd.Filter = "JPEG Image (*.jpg)|*.jpg"; break; } if (sfd.ShowDialog() == DialogResult.OK) { File.WriteAllBytes(sfd.FileName, currentPatch.Screenshot); messageString += "\r\n\r\nThe patch image has been saved."; } } catch (Exception ex) { messageString += "\r\n\r\nThe patch image could not saved: \n" + ex.Message; } } MetroMessageBox.Show("Information Extracted!", messageString); }
private byte[] ExtractRawPerm(ISoundPermutation permutation) { var data = ExtractRaw(); var permutationData = new List <byte>(); var memoryStream = new MemoryStream(data); var stream = new EndianStream(memoryStream, Endian.BigEndian); for (var i = permutation.PermutationChunkIndex; i < permutation.ChunkCount + permutation.PermutationChunkIndex; i++) { var permutationChunk = _soundResourceGestalt.SoundPermutationChunks[i]; stream.SeekTo(permutationChunk.Offset); permutationData.AddRange(stream.ReadBlock(permutationChunk.Size)); } return(permutationData.ToArray()); }
/// <summary> /// Load the Film Header /// </summary> public void LoadHeader() { _filmHeader = new Header(); #region Creation and Modification // Read Creation Date _filmStream.SeekTo(0x7C); _filmHeader.CreationDate = _filmStream.ReadInt32(); // Read Creation Author _filmStream.SeekTo(0x88); _filmHeader.CreationAuthor = _filmStream.ReadAscii(); // Read Modification Date _filmStream.SeekTo(0xA0); _filmHeader.ModifiedDate = _filmStream.ReadInt32(); // Read Modification Author _filmStream.SeekTo(0xAC); _filmHeader.ModifiedAuthor = _filmStream.ReadAscii(); #endregion #region Film Info // Read Film Name _filmStream.SeekTo(0xC0); _filmHeader.FilmName = _filmStream.ReadUTF16(); // Read Film Description _filmStream.SeekTo(0x1C0); _filmHeader.FilmDescription = _filmStream.ReadUTF16(); // Read Info String _filmStream.SeekTo(0x3D8); _filmHeader.InfoString = _filmStream.ReadAscii(); #endregion #region Gametype Info // Read Gametype Name _filmStream.SeekTo(0x998); _filmHeader.GametypeName = _filmStream.ReadUTF16(); // Read Gametype Description _filmStream.SeekTo(0xA98); _filmHeader.GametypeDescription = _filmStream.ReadUTF16(); #endregion #region RawMapData // Read Map Name _filmStream.SeekTo(0x1011C); _filmHeader.MapName = _filmStream.ReadAscii(); // Read Map Rally Point _filmStream.SeekTo(0x10220); _filmHeader.RallyPoint = _filmStream.ReadAscii(); #endregion #region MatchmakingPlaylistInfo // Read Playlist Name _filmStream.SeekTo(0x10342); _filmHeader.MatchmakingPlaylistName = _filmStream.ReadUTF16(); // Read Usermap Name _filmStream.SeekTo(0x10460); _filmHeader.UsermapName = _filmStream.ReadUTF16(); // Read Usermap Description _filmStream.SeekTo(0x10560); _filmHeader.UsermapDescription = _filmStream.ReadUTF16(); #endregion }
private void loadBLF() { try { _blf = new PureBLF(_blfLocation); var imgChunkData = new List <byte>(_blf.BLFChunks[1].ChunkData); imgChunkData.RemoveRange(0, 0x08); Dispatcher.Invoke(new Action(delegate { var image = new BitmapImage(); image.BeginInit(); image.StreamSource = new MemoryStream(imgChunkData.ToArray()); image.EndInit(); imgBLF.Source = image; var stream = new EndianStream(new MemoryStream(imgChunkData.ToArray <byte>()), Endian.BigEndian); stream.SeekTo(0x0); ushort imageMagic = stream.ReadUInt16(); switch (imageMagic) { case 0xFFD8: blfImageFormat = "JPEG"; break; case 0x8950: blfImageFormat = "PNG"; break; case 0x424D: blfImageFormat = "BMP"; break; default: blfImageFormat = "Unknown"; break; } // Add Image Info paneImageInfo.Children.Insert(0, new MapHeaderEntry("Image Format:", blfImageFormat)); paneImageInfo.Children.Insert(1, new MapHeaderEntry("Image Width:", image.PixelWidth + "px")); paneImageInfo.Children.Insert(2, new MapHeaderEntry("Image Height", image.PixelHeight + "px")); // Add BLF Info paneBLFInfo.Children.Insert(0, new MapHeaderEntry("BLF Length:", "0x" + _blf.BLFStream.Length.ToString("X"))); paneBLFInfo.Children.Insert(1, new MapHeaderEntry("BLF Chunks:", _blf.BLFChunks.Count.ToString(CultureInfo.InvariantCulture))); if (App.AssemblyStorage.AssemblySettings.StartpageHideOnLaunch) { App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose(Home.TabGenre.StartPage); } RecentFiles.AddNewEntry(new FileInfo(_blfLocation).Name, _blfLocation, "BLF Image", Settings.RecentFileType.Blf); Close(); })); } catch (Exception ex) { Close(); Dispatcher.Invoke(new Action(delegate { MetroMessageBox.Show("Unable to open BLF", ex.Message.ToString(CultureInfo.InvariantCulture)); App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose((LayoutDocument)Parent); })); } }
private void btnInjectImage_Click(object sender, RoutedEventArgs e) { try { _blf = new PureBLF(_blfLocation); var ofd = new OpenFileDialog { Title = "Open an image to be injected", Filter = "JPEG Image (*.jpg,*.jpeg,)|*.jpg;*.jpeg|PNG Image [H3/ODST]|*.png|BMP Image [H3/ODST]|*.bmp" }; if (!((bool)ofd.ShowDialog())) { Close(); return; } byte[] newImage = File.ReadAllBytes(ofd.FileName); var stream = new EndianStream(new MemoryStream(newImage), Endian.BigEndian); // Check if it's a supported image stream.SeekTo(0x0); ushort imageMagic = stream.ReadUInt16(); if (imageMagic != 0xFFD8 && imageMagic != 0x8950 && imageMagic != 0x424D) { throw new Exception("Invalid image type. Only JPEG, PNG, and BMP are supported."); } // Check for size and dimension differences var imageSize = new FileInfo(ofd.FileName).Length; var image = new BitmapImage(); image.BeginInit(); image.StreamSource = new MemoryStream(newImage); image.EndInit(); string sizeMessage = ""; string dimensionMessage = ""; if (new FileInfo(ofd.FileName).Length >= 0x1C000) { sizeMessage = String.Format("- The size of the new image (0x{0}) exceeds Halo 3/ODST's modified limit of 0x1C000. This image will not display in those games as a result. Can be ignored otherwise.\n", imageSize.ToString("X")); } if (image.PixelWidth != ((BitmapImage)imgBLF.Source).PixelWidth || image.PixelHeight != ((BitmapImage)imgBLF.Source).PixelHeight) { dimensionMessage = String.Format("- The dimensions of the new image ({0}x{1}) are not the same as the dimensions of the original image ({2}x{3}). This blf may appear stretched or not appear at all as a result.\n", image.PixelWidth, image.PixelHeight, ((BitmapImage)imgBLF.Source).PixelWidth, ((BitmapImage)imgBLF.Source).PixelHeight); } if (dimensionMessage != "" || sizeMessage != "") { if (MetroMessageBox.Show("Warning", "There were some potential issue(s) found with your new image;\n\n" + String.Format("{0}{1}", sizeMessage, dimensionMessage) + "\nInject anyway?", MetroMessageBox.MessageBoxButtons.OkCancel) != MetroMessageBox.MessageBoxResult.OK) { Close(); return; } } // It's the right everything! Let's inject var newImageChunkData = new List <byte>(); newImageChunkData.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00 }); byte[] imageLength = BitConverter.GetBytes(newImage.Length); Array.Reverse(imageLength); newImageChunkData.AddRange(imageLength); newImageChunkData.AddRange(newImage); // Write data to chunk file _blf.BLFChunks[1].ChunkData = newImageChunkData.ToArray <byte>(); _blf.RefreshRelativeChunkData(); _blf.UpdateChunkTable(); // Update eof offset value var eofstream = new EndianStream(new MemoryStream(_blf.BLFChunks[2].ChunkData), Endian.BigEndian); uint eofFixup = (uint)_blf.BLFStream.Length - 0x111; //real cheap but hey it works and is always the same in all games eofstream.SeekTo(0); eofstream.WriteUInt32(eofFixup); _blf.RefreshRelativeChunkData(); _blf.UpdateChunkTable(); Close(); MetroMessageBox.Show("Injected!", "The BLF Image has been injected. This image tab will now close."); App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose(_tab); } catch (Exception ex) { Close(); MetroMessageBox.Show("Inject Failed!", "The BLF Image failed to be injected: \n " + ex.Message); } }
/// <summary> /// Load the STFS Container's Header /// </summary> public void LoadHeader() { _stfsHeader = new xHeader(); _stfsStream.SeekTo(0x00); _stfsHeader.Magic = _stfsStream.ReadAscii(0x04); _stfsHeader.PackageType = GetPackageType(_stfsHeader.Magic); _stfsStream.SeekTo(0x04); switch (_stfsHeader.PackageType) { case PackageType.CON: _stfsHeader.PublicKeyCertificateSize = _stfsStream.ReadBlock(0x02); _stfsHeader.CertificateOwnerConsoleID = _stfsStream.ReadBlock(0x05); _stfsHeader.CertificateOwnerConsolePartNumber = _stfsStream.ReadAscii(0x14).Trim(); _stfsHeader.CertiicateOwnerConsoleType = (CertOwnerConsoleType)_stfsStream.ReadByte(); _stfsHeader.CertificateDateOfGeneration = _stfsStream.ReadAscii(0x08); _stfsHeader.PublicExponent = _stfsStream.ReadBlock(0x04); _stfsHeader.PublicModulus = _stfsStream.ReadBlock(0x80); _stfsHeader.CertificateSignature = _stfsStream.ReadBlock(0x100); _stfsHeader.Signature = _stfsStream.ReadBlock(0x80); break; case PackageType.PIRS: case PackageType.LIVE: _stfsHeader.PackageSignature = _stfsStream.ReadBlock(0x100); break; } }
public void LoadHeader() { _filmHeader = new Header(); _filmStream.SeekTo(0x48); _filmHeader.FilmName = _filmStream.ReadUTF16(0x1F); _filmStream.SeekTo(0x67); _filmHeader.FilmDescription = _filmStream.ReadAscii(0x80); _filmStream.SeekTo(0xE7); _filmHeader.FilmAuthor = _filmStream.ReadAscii(0x80); _filmStream.SeekTo(0x15); _filmHeader.FilmAuthor = _filmStream.ReadAscii(0x2E); _filmStream.SeekTo(0x198); _filmHeader.FilmAuthor = _filmStream.ReadAscii(0x23); _filmStream.SeekTo(0x220); _filmHeader.FilmAuthor = _filmStream.ReadAscii(0x26); _filmStream.SeekTo(0x2C4); _filmHeader.FilmAuthor = _filmStream.ReadAscii(0x2A); }
/// <summary> /// Load the Screenshots Header data /// </summary> public void LoadHeader() { _shotHeader = new Header(); _shotStream.SeekTo(0x48); _shotHeader.ScreenshotName = _shotStream.ReadUTF16(); _shotStream.SeekTo(0x67); _shotHeader.ScreenshotDescription = _shotStream.ReadUTF16(); _shotStream.SeekTo(0xE8); _shotHeader.ScreenshotAuthor = _shotStream.ReadAscii(); }
private void btnInjectImage_Click(object sender, RoutedEventArgs e) { try { _blf = new PureBLF(_blfLocation); var ofd = new OpenFileDialog { Title = "Opem an image to be injected", Filter = "JPEG Image (*.jpg)|*.jpg|JPEG Image (*.jpeg)|*.jpeg" }; if (!((bool)ofd.ShowDialog())) { Close(); return; } byte[] newImage = File.ReadAllBytes(ofd.FileName); var stream = new EndianStream(new MemoryStream(newImage), Endian.BigEndian); // To-do: Allow PNGs // Check if it's a JIFI stream.SeekTo(0x0); ushort imageMagic = stream.ReadUInt16(); if (imageMagic != 0xFFD8) { throw new Exception("Invalid image type, it has to be a JPEG (JFIF in the header)."); } // Check if it's the right size var image = new BitmapImage(); image.BeginInit(); image.StreamSource = new MemoryStream(newImage); image.EndInit(); if (image.PixelWidth != ((BitmapImage)imgBLF.Source).PixelWidth || image.PixelHeight != ((BitmapImage)imgBLF.Source).PixelHeight) { throw new Exception(string.Format("Image isn't the right size. It must be {0}x{1}", ((BitmapImage)imgBLF.Source).PixelWidth, ((BitmapImage)imgBLF.Source).PixelHeight)); } // It's the right everything! Let's inject var newImageChunkData = new List <byte>(); newImageChunkData.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00 }); byte[] imageLength = BitConverter.GetBytes(newImage.Length); Array.Reverse(imageLength); newImageChunkData.AddRange(imageLength); newImageChunkData.AddRange(newImage); // Write data to chunk file _blf.BLFChunks[1].ChunkData = newImageChunkData.ToArray <byte>(); _blf.RefreshRelativeChunkData(); _blf.UpdateChunkTable(); imgBLF.Source = image; MetroMessageBox.Show("Injected!", "The BLF Image has been injected."); Close(); } catch (Exception ex) { Close(); MetroMessageBox.Show("Inject Failed!", "The BLF Image failed to be injected: \n " + ex.Message); } }
/// <summary> /// Load the gpd's Player Visuals /// </summary> public void LoadPlayerVisuals() { _gpdPlayerVisuals = new PlayerVisuals(); _gpdStream.SeekTo(0x25B4); _gpdPlayerVisuals.ServiceTag = _gpdStream.ReadUTF16(); _gpdStream.SeekTo(0x35E1); _gpdPlayerVisuals.HelmetOn = (HelmetToggle)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x35DF); _gpdPlayerVisuals.Character = (Character)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x35AC); _gpdPlayerVisuals.EmblemForeground = (EmblemForeground)_gpdStream.ReadByte(); _gpdPlayerVisuals.EmblemBackground = (EmblemBackground)_gpdStream.ReadByte(); _gpdPlayerVisuals.EmblemToggle = (EmblemForegroundToggle)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x35AF); _gpdPlayerVisuals.EmblemForegroundColour = (Colours)_gpdStream.ReadByte(); _gpdPlayerVisuals.EmblemSecondaryColour = (Colours)_gpdStream.ReadByte(); _gpdPlayerVisuals.EmblemBackgroundColour = (Colours)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x359F); _gpdPlayerVisuals.ArmourPrimaryColour = (Colours)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x35A3); _gpdPlayerVisuals.ArmourDetailColour = (Colours)_gpdStream.ReadByte(); }
/// <summary> /// Load the gpd's Player Visuals /// </summary> public void LoadPlayerVisuals() { _gpdPlayerVisuals = new PlayerVisuals(); _gpdStream.SeekTo(0x35C7); _gpdPlayerVisuals.PlayerSpecies = (Species)_gpdStream.ReadByte(); if (_gpdPlayerVisuals.PlayerSpecies == Species.Spartan) { _gpdPlayerVisuals.PlayerSpartan = new PlayerVisuals.Spartan() { SpartanHelmet = (SpartanHelmet)_gpdStream.ReadByte(), SpartanLeftShoulder = (SpartanShoulder)_gpdStream.ReadByte(), SpartanRightShoulder = (SpartanShoulder)_gpdStream.ReadByte(), SpartanChest = (SpartanChest)_gpdStream.ReadByte() }; } else { _gpdPlayerVisuals.PlayerElite = new PlayerVisuals.Elite() { EliteHelmet = (EliteHelmet)_gpdStream.ReadByte(), EliteLeftShoulder = (EliteShoulder)_gpdStream.ReadByte(), EliteRightShoulder = (EliteShoulder)_gpdStream.ReadByte(), EliteChest = (EliteChest)_gpdStream.ReadByte() }; } _gpdStream.SeekTo(0x358F); _gpdPlayerVisuals.PrimaryArmourColour = (Colours)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x3593); _gpdPlayerVisuals.SecondaryArmourColour = (Colours)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x3597); _gpdPlayerVisuals.DetailArmourColour = (Colours)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x359B); _gpdPlayerVisuals.EmblemToggle = (EmblemForegroundToggle)_gpdStream.ReadByte(); _gpdPlayerVisuals.EmblemForeground = (EmblemForeground)_gpdStream.ReadByte(); _gpdPlayerVisuals.EmblemBackground = (EmblemBackground)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x359B); _gpdPlayerVisuals.PrimaryEmblemColour = (Colours)_gpdStream.ReadByte(); _gpdPlayerVisuals.SecondaryEmblemColour = (Colours)_gpdStream.ReadByte(); _gpdPlayerVisuals.BackgroundEmblemColour = (Colours)_gpdStream.ReadByte(); _gpdStream.SeekTo(0x35A4); _gpdPlayerVisuals.ServiceTag = _gpdStream.ReadUTF16(); }
/// <summary> /// Load the usermap's Header /// </summary> public void LoadHeader() { _forgeHeader = new Header(); _forgeStream.SeekTo(0x42); _forgeHeader.CreationDate = _forgeStream.ReadInt32(); _forgeStream.SeekTo(0x48); _forgeHeader.CreationVarientName = _forgeStream.ReadUTF16(0x1F); _forgeStream.SeekTo(0x68); _forgeHeader.CreationVarientDescription = _forgeStream.ReadAscii(0x80); _forgeStream.SeekTo(0xE8); _forgeHeader.CreationVarientAuthor = _forgeStream.ReadAscii(0x13); _forgeStream.SeekTo(0x114); _forgeHeader.ModificationDate = _forgeStream.ReadInt32(); _forgeStream.SeekTo(0x150); _forgeHeader.VarientName = _forgeStream.ReadUTF16(0x1F); _forgeStream.SeekTo(0x170); _forgeHeader.VarientDescription = _forgeStream.ReadAscii(0x80); _forgeStream.SeekTo(0x1F0); _forgeHeader.VarientAuthor = _forgeStream.ReadAscii(0x13); _forgeStream.SeekTo(0x228); _forgeHeader.MapID = _forgeStream.ReadInt32(); _forgeStream.SeekTo(0x246); _forgeHeader.SpawnedObjectCount = _forgeStream.ReadInt16(); _forgeStream.SeekTo(0x24C); _forgeHeader.WorldBoundsXMin = _forgeStream.ReadFloat(); _forgeHeader.WorldBoundsXMax = _forgeStream.ReadFloat(); _forgeHeader.WorldBoundsYMin = _forgeStream.ReadFloat(); _forgeHeader.WorldBoundsYMax = _forgeStream.ReadFloat(); _forgeHeader.WorldBoundsZMin = _forgeStream.ReadFloat(); _forgeHeader.WorldBoundsZMax = _forgeStream.ReadFloat(); _forgeStream.SeekTo(0x268); _forgeHeader.MaximiumBudget = _forgeStream.ReadFloat(); _forgeHeader.CurrentBudget = _forgeStream.ReadFloat(); }
/// <summary> /// Load the Film Header /// </summary> public void LoadHeader() { _filmHeader = new Header(); #region Creation and Modification // Read Creation Date _filmStream.SeekTo(0x114); _filmHeader.CreationDate = _filmStream.ReadInt32(); // Read Creation Author _filmStream.SeekTo(0xE8); _filmHeader.CreationAuthor = _filmStream.ReadAscii(); #endregion #region Film Info // Read Film Name _filmStream.SeekTo(0x48); _filmHeader.FilmName = _filmStream.ReadUTF16(); // Read Film Description _filmStream.SeekTo(0x67); _filmHeader.FilmDescription = _filmStream.ReadUTF16(); // Read Film Engine Build String 1 _filmStream.SeekTo(0x15C); _filmHeader.EngineBuildString1 = _filmStream.ReadAscii(); // Read Film Engine Build String 2 _filmStream.SeekTo(0x198); _filmHeader.EngineBuildString2 = _filmStream.ReadAscii(); // Read Film InfoString _filmStream.SeekTo(0x220); _filmHeader.InfoString = _filmStream.ReadAscii(); #endregion #region GametypeUsermapInfo // Read Gametype Name _filmStream.SeekTo(0x4DC); _filmHeader.GametypeName = _filmStream.ReadUTF16(); // Read Gametype Description _filmStream.SeekTo(0x4FB); _filmHeader.GametypeDescription = _filmStream.ReadUTF16(); // Read Gametype Author _filmStream.SeekTo(0x57B); _filmHeader.GametypeAuthor = _filmStream.ReadUTF16(); // Read Usermap Name _filmStream.SeekTo(0x738); _filmHeader.GametypeAuthor = _filmStream.ReadUTF16(); // Read Usermap Description _filmStream.SeekTo(0x757); _filmHeader.GametypeAuthor = _filmStream.ReadUTF16(); // Read Usermap Author _filmStream.SeekTo(0x7D7); _filmHeader.GametypeAuthor = _filmStream.ReadUTF16(); #endregion #region RawMapData // Read Map Name _filmStream.SeekTo(0x24C); _filmHeader.MapName = _filmStream.ReadAscii(); #endregion #region Mathcmaking Playlist Info // Read Matchmaking Playlist Name _filmStream.SeekTo(0x472); _filmHeader.MatchmakingPlaylistName = _filmStream.ReadUTF16(); #endregion }