From 350b36df2550f1c8c6ab63f0c3c0b367af206d68 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 7 Jun 2017 17:30:53 -0400 Subject: [PATCH] Wired in an attempted usage of the new tape parser. --- StaticAnalyser/ZX8081/StaticAnalyser.cpp | 35 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/StaticAnalyser/ZX8081/StaticAnalyser.cpp b/StaticAnalyser/ZX8081/StaticAnalyser.cpp index ce8fa0383..840f30d5f 100644 --- a/StaticAnalyser/ZX8081/StaticAnalyser.cpp +++ b/StaticAnalyser/ZX8081/StaticAnalyser.cpp @@ -8,14 +8,39 @@ #include "StaticAnalyser.hpp" +#include +#include + +#include "../../Storage/Tape/Parsers/ZX8081.hpp" + +static std::vector GetFiles(const std::shared_ptr &tape) { + std::vector files; + Storage::Tape::ZX8081::Parser parser; + + while(!tape->is_at_end()) { + std::shared_ptr next_file = parser.get_next_file(tape); + if(next_file != nullptr) { + files.push_back(*next_file); + } + } + + return files; +} + void StaticAnalyser::ZX8081::AddTargets( const std::list> &disks, const std::list> &tapes, const std::list> &cartridges, std::list &destination) { - // Temporary: be entirely trusting. - StaticAnalyser::Target target; - target.machine = Target::ZX80; - target.tapes = tapes; - destination.push_back(target); + + if(!tapes.empty()) { + std::vector files = GetFiles(tapes.front()); + if(!files.empty()) { + // TODO: check files for machine type, memory size. + StaticAnalyser::Target target; + target.machine = Target::ZX80; + target.tapes = tapes; + destination.push_back(target); + } + } }