Exemplo n.º 1
0
        public Cartridge(byte[] programRom, byte[] characterRom, byte mapperId, MirrorMode mirrorMode)
        {
            ProgramRom   = programRom.ToArray();
            CharacterRom = characterRom.ToArray();
            MapperId     = mapperId;
            MirrorMode   = mirrorMode;

            SaveRam = new SaveRam();

            // compute CRC
            byte[] romBody = new byte[programRom.Length + characterRom.Length];
            Array.Copy(programRom, romBody, programRom.Length);
            Array.Copy(characterRom, 0, romBody, programRom.Length, characterRom.Length);
            Crc32 crc32 = new Crc32();

            Crc = crc32.ComputeChecksum(romBody.ToArray());

            if (DetermineMapperId != null)
            {
                MapperId = DetermineMapperId(Crc, MapperId);
            }

            DetermineCartridgeMap();
            Debug.WriteLine(ToString());
        }
Exemplo n.º 2
0
        public Cartridge(BinaryReader romBinaryReader)
        {
            byte[] romBody = LoadFromBinaryReader(romBinaryReader);

            SaveRam = new SaveRam();

            // compute CRC
            Crc32 crc32 = new Crc32();

            Crc = crc32.ComputeChecksum(romBody.ToArray());

            if (DetermineMapperId != null)
            {
                MapperId = DetermineMapperId(Crc, MapperId);
            }

            DetermineCartridgeMap();
            Debug.WriteLine(ToString());
        }