From 51b8dcd0111cc7bc51dfa68e4e0a6d403531f7bf Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 28 Mar 2021 23:25:29 -0400 Subject: [PATCH] =?UTF-8?q?Fixes=20`is=5Fat=5Fend`=20=E2=80=94=20must=20be?= =?UTF-8?q?=20at=20end=20of=20file=20and=20have=20finished=20final=20block?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Storage/Tape/Formats/ZXSpectrumTAP.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Storage/Tape/Formats/ZXSpectrumTAP.cpp b/Storage/Tape/Formats/ZXSpectrumTAP.cpp index 080dcba11..5fa28c4de 100644 --- a/Storage/Tape/Formats/ZXSpectrumTAP.cpp +++ b/Storage/Tape/Formats/ZXSpectrumTAP.cpp @@ -38,7 +38,7 @@ ZXSpectrumTAP::ZXSpectrumTAP(const std::string &file_name) : } bool ZXSpectrumTAP::is_at_end() { - return file_.tell() == file_.stats().st_size; + return file_.tell() == file_.stats().st_size && phase_ == Phase::Gap; } void ZXSpectrumTAP::virtual_reset() { @@ -111,7 +111,7 @@ Tape::Pulse ZXSpectrumTAP::virtual_get_next_pulse() { } void ZXSpectrumTAP::read_next_block() { - if(is_at_end()) { + if(file_.tell() == file_.stats().st_size) { phase_ = Phase::Gap; } else { block_length_ = file_.get16le();