From 49197868254bbf557fbc6d9c41a0217cf5acc570 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 29 Apr 2021 18:00:02 -0400 Subject: [PATCH] Relaxes Oric .tap signature check. --- Storage/Tape/Formats/OricTAP.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Storage/Tape/Formats/OricTAP.cpp b/Storage/Tape/Formats/OricTAP.cpp index f4169340c..9b13dc1b1 100644 --- a/Storage/Tape/Formats/OricTAP.cpp +++ b/Storage/Tape/Formats/OricTAP.cpp @@ -15,9 +15,19 @@ using namespace Storage::Tape; OricTAP::OricTAP(const std::string &file_name) : file_(file_name) { - // check the file signature - if(!file_.check_signature("\x16\x16\x16\x24", 4)) - throw ErrorNotOricTAP; + // Check for a sequence of at least three 0x16s followed by a 0x24. + while(true) { + const uint8_t next = file_.get8(); + if(next != 0x16 && next != 0x24) { + throw ErrorNotOricTAP; + } + if(next == 0x24) { + if(file_.tell() < 4) { + throw ErrorNotOricTAP; + } + break; + } + } // then rewind and start again virtual_reset();