Exemple #1
0
        /// <summary>
        /// Writes every ROM file (except System files) into the Stream.
        /// </summary>
        /// <param name="strOut">Output stream.</param>
        public void WriteFiles(DataStream strOut)
        {
            // Uses the Fat class because there it's donde the implementation
            // to sorted them
            Fat fat = new Fat();

            fat.Initialize(null, this.root);
            fat.WriteFiles(strOut);
        }
Exemple #2
0
        /// <summary>
        /// Write the file system to the stream.
        /// </summary>
        /// <param name="str">Stream to write to.</param>
        public override void Write(DataStream str)
        {
            // The order is: ARM9 - Overlays9 - ARM7 - Overlays7 - FNT - FAT
            this.WriteArm(str, true);                   // Write ARM9
            this.WriteArm(str, false);                  // Write ARM7

            // To get the first ROM file ID
            int numOverlays = this.CountOverlays(false) + this.CountOverlays(true);

            // Create a new File Name Table...
            Fnt fnt = new Fnt();

            fnt.Initialize(null, this.root, numOverlays);

            // ... and writes it
            this.header.FntOffset = (uint)(this.header.HeaderSize + str.Position);
            long fntStartOffset = str.Position;

            fnt.Write(str);
            this.header.FntSize = (uint)(str.Position - fntStartOffset);
            str.WritePadding(FileSystem.PaddingByte, FileSystem.PaddingAddress);

            // Create a temp dir with every file to be register in the FAT (Game + System)
            GameFolder tmpFolder = new GameFolder(string.Empty);

            tmpFolder.AddFolders(this.sysFolder.Folders);               // Overlay folders
            tmpFolder.AddFolder(this.root);                             // Game files

            // Write File Allocation Table
            Fat fat = new Fat();

            fat.Initialize(null, tmpFolder, Banner.Size + this.header.HeaderSize);              // First file offset after banner
            this.header.FatOffset = (uint)(this.header.HeaderSize + str.Position);
            fat.Write(str);
            str.WritePadding(FileSystem.PaddingByte, FileSystem.PaddingAddress);
            this.header.FatSize = fat.Size;
        }
Exemple #3
0
 /// <summary>
 /// Writes every ROM file (except System files) into the Stream.
 /// </summary>
 /// <param name="strOut">Output stream.</param>
 public void WriteFiles(DataStream strOut)
 {
     // Uses the Fat class because there it's donde the implementation
     // to sorted them
     Fat fat = new Fat();
     fat.Initialize(null, this.root);
     fat.WriteFiles(strOut);
 }
Exemple #4
0
        /// <summary>
        /// Write the file system to the stream.
        /// </summary>
        /// <param name="str">Stream to write to.</param>
        public override void Write(DataStream str)
        {
            // The order is: ARM9 - Overlays9 - ARM7 - Overlays7 - FNT - FAT
            this.WriteArm(str, true);	// Write ARM9
            this.WriteArm(str, false);	// Write ARM7

            // To get the first ROM file ID
            int numOverlays = this.CountOverlays(false) + this.CountOverlays(true);

            // Create a new File Name Table...
            Fnt fnt = new Fnt();
            fnt.Initialize(null, this.root, numOverlays);

            // ... and writes it
            this.header.FntOffset = (uint)(this.header.HeaderSize + str.Position);
            long fntStartOffset = str.Position;
            fnt.Write(str);
            this.header.FntSize = (uint)(str.Position - fntStartOffset);
            str.WritePadding(FileSystem.PaddingByte, FileSystem.PaddingAddress);

            // Create a temp dir with every file to be register in the FAT (Game + System)
            GameFolder tmpFolder = new GameFolder(string.Empty);
            tmpFolder.AddFolders(this.sysFolder.Folders);	// Overlay folders
            tmpFolder.AddFolder(this.root);					// Game files

            // Write File Allocation Table
            Fat fat = new Fat();
            fat.Initialize(null, tmpFolder, Banner.Size + this.header.HeaderSize);	// First file offset after banner
            this.header.FatOffset = (uint)(this.header.HeaderSize + str.Position);
            fat.Write(str);
            str.WritePadding(FileSystem.PaddingByte, FileSystem.PaddingAddress);
            this.header.FatSize = fat.Size;
        }