// --------------------------------------------------- constructor
 public NintendoSuperFamicom_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     base.MediaType = MediaTypes.ROM;
     base.HardwareName = NintendoSuperFamicom_ROM.HW_Worldwide;
     Setup();
 }
        /*public static class Dump
         * {
         *  public enum Formats
         *  {
         *      RAW = 0,
         *      FDS,
         *      FAM
         *  }
         *
         *  public static Formats GetDumpFormat(byte[] Image)
         *  {
         *      if (Image == null) throw new ArgumentNullException();
         *      // check for FDS first
         *      if (Image[0] == 0x46 && Image[1] == 0x44 && Image[2] == 0x53 && Image[3] == 0x1a) return Formats.FDS;
         *      // the FAM format doesn't seem to be well understood
         *      // There is always a 0xf180 length header followed by standard FDS data
         *      // check for the block markers after 0xf180
         *      if (Image[0xf180] == 1 && Image[0xf1b8] == 2 && Image[0xf1ba] == 3) return Formats.FAM;
         *
         *      return Formats.RAW;
         *  }
         *
         *  public static string GetDumpInfo(Formats DumpFormat)
         *  {
         *      switch (DumpFormat)
         *      {
         *          case Formats.FAM:
         *              return "Pasofami format - 0xF180 byte header";
         *          case Formats.FDS:
         *              return "fwNES format - 16 byte header";
         *          case Formats.RAW:
         *              return "Raw format";
         *          default:
         *              return "Unknown dump format";
         *      }
         *  }
         *
         *  public static byte[] Standardize(byte[] Image, Formats DumpFormat)
         *  {
         *      if (Image == null) throw new ArgumentNullException();
         *      byte[] _out;
         *      switch (DumpFormat)
         *      {
         *          case Dump.Formats.FDS:
         *              _out = new byte[Image.Length - 16];
         *              Buffer.BlockCopy(Image, 16, _out, 0, _out.Length);
         *              return _out;
         *          case Dump.Formats.FAM:
         *              _out = new byte[Image.Length - 0xf180];
         *              Buffer.BlockCopy(Image, 0xf180, _out, 0, _out.Length);
         *              return _out;
         *          default:
         *              return Image;
         *      }
         *
         *  }
         * }*/

        public NintendoFamicomDiskSys_disk(Stream Datastream, IDumpConverter Converter = null)
            : base(Datastream, Converter)
        {
            base.MediaType    = MediaTypes.Disk;
            base.HardwareName = NintendoFamicomDiskSys_disk.HW_JP_R;

            // this needs to be dealt with more gracefully:
            // FDS/FAM images are dumps of multiple disk sides concatenated into one file
            // the dump header indicates how many sides there are
            // in the current methodology, the dump headers are disposed
            // so, for now, the FDS converters have an extra property, Sides, that preserves this value
            // we can either look into a more robust dump solution that keeps a copy of the header
            // or just search through the stream and manualy find each disk side (i.e. the "NINTENDO-HVC" string)

            /*if (Converter != null)
             * {
             *  if (Converter is NintendoFDS_FAM) this.Sides = new FamicomDiskSystem_Side[(Converter as NintendoFDS_FAM).Sides];
             *  else if (Converter is NintendoFDS_FDS) this.Sides = new FamicomDiskSystem_Side[(Converter as NintendoFDS_FDS).Sides];
             * }
             * else this.Sides = new FamicomDiskSystem_Side[1];*/

            base.SoftwareTitle = this.GetText_ASCII(new Layout.Range(16, 4));
            //byte[] thisside = new byte[65500];
            //this.Datastream.Seek(0, SeekOrigin.Begin);
            this.Volumes = new FamicomDiskSystem_Side[this.Datastream.Length / 65500];
            for (uint h = 0; h < this.Volumes.Length; h++)
            {
                //this.Datastream.Read(thisside, 0, 65500);
                base.Volumes[h] = new FamicomDiskSystem_Side(this.Datastream, (h * 65500));
            }
        }
Exemple #3
0
 public UnknownImage(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     base.MediaType = MediaTypes.ROM;
     base.HardwareName = "Unknown";
     base.SoftwareTitle = "Unknown ROM";
 }
