Example #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);
        }
Example #2
0
 public static bool ContainsConfig(Z64VersionEnum v)
 {
     return(File.Exists($"versions/{v}.json"));
 }