ZXHawk: fixed tap tape image parsing exceptions (operation wolf etc) - #1158
This commit is contained in:
parent
41f1058469
commit
f36e252d5e
|
@ -184,6 +184,57 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
the start of the code block when saved, and parameter 2 holds 32768. For data files finally, the byte at position 14 decimal holds the variable name.)
|
||||
*/
|
||||
|
||||
tdb.MetaData = new Dictionary<BlockDescriptorTitle, string>();
|
||||
|
||||
if (blockdata[0] == 0x00 && blockSize == 19)
|
||||
{
|
||||
string fileName = Encoding.ASCII.GetString(blockdata.Skip(2).Take(10).ToArray()).Trim();
|
||||
string type = "Unknown Type";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
var param1 = GetWordValue(blockdata, 12);
|
||||
var param2 = GetWordValue(blockdata, 14);
|
||||
|
||||
// header block - examine first byte of header
|
||||
if (blockdata[1] == 0)
|
||||
{
|
||||
type = "Program";
|
||||
sb.Append(type + ": ");
|
||||
sb.Append(fileName + " ");
|
||||
}
|
||||
else if (blockdata[1] == 1)
|
||||
{
|
||||
type = "NumArray";
|
||||
sb.Append(type + ": ");
|
||||
sb.Append(fileName + " ");
|
||||
}
|
||||
else if (blockdata[1] == 2)
|
||||
{
|
||||
type = "CharArray";
|
||||
sb.Append(type + ": ");
|
||||
sb.Append(fileName + " ");
|
||||
}
|
||||
else if (blockdata[1] == 3)
|
||||
{
|
||||
type = "Code";
|
||||
sb.Append(type + ": ");
|
||||
sb.Append(fileName + " ");
|
||||
}
|
||||
}
|
||||
else if (blockdata[0] == 0xff)
|
||||
{
|
||||
// data block
|
||||
description = "Data Block " + (blockSize - 2) + "bytes";
|
||||
tdb.AddMetaData(BlockDescriptorTitle.Data_Bytes, (blockSize - 2).ToString() + " Bytes");
|
||||
}
|
||||
else
|
||||
{
|
||||
// some other type (turbo data etc..)
|
||||
description = string.Format("#{0} block, {1} bytes", blockdata[0].ToString("X2"), blockSize);
|
||||
//description += string.Format(", crc {0}", ((crc != 0) ? string.Format("bad (#{0:X2}!=#{1:X2})", crcFile, crcValue) : "ok"));
|
||||
tdb.AddMetaData(BlockDescriptorTitle.Undefined, description);
|
||||
}
|
||||
/*
|
||||
if (blockdata[0] == 0x00 && blockSize == 19 && (blockdata[1] == 0x00) || blockdata[1] == 3)
|
||||
{
|
||||
// This is the PROGRAM header
|
||||
|
@ -224,6 +275,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
description = string.Format("#{0} block, {1} bytes", blockdata[0].ToString("X2"), blockSize - 2);
|
||||
description += string.Format(", crc {0}", ((crc != 0) ? string.Format("bad (#{0:X2}!=#{1:X2})", crcFile, crcValue) : "ok"));
|
||||
}
|
||||
*/
|
||||
|
||||
tdb.BlockDescription = BlockType.Standard_Speed_Data_Block;
|
||||
|
||||
|
|
Loading…
Reference in New Issue