public void makeBinBackup(int file, bool forInserting = false) { string str = forInserting ? "/bak_safe" : "/bak"; System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(ROM.romfile.Directory.FullName + "/bak"); //Console.Out.WriteLine("Backing up " + file + " "+dir.FullName); if (!dir.Exists) { dir.Create(); } dir = ROM.romfile.Directory; System.IO.FileStream fs; string filename; if (file == -1) { filename = dir.FullName + str + "/main.bin"; } else { filename = dir.FullName + str + "/" + file + ".bin"; } if (System.IO.File.Exists(filename)) { return; } fs = new System.IO.FileStream(filename, System.IO.FileMode.CreateNew); File f = ROM.arm9binFile; if (file != -1) { f = ROM.arm9ovs[file].f; ROM.arm9ovs[file].decompress(); } fs.Write(f.getContents(), 0, f.fileSize); fs.Close(); }