From 437023bff6ce1e891e3da78bc169b861864fb5e4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 27 Aug 2017 15:20:22 -0400 Subject: [PATCH] Expands to take an already-accrued list of potential platforms, as that may indicate that one or the other of the ZX80 and ZX81 is already out of contention and therefore save the need to attempt analysis. --- StaticAnalyser/ZX8081/StaticAnalyser.cpp | 14 ++++++++++++-- StaticAnalyser/ZX8081/StaticAnalyser.hpp | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/StaticAnalyser/ZX8081/StaticAnalyser.cpp b/StaticAnalyser/ZX8081/StaticAnalyser.cpp index 7449a0063..8a15493f1 100644 --- a/StaticAnalyser/ZX8081/StaticAnalyser.cpp +++ b/StaticAnalyser/ZX8081/StaticAnalyser.cpp @@ -27,14 +27,24 @@ static std::vector GetFiles(const std::shared_ptr &destination) { +void StaticAnalyser::ZX8081::AddTargets(const Media &media, std::list &destination, TargetPlatform::IntType potential_platforms) { if(!media.tapes.empty()) { std::vector files = GetFiles(media.tapes.front()); media.tapes.front()->reset(); if(!files.empty()) { StaticAnalyser::Target target; target.machine = Target::ZX8081; - target.zx8081.isZX81 = files.front().isZX81; + + // Guess the machine type from the file only if it isn't already known. + switch(potential_platforms & (TargetPlatform::ZX80 | TargetPlatform::ZX81)) { + default: + target.zx8081.isZX81 = files.front().isZX81; + break; + + case TargetPlatform::ZX80: target.zx8081.isZX81 = false; break; + case TargetPlatform::ZX81: target.zx8081.isZX81 = true; break; + } + /*if(files.front().data.size() > 16384) { target.zx8081.memory_model = ZX8081MemoryModel::SixtyFourKB; } else*/ if(files.front().data.size() > 1024) { diff --git a/StaticAnalyser/ZX8081/StaticAnalyser.hpp b/StaticAnalyser/ZX8081/StaticAnalyser.hpp index a352988be..3212f4c53 100644 --- a/StaticAnalyser/ZX8081/StaticAnalyser.hpp +++ b/StaticAnalyser/ZX8081/StaticAnalyser.hpp @@ -10,11 +10,12 @@ #define StaticAnalyser_ZX8081_StaticAnalyser_hpp #include "../StaticAnalyser.hpp" +#include "../../Storage/TargetPlatforms.hpp" namespace StaticAnalyser { namespace ZX8081 { -void AddTargets(const Media &media, std::list &destination); +void AddTargets(const Media &media, std::list &destination, TargetPlatform::IntType potential_platforms); } }