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); } }
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); } }