Beispiel #1
0
        public Z64Game(N64Rom rom, Action <float, string> progressCalback = null)
        {
            Rom = rom;

            if (!N64CheckSum.Validate(Rom, 6105))
            {
                throw new Exception("Invalid CRC");
            }

            int off = FindBuildNameOffset();

            if (off == -1)
            {
                throw new Exception("Invalid ROM");
            }

            using (MemoryStream ms = new MemoryStream(rom.RawRom))
            {
                BinaryStream br = new BinaryStream(ms, ByteConverter.Big);
                br.Position = off;
                BuildID     = br.ReadString(0x30, Encoding.ASCII).TrimEnd('\0').Replace("\0", " ");

                if (Z64Version.BuildIds.ContainsKey(BuildID))
                {
                    Version = Z64Version.BuildIds[BuildID];
                }
                else
                {
                    throw new Z64GameException("Invalid or unknown build name");
                }


                GetFs(br, progressCalback);
            }

            Memory = new Z64Memory(this);
        }
Beispiel #2
0
 public void FixRom()
 {
     FixDmaDataTable();
     N64CheckSum.Update(Rom, 6105);
 }