public static Section_AHDR GetAsset(AssetHeader a, out bool success) { DialogResult d = a.ShowDialog(); if (d == DialogResult.OK) { AHDRFlags flags = (a.checkSourceFile.Checked ? AHDRFlags.SOURCE_FILE : 0) | (a.checkSourceVirtual.Checked ? AHDRFlags.SOURCE_VIRTUAL : 0) | (a.checkReadT.Checked ? AHDRFlags.READ_TRANSFORM : 0) | (a.checkWriteT.Checked ? AHDRFlags.WRITE_TRANSFORM : 0); Section_ADBG ADBG = new Section_ADBG(0, a.assetName, a.assetFileName, a.checksum); Section_AHDR AHDR = new Section_AHDR(a.assetID, a.assetType, flags, ADBG, a.data) { fileSize = a.data.Length, plusValue = 0 }; success = true; return(AHDR); } else { success = false; return(null); } }
private void comboBoxAssetTypes_SelectedIndexChanged(object sender, EventArgs e) { assetType = (AssetType)comboBoxAssetTypes.SelectedItem; AHDRflags = ArchiveEditorFunctions.AHDRFlagsFromAssetType(assetType); label1.Visible = AHDRflags == 0; }
public Section_AHDR(uint assetID, AssetType assetType, AHDRFlags flags, Section_ADBG ADBG) : base(Section.AHDR) { this.assetID = assetID; this.assetType = assetType; this.flags = flags; this.ADBG = ADBG; }
public Section_AHDR(uint assetID, string assetType, AHDRFlags flags, Section_ADBG ADBG) : base(Section.AHDR) { this.assetID = assetID; this.assetType = AssetTypeFromString(assetType); this.flags = flags; this.ADBG = ADBG; }
public Asset(string assetName, AssetType assetType) { game = Game.Unknown; endianness = Endianness.Unknown; this.assetType = assetType; this.assetName = assetName; assetID = new AssetID(assetName); assetFileName = ""; flags = ArchiveEditorFunctions.AHDRFlagsFromAssetType(assetType); }
public Asset(Section_AHDR AHDR, Game game, Endianness endianness) { this.game = game; this.endianness = endianness; assetID = AHDR.assetID; assetName = AHDR.ADBG.assetName; assetFileName = AHDR.ADBG.assetFileName; assetType = AHDR.assetType; flags = AHDR.flags; checksum = AHDR.ADBG.checksum; }
public static Section_AHDR GetAsset(AssetHeader a, out bool success, out bool setPosition) { DialogResult d = a.ShowDialog(); if (d == DialogResult.OK) { AHDRFlags flags = (a.checkSourceFile.Checked ? AHDRFlags.SOURCE_FILE : 0) | (a.checkSourceVirtual.Checked ? AHDRFlags.SOURCE_VIRTUAL : 0) | (a.checkReadT.Checked ? AHDRFlags.READ_TRANSFORM : 0) | (a.checkWriteT.Checked ? AHDRFlags.WRITE_TRANSFORM : 0); Section_ADBG ADBG = new Section_ADBG(0, a.assetName, a.assetFileName, a.checksum); Section_AHDR AHDR = new Section_AHDR(a.assetID, a.assetType, flags, ADBG, a.data) { fileSize = a.data.Length, plusValue = 0 }; int alignment = 16; if (Functions.currentGame == Game.BFBB) { if (AHDR.assetType == AssetType.CSN | AHDR.assetType == AssetType.SND | AHDR.assetType == AssetType.SNDS) { alignment = 32; } else if (AHDR.assetType == AssetType.CRDT) { alignment = 4; } } int value = AHDR.fileSize % alignment; if (value != 0) { AHDR.plusValue = alignment - value; } setPosition = a.setPosition; success = true; return(AHDR); } else { success = false; setPosition = false; return(null); } }
private void comboBoxAssetTypes_SelectedIndexChanged(object sender, EventArgs e) { assetType = (AssetType)comboBoxAssetTypes.SelectedItem; AHDRFlags flags = ArchiveEditorFunctions.AHDRFlagsFromAssetType(assetType); checkSourceFile.Checked = (flags & AHDRFlags.SOURCE_FILE) != 0; checkSourceVirtual.Checked = (flags & AHDRFlags.SOURCE_VIRTUAL) != 0; checkReadT.Checked = (flags & AHDRFlags.READ_TRANSFORM) != 0; checkWriteT.Checked = (flags & AHDRFlags.WRITE_TRANSFORM) != 0; label1.Visible = flags == 0; }
private void AddAsset(string[] j, ref List <uint> assetIDlist) { uint assetID = Convert.ToUInt32(j[0], 16); string assetType = j[1]; AHDRFlags flags = (AHDRFlags)Convert.ToInt32(j[2]); int align = Convert.ToInt32(j[3]); string assetName = j[4]; string assetFileName = j[5]; int checksum = Convert.ToInt32(j[6], 16); assetIDlist.Add(assetID); Section_ADBG newADBG = new Section_ADBG(align, assetName, assetFileName, checksum); Section_AHDR newAHDR = new Section_AHDR(assetID, assetType, flags, newADBG); DICT.ATOC.AHDRList.Add(newAHDR); }
public Section_AHDR(BinaryReader binaryReader) : base(binaryReader, Section.AHDR) { assetID = Switch(binaryReader.ReadUInt32()); assetType = AssetTypeFromString(new string(binaryReader.ReadChars(4))); fileOffset = Switch(binaryReader.ReadInt32()); fileSize = Switch(binaryReader.ReadInt32()); plusValue = Switch(binaryReader.ReadInt32()); flags = (AHDRFlags)Switch(binaryReader.ReadInt32()); string currentSectionName = new string(binaryReader.ReadChars(4)); if (currentSectionName != Section.ADBG.ToString()) { throw new Exception(); } ADBG = new Section_ADBG(binaryReader); long savePosition = binaryReader.BaseStream.Position; binaryReader.BaseStream.Position = fileOffset; data = binaryReader.ReadBytes(fileSize); binaryReader.BaseStream.Position = savePosition; }