From 079dc671e1435d192b1e011a02463059afeb066c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 14 Apr 2018 12:12:12 -0400 Subject: [PATCH] Rationalises per-machine static analyser call pattern, and adds Apple II as an option. --- Analyser/Static/Acorn/StaticAnalyser.cpp | 8 ++++-- Analyser/Static/Acorn/StaticAnalyser.hpp | 4 ++- Analyser/Static/Acorn/Target.hpp | 2 ++ Analyser/Static/AmstradCPC/StaticAnalyser.cpp | 5 +++- Analyser/Static/AmstradCPC/StaticAnalyser.hpp | 10 ++++--- Analyser/Static/AmstradCPC/Target.hpp | 2 ++ Analyser/Static/AppleII/StaticAnalyser.cpp | 13 +++++++++ Analyser/Static/AppleII/StaticAnalyser.hpp | 26 +++++++++++++++++ Analyser/Static/Atari/StaticAnalyser.cpp | 7 +++-- Analyser/Static/Atari/StaticAnalyser.hpp | 4 ++- Analyser/Static/Coleco/StaticAnalyser.cpp | 6 ++-- Analyser/Static/Coleco/StaticAnalyser.hpp | 4 ++- Analyser/Static/Commodore/StaticAnalyser.cpp | 6 +++- Analyser/Static/Commodore/StaticAnalyser.hpp | 3 +- Analyser/Static/Commodore/Target.hpp | 2 ++ Analyser/Static/MSX/StaticAnalyser.cpp | 6 +++- Analyser/Static/MSX/StaticAnalyser.hpp | 4 ++- Analyser/Static/MSX/Target.hpp | 2 ++ Analyser/Static/Oric/StaticAnalyser.cpp | 6 ++-- Analyser/Static/Oric/StaticAnalyser.hpp | 4 ++- Analyser/Static/Oric/Target.hpp | 4 +++ Analyser/Static/StaticAnalyser.cpp | 28 ++++++++++++------- Analyser/Static/StaticAnalyser.hpp | 6 ++-- Analyser/Static/ZX8081/StaticAnalyser.cpp | 4 ++- Analyser/Static/ZX8081/StaticAnalyser.hpp | 7 +++-- Analyser/Static/ZX8081/Target.hpp | 2 ++ Machines/AmstradCPC/AmstradCPC.cpp | 4 +-- Machines/Commodore/Vic-20/Vic20.cpp | 4 +-- Machines/Electron/Electron.cpp | 4 +-- Machines/MSX/MSX.cpp | 4 +-- Machines/Oric/Oric.cpp | 4 +-- Machines/ZX8081/ZX8081.cpp | 4 +-- .../Clock Signal.xcodeproj/project.pbxproj | 16 +++++++++++ Storage/TargetPlatforms.hpp | 25 +++++++++-------- 34 files changed, 176 insertions(+), 64 deletions(-) create mode 100644 Analyser/Static/AppleII/StaticAnalyser.cpp create mode 100644 Analyser/Static/AppleII/StaticAnalyser.hpp diff --git a/Analyser/Static/Acorn/StaticAnalyser.cpp b/Analyser/Static/Acorn/StaticAnalyser.cpp index 5942d7fc9..eeeba1509 100644 --- a/Analyser/Static/Acorn/StaticAnalyser.cpp +++ b/Analyser/Static/Acorn/StaticAnalyser.cpp @@ -57,7 +57,7 @@ static std::vector> return acorn_cartridges; } -void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector> &destination) { +Analyser::Static::TargetList Analyser::Static::Acorn::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { std::unique_ptr target(new Target); target->machine = Machine::Electron; target->confidence = 0.5; // TODO: a proper estimation @@ -121,7 +121,9 @@ void Analyser::Static::Acorn::AddTargets(const Media &media, std::vectormedia.tapes.size() || target->media.disks.size() || target->media.cartridges.size()) { - destination.push_back(std::move(target)); + TargetList targets; + if(!target->media.empty()) { + targets.push_back(std::move(target)); } + return targets; } diff --git a/Analyser/Static/Acorn/StaticAnalyser.hpp b/Analyser/Static/Acorn/StaticAnalyser.hpp index 695b5e183..83c1e1756 100644 --- a/Analyser/Static/Acorn/StaticAnalyser.hpp +++ b/Analyser/Static/Acorn/StaticAnalyser.hpp @@ -10,12 +10,14 @@ #define StaticAnalyser_Acorn_StaticAnalyser_hpp #include "../StaticAnalyser.hpp" +#include "../../../Storage/TargetPlatforms.hpp" +#include namespace Analyser { namespace Static { namespace Acorn { -void AddTargets(const Media &media, std::vector> &destination); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } diff --git a/Analyser/Static/Acorn/Target.hpp b/Analyser/Static/Acorn/Target.hpp index e7e97d467..a6157a8ec 100644 --- a/Analyser/Static/Acorn/Target.hpp +++ b/Analyser/Static/Acorn/Target.hpp @@ -10,6 +10,7 @@ #define Analyser_Static_Acorn_Target_h #include "../StaticAnalyser.hpp" +#include namespace Analyser { namespace Static { @@ -19,6 +20,7 @@ struct Target: public ::Analyser::Static::Target { bool has_adfs = false; bool has_dfs = false; bool should_shift_restart = false; + std::string loading_command; }; } diff --git a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp index 7e6dc88eb..cc7ed4ecf 100644 --- a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp +++ b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp @@ -179,7 +179,8 @@ static bool CheckBootSector(const std::shared_ptr &disk, co return false; } -void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector> &destination) { +Analyser::Static::TargetList Analyser::Static::AmstradCPC::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { + TargetList destination; std::unique_ptr target(new Target); target->machine = Machine::AmstradCPC; target->confidence = 0.5; @@ -241,4 +242,6 @@ void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vectormedia.empty()) destination.push_back(std::move(target)); + + return destination; } diff --git a/Analyser/Static/AmstradCPC/StaticAnalyser.hpp b/Analyser/Static/AmstradCPC/StaticAnalyser.hpp index f474ecf3b..d678bd327 100644 --- a/Analyser/Static/AmstradCPC/StaticAnalyser.hpp +++ b/Analyser/Static/AmstradCPC/StaticAnalyser.hpp @@ -6,19 +6,21 @@ // Copyright © 2017 Thomas Harte. All rights reserved. // -#ifndef StaticAnalyser_AmstradCPC_StaticAnalyser_hpp -#define StaticAnalyser_AmstradCPC_StaticAnalyser_hpp +#ifndef Analyser_Static_AmstradCPC_StaticAnalyser_hpp +#define Analyser_Static_AmstradCPC_StaticAnalyser_hpp #include "../StaticAnalyser.hpp" +#include "../../../Storage/TargetPlatforms.hpp" +#include namespace Analyser { namespace Static { namespace AmstradCPC { -void AddTargets(const Media &media, std::vector> &destination); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } } -#endif /* StaticAnalyser_AmstradCPC_StaticAnalyser_hpp */ +#endif /* Analyser_Static_AmstradCPC_StaticAnalyser_hpp */ diff --git a/Analyser/Static/AmstradCPC/Target.hpp b/Analyser/Static/AmstradCPC/Target.hpp index ae656399e..adff04774 100644 --- a/Analyser/Static/AmstradCPC/Target.hpp +++ b/Analyser/Static/AmstradCPC/Target.hpp @@ -10,6 +10,7 @@ #define Analyser_Static_AmstradCPC_Target_h #include "../StaticAnalyser.hpp" +#include namespace Analyser { namespace Static { @@ -23,6 +24,7 @@ struct Target: public ::Analyser::Static::Target { }; Model model = Model::CPC464; + std::string loading_command; }; } diff --git a/Analyser/Static/AppleII/StaticAnalyser.cpp b/Analyser/Static/AppleII/StaticAnalyser.cpp new file mode 100644 index 000000000..c2996bbee --- /dev/null +++ b/Analyser/Static/AppleII/StaticAnalyser.cpp @@ -0,0 +1,13 @@ +// +// StaticAnalyser.cpp +// Clock Signal +// +// Created by Thomas Harte on 14/04/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "StaticAnalyser.hpp" + +Analyser::Static::TargetList Analyser::Static::AppleII::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { + return TargetList(); +} diff --git a/Analyser/Static/AppleII/StaticAnalyser.hpp b/Analyser/Static/AppleII/StaticAnalyser.hpp new file mode 100644 index 000000000..2ca147d7c --- /dev/null +++ b/Analyser/Static/AppleII/StaticAnalyser.hpp @@ -0,0 +1,26 @@ +// +// StaticAnalyser.hpp +// Clock Signal +// +// Created by Thomas Harte on 14/04/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef Analyser_Static_AppleII_StaticAnalyser_hpp +#define Analyser_Static_AppleII_StaticAnalyser_hpp + +#include "../StaticAnalyser.hpp" +#include "../../../Storage/TargetPlatforms.hpp" +#include + +namespace Analyser { +namespace Static { +namespace AppleII { + +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); + +} +} +} + +#endif /* Analyser_Static_AppleII_StaticAnalyser_hpp */ diff --git a/Analyser/Static/Atari/StaticAnalyser.cpp b/Analyser/Static/Atari/StaticAnalyser.cpp index 206fe1f77..24318cd5a 100644 --- a/Analyser/Static/Atari/StaticAnalyser.cpp +++ b/Analyser/Static/Atari/StaticAnalyser.cpp @@ -180,7 +180,7 @@ static void DeterminePagingForCartridge(Analyser::Static::Atari::Target &target, } } -void Analyser::Static::Atari::AddTargets(const Media &media, std::vector> &destination) { +Analyser::Static::TargetList Analyser::Static::Atari::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { // TODO: sanity checking; is this image really for an Atari 2600? std::unique_ptr target(new Analyser::Static::Atari::Target); target->machine = Machine::Atari2600; @@ -198,6 +198,7 @@ void Analyser::Static::Atari::AddTargets(const Media &media, std::vector namespace Analyser { namespace Static { namespace Atari { -void AddTargets(const Media &media, std::vector> &destination); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } diff --git a/Analyser/Static/Coleco/StaticAnalyser.cpp b/Analyser/Static/Coleco/StaticAnalyser.cpp index acad40f72..076e2ec48 100644 --- a/Analyser/Static/Coleco/StaticAnalyser.cpp +++ b/Analyser/Static/Coleco/StaticAnalyser.cpp @@ -52,11 +52,13 @@ static std::vector> return coleco_cartridges; } -void Analyser::Static::Coleco::AddTargets(const Media &media, std::vector> &destination) { +Analyser::Static::TargetList Analyser::Static::Coleco::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { + TargetList targets; std::unique_ptr target(new Target); target->machine = Machine::ColecoVision; target->confidence = 1.0f - 1.0f / 32768.0f; target->media.cartridges = ColecoCartridgesFrom(media.cartridges); if(!target->media.empty()) - destination.push_back(std::move(target)); + targets.push_back(std::move(target)); + return targets; } diff --git a/Analyser/Static/Coleco/StaticAnalyser.hpp b/Analyser/Static/Coleco/StaticAnalyser.hpp index 91014b1c4..7c6389c4f 100644 --- a/Analyser/Static/Coleco/StaticAnalyser.hpp +++ b/Analyser/Static/Coleco/StaticAnalyser.hpp @@ -10,12 +10,14 @@ #define StaticAnalyser_Coleco_StaticAnalyser_hpp #include "../StaticAnalyser.hpp" +#include "../../../Storage/TargetPlatforms.hpp" +#include namespace Analyser { namespace Static { namespace Coleco { -void AddTargets(const Media &media, std::vector> &destination); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } diff --git a/Analyser/Static/Commodore/StaticAnalyser.cpp b/Analyser/Static/Commodore/StaticAnalyser.cpp index ac846bc76..0f8cd270f 100644 --- a/Analyser/Static/Commodore/StaticAnalyser.cpp +++ b/Analyser/Static/Commodore/StaticAnalyser.cpp @@ -40,7 +40,9 @@ static std::vector> return vic20_cartridges; } -void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector> &destination, const std::string &file_name) { +Analyser::Static::TargetList Analyser::Static::Commodore::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { + std::vector> destination; + std::unique_ptr target(new Target); target->machine = Machine::Vic20; // TODO: machine estimation target->confidence = 0.5; // TODO: a proper estimation @@ -154,4 +156,6 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector namespace Analyser { namespace Static { namespace Commodore { -void AddTargets(const Media &media, std::vector> &destination, const std::string &file_name); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } diff --git a/Analyser/Static/Commodore/Target.hpp b/Analyser/Static/Commodore/Target.hpp index 1dc54db88..3f287d61a 100644 --- a/Analyser/Static/Commodore/Target.hpp +++ b/Analyser/Static/Commodore/Target.hpp @@ -10,6 +10,7 @@ #define Analyser_Static_Commodore_Target_h #include "../StaticAnalyser.hpp" +#include namespace Analyser { namespace Static { @@ -33,6 +34,7 @@ struct Target: public ::Analyser::Static::Target { MemoryModel memory_model = MemoryModel::Unexpanded; Region region = Region::European; bool has_c1540 = false; + std::string loading_command; }; } diff --git a/Analyser/Static/MSX/StaticAnalyser.cpp b/Analyser/Static/MSX/StaticAnalyser.cpp index 9b4e4377a..82cdc8408 100644 --- a/Analyser/Static/MSX/StaticAnalyser.cpp +++ b/Analyser/Static/MSX/StaticAnalyser.cpp @@ -261,7 +261,9 @@ static std::vector> CartridgeTargetsFr return targets; } -void Analyser::Static::MSX::AddTargets(const Media &media, std::vector> &destination) { +Analyser::Static::TargetList Analyser::Static::MSX::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { + TargetList destination; + // Append targets for any cartridges that look correct. auto cartridge_targets = CartridgeTargetsFrom(media.cartridges); std::move(cartridge_targets.begin(), cartridge_targets.end(), std::back_inserter(destination)); @@ -292,4 +294,6 @@ void Analyser::Static::MSX::AddTargets(const Media &media, std::vectorconfidence = 0.5; destination.push_back(std::move(target)); } + + return destination; } diff --git a/Analyser/Static/MSX/StaticAnalyser.hpp b/Analyser/Static/MSX/StaticAnalyser.hpp index 4f08ebb9d..32100aae4 100644 --- a/Analyser/Static/MSX/StaticAnalyser.hpp +++ b/Analyser/Static/MSX/StaticAnalyser.hpp @@ -10,12 +10,14 @@ #define StaticAnalyser_MSX_StaticAnalyser_hpp #include "../StaticAnalyser.hpp" +#include "../../../Storage/TargetPlatforms.hpp" +#include namespace Analyser { namespace Static { namespace MSX { -void AddTargets(const Media &media, std::vector> &destination); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } diff --git a/Analyser/Static/MSX/Target.hpp b/Analyser/Static/MSX/Target.hpp index 6c6c2cea7..6d552a4af 100644 --- a/Analyser/Static/MSX/Target.hpp +++ b/Analyser/Static/MSX/Target.hpp @@ -10,6 +10,7 @@ #define Analyser_Static_MSX_Target_h #include "../StaticAnalyser.hpp" +#include namespace Analyser { namespace Static { @@ -17,6 +18,7 @@ namespace MSX { struct Target: public ::Analyser::Static::Target { bool has_disk_drive = false; + std::string loading_command; }; } diff --git a/Analyser/Static/Oric/StaticAnalyser.cpp b/Analyser/Static/Oric/StaticAnalyser.cpp index e53aa6463..dcd16b924 100644 --- a/Analyser/Static/Oric/StaticAnalyser.cpp +++ b/Analyser/Static/Oric/StaticAnalyser.cpp @@ -100,7 +100,7 @@ static bool IsMicrodisc(Storage::Encodings::MFM::Parser &parser) { return !std::memcmp(signature, first_sample.data(), sizeof(signature)); } -void Analyser::Static::Oric::AddTargets(const Media &media, std::vector> &destination) { +Analyser::Static::TargetList Analyser::Static::Oric::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { std::unique_ptr target(new Target); target->machine = Machine::Oric; target->confidence = 0.5; @@ -146,6 +146,8 @@ void Analyser::Static::Oric::AddTargets(const Media &media, std::vectoruse_atmos_rom = basic11_votes >= basic10_votes; if(target->has_microdrive) target->use_atmos_rom = true; + TargetList targets; if(target->media.tapes.size() || target->media.disks.size() || target->media.cartridges.size()) - destination.push_back(std::move(target)); + targets.push_back(std::move(target)); + return targets; } diff --git a/Analyser/Static/Oric/StaticAnalyser.hpp b/Analyser/Static/Oric/StaticAnalyser.hpp index 1f2823be6..40aa7f9d9 100644 --- a/Analyser/Static/Oric/StaticAnalyser.hpp +++ b/Analyser/Static/Oric/StaticAnalyser.hpp @@ -10,12 +10,14 @@ #define StaticAnalyser_Oric_StaticAnalyser_hpp #include "../StaticAnalyser.hpp" +#include "../../../Storage/TargetPlatforms.hpp" +#include namespace Analyser { namespace Static { namespace Oric { -void AddTargets(const Media &media, std::vector> &destination); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } diff --git a/Analyser/Static/Oric/Target.hpp b/Analyser/Static/Oric/Target.hpp index 4bd5bb16e..36bc42c22 100644 --- a/Analyser/Static/Oric/Target.hpp +++ b/Analyser/Static/Oric/Target.hpp @@ -9,6 +9,9 @@ #ifndef Analyser_Static_Oric_Target_h #define Analyser_Static_Oric_Target_h +#include "../StaticAnalyser.hpp" +#include + namespace Analyser { namespace Static { namespace Oric { @@ -16,6 +19,7 @@ namespace Oric { struct Target: public ::Analyser::Static::Target { bool use_atmos_rom = false; bool has_microdrive = false; + std::string loading_command; }; } diff --git a/Analyser/Static/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp index f97db90f6..c4ae7a7be 100644 --- a/Analyser/Static/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -11,10 +11,12 @@ #include #include #include +#include // Analysers #include "Acorn/StaticAnalyser.hpp" #include "AmstradCPC/StaticAnalyser.hpp" +#include "AppleII/StaticAnalyser.hpp" #include "Atari/StaticAnalyser.hpp" #include "Coleco/StaticAnalyser.hpp" #include "Commodore/StaticAnalyser.hpp" @@ -138,8 +140,8 @@ Media Analyser::Static::GetMedia(const std::string &file_name) { return GetMediaAndPlatforms(file_name, throwaway); } -std::vector> Analyser::Static::GetTargets(const std::string &file_name) { - std::vector> targets; +TargetList Analyser::Static::GetTargets(const std::string &file_name) { + TargetList targets; // Collect all disks, tapes and ROMs as can be extrapolated from this file, forming the // union of all platforms this file might be a target for. @@ -148,14 +150,20 @@ std::vector> Analyser::Static::GetTargets(const std::str // Hand off to platform-specific determination of whether these things are actually compatible and, // if so, how to load them. - if(potential_platforms & TargetPlatform::Acorn) Acorn::AddTargets(media, targets); - if(potential_platforms & TargetPlatform::AmstradCPC) AmstradCPC::AddTargets(media, targets); - if(potential_platforms & TargetPlatform::Atari2600) Atari::AddTargets(media, targets); - if(potential_platforms & TargetPlatform::ColecoVision) Coleco::AddTargets(media, targets); - if(potential_platforms & TargetPlatform::Commodore) Commodore::AddTargets(media, targets, file_name); - if(potential_platforms & TargetPlatform::MSX) MSX::AddTargets(media, targets); - if(potential_platforms & TargetPlatform::Oric) Oric::AddTargets(media, targets); - if(potential_platforms & TargetPlatform::ZX8081) ZX8081::AddTargets(media, targets, potential_platforms); + #define Append(x) {\ + auto new_targets = x::GetTargets(media, file_name, potential_platforms);\ + std::move(new_targets.begin(), new_targets.end(), std::back_inserter(targets));\ + } + if(potential_platforms & TargetPlatform::Acorn) Append(Acorn); + if(potential_platforms & TargetPlatform::AmstradCPC) Append(AmstradCPC); + if(potential_platforms & TargetPlatform::AppleII) Append(AppleII); + if(potential_platforms & TargetPlatform::Atari2600) Append(Atari); + if(potential_platforms & TargetPlatform::ColecoVision) Append(Coleco); + if(potential_platforms & TargetPlatform::Commodore) Append(Commodore); + if(potential_platforms & TargetPlatform::MSX) Append(MSX); + if(potential_platforms & TargetPlatform::Oric) Append(Oric); + if(potential_platforms & TargetPlatform::ZX8081) Append(ZX8081); + #undef Append // Reset any tapes to their initial position for(auto &target : targets) { diff --git a/Analyser/Static/StaticAnalyser.hpp b/Analyser/Static/StaticAnalyser.hpp index 64ea0196e..8d6c85fab 100644 --- a/Analyser/Static/StaticAnalyser.hpp +++ b/Analyser/Static/StaticAnalyser.hpp @@ -15,6 +15,7 @@ #include "../../Storage/Disk/Disk.hpp" #include "../../Storage/Cartridge/Cartridge.hpp" +#include #include #include @@ -43,17 +44,16 @@ struct Target { Machine machine; Media media; - float confidence; - std::string loading_command; }; +typedef std::vector> TargetList; /*! Attempts, through any available means, to return a list of potential targets for the file with the given name. @returns The list of potential targets, sorted from most to least probable. */ -std::vector> GetTargets(const std::string &file_name); +TargetList GetTargets(const std::string &file_name); /*! Inspects the supplied file and determines the media included. diff --git a/Analyser/Static/ZX8081/StaticAnalyser.cpp b/Analyser/Static/ZX8081/StaticAnalyser.cpp index 06727de52..c9b24a165 100644 --- a/Analyser/Static/ZX8081/StaticAnalyser.cpp +++ b/Analyser/Static/ZX8081/StaticAnalyser.cpp @@ -28,7 +28,8 @@ static std::vector GetFiles(const std::shared_ptr> &destination, TargetPlatform::IntType potential_platforms) { +Analyser::Static::TargetList Analyser::Static::ZX8081::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { + std::vector> destination; if(!media.tapes.empty()) { std::vector files = GetFiles(media.tapes.front()); media.tapes.front()->reset(); @@ -65,4 +66,5 @@ void Analyser::Static::ZX8081::AddTargets(const Media &media, std::vector namespace Analyser { namespace Static { namespace ZX8081 { -void AddTargets(const Media &media, std::vector> &destination, TargetPlatform::IntType potential_platforms); +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); } } diff --git a/Analyser/Static/ZX8081/Target.hpp b/Analyser/Static/ZX8081/Target.hpp index 5f40e0bdf..b852e4473 100644 --- a/Analyser/Static/ZX8081/Target.hpp +++ b/Analyser/Static/ZX8081/Target.hpp @@ -10,6 +10,7 @@ #define Analyser_Static_ZX8081_Target_h #include "../StaticAnalyser.hpp" +#include namespace Analyser { namespace Static { @@ -25,6 +26,7 @@ struct Target: public ::Analyser::Static::Target { MemoryModel memory_model = MemoryModel::Unexpanded; bool is_ZX81 = false; bool ZX80_uses_ZX81_ROM = false; + std::string loading_command; }; } diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 202d06628..cfd9c2e8f 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -916,8 +916,8 @@ class ConcreteMachine: read_pointers_[3] = roms_[upper_rom_].data(); // Type whatever is required. - if(target->loading_command.length()) { - type_string(target->loading_command); + if(!cpc_target->loading_command.empty()) { + type_string(cpc_target->loading_command); } insert_media(target->media); diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index e05711ed0..fa9e54939 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -371,8 +371,8 @@ class ConcreteMachine: void configure_as_target(const Analyser::Static::Target *target) override final { commodore_target_ = *dynamic_cast(target); - if(target->loading_command.length()) { - type_string(target->loading_command); + if(!commodore_target_.loading_command.empty()) { + type_string(commodore_target_.loading_command); } if(commodore_target_.has_c1540) { diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 4873af70d..b8e16c525 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -131,8 +131,8 @@ class ConcreteMachine: void configure_as_target(const Analyser::Static::Target *target) override final { auto *const acorn_target = dynamic_cast(target); - if(target->loading_command.length()) { - type_string(target->loading_command); + if(!acorn_target->loading_command.empty()) { + type_string(acorn_target->loading_command); } if(acorn_target->should_shift_restart) { diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 35807af48..5794be009 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -201,8 +201,8 @@ class ConcreteMachine: insert_media(target->media); // Type whatever has been requested. - if(target->loading_command.length()) { - type_string(target->loading_command); + if(!msx_target->loading_command.empty()) { + type_string(msx_target->loading_command); } } diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index d65531d8b..03c86be0f 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -273,8 +273,8 @@ class ConcreteMachine: microdisc_.set_delegate(this); } - if(target->loading_command.length()) { - type_string(target->loading_command); + if(!oric_target->loading_command.empty()) { + type_string(oric_target->loading_command); } if(oric_target->use_atmos_rom) { diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 7d17bd357..4c86641ea 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -324,8 +324,8 @@ template class ConcreteMachine: } Memory::Fuzz(ram_); - if(target->loading_command.length()) { - type_string(target->loading_command); + if(!zx8081_target->loading_command.empty()) { + type_string(zx8081_target->loading_command); } insert_media(target->media); diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index ef546f057..0dcf0e176 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -130,6 +130,8 @@ 4B1497921EE4B5A800CE2596 /* ZX8081.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1497901EE4B5A800CE2596 /* ZX8081.cpp */; }; 4B1497981EE4B97F00CE2596 /* ZX8081Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B1497961EE4B97F00CE2596 /* ZX8081Options.xib */; }; 4B1558C01F844ECD006E9A97 /* BitReverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1558BE1F844ECD006E9A97 /* BitReverse.cpp */; }; + 4B15A9FC208249BB005E6C8D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B15A9FA208249BB005E6C8D /* StaticAnalyser.cpp */; }; + 4B15A9FD208249BB005E6C8D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B15A9FA208249BB005E6C8D /* StaticAnalyser.cpp */; }; 4B1B88BB202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */; }; 4B1B88BC202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */; }; 4B1B88BD202E3D3D00B67DFF /* MultiMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3FCC3F201EC24200960631 /* MultiMachine.cpp */; }; @@ -701,6 +703,8 @@ 4B1497971EE4B97F00CE2596 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/ZX8081Options.xib"; sourceTree = SOURCE_ROOT; }; 4B1558BE1F844ECD006E9A97 /* BitReverse.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = BitReverse.cpp; path = Data/BitReverse.cpp; sourceTree = ""; }; 4B1558BF1F844ECD006E9A97 /* BitReverse.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = BitReverse.hpp; path = Data/BitReverse.hpp; sourceTree = ""; }; + 4B15A9FA208249BB005E6C8D /* StaticAnalyser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = AppleII/StaticAnalyser.cpp; sourceTree = ""; }; + 4B15A9FB208249BB005E6C8D /* StaticAnalyser.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = AppleII/StaticAnalyser.hpp; sourceTree = ""; }; 4B1667F61FFF1E2400A16032 /* Konami.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Konami.hpp; path = MSX/Cartridges/Konami.hpp; sourceTree = ""; }; 4B1667F91FFF215E00A16032 /* ASCII16kb.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ASCII16kb.hpp; path = MSX/Cartridges/ASCII16kb.hpp; sourceTree = ""; }; 4B1667FA1FFF215E00A16032 /* ASCII8kb.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ASCII8kb.hpp; path = MSX/Cartridges/ASCII8kb.hpp; sourceTree = ""; }; @@ -1505,6 +1509,15 @@ name = ZX8081; sourceTree = ""; }; + 4B15A9FE20824C9F005E6C8D /* AppleII */ = { + isa = PBXGroup; + children = ( + 4B15A9FA208249BB005E6C8D /* StaticAnalyser.cpp */, + 4B15A9FB208249BB005E6C8D /* StaticAnalyser.hpp */, + ); + name = AppleII; + sourceTree = ""; + }; 4B1667F81FFF1E2900A16032 /* Cartridges */ = { isa = PBXGroup; children = ( @@ -2144,6 +2157,7 @@ 4B8944EA201967B4007DE474 /* StaticAnalyser.hpp */, 4B8944EB201967B4007DE474 /* Acorn */, 4B894514201967B4007DE474 /* AmstradCPC */, + 4B15A9FE20824C9F005E6C8D /* AppleII */, 4B8944F3201967B4007DE474 /* Atari */, 4B7A90EA20410A85008514A2 /* Coleco */, 4B8944FB201967B4007DE474 /* Commodore */, @@ -3465,6 +3479,7 @@ 4B894531201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B894539201967B4007DE474 /* Tape.cpp in Sources */, 4B055AE51FAE9B6F0060FFFF /* IntermediateShader.cpp in Sources */, + 4B15A9FD208249BB005E6C8D /* StaticAnalyser.cpp in Sources */, 4B055AD31FAE9B0B0060FFFF /* Microdisc.cpp in Sources */, 4B055AB41FAE860F0060FFFF /* OricTAP.cpp in Sources */, 4B055AB71FAE860F0060FFFF /* TZX.cpp in Sources */, @@ -3721,6 +3736,7 @@ 4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */, 4B8805FB1DCFF807003085B1 /* Oric.cpp in Sources */, 4BFE7B871FC39BF100160B38 /* StandardOptions.cpp in Sources */, + 4B15A9FC208249BB005E6C8D /* StaticAnalyser.cpp in Sources */, 4B5FADC01DE3BF2B00AEC565 /* Microdisc.cpp in Sources */, 4B54C0C81F8D91E50050900F /* Keyboard.cpp in Sources */, 4B79A5011FC913C900EEDAD5 /* MSX.cpp in Sources */, diff --git a/Storage/TargetPlatforms.hpp b/Storage/TargetPlatforms.hpp index b0a2ef317..ebf9c6a33 100644 --- a/Storage/TargetPlatforms.hpp +++ b/Storage/TargetPlatforms.hpp @@ -14,18 +14,19 @@ namespace TargetPlatform { typedef int IntType; enum Type: IntType { AmstradCPC = 1 << 1, - Atari2600 = 1 << 2, - AcornAtom = 1 << 3, - AcornElectron = 1 << 4, - BBCMaster = 1 << 5, - BBCModelA = 1 << 6, - BBCModelB = 1 << 7, - ColecoVision = 1 << 8, - Commodore = 1 << 9, - MSX = 1 << 10, - Oric = 1 << 11, - ZX80 = 1 << 12, - ZX81 = 1 << 13, + AppleII = 1 << 2, + Atari2600 = 1 << 3, + AcornAtom = 1 << 4, + AcornElectron = 1 << 5, + BBCMaster = 1 << 6, + BBCModelA = 1 << 7, + BBCModelB = 1 << 8, + ColecoVision = 1 << 9, + Commodore = 1 << 10, + MSX = 1 << 11, + Oric = 1 << 12, + ZX80 = 1 << 13, + ZX81 = 1 << 14, Acorn = AcornAtom | AcornElectron | BBCMaster | BBCModelA | BBCModelB, ZX8081 = ZX80 | ZX81,