Page 1 of 1

BF2 - BFP4F DFM Menu files

Posted: Thu Jan 24, 2019 10:26 am
by warrantyvoider
someone asked me about this, so I looked into it, its just a simple XOR encryption:

Code: Select all

 class Program
    {
        static byte[] key = { 0x0B, 0xAD, 0xF0, 0x0D };

        static void Main(string[] args)
        {
            if (args.Length != 1 || !File.Exists(args[0]))
            {
                ShowUsage();
                return;
            }
            byte[] input = File.ReadAllBytes(args[0]);
            for (int i = 0; i < input.Length; i++)
                input[i] ^= key[i % 4];
            string name = Path.GetFileNameWithoutExtension(args[0]);
            if (args[0].ToLower().Trim().EndsWith(".dfm"))
                name += ".swf";
            else
                name += ".dfm";
            File.WriteAllBytes(name, input);
        }

        static void ShowUsage()
        {
            Console.WriteLine("DFM Converter Tool by Warranty Voider");
            Console.WriteLine("Usage:");
            Console.WriteLine(" DFMTool filename[.swf|.dfm]");
            Console.WriteLine(" DFMTool input.dfm");
            Console.WriteLine(" DFMTool input.swf");
        }
    }

greetz