Ejemplo n.º 1
0
            public override void CalculateHashes(byte[] rom, IHashWorkManager worker, float startProgress, float endProgress)
            {
                iNesHeader header = null;

                if (rom.Length > 0x10)
                {
                    header = new iNesHeader(rom, 0);
                }

                if (SNES.HasExternalHeader(rom))   // Headered
                {
                    worker.AddHashes(rom, 0, rom.Length, () => worker.AbortPending, RomHash.AllHashAlgorithms, HashFlags.FileHash);

                    // Calculate headerless hashes
                    int ROMSize = rom.Length - SNES.ExternalHeaderSize;
                    ROMSize = Math.Min(ROMSize, rom.Length - SNES.ExternalHeaderSize);

                    worker.AddHashes(rom, SNES.ExternalHeaderSize, ROMSize, () => worker.AbortPending, RomHash.AllHashAlgorithms, HashFlags.RomHash);
                }
                else
                {
                    // Unheadered (file hash IS rom hash)
                    worker.AddHashes(rom, 0, rom.Length, () => worker.AbortPending, RomHash.AllHashAlgorithms, HashFlags.FileHash, HashFlags.RomHash);
                }
            }
Ejemplo n.º 2
0
            internal override void InitRomData(RomData data, byte[] rom)
            {
                base.InitRomData(data, rom);

                int romOffset = SNES.HasExternalHeader(rom) ? SNES.ExternalHeaderSize : 0;

                if (rom.Length - romOffset >= SnesHeader.MinimumRomSize)
                {
                    SnesHeader snesheader = new SnesHeader(rom, romOffset);
                    data.MiscData.Add(DataTags.DecodedHeader, snesheader);
                }
            }
Ejemplo n.º 3
0
            protected override void AddPlatformExtendedData(RomExDataBuilder builder, byte[] rom, RomData data)
            {
                var checksum  = SNES.CalculateChecksum(rom);
                int romOffset = SNES.HasExternalHeader(rom) ? SNES.ExternalHeaderSize : 0;

                string header = RomExDataBuilder.HeaderCat;

                object     o_snesheader;
                SnesHeader snesheader;

                if (data.MiscData.TryGetValue(DataTags.DecodedHeader, out o_snesheader))
                {
                    //if (snesheader != null) {
                    snesheader = o_snesheader as SnesHeader;

                    builder.AddData(RomExDataBuilder.GeneralCat, "Checksum valid", (checksum == snesheader.Checksum) ? "Yes" : "No");

                    builder.AddData(header, "Mapping", snesheader.Mapping.ToString());

                    //builder.AddData(header,"Name", GetAscii
                }
            }
Ejemplo n.º 4
0
 public override bool?HasHeader(byte[] rom)
 {
     return(SNES.HasExternalHeader(rom));
 }
Ejemplo n.º 5
0
 public override string GetRomFormatName(byte[] rom)
 {
     return(SNES.HasExternalHeader(rom) ? "Super Magicom" : "SNES rom image");
 }
Ejemplo n.º 6
0
 public override int GetRomSize(byte[] rom)
 {
     return(SNES.HasExternalHeader(rom) ? rom.Length - SNES.ExternalHeaderSize : rom.Length);
 }