From 5ec469f2f31b1b4ab3e95183d28307d4529b2845 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Tue, 12 Jun 2018 14:22:28 +0100 Subject: [PATCH] ZXHawk: Tape status (F10) now reports tape progress in addition to current block progress --- .../SinclairSpectrum/ZXSpectrum.Messaging.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs index 8c7f6baf14..7b14980b30 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs @@ -410,6 +410,28 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum sb.Append(p.ToString("N0") + "%"); SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape); sb.Clear(); + + // get position within the tape itself + sb.Append("Tape Pos: "); + var ind = _machine.TapeDevice.CurrentDataBlockIndex; + int cnt = 0; + for (int i = 0; i < ind; i++) + { + cnt += _machine.TapeDevice.DataBlocks[i].DataPeriods.Count; + } + // now we are at our current block + int ourPos = cnt + pos; + cnt += end; + // count periods in the remaining blocks + for (int i = ind + 1; i < _machine.TapeDevice.DataBlocks.Count; i++) + { + cnt += _machine.TapeDevice.DataBlocks[i].DataPeriods.Count; + } + // work out overall position within the tape + p = 0; + p = ((double)ourPos / (double)cnt) * (double)100; + sb.Append(p.ToString("N0") + "%"); + SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape); } #endregion