1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-22 14:30:29 +00:00

Fixes is_at_end — must be at end of file and have finished final block.

This commit is contained in:
Thomas Harte 2021-03-28 23:25:29 -04:00
parent acdbd88b9e
commit 51b8dcd011

View File

@ -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();