public void Assemble(string version, ref BisAssembler bisAssembler, string path)
        {
            byte[] text = new byte[0x10] { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
            Encoding.UTF8.GetBytes(version).CopyTo(text, 0);
            header.Write(text);

            byte[] args = new byte[1];
            args[0] = 0xF0;

            if (!Config.noExfat)
                args[0] += 0x01;

            header.Write(args);

            uint[] starts = new uint[4];

            starts[0] = (uint)bisAssembler.boot0.bytes.Count;
            starts[1] = (uint)bisAssembler.boot1.bytes.Count;
            starts[2] = (uint)bisAssembler.bcpkg2_1.bytes.Count;
            starts[3] = (uint)bisAssembler.bcpkg2_3.bytes.Count;

            foreach(uint i in starts)
            {
                header.Write(ConvertInt(i));
            }

            bytes.Write(header.bytes.ToArray());

            bytes.Write(bisAssembler.boot0.bytes.ToArray());
            bytes.Write(bisAssembler.boot1.bytes.ToArray());
            bytes.Write(bisAssembler.bcpkg2_1.bytes.ToArray());
            bytes.Write(bisAssembler.bcpkg2_3.bytes.ToArray());

            bytes.DumpToFile(path);
        }
Beispiel #2
0
        private void Assemble(ref NcaIndexer files)
        {
            normal = new BisExtractor(files.FindNca(Config.normalBisId, NcaContentType.Data));
            safe   = new BisExtractor(files.FindNca(Config.safeBisId, NcaContentType.Data));

            boot0.Write(normal.bct);
            boot0.Pad(0x4000 - normal.bct.Length);
            boot0.Write(safe.bct);
            boot0.Pad(0x4000 - safe.bct.Length);
            boot0.Write(normal.bct);
            boot0.Pad(0x4000 - normal.bct.Length);
            boot0.Write(safe.bct);
            boot0.Pad(0x4000 - safe.bct.Length);
            boot0.Pad(0xF0000);
            boot0.Write(normal.pkg1);
            boot0.Pad(0x40000 - normal.pkg1.Length);
            boot0.Write(normal.pkg1);
            boot0.Pad(0x40000 - normal.pkg1.Length);
            boot0.DumpToFile($"{destFolder}/BOOT0.bin");

            boot1.Write(safe.pkg1);
            boot1.Pad(0x40000 - safe.pkg1.Length);
            boot1.Write(safe.pkg1);
            boot1.Pad(0x40000 - safe.pkg1.Length);
            boot1.DumpToFile($"{destFolder}/BOOT1.bin");

            bcpkg2_1.Pad(0x4000);
            bcpkg2_1.Write(normal.pkg2);
            bcpkg2_1.DumpToFile($"{destFolder}/BCPKG2-1-Normal-Main.bin");
            bcpkg2_1.DumpToFile($"{destFolder}/BCPKG2-2-Normal-Sub.bin");

            bcpkg2_3.Pad(0x4000);
            bcpkg2_3.Write(safe.pkg2);
            bcpkg2_3.DumpToFile($"{destFolder}/BCPKG2-3-SafeMode-Main.bin");
            bcpkg2_3.DumpToFile($"{destFolder}/BCPKG2-4-SafeMode-Sub.bin");
        }