示例#1
0
文件: C64.cs 项目: budzikt/BizHawk
        private void InitMedia()
        {
            switch (inputFileInfo.Extension.ToUpper())
            {
            case @".CRT":
                Cart cart = Cart.Load(inputFileInfo.Data);
                if (cart != null)
                {
                    board.cartPort.Connect(cart);
                }
                break;

            case @".TAP":
                CassettePort.Tape tape = CassettePort.Tape.Load(inputFileInfo.Data);
                if (tape != null)
                {
                    board.cassPort.Connect(tape);
                }
                break;

            case @".PRG":
                if (inputFileInfo.Data.Length > 2)
                {
                    loadPrg = true;
                }
                break;
            }
        }
示例#2
0
		internal void Connect(Tape tape)
		{
			this.tape = tape;
		}
示例#3
0
文件: Tape.cs 项目: henke37/BizHawk
		// Try to construct a tape file from file data. Returns null if not a tape file, throws exceptions for bad tape files.
		// (Note that some error conditions aren't caught right here.)
		static public Tape Load(byte[] tapeFile)
		{
			Tape result = null;

			if (System.Text.Encoding.ASCII.GetString(tapeFile, 0, 12) == "C64-TAPE-RAW")
			{
				byte version = tapeFile[12];
				if (version > 1) throw new Exception("This tape has an unsupported version");
				uint size = BitConverter.ToUInt32(tapeFile, 16);
				if (size + 20 != tapeFile.Length)
				{
					throw new Exception("Tape file header specifies a length that doesn't match the file size");
				}
				result = new Tape(version, tapeFile, 20, (uint)tapeFile.Length);
			}
			return result;
		}