Exemple #4
0
        // --------------------------------------------------- constructor

        public NintendoSuperFamicom_ROM(Stream Datastream, IDumpConverter Converter = null)
            : base(Datastream, Converter)
        {
            base.MediaType    = MediaTypes.ROM;
            base.HardwareName = NintendoSuperFamicom_ROM.HW_Worldwide;
            Setup();
        }
Exemple #5
0
 public UnknownImage(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     base.MediaType     = MediaTypes.ROM;
     base.HardwareName  = "Unknown";
     base.SoftwareTitle = "Unknown ROM";
 }
        public SNKNeoGeoPocket_ROM(Stream Datastream, IDumpConverter Converter = null)
            : base(Datastream, Converter)
        {
            base.MediaType = MediaTypes.ROM;
            base.HardwareName = SNKNeoGeoPocket_ROM.HW_Worldwide;

            base.SoftwareTitle = dumplib.Text.Transcode.UsingASCII(GetBytes(0x24, 12));
        }
        public SNKNeoGeoPocket_ROM(Stream Datastream, IDumpConverter Converter = null)
            : base(Datastream, Converter)
        {
            base.MediaType    = MediaTypes.ROM;
            base.HardwareName = SNKNeoGeoPocket_ROM.HW_Worldwide;

            base.SoftwareTitle = dumplib.Text.Transcode.UsingASCII(GetBytes(0x24, 12));
        }
Exemple #8
0
 protected MediaImage(Stream Datastream, IDumpConverter Converter = null)
 {
     if (Datastream == null)
     {
         throw new ArgumentNullException();
     }
     if (Converter == null)
     {
         this.Datastream = Datastream;
     }
     else
     {
         this.Datastream = Converter.Normalize(Datastream);
     }
 }
Exemple #9
0
 public SegaSuper32X_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
 public NintendoGameboyAdv_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
Exemple #11
0
 public DiskImage(Stream DataStream, IDumpConverter Converter = null) : base(DataStream, Converter)
 {
 }
Exemple #12
0
        public Atari8bit_disk(Stream DataStream, IDumpConverter Converter) : base(DataStream, Converter)
        {
            if (Converter == null)
            {
                this.Datastream = Datastream;
            }
            else
            {
                this.Datastream = Converter.Normalize(DataStream);
            }

            this.Volumes         = new Volume[1];
            this.Volumes[0]      = new Volume();
            this.Volumes[0].Root = new Directory();

            // check for the VTOC location first, to confirm if single or double density
            if (this.Datastream.Length < 0xb380)
            {
                // file isn't even long enough to look for the VTOC
                // set an empty root directory and get outta here
                this.Density = DensityType.Unknown;

                return;
            }
            this.Datastream.Seek(0xb381, SeekOrigin.Begin);
            if (this.Datastream.ReadByte() == 0xc3 && this.Datastream.ReadByte() == 2)
            {
                //most likely found the VTOC
                this.Density             = DensityType.Single;
                this.Volumes[0].UnitSize = 128;
            }
            else
            {
                this.Datastream.Seek(0x16801, SeekOrigin.Begin);
                if (this.Datastream.ReadByte() == 0xc3 && this.Datastream.ReadByte() == 2)
                {
                    //most likely found the VTOC
                    this.Density             = DensityType.Double;
                    this.Volumes[0].UnitSize = 256;
                }
                else
                {
                    // non-standard format or not an Atari disk
                    // set an empty root directory and get outta here
                    this.Density = DensityType.Unknown;
                    return;
                }
            }

            //our bearings our set, get the file list
            this.Datastream.Seek(360 * this.Volumes[0].UnitSize, SeekOrigin.Begin);
            int x = 0;

            byte[]      buffer = new byte[16];
            byte[]      temp   = new byte[2];
            List <File> files  = new List <File>();

            // max of 64 file entries
            while (x < 64)
            {
                this.Datastream.Read(buffer, 0, 16);
                if (buffer[0] == 0)
                {
                    break;
                }
                var newfile = new AtariFile();
                newfile.Flags = buffer[0];
                // get sector count
                Buffer.BlockCopy(buffer, 1, temp, 0, 2);
                if (!BitConverter.IsLittleEndian)
                {
                    Array.Reverse(temp);
                }
                newfile.Length = (ulong)BitConverter.ToInt16(temp, 0);
                // get sector start
                Buffer.BlockCopy(buffer, 3, temp, 0, 2);
                if (!BitConverter.IsLittleEndian)
                {
                    Array.Reverse(temp);
                }
                newfile.Start = (ulong)BitConverter.ToInt16(temp, 0);
                newfile.Name  = Encoding.ASCII.GetString(buffer, 5, 8).Trim() + "." + Encoding.ASCII.GetString(buffer, 13, 3);
                files.Add(newfile);
                x++;
            }
            Volumes[0].Root.Contents = files.ToArray();
        }
Exemple #13
0
 public SegaMegadrive_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
Exemple #14
0
        public Atari8bit_disk(Stream DataStream, IDumpConverter Converter)
            : base(DataStream, Converter)
        {
            if (Converter == null) this.Datastream = Datastream;
            else this.Datastream = Converter.Normalize(DataStream);

            this.Volumes = new Volume[1];
            this.Volumes[0] = new Volume();
            this.Volumes[0].Root = new Directory();

            // check for the VTOC location first, to confirm if single or double density
            if (this.Datastream.Length < 0xb380)
            {
                // file isn't even long enough to look for the VTOC
                // set an empty root directory and get outta here
                this.Density = DensityType.Unknown;

                return;
            }
            this.Datastream.Seek(0xb381, SeekOrigin.Begin);
            if (this.Datastream.ReadByte() == 0xc3 && this.Datastream.ReadByte() == 2)
            {
                //most likely found the VTOC
                this.Density = DensityType.Single;
                this.Volumes[0].UnitSize = 128;
            }
            else
            {
                this.Datastream.Seek(0x16801, SeekOrigin.Begin);
                if (this.Datastream.ReadByte() == 0xc3 && this.Datastream.ReadByte() == 2)
                {
                    //most likely found the VTOC
                    this.Density = DensityType.Double;
                    this.Volumes[0].UnitSize = 256;
                }
                else
                {
                    // non-standard format or not an Atari disk
                    // set an empty root directory and get outta here
                    this.Density = DensityType.Unknown;
                    return;
                }
            }

            //our bearings our set, get the file list
            this.Datastream.Seek(360 * this.Volumes[0].UnitSize, SeekOrigin.Begin);
            int x = 0;
            byte[] buffer = new byte[16];
            byte[] temp = new byte[2];
            List<File> files = new List<File>();
            // max of 64 file entries
            while (x < 64)
            {
                this.Datastream.Read(buffer, 0, 16);
                if (buffer[0] == 0) break;
                var newfile = new AtariFile();
                newfile.Flags = buffer[0];
                // get sector count
                Buffer.BlockCopy(buffer, 1, temp, 0, 2);
                if (!BitConverter.IsLittleEndian) Array.Reverse(temp);
                newfile.Length = (ulong)BitConverter.ToInt16(temp, 0);
                // get sector start
                Buffer.BlockCopy(buffer, 3, temp, 0, 2);
                if (!BitConverter.IsLittleEndian) Array.Reverse(temp);
                newfile.Start = (ulong)BitConverter.ToInt16(temp, 0);
                newfile.Name = Encoding.ASCII.GetString(buffer, 5, 8).Trim() + "." + Encoding.ASCII.GetString(buffer, 13, 3);
                files.Add(newfile);
                x++;
            }
            Volumes[0].Root.Contents = files.ToArray();
        }
Exemple #15
0
 public DiskImage(Stream DataStream, IDumpConverter Converter = null)
     : base(DataStream, Converter)
 {
 }
Exemple #16
0
 public SegaSuper32X_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
 public SegaMegadrive_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
 /*public Dump.Formats Format
 {
     get;
     private set;
 }*/
 //private Dump.iNESHeader inesheader = null;
 public NintendoFamicom_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
Exemple #19
0
 protected MediaImage(Stream Datastream, IDumpConverter Converter = null)
 {
     if (Datastream == null) throw new ArgumentNullException();
     if (Converter == null) this.Datastream = Datastream;
     else this.Datastream = Converter.Normalize(Datastream);
 }
Exemple #20
0
 public SegaGameGear_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
        /*public static class Dump
        {
            public enum Formats
            {
                RAW = 0,
                FDS,
                FAM
            }

            public static Formats GetDumpFormat(byte[] Image)
            {
                if (Image == null) throw new ArgumentNullException();
                // check for FDS first
                if (Image[0] == 0x46 && Image[1] == 0x44 && Image[2] == 0x53 && Image[3] == 0x1a) return Formats.FDS;
                // the FAM format doesn't seem to be well understood
                // There is always a 0xf180 length header followed by standard FDS data
                // check for the block markers after 0xf180
                if (Image[0xf180] == 1 && Image[0xf1b8] == 2 && Image[0xf1ba] == 3) return Formats.FAM;

                return Formats.RAW;
            }

            public static string GetDumpInfo(Formats DumpFormat)
            {
                switch (DumpFormat)
                {
                    case Formats.FAM:
                        return "Pasofami format - 0xF180 byte header";
                    case Formats.FDS:
                        return "fwNES format - 16 byte header";
                    case Formats.RAW:
                        return "Raw format";
                    default:
                        return "Unknown dump format";
                }
            }

            public static byte[] Standardize(byte[] Image, Formats DumpFormat)
            {
                if (Image == null) throw new ArgumentNullException();
                byte[] _out;
                switch (DumpFormat)
                {
                    case Dump.Formats.FDS:
                        _out = new byte[Image.Length - 16];
                        Buffer.BlockCopy(Image, 16, _out, 0, _out.Length);
                        return _out;
                    case Dump.Formats.FAM:
                        _out = new byte[Image.Length - 0xf180];
                        Buffer.BlockCopy(Image, 0xf180, _out, 0, _out.Length);
                        return _out;
                    default:
                        return Image;
                }

            }
        }*/
        public NintendoFamicomDiskSys_disk(Stream Datastream, IDumpConverter Converter = null)
            : base(Datastream, Converter)
        {
            base.MediaType = MediaTypes.Disk;
            base.HardwareName = NintendoFamicomDiskSys_disk.HW_JP_R;

            // this needs to be dealt with more gracefully:
            // FDS/FAM images are dumps of multiple disk sides concatenated into one file
            // the dump header indicates how many sides there are
            // in the current methodology, the dump headers are disposed
            // so, for now, the FDS converters have an extra property, Sides, that preserves this value
            // we can either look into a more robust dump solution that keeps a copy of the header
            // or just search through the stream and manualy find each disk side (i.e. the "NINTENDO-HVC" string)

            /*if (Converter != null)
            {
                if (Converter is NintendoFDS_FAM) this.Sides = new FamicomDiskSystem_Side[(Converter as NintendoFDS_FAM).Sides];
                else if (Converter is NintendoFDS_FDS) this.Sides = new FamicomDiskSystem_Side[(Converter as NintendoFDS_FDS).Sides];
            }
            else this.Sides = new FamicomDiskSystem_Side[1];*/

            base.SoftwareTitle = this.GetText_ASCII(new Layout.Range(16, 4));
            //byte[] thisside = new byte[65500];
            //this.Datastream.Seek(0, SeekOrigin.Begin);
            this.Volumes = new FamicomDiskSystem_Side[this.Datastream.Length / 65500];
            for (uint h = 0; h < this.Volumes.Length; h++)
            {
                //this.Datastream.Read(thisside, 0, 65500);
                base.Volumes[h] = new FamicomDiskSystem_Side(this.Datastream, (h * 65500));
            }
        }
Exemple #22
0
 public SegaGameGear_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
Exemple #23
0
 public Nintendo64_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }
 public NintendoVirtualBoy_ROM(Stream Datastream, IDumpConverter Converter = null)
     : base(Datastream, Converter)
 {
     this.Init();
 }