├── App.config ├── BFSAR_Split.csproj ├── Program.cs ├── Properties └── AssemblyInfo.cs └── README.md /App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BFSAR_Split.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1477008E-9A66-4E3E-9CDD-CB6509C51027} 8 | Exe 9 | BFSAR_Split 10 | BFSAR_Split 11 | v4.6.1 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | none 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | 5 | namespace BFSAR_Split 6 | { 7 | internal class Program 8 | { 9 | private static void Main(string[] args) 10 | { 11 | if (args.Length != 1) 12 | { 13 | Console.WriteLine("\a\nUsage: BFSAR_Split.exe "); 14 | } 15 | else 16 | { 17 | var Strm = File.OpenRead(args[0]); 18 | var Reader = new BinaryReader(Strm); 19 | 20 | Directory.CreateDirectory($@"{args[0]}_Extracted"); 21 | try 22 | { 23 | while (true) 24 | { 25 | int TryRdMagic = Reader.ReadInt32(); 26 | 27 | void Extract(string Extension) 28 | { 29 | long PosOffs = Reader.ReadInt64(); 30 | int SizeOf = Reader.ReadInt32(); 31 | byte[] Data = Reader.ReadBytes(SizeOf - 0x10); 32 | 33 | int RelPos = (int)Strm.Position - SizeOf; 34 | 35 | string Range = $"0x{RelPos:x}-0x{RelPos + SizeOf:x}"; 36 | 37 | Console.WriteLine($"Extracting {Extension} at {Range}..."); 38 | 39 | var WrtStrm = File.OpenWrite($@"{args[0]}_Extracted/{Range}.{Extension}"); 40 | var Writer = new BinaryWriter(WrtStrm); 41 | 42 | Writer.Write(TryRdMagic); 43 | Writer.Write(PosOffs); 44 | Writer.Write(SizeOf); 45 | Writer.Write(Data); 46 | 47 | Writer.Dispose(); 48 | WrtStrm.Dispose(); 49 | 50 | Strm.Position -= Strm.Position % 4; 51 | } 52 | 53 | if (TryRdMagic == 0x56415746) 54 | { 55 | Extract("bfwav"); 56 | } 57 | else if (TryRdMagic == 0x50545346) 58 | { 59 | Extract("bfstp"); 60 | } 61 | else if (TryRdMagic == 0x51455346) 62 | { 63 | Extract("bfseq"); 64 | } 65 | } 66 | } 67 | catch (EndOfStreamException) 68 | { 69 | Console.WriteLine("\nDone!"); 70 | } 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BFSAR_Split")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BFSAR_Split")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1477008e-9a66-4e3e-9cdd-cb6509c51027")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BFSAR_Split 2 | Splits / extracts bfwav, bfstp and bfseq files from a little-endian BFSAR (or similar container format). 3 | --------------------------------------------------------------------------------