From 426c3ddaea71b6ad793d8916da7288f6013cd745 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Mon, 26 Mar 2018 09:07:36 +0100 Subject: [PATCH] ZXHawk: All TZX blocks now handled correctly (in many cases these are not serialized correctly, but lengths are correct so the entire tape image should be loaded without throwing an exception) - #1158 --- .../Media/Tape/TzxSerializer.cs | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TzxSerializer.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TzxSerializer.cs index 1cccd7ec06..1bd5e6179b 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TzxSerializer.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TzxSerializer.cs @@ -630,6 +630,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum t.BlockDescription = BlockType.CSW_Recording; t.DataPeriods = new List(); + int blockLen = GetInt32(data, _position); + _position += 4; + + _position += blockLen; + // add the block _datacorder.DataBlocks.Add(t); } @@ -814,8 +819,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum // advance to next block _position += nameLength; - - ; } #endregion @@ -852,6 +855,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum All blocks are included in the block count!. */ private void ProcessBlockID23(byte[] data) { + // not implemented properly + TapeDataBlock t = new TapeDataBlock(); t.BlockID = 0x23; t.DataPeriods = new List(); @@ -1450,14 +1455,40 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum #region ID 16 - C64 ROM Type Data Block private void ProcessBlockID16(byte[] data) { + // zxhawk will not implement this block. it will however handle it so subsequent blocks can be parsed + TapeDataBlock t = new TapeDataBlock(); + t.BlockID = 0x16; + t.DataPeriods = new List(); + t.BlockDescription = BlockType.C64_ROM_Type_Data_Block; + t.PauseInMS = 0; + + // add to tape + _datacorder.DataBlocks.Add(t); + + // advance to next block + int blockLen = GetInt32(data, _position); + _position += blockLen; } #endregion #region ID 17 - C64 Turbo Tape Data Block private void ProcessBlockID17(byte[] data) { + // zxhawk will not implement this block. it will however handle it so subsequent blocks can be parsed + TapeDataBlock t = new TapeDataBlock(); + t.BlockID = 0x17; + t.DataPeriods = new List(); + t.BlockDescription = BlockType.C64_Turbo_Tape_Data_Block; + t.PauseInMS = 0; + + // add to tape + _datacorder.DataBlocks.Add(t); + + // advance to next block + int blockLen = GetInt32(data, _position); + _position += blockLen; } #endregion