From d213341d9cf572ccc567bf8a0ab1a1921f7c38e7 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 22 Jan 2018 21:39:23 -0500 Subject: [PATCH 01/37] Introduces the counters upon which I expect dynamic analysis to rest. --- DynamicAnalyser/ConfidenceCounter.cpp | 28 ++++++++++++ DynamicAnalyser/ConfidenceCounter.hpp | 45 +++++++++++++++++++ DynamicAnalyser/ConfidenceSource.hpp | 26 +++++++++++ DynamicAnalyser/ConfidenceSummary.cpp | 28 ++++++++++++ DynamicAnalyser/ConfidenceSummary.hpp | 44 ++++++++++++++++++ .../Clock Signal.xcodeproj/project.pbxproj | 27 +++++++++++ 6 files changed, 198 insertions(+) create mode 100644 DynamicAnalyser/ConfidenceCounter.cpp create mode 100644 DynamicAnalyser/ConfidenceCounter.hpp create mode 100644 DynamicAnalyser/ConfidenceSource.hpp create mode 100644 DynamicAnalyser/ConfidenceSummary.cpp create mode 100644 DynamicAnalyser/ConfidenceSummary.hpp diff --git a/DynamicAnalyser/ConfidenceCounter.cpp b/DynamicAnalyser/ConfidenceCounter.cpp new file mode 100644 index 000000000..2a7ebfae9 --- /dev/null +++ b/DynamicAnalyser/ConfidenceCounter.cpp @@ -0,0 +1,28 @@ +// +// ConfidenceCounter.cpp +// Clock Signal +// +// Created by Thomas Harte on 21/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "ConfidenceCounter.hpp" + +using namespace DynamicAnalyser; + +float ConfidenceCounter::get_probability() { + return static_cast(hits_) / static_cast(hits_ + misses_); +} + +void ConfidenceCounter::add_hit() { + hits_++; +} + +void ConfidenceCounter::add_miss() { + misses_++; +} + +void ConfidenceCounter::add_equivocal() { + hits_++; + misses_++; +} diff --git a/DynamicAnalyser/ConfidenceCounter.hpp b/DynamicAnalyser/ConfidenceCounter.hpp new file mode 100644 index 000000000..68f8ef91e --- /dev/null +++ b/DynamicAnalyser/ConfidenceCounter.hpp @@ -0,0 +1,45 @@ +// +// ConfidenceCounter.hpp +// Clock Signal +// +// Created by Thomas Harte on 21/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef ConfidenceCounter_hpp +#define ConfidenceCounter_hpp + +#include "ConfidenceSource.hpp" + +namespace DynamicAnalyser { + +/*! + Provides a confidence source that calculates its probability by virtual of a history of events. + + The initial value of the confidence counter is 0.5. +*/ +class ConfidenceCounter: public ConfidenceSource { + public: + /*! @returns The computed probability, based on the history of events. */ + float get_probability() override; + + /*! Records an event that implies this is the appropriate class — pushes probability up towards 1.0. */ + void add_hit(); + + /*! Records an event that implies this is not the appropriate class — pushes probability down towards 0.0. */ + void add_miss(); + + /*! + Records an event that provides no strong evidence either way — one that + could be a hit but could be a miss — pushes probability up or down towards 0.5. + */ + void add_equivocal(); + + private: + int hits_ = 1; + int misses_ = 1; +}; + +} + +#endif /* ConfidenceCounter_hpp */ diff --git a/DynamicAnalyser/ConfidenceSource.hpp b/DynamicAnalyser/ConfidenceSource.hpp new file mode 100644 index 000000000..0f959f9d1 --- /dev/null +++ b/DynamicAnalyser/ConfidenceSource.hpp @@ -0,0 +1,26 @@ +// +// ConfidenceSource.hpp +// Clock Signal +// +// Created by Thomas Harte on 21/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef ConfidenceSource_hpp +#define ConfidenceSource_hpp + +namespace DynamicAnalyser { + +/*! + Provides an abstract interface through which objects can declare the probability + that they are the proper target for their input; e.g. if an Acorn Electron is asked + to run an Atari 2600 program then its confidence should shrink towards 0.0; if the + program is handed to an Atari 2600 then its confidence should grow towards 1.0. +*/ +struct ConfidenceSource { + virtual float get_probability() = 0; +}; + +} + +#endif /* ConfidenceSource_hpp */ diff --git a/DynamicAnalyser/ConfidenceSummary.cpp b/DynamicAnalyser/ConfidenceSummary.cpp new file mode 100644 index 000000000..f2888a4d8 --- /dev/null +++ b/DynamicAnalyser/ConfidenceSummary.cpp @@ -0,0 +1,28 @@ +// +// ConfidenceSummary.cpp +// Clock Signal +// +// Created by Thomas Harte on 21/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "ConfidenceSummary.hpp" + +#include +#include + +using namespace DynamicAnalyser; + +ConfidenceSummary::ConfidenceSummary(const std::vector &sources, const std::vector &weights) : + sources_(sources), weights_(weights) { + assert(weights.size() == sources.size()); + weight_sum_ = std::accumulate(weights.begin(), weights.end(), 0.0f); +} + +float ConfidenceSummary::get_probability() { + float result = 0.0f; + for(std::size_t index = 0; index < sources_.size(); ++index) { + result += sources_[index]->get_probability() * weights_[index]; + } + return result / weight_sum_; +} diff --git a/DynamicAnalyser/ConfidenceSummary.hpp b/DynamicAnalyser/ConfidenceSummary.hpp new file mode 100644 index 000000000..a3f8f2fb7 --- /dev/null +++ b/DynamicAnalyser/ConfidenceSummary.hpp @@ -0,0 +1,44 @@ +// +// ConfidenceSummary.hpp +// Clock Signal +// +// Created by Thomas Harte on 21/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef ConfidenceSummary_hpp +#define ConfidenceSummary_hpp + +#include "ConfidenceSource.hpp" + +#include + +namespace DynamicAnalyser { + +/*! + Summaries a collection of confidence sources by calculating their weighted sum. +*/ +class ConfidenceSummary: public ConfidenceSource { + public: + /*! + Instantiates a summary that will produce the weighted sum of + @c sources, each using the corresponding entry of @c weights. + + Requires that @c sources and @c weights are of the same length. + */ + ConfidenceSummary( + const std::vector &sources, + const std::vector &weights); + + /*! @returns The weighted sum of all sources. */ + float get_probability() override; + + private: + std::vector sources_; + std::vector weights_; + float weight_sum_; +}; + +} + +#endif /* ConfidenceSummary_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 7a0cc8a1a..42dd15821 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -215,6 +215,10 @@ 4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C41F8D91D90050900F /* Keyboard.cpp */; }; 4B54C0C81F8D91E50050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C61F8D91E50050900F /* Keyboard.cpp */; }; 4B54C0CB1F8D92590050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0CA1F8D92580050900F /* Keyboard.cpp */; }; + 4B5539FF201583AD00027510 /* ConfidenceCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */; }; + 4B553A00201583AD00027510 /* ConfidenceCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */; }; + 4B553A032015855900027510 /* ConfidenceSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B553A012015855900027510 /* ConfidenceSummary.cpp */; }; + 4B553A042015855900027510 /* ConfidenceSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B553A012015855900027510 /* ConfidenceSummary.cpp */; }; 4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */; }; 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */; }; 4B58601E1F806AB200AEE2E3 /* MFMSectorDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B58601C1F806AB200AEE2E3 /* MFMSectorDump.cpp */; }; @@ -822,6 +826,11 @@ 4B54C0C71F8D91E50050900F /* Keyboard.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Keyboard.hpp; path = Electron/Keyboard.hpp; sourceTree = ""; }; 4B54C0C91F8D92580050900F /* Keyboard.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Keyboard.hpp; path = ZX8081/Keyboard.hpp; sourceTree = ""; }; 4B54C0CA1F8D92580050900F /* Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Keyboard.cpp; path = ZX8081/Keyboard.cpp; sourceTree = ""; }; + 4B5539F62015820B00027510 /* ConfidenceSource.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceSource.hpp; sourceTree = ""; }; + 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ConfidenceCounter.cpp; sourceTree = ""; }; + 4B5539FE201583AD00027510 /* ConfidenceCounter.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceCounter.hpp; sourceTree = ""; }; + 4B553A012015855900027510 /* ConfidenceSummary.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ConfidenceSummary.cpp; sourceTree = ""; }; + 4B553A022015855900027510 /* ConfidenceSummary.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceSummary.hpp; sourceTree = ""; }; 4B55CE5B1C3B7D6F0093A61B /* CSOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSOpenGLView.h; sourceTree = ""; }; 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSOpenGLView.m; sourceTree = ""; }; 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MachineDocument.swift; sourceTree = ""; }; @@ -1855,6 +1864,19 @@ path = 1540; sourceTree = ""; }; + 4B5539F52015820B00027510 /* DynamicAnalyser */ = { + isa = PBXGroup; + children = ( + 4B5539F62015820B00027510 /* ConfidenceSource.hpp */, + 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */, + 4B5539FE201583AD00027510 /* ConfidenceCounter.hpp */, + 4B553A012015855900027510 /* ConfidenceSummary.cpp */, + 4B553A022015855900027510 /* ConfidenceSummary.hpp */, + ); + name = DynamicAnalyser; + path = ../../DynamicAnalyser; + sourceTree = ""; + }; 4B55CE551C3B7D360093A61B /* Documents */ = { isa = PBXGroup; children = ( @@ -2431,6 +2453,7 @@ 4BC9DF4A1D04691600F44158 /* Components */, 4B3940E81DA83C8700427841 /* Concurrency */, 4B31B88E1FBFBCD800C140D5 /* Configurable */, + 4B5539F52015820B00027510 /* DynamicAnalyser */, 4B055A761FAE78210060FFFF /* Frameworks */, 4B86E2581F8C628F006FAA45 /* Inputs */, 4BB73EDC1B587CA500552FC2 /* Machines */, @@ -3317,6 +3340,7 @@ 4B055AA51FAE85EF0060FFFF /* Encoder.cpp in Sources */, 4B055AEA1FAE9B990060FFFF /* 6502Storage.cpp in Sources */, 4B055A8A1FAE855B0060FFFF /* Tape.cpp in Sources */, + 4B553A042015855900027510 /* ConfidenceSummary.cpp in Sources */, 4B055AA71FAE85EF0060FFFF /* SegmentParser.cpp in Sources */, 4B055AC11FAE98DC0060FFFF /* MachineForTarget.cpp in Sources */, 4B055AD81FAE9B180060FFFF /* Video.cpp in Sources */, @@ -3391,6 +3415,7 @@ 4B055AAD1FAE85FD0060FFFF /* PCMTrack.cpp in Sources */, 4B055A841FAE85450060FFFF /* Disk.cpp in Sources */, 4B055A831FAE85410060FFFF /* Tape.cpp in Sources */, + 4B553A00201583AD00027510 /* ConfidenceCounter.cpp in Sources */, 4B055AC61FAE9AEE0060FFFF /* TIASound.cpp in Sources */, 4B055AA81FAE85EF0060FFFF /* Shifter.cpp in Sources */, 4B055AC81FAE9AFB0060FFFF /* C1540.cpp in Sources */, @@ -3531,6 +3556,7 @@ 4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */, 4BB697CB1D4B6D3E00248BDF /* TimedEventLoop.cpp in Sources */, 4B54C0C21F8D91CD0050900F /* Keyboard.cpp in Sources */, + 4B553A032015855900027510 /* ConfidenceSummary.cpp in Sources */, 4BBC951E1F368D83008F4C34 /* i8272.cpp in Sources */, 4BF1354C1D6D2C300054B2EA /* StaticAnalyser.cpp in Sources */, 4B4A76301DB1A3FA007AAE2E /* AY38910.cpp in Sources */, @@ -3565,6 +3591,7 @@ 4BFE7B871FC39BF100160B38 /* StandardOptions.cpp in Sources */, 4B5FADC01DE3BF2B00AEC565 /* Microdisc.cpp in Sources */, 4B54C0C81F8D91E50050900F /* Keyboard.cpp in Sources */, + 4B5539FF201583AD00027510 /* ConfidenceCounter.cpp in Sources */, 4B79A5011FC913C900EEDAD5 /* MSX.cpp in Sources */, 4BEE0A701D72496600532C7B /* PRG.cpp in Sources */, 4B8334861F5DA3780097E338 /* 6502Storage.cpp in Sources */, From 8fb4409ebb2b88ca52af23402c50a2e5188466e9 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 22 Jan 2018 21:50:56 -0500 Subject: [PATCH 02/37] Adds hasty attempt at dynamic analysis to the MSX ROM handlers. Logging for now, for further experimentation. --- Machines/MSX/Cartridges/ASCII16kb.hpp | 6 +++++- Machines/MSX/Cartridges/ASCII8kb.hpp | 8 +++++++- Machines/MSX/Cartridges/Konami.hpp | 7 ++++++- Machines/MSX/Cartridges/KonamiWithSCC.hpp | 17 +++++++++++++++-- Machines/MSX/MSX.cpp | 4 ++++ Machines/MSX/ROMSlotHandler.hpp | 14 +++++++++++--- 6 files changed, 48 insertions(+), 8 deletions(-) diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index 37aa6a70b..cc2175423 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -21,11 +21,15 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { void write(uint16_t address, uint8_t value) { switch(address >> 11) { - default: break; + default: + confidence_counter_.add_miss(); + break; case 0xc: + if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x4000, 0x4000); break; case 0xe: + if(address == 0x7000 || address == 0x77ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x8000, 0x4000); break; } diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index ab5c515e2..dfc76f4ab 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -21,17 +21,23 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { void write(uint16_t address, uint8_t value) { switch(address >> 11) { - default: break; + default: + confidence_counter_.add_miss(); + break; case 0xc: + if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x4000, 0x2000); break; case 0xd: + if(address == 0x6800) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x6000, 0x2000); break; case 0xe: + if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x8000, 0x2000); break; case 0xf: + if(address == 0x7800) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0xa000, 0x2000); break; } diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp index 296f00a97..1fff998ae 100644 --- a/Machines/MSX/Cartridges/Konami.hpp +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -21,14 +21,19 @@ class KonamiROMSlotHandler: public ROMSlotHandler { void write(uint16_t address, uint8_t value) { switch(address >> 13) { - default: break; + default: + confidence_counter_.add_miss(); + break; case 3: + if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x6000, 0x2000); break; case 4: + if(address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x8000, 0x2000); break; case 5: + if(address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0xa000, 0x2000); break; } diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp index d640b4d70..6133b5f12 100644 --- a/Machines/MSX/Cartridges/KonamiWithSCC.hpp +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -22,14 +22,19 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { void write(uint16_t address, uint8_t value) override { switch(address >> 11) { - default: break; + default: + confidence_counter_.add_miss(); + break; case 0x0a: + if(address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x4000, 0x2000); break; case 0x0e: + if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0x6000, 0x2000); break; case 0x12: + if(address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); if((value&0x3f) == 0x3f) { scc_is_visible_ = true; map_.unmap(slot_, 0x8000, 0x2000); @@ -39,9 +44,15 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { } break; case 0x13: - if(scc_is_visible_) scc_.write(address, value); + if(scc_is_visible_) { + confidence_counter_.add_hit(); + scc_.write(address, value); + } else { + confidence_counter_.add_miss(); + } break; case 0x16: + if(address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 8192, 0xa000, 0x2000); break; } @@ -49,8 +60,10 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { uint8_t read(uint16_t address) override { if(scc_is_visible_ && address >= 0x9800 && address < 0xa000) { + confidence_counter_.add_hit(); return scc_.read(address); } + confidence_counter_.add_miss(); return 0xff; } diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index ccdbb52f9..ed926a5f0 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -154,6 +154,10 @@ class ConcreteMachine: void run_for(const Cycles cycles) override { z80_.run_for(cycles); + + if(memory_slots_[1].handler) { + printf("%0.2f\n", memory_slots_[1].handler->get_confidence()); + } } void configure_as_target(const StaticAnalyser::Target &target) override { diff --git a/Machines/MSX/ROMSlotHandler.hpp b/Machines/MSX/ROMSlotHandler.hpp index 857d1a6aa..ba62db932 100644 --- a/Machines/MSX/ROMSlotHandler.hpp +++ b/Machines/MSX/ROMSlotHandler.hpp @@ -10,6 +10,7 @@ #define ROMSlotHandler_hpp #include "../../ClockReceiver/ClockReceiver.hpp" +#include "../../DynamicAnalyser/ConfidenceCounter.hpp" #include #include @@ -57,12 +58,19 @@ class ROMSlotHandler { /// Empty causes all out-of-bounds accesses to read a vacant bus. Empty }; - /*! - Returns the wrapping strategy to apply to mapping requests from this ROM slot. - */ + + /*! @returns The wrapping strategy to apply to mapping requests from this ROM slot. */ virtual WrappingStrategy wrapping_strategy() const { return WrappingStrategy::Repeat; } + + /*! @returns The probability that this handler is correct for the data it owns. */ + float get_confidence() { + return confidence_counter_.get_probability(); + } + + protected: + DynamicAnalyser::ConfidenceCounter confidence_counter_; }; } From 6a112edc188192490bdb3218eb4274f9ffa73c3a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 22 Jan 2018 22:13:16 -0500 Subject: [PATCH 03/37] Corrects 16kb ASCII mapper. Also increases hit position acceptance for the 8kb ASCII. --- Machines/MSX/Cartridges/ASCII16kb.hpp | 4 ++-- Machines/MSX/Cartridges/ASCII8kb.hpp | 16 ++++++++-------- Machines/MSX/Cartridges/Konami.hpp | 6 +++--- Machines/MSX/Cartridges/KonamiWithSCC.hpp | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index cc2175423..644a9f69e 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -26,11 +26,11 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { break; case 0xc: if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x4000, 0x4000); + map_.map(slot_, value * 0x4000, 0x4000, 0x4000); break; case 0xe: if(address == 0x7000 || address == 0x77ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x8000, 0x4000); + map_.map(slot_, value * 0x4000, 0x8000, 0x4000); break; } } diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index dfc76f4ab..8230ded1d 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -25,20 +25,20 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { confidence_counter_.add_miss(); break; case 0xc: - if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x4000, 0x2000); + if(address == 0x6000 || address == 0x60ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + map_.map(slot_, value * 0x2000, 0x4000, 0x2000); break; case 0xd: - if(address == 0x6800) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x6000, 0x2000); + if(address == 0x6800 || address == 0x68ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 0xe: - if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x8000, 0x2000); + if(address == 0x7000 || address == 0x70ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + map_.map(slot_, value * 0x2000, 0x8000, 0x2000); break; case 0xf: - if(address == 0x7800) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0xa000, 0x2000); + if(address == 0x7800 || address == 0x78ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } } diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp index 1fff998ae..a4d7fb594 100644 --- a/Machines/MSX/Cartridges/Konami.hpp +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -26,15 +26,15 @@ class KonamiROMSlotHandler: public ROMSlotHandler { break; case 3: if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x6000, 0x2000); + map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 4: if(address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x8000, 0x2000); + map_.map(slot_, value * 0x2000, 0x8000, 0x2000); break; case 5: if(address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0xa000, 0x2000); + map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } } diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp index 6133b5f12..7ecdfd2af 100644 --- a/Machines/MSX/Cartridges/KonamiWithSCC.hpp +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -27,11 +27,11 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { break; case 0x0a: if(address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x4000, 0x2000); + map_.map(slot_, value * 0x2000, 0x4000, 0x2000); break; case 0x0e: if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0x6000, 0x2000); + map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 0x12: if(address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); @@ -40,7 +40,7 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { map_.unmap(slot_, 0x8000, 0x2000); } else { scc_is_visible_ = false; - map_.map(slot_, value * 8192, 0x8000, 0x2000); + map_.map(slot_, value * 0x2000, 0x8000, 0x2000); } break; case 0x13: @@ -53,7 +53,7 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { break; case 0x16: if(address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); - map_.map(slot_, value * 8192, 0xa000, 0x2000); + map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } } From d360b2c62dd45cacc251cc16c9e783abd38f05c3 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 23 Jan 2018 22:18:16 -0500 Subject: [PATCH 04/37] Standardises the static analyser on std::vector and slightly widens passageway to a machine. The SDL target would now be fooled by a hypothetical multi-target, the Mac not yet. --- Machines/Utility/MachineForTarget.cpp | 7 ++++--- Machines/Utility/MachineForTarget.hpp | 7 ++++--- .../Mac/Clock Signal.xcodeproj/project.pbxproj | 6 ++++-- .../Machine/StaticAnalyser/CSStaticAnalyser.mm | 15 +++++++-------- OSBindings/SDL/main.cpp | 4 ++-- StaticAnalyser/Acorn/Disk.cpp | 6 ++---- StaticAnalyser/Acorn/Disk.hpp | 2 +- StaticAnalyser/Acorn/File.hpp | 3 +-- StaticAnalyser/Acorn/StaticAnalyser.cpp | 10 +++++----- StaticAnalyser/Acorn/StaticAnalyser.hpp | 2 +- StaticAnalyser/Acorn/Tape.cpp | 4 ++-- StaticAnalyser/Acorn/Tape.hpp | 2 +- StaticAnalyser/AmstradCPC/StaticAnalyser.cpp | 2 +- StaticAnalyser/AmstradCPC/StaticAnalyser.hpp | 2 +- StaticAnalyser/Atari/StaticAnalyser.cpp | 2 +- StaticAnalyser/Atari/StaticAnalyser.hpp | 2 +- StaticAnalyser/Commodore/Disk.cpp | 4 ++-- StaticAnalyser/Commodore/Disk.hpp | 4 ++-- StaticAnalyser/Commodore/StaticAnalyser.cpp | 18 +++++++++--------- StaticAnalyser/Commodore/StaticAnalyser.hpp | 2 +- StaticAnalyser/Commodore/Tape.cpp | 4 ++-- StaticAnalyser/Commodore/Tape.hpp | 2 +- StaticAnalyser/MSX/StaticAnalyser.cpp | 8 ++++---- StaticAnalyser/MSX/StaticAnalyser.hpp | 2 +- StaticAnalyser/Oric/StaticAnalyser.cpp | 4 ++-- StaticAnalyser/Oric/StaticAnalyser.hpp | 2 +- StaticAnalyser/Oric/Tape.cpp | 4 ++-- StaticAnalyser/Oric/Tape.hpp | 2 +- StaticAnalyser/StaticAnalyser.cpp | 4 ++-- StaticAnalyser/StaticAnalyser.hpp | 9 ++++----- StaticAnalyser/ZX8081/StaticAnalyser.cpp | 2 +- StaticAnalyser/ZX8081/StaticAnalyser.hpp | 2 +- 32 files changed, 74 insertions(+), 75 deletions(-) diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 730284163..ef96f1d15 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -18,15 +18,16 @@ #include "TypedDynamicMachine.hpp" -::Machine::DynamicMachine *::Machine::MachineForTarget(const StaticAnalyser::Target &target) { - switch(target.machine) { +::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector &targets) { + // TODO: deal with target lists containing more than one machine. + switch(targets.front().machine) { case StaticAnalyser::Target::AmstradCPC: return new TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); case StaticAnalyser::Target::Atari2600: return new TypedDynamicMachine(Atari2600::Machine::Atari2600()); case StaticAnalyser::Target::Electron: return new TypedDynamicMachine(Electron::Machine::Electron()); case StaticAnalyser::Target::MSX: return new TypedDynamicMachine(MSX::Machine::MSX()); case StaticAnalyser::Target::Oric: return new TypedDynamicMachine(Oric::Machine::Oric()); case StaticAnalyser::Target::Vic20: return new TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); - case StaticAnalyser::Target::ZX8081: return new TypedDynamicMachine(ZX8081::Machine::ZX8081(target)); + case StaticAnalyser::Target::ZX8081: return new TypedDynamicMachine(ZX8081::Machine::ZX8081(targets.front())); default: return nullptr; } diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index 01f2c326a..95f0ef035 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -20,6 +20,7 @@ #include #include +#include namespace Machine { @@ -38,10 +39,10 @@ struct DynamicMachine { /*! Allocates an instance of DynamicMachine holding a machine that can - receive the supplied target. The machine has been allocated on the heap. - It is the caller's responsibility to delete the class when finished. + receive the supplied static analyser result. The machine has been allocated + on the heap. It is the caller's responsibility to delete the class when finished. */ -DynamicMachine *MachineForTarget(const StaticAnalyser::Target &target); +DynamicMachine *MachineForTargets(const std::vector &target); /*! Returns a short string name for the machine identified by the target, diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 42dd15821..cc7a17244 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -166,6 +166,7 @@ 4B2C45421E3C3896002A2389 /* cartridge.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B2C45411E3C3896002A2389 /* cartridge.png */; }; 4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2E2D971C3A06EC00138695 /* Atari2600.cpp */; }; 4B2E2D9D1C3A070400138695 /* Electron.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2E2D9B1C3A070400138695 /* Electron.cpp */; }; + 4B2F67F12018312F00251FB5 /* Z80.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9C9D731FF81CC00030A129 /* Z80.cpp */; }; 4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B30512B1D989E2200B4FED8 /* Drive.cpp */; }; 4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B30512E1D98ACC600B4FED8 /* Plus3.cpp */; }; 4B322E011F5A2990004EB04C /* Z80AllRAM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B322DFD1F5A2981004EB04C /* Z80AllRAM.cpp */; }; @@ -2848,13 +2849,13 @@ 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */, 4BF1354B1D6D2C300054B2EA /* StaticAnalyser.hpp */, 4BD14B121D7462810088EAD6 /* Acorn */, + 4B38F3451F2EB41800D9235D /* AmstradCPC */, 4BA799961D8B65730045123D /* Atari */, 4BC830D21D6E7C6D0000A26F /* Commodore */, 4B5A12581DD55873007A2231 /* Disassembler */, + 4B0E04F01FC9E89100F43484 /* MSX */, 4BCF1FAC1DADD41F0039D2E7 /* Oric */, 4B14978C1EE4AC6200CE2596 /* ZX80/81 */, - 4B38F3451F2EB41800D9235D /* AmstradCPC */, - 4B0E04F01FC9E89100F43484 /* MSX */, ); name = StaticAnalyser; sourceTree = ""; @@ -3380,6 +3381,7 @@ 4B055A881FAE85530060FFFF /* 6502.cpp in Sources */, 4B055AED1FAE9BA20060FFFF /* Z80Storage.cpp in Sources */, 4B055AD11FAE9B030060FFFF /* Video.cpp in Sources */, + 4B2F67F12018312F00251FB5 /* Z80.cpp in Sources */, 4B055AA21FAE85DA0060FFFF /* SSD.cpp in Sources */, 4BEBFB4E2002C4BF000708CC /* MSXDSK.cpp in Sources */, 4B055ADD1FAE9B460060FFFF /* i8272.cpp in Sources */, diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index 8dcd7d18a..dd8661fcc 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -25,15 +25,14 @@ #import "Clock_Signal-Swift.h" @implementation CSStaticAnalyser { - StaticAnalyser::Target _target; + std::vector _targets; } - (instancetype)initWithFileAtURL:(NSURL *)url { self = [super init]; if(self) { - std::list targets = StaticAnalyser::GetTargets([url fileSystemRepresentation]); - if(!targets.size()) return nil; - _target = targets.front(); + _targets = StaticAnalyser::GetTargets([url fileSystemRepresentation]); + if(!_targets.size()) return nil; // TODO: can this better be supplied by the analyser? _displayName = [[url pathComponents] lastObject]; @@ -42,7 +41,7 @@ } - (NSString *)optionsPanelNibName { - switch(_target.machine) { + switch(_targets.front().machine) { case StaticAnalyser::Target::AmstradCPC: return nil; case StaticAnalyser::Target::Atari2600: return @"Atari2600Options"; case StaticAnalyser::Target::Electron: return @"QuickLoadCompositeOptions"; @@ -55,20 +54,20 @@ } - (CSMachine *)newMachine { - switch(_target.machine) { + switch(_targets.front().machine) { case StaticAnalyser::Target::AmstradCPC: return [[CSAmstradCPC alloc] init]; case StaticAnalyser::Target::Atari2600: return [[CSAtari2600 alloc] init]; case StaticAnalyser::Target::Electron: return [[CSElectron alloc] init]; case StaticAnalyser::Target::MSX: return [[CSMSX alloc] init]; case StaticAnalyser::Target::Oric: return [[CSOric alloc] init]; case StaticAnalyser::Target::Vic20: return [[CSVic20 alloc] init]; - case StaticAnalyser::Target::ZX8081: return [[CSZX8081 alloc] initWithIntendedTarget:_target]; + case StaticAnalyser::Target::ZX8081: return [[CSZX8081 alloc] initWithIntendedTarget:_targets.front()]; default: return nil; } } - (void)applyToMachine:(CSMachine *)machine { - [machine applyTarget:_target]; + [machine applyTarget:_targets.front()]; } @end diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index abcb46e77..d9faf5067 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) { } // Determine the machine for the supplied file. - std::list targets = StaticAnalyser::GetTargets(arguments.file_name.c_str()); + std::vector targets = StaticAnalyser::GetTargets(arguments.file_name.c_str()); if(targets.empty()) { std::cerr << "Cannot open " << arguments.file_name << std::endl; return -1; @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) { SpeakerDelegate speaker_delegate; // Create and configure a machine. - std::unique_ptr<::Machine::DynamicMachine> machine(::Machine::MachineForTarget(targets.front())); + std::unique_ptr<::Machine::DynamicMachine> machine(::Machine::MachineForTargets(targets)); updater.set_clock_rate(machine->crt_machine()->get_clock_rate()); crt_delegate.best_effort_updater = &updater; diff --git a/StaticAnalyser/Acorn/Disk.cpp b/StaticAnalyser/Acorn/Disk.cpp index 228e5e9bc..1249cca36 100644 --- a/StaticAnalyser/Acorn/Disk.cpp +++ b/StaticAnalyser/Acorn/Disk.cpp @@ -41,9 +41,7 @@ std::unique_ptr StaticAnalyser::Acorn::GetDFSCatalogue(const std::sha case 3: catalogue->bootOption = Catalogue::BootOption::ExecBOOT; break; } - // DFS files are stored contiguously, and listed in descending order of distance from track 0. - // So iterating backwards implies the least amount of seeking. - for(std::size_t file_offset = final_file_offset - 8; file_offset > 0; file_offset -= 8) { + for(std::size_t file_offset = 8; file_offset < final_file_offset; file_offset += 8) { File new_file; char name[10]; snprintf(name, 10, "%c.%.7s", names->samples[0][file_offset + 7] & 0x7f, &names->samples[0][file_offset]); @@ -69,7 +67,7 @@ std::unique_ptr StaticAnalyser::Acorn::GetDFSCatalogue(const std::sha new_file.data.insert(new_file.data.end(), next_sector->samples[0].begin(), next_sector->samples[0].begin() + length_from_sector); data_length -= length_from_sector; } - if(!data_length) catalogue->files.push_front(new_file); + if(!data_length) catalogue->files.push_back(new_file); } return catalogue; diff --git a/StaticAnalyser/Acorn/Disk.hpp b/StaticAnalyser/Acorn/Disk.hpp index 43e6810c0..2bf33bcb8 100644 --- a/StaticAnalyser/Acorn/Disk.hpp +++ b/StaticAnalyser/Acorn/Disk.hpp @@ -18,7 +18,7 @@ namespace Acorn { /// Describes a DFS- or ADFS-format catalogue(/directory) — the list of files available and the catalogue's boot option. struct Catalogue { std::string name; - std::list files; + std::vector files; enum class BootOption { None, LoadBOOT, diff --git a/StaticAnalyser/Acorn/File.hpp b/StaticAnalyser/Acorn/File.hpp index 375137eff..d2cfeb59b 100644 --- a/StaticAnalyser/Acorn/File.hpp +++ b/StaticAnalyser/Acorn/File.hpp @@ -9,7 +9,6 @@ #ifndef StaticAnalyser_Acorn_File_hpp #define StaticAnalyser_Acorn_File_hpp -#include #include #include #include @@ -38,7 +37,7 @@ struct File { std::vector data; }; - std::list chunks; + std::vector chunks; }; } diff --git a/StaticAnalyser/Acorn/StaticAnalyser.cpp b/StaticAnalyser/Acorn/StaticAnalyser.cpp index ddcc86be4..b7ab067ca 100644 --- a/StaticAnalyser/Acorn/StaticAnalyser.cpp +++ b/StaticAnalyser/Acorn/StaticAnalyser.cpp @@ -13,9 +13,9 @@ using namespace StaticAnalyser::Acorn; -static std::list> - AcornCartridgesFrom(const std::list> &cartridges) { - std::list> acorn_cartridges; +static std::vector> + AcornCartridgesFrom(const std::vector> &cartridges) { + std::vector> acorn_cartridges; for(const auto &cartridge : cartridges) { const auto &segments = cartridge->get_segments(); @@ -56,7 +56,7 @@ static std::list> return acorn_cartridges; } -void StaticAnalyser::Acorn::AddTargets(const Media &media, std::list &destination) { +void StaticAnalyser::Acorn::AddTargets(const Media &media, std::vector &destination) { Target target; target.machine = Target::Electron; target.probability = 1.0; // TODO: a proper estimation @@ -70,7 +70,7 @@ void StaticAnalyser::Acorn::AddTargets(const Media &media, std::list &de // if there are any tapes, attempt to get data from the first if(media.tapes.size() > 0) { std::shared_ptr tape = media.tapes.front(); - std::list files = GetFiles(tape); + std::vector files = GetFiles(tape); tape->reset(); // continue if there are any files diff --git a/StaticAnalyser/Acorn/StaticAnalyser.hpp b/StaticAnalyser/Acorn/StaticAnalyser.hpp index c7ebbbf52..c578321b3 100644 --- a/StaticAnalyser/Acorn/StaticAnalyser.hpp +++ b/StaticAnalyser/Acorn/StaticAnalyser.hpp @@ -14,7 +14,7 @@ namespace StaticAnalyser { namespace Acorn { -void AddTargets(const Media &media, std::list &destination); +void AddTargets(const Media &media, std::vector &destination); } } diff --git a/StaticAnalyser/Acorn/Tape.cpp b/StaticAnalyser/Acorn/Tape.cpp index 5ef66673b..60cb030d5 100644 --- a/StaticAnalyser/Acorn/Tape.cpp +++ b/StaticAnalyser/Acorn/Tape.cpp @@ -118,7 +118,7 @@ static std::unique_ptr GetNextFile(std::deque &chunks) { return file; } -std::list StaticAnalyser::Acorn::GetFiles(const std::shared_ptr &tape) { +std::vector StaticAnalyser::Acorn::GetFiles(const std::shared_ptr &tape) { Storage::Tape::Acorn::Parser parser; // populate chunk list @@ -131,7 +131,7 @@ std::list StaticAnalyser::Acorn::GetFiles(const std::shared_ptr file_list; + std::vector file_list; while(chunk_list.size()) { std::unique_ptr next_file = GetNextFile(chunk_list); diff --git a/StaticAnalyser/Acorn/Tape.hpp b/StaticAnalyser/Acorn/Tape.hpp index ac13b6ab3..3f16aad1d 100644 --- a/StaticAnalyser/Acorn/Tape.hpp +++ b/StaticAnalyser/Acorn/Tape.hpp @@ -17,7 +17,7 @@ namespace StaticAnalyser { namespace Acorn { -std::list GetFiles(const std::shared_ptr &tape); +std::vector GetFiles(const std::shared_ptr &tape); } } diff --git a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp b/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp index ea2f5c1fd..5fa6bc977 100644 --- a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp +++ b/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp @@ -177,7 +177,7 @@ static bool CheckBootSector(const std::shared_ptr &disk, St return false; } -void StaticAnalyser::AmstradCPC::AddTargets(const Media &media, std::list &destination) { +void StaticAnalyser::AmstradCPC::AddTargets(const Media &media, std::vector &destination) { Target target; target.machine = Target::AmstradCPC; target.probability = 1.0; diff --git a/StaticAnalyser/AmstradCPC/StaticAnalyser.hpp b/StaticAnalyser/AmstradCPC/StaticAnalyser.hpp index 03811a376..1f91e58bb 100644 --- a/StaticAnalyser/AmstradCPC/StaticAnalyser.hpp +++ b/StaticAnalyser/AmstradCPC/StaticAnalyser.hpp @@ -14,7 +14,7 @@ namespace StaticAnalyser { namespace AmstradCPC { -void AddTargets(const Media &media, std::list &destination); +void AddTargets(const Media &media, std::vector &destination); } } diff --git a/StaticAnalyser/Atari/StaticAnalyser.cpp b/StaticAnalyser/Atari/StaticAnalyser.cpp index 7490c7861..fb36d427f 100644 --- a/StaticAnalyser/Atari/StaticAnalyser.cpp +++ b/StaticAnalyser/Atari/StaticAnalyser.cpp @@ -178,7 +178,7 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St } } -void StaticAnalyser::Atari::AddTargets(const Media &media, std::list &destination) { +void StaticAnalyser::Atari::AddTargets(const Media &media, std::vector &destination) { // TODO: sanity checking; is this image really for an Atari 2600. Target target; target.machine = Target::Atari2600; diff --git a/StaticAnalyser/Atari/StaticAnalyser.hpp b/StaticAnalyser/Atari/StaticAnalyser.hpp index 6276583c0..866e4bead 100644 --- a/StaticAnalyser/Atari/StaticAnalyser.hpp +++ b/StaticAnalyser/Atari/StaticAnalyser.hpp @@ -14,7 +14,7 @@ namespace StaticAnalyser { namespace Atari { -void AddTargets(const Media &media, std::list &destination); +void AddTargets(const Media &media, std::vector &destination); } } diff --git a/StaticAnalyser/Commodore/Disk.cpp b/StaticAnalyser/Commodore/Disk.cpp index bef7e6e9e..1af2fedb2 100644 --- a/StaticAnalyser/Commodore/Disk.cpp +++ b/StaticAnalyser/Commodore/Disk.cpp @@ -165,8 +165,8 @@ class CommodoreGCRParser: public Storage::Disk::Controller { } }; -std::list StaticAnalyser::Commodore::GetFiles(const std::shared_ptr &disk) { - std::list files; +std::vector StaticAnalyser::Commodore::GetFiles(const std::shared_ptr &disk) { + std::vector files; CommodoreGCRParser parser; parser.drive->set_disk(disk); diff --git a/StaticAnalyser/Commodore/Disk.hpp b/StaticAnalyser/Commodore/Disk.hpp index 373d00124..ab1d8a0a2 100644 --- a/StaticAnalyser/Commodore/Disk.hpp +++ b/StaticAnalyser/Commodore/Disk.hpp @@ -11,12 +11,12 @@ #include "../../Storage/Disk/Disk.hpp" #include "File.hpp" -#include +#include namespace StaticAnalyser { namespace Commodore { -std::list GetFiles(const std::shared_ptr &disk); +std::vector GetFiles(const std::shared_ptr &disk); } } diff --git a/StaticAnalyser/Commodore/StaticAnalyser.cpp b/StaticAnalyser/Commodore/StaticAnalyser.cpp index 921b399b1..9f98b4c7c 100644 --- a/StaticAnalyser/Commodore/StaticAnalyser.cpp +++ b/StaticAnalyser/Commodore/StaticAnalyser.cpp @@ -17,9 +17,9 @@ using namespace StaticAnalyser::Commodore; -static std::list> - Vic20CartridgesFrom(const std::list> &cartridges) { - std::list> vic20_cartridges; +static std::vector> + Vic20CartridgesFrom(const std::vector> &cartridges) { + std::vector> vic20_cartridges; for(const auto &cartridge : cartridges) { const auto &segments = cartridge->get_segments(); @@ -38,13 +38,13 @@ static std::list> return vic20_cartridges; } -void StaticAnalyser::Commodore::AddTargets(const Media &media, std::list &destination) { +void StaticAnalyser::Commodore::AddTargets(const Media &media, std::vector &destination) { Target target; target.machine = Target::Vic20; // TODO: machine estimation target.probability = 1.0; // TODO: a proper estimation int device = 0; - std::list files; + std::vector files; bool is_disk = false; // strip out inappropriate cartridges @@ -52,10 +52,10 @@ void StaticAnalyser::Commodore::AddTargets(const Media &media, std::list // check disks for(auto &disk : media.disks) { - std::list disk_files = GetFiles(disk); + std::vector disk_files = GetFiles(disk); if(!disk_files.empty()) { is_disk = true; - files.splice(files.end(), disk_files); + files.insert(files.end(), disk_files.begin(), disk_files.end()); target.media.disks.push_back(disk); if(!device) device = 8; } @@ -63,10 +63,10 @@ void StaticAnalyser::Commodore::AddTargets(const Media &media, std::list // check tapes for(auto &tape : media.tapes) { - std::list tape_files = GetFiles(tape); + std::vector tape_files = GetFiles(tape); tape->reset(); if(!tape_files.empty()) { - files.splice(files.end(), tape_files); + files.insert(files.end(), tape_files.begin(), tape_files.end()); target.media.tapes.push_back(tape); if(!device) device = 1; } diff --git a/StaticAnalyser/Commodore/StaticAnalyser.hpp b/StaticAnalyser/Commodore/StaticAnalyser.hpp index df845c972..536560f7f 100644 --- a/StaticAnalyser/Commodore/StaticAnalyser.hpp +++ b/StaticAnalyser/Commodore/StaticAnalyser.hpp @@ -14,7 +14,7 @@ namespace StaticAnalyser { namespace Commodore { -void AddTargets(const Media &media, std::list &destination); +void AddTargets(const Media &media, std::vector &destination); } } diff --git a/StaticAnalyser/Commodore/Tape.cpp b/StaticAnalyser/Commodore/Tape.cpp index 9f667bf76..9e20774c1 100644 --- a/StaticAnalyser/Commodore/Tape.cpp +++ b/StaticAnalyser/Commodore/Tape.cpp @@ -12,9 +12,9 @@ using namespace StaticAnalyser::Commodore; -std::list StaticAnalyser::Commodore::GetFiles(const std::shared_ptr &tape) { +std::vector StaticAnalyser::Commodore::GetFiles(const std::shared_ptr &tape) { Storage::Tape::Commodore::Parser parser; - std::list file_list; + std::vector file_list; std::unique_ptr header = parser.get_next_header(tape); diff --git a/StaticAnalyser/Commodore/Tape.hpp b/StaticAnalyser/Commodore/Tape.hpp index 8318b0837..fef2130b0 100644 --- a/StaticAnalyser/Commodore/Tape.hpp +++ b/StaticAnalyser/Commodore/Tape.hpp @@ -16,7 +16,7 @@ namespace StaticAnalyser { namespace Commodore { -std::list GetFiles(const std::shared_ptr &tape); +std::vector GetFiles(const std::shared_ptr &tape); } } diff --git a/StaticAnalyser/MSX/StaticAnalyser.cpp b/StaticAnalyser/MSX/StaticAnalyser.cpp index 3de0bcfc4..7946a1c15 100644 --- a/StaticAnalyser/MSX/StaticAnalyser.cpp +++ b/StaticAnalyser/MSX/StaticAnalyser.cpp @@ -24,9 +24,9 @@ DEFW basic ; pointer to the start of a tokenized basicprogram, 0 if no basicprogram DEFS 6,0 ; room reserved for future extensions */ -static std::list> - MSXCartridgesFrom(const std::list> &cartridges, StaticAnalyser::Target &target) { - std::list> msx_cartridges; +static std::vector> + MSXCartridgesFrom(const std::vector> &cartridges, StaticAnalyser::Target &target) { + std::vector> msx_cartridges; for(const auto &cartridge : cartridges) { const auto &segments = cartridge->get_segments(); @@ -200,7 +200,7 @@ static std::list> return msx_cartridges; } -void StaticAnalyser::MSX::AddTargets(const Media &media, std::list &destination) { +void StaticAnalyser::MSX::AddTargets(const Media &media, std::vector &destination) { Target target; // Obtain only those cartridges which it looks like an MSX would understand. diff --git a/StaticAnalyser/MSX/StaticAnalyser.hpp b/StaticAnalyser/MSX/StaticAnalyser.hpp index 354fd2d7c..22bed2c79 100644 --- a/StaticAnalyser/MSX/StaticAnalyser.hpp +++ b/StaticAnalyser/MSX/StaticAnalyser.hpp @@ -14,7 +14,7 @@ namespace StaticAnalyser { namespace MSX { -void AddTargets(const Media &media, std::list &destination); +void AddTargets(const Media &media, std::vector &destination); } } diff --git a/StaticAnalyser/Oric/StaticAnalyser.cpp b/StaticAnalyser/Oric/StaticAnalyser.cpp index 09ec12734..1aea8e986 100644 --- a/StaticAnalyser/Oric/StaticAnalyser.cpp +++ b/StaticAnalyser/Oric/StaticAnalyser.cpp @@ -73,7 +73,7 @@ static int Basic11Score(const StaticAnalyser::MOS6502::Disassembly &disassembly) return Score(disassembly, rom_functions, variable_locations); } -void StaticAnalyser::Oric::AddTargets(const Media &media, std::list &destination) { +void StaticAnalyser::Oric::AddTargets(const Media &media, std::vector &destination) { Target target; target.machine = Target::Oric; target.probability = 1.0; @@ -82,7 +82,7 @@ void StaticAnalyser::Oric::AddTargets(const Media &media, std::list &des int basic11_votes = 0; for(auto &tape : media.tapes) { - std::list tape_files = GetFiles(tape); + std::vector tape_files = GetFiles(tape); tape->reset(); if(tape_files.size()) { for(auto file : tape_files) { diff --git a/StaticAnalyser/Oric/StaticAnalyser.hpp b/StaticAnalyser/Oric/StaticAnalyser.hpp index 3b660367f..53a1f6085 100644 --- a/StaticAnalyser/Oric/StaticAnalyser.hpp +++ b/StaticAnalyser/Oric/StaticAnalyser.hpp @@ -14,7 +14,7 @@ namespace StaticAnalyser { namespace Oric { -void AddTargets(const Media &media, std::list &destination); +void AddTargets(const Media &media, std::vector &destination); } } diff --git a/StaticAnalyser/Oric/Tape.cpp b/StaticAnalyser/Oric/Tape.cpp index 7a45d029f..7e1aeefd6 100644 --- a/StaticAnalyser/Oric/Tape.cpp +++ b/StaticAnalyser/Oric/Tape.cpp @@ -11,8 +11,8 @@ using namespace StaticAnalyser::Oric; -std::list StaticAnalyser::Oric::GetFiles(const std::shared_ptr &tape) { - std::list files; +std::vector StaticAnalyser::Oric::GetFiles(const std::shared_ptr &tape) { + std::vector files; Storage::Tape::Oric::Parser parser; while(!tape->is_at_end()) { diff --git a/StaticAnalyser/Oric/Tape.hpp b/StaticAnalyser/Oric/Tape.hpp index b8d0f39db..00073df6d 100644 --- a/StaticAnalyser/Oric/Tape.hpp +++ b/StaticAnalyser/Oric/Tape.hpp @@ -30,7 +30,7 @@ struct File { std::vector data; }; -std::list GetFiles(const std::shared_ptr &tape); +std::vector GetFiles(const std::shared_ptr &tape); } } diff --git a/StaticAnalyser/StaticAnalyser.cpp b/StaticAnalyser/StaticAnalyser.cpp index ce9214b9d..eb63f3b7b 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/StaticAnalyser/StaticAnalyser.cpp @@ -139,8 +139,8 @@ Media StaticAnalyser::GetMedia(const char *file_name) { return GetMediaAndPlatforms(file_name, throwaway); } -std::list StaticAnalyser::GetTargets(const char *file_name) { - std::list targets; +std::vector StaticAnalyser::GetTargets(const char *file_name) { + std::vector 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. diff --git a/StaticAnalyser/StaticAnalyser.hpp b/StaticAnalyser/StaticAnalyser.hpp index b4bcee655..3b44864ba 100644 --- a/StaticAnalyser/StaticAnalyser.hpp +++ b/StaticAnalyser/StaticAnalyser.hpp @@ -14,7 +14,6 @@ #include "../Storage/Cartridge/Cartridge.hpp" #include -#include #include namespace StaticAnalyser { @@ -65,9 +64,9 @@ enum class AmstradCPCModel { A list of disks, tapes and cartridges. */ struct Media { - std::list> disks; - std::list> tapes; - std::list> cartridges; + std::vector> disks; + std::vector> tapes; + std::vector> cartridges; bool empty() const { return disks.empty() && tapes.empty() && cartridges.empty(); @@ -137,7 +136,7 @@ struct Target { @returns The list of potential targets, sorted from most to least probable. */ -std::list GetTargets(const char *file_name); +std::vector GetTargets(const char *file_name); /*! Inspects the supplied file and determines the media included. diff --git a/StaticAnalyser/ZX8081/StaticAnalyser.cpp b/StaticAnalyser/ZX8081/StaticAnalyser.cpp index 02fe4c37f..464bc6041 100644 --- a/StaticAnalyser/ZX8081/StaticAnalyser.cpp +++ b/StaticAnalyser/ZX8081/StaticAnalyser.cpp @@ -27,7 +27,7 @@ static std::vector GetFiles(const std::shared_ptr &destination, TargetPlatform::IntType potential_platforms) { +void StaticAnalyser::ZX8081::AddTargets(const Media &media, std::vector &destination, TargetPlatform::IntType potential_platforms) { if(!media.tapes.empty()) { std::vector files = GetFiles(media.tapes.front()); media.tapes.front()->reset(); diff --git a/StaticAnalyser/ZX8081/StaticAnalyser.hpp b/StaticAnalyser/ZX8081/StaticAnalyser.hpp index 3212f4c53..4cc381c46 100644 --- a/StaticAnalyser/ZX8081/StaticAnalyser.hpp +++ b/StaticAnalyser/ZX8081/StaticAnalyser.hpp @@ -15,7 +15,7 @@ namespace StaticAnalyser { namespace ZX8081 { -void AddTargets(const Media &media, std::list &destination, TargetPlatform::IntType potential_platforms); +void AddTargets(const Media &media, std::vector &destination, TargetPlatform::IntType potential_platforms); } } From 622a04aec80a765a82b241c20db195b02c090b6e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 24 Jan 2018 20:14:15 -0500 Subject: [PATCH 05/37] Starts stripping the Mac port of its special machine knowledge. Partly to force myself into moving that stuff into the cross-platform area, but mainly so that dynamic analysis can work equally from day one. --- .../Clock Signal.xcodeproj/project.pbxproj | 28 +++---------------- .../ClockSignal-Bridging-Header.h | 2 -- .../Documents/MachineDocument.swift | 13 ++++----- .../Mac/Clock Signal/Machine/CSMachine.h | 9 +++--- .../Mac/Clock Signal/Machine/CSMachine.mm | 18 ++++++++++-- .../CSStaticAnalyser+TargetVector.h | 15 ++++++++++ .../Machine/StaticAnalyser/CSStaticAnalyser.h | 2 -- .../StaticAnalyser/CSStaticAnalyser.mm | 28 ++++--------------- .../Machine/Wrappers/CSAmstradCPC.h | 15 ---------- .../Machine/Wrappers/CSAmstradCPC.mm | 25 ----------------- .../Machine/Wrappers/CSAtari2600.mm | 2 +- .../Machine/Wrappers/CSElectron.h | 16 ----------- .../Machine/Wrappers/CSElectron.mm | 27 ------------------ .../Mac/Clock Signal/Machine/Wrappers/CSMSX.h | 16 ----------- .../Clock Signal/Machine/Wrappers/CSMSX.mm | 25 ----------------- .../Clock Signal/Machine/Wrappers/CSOric.h | 16 ----------- .../Clock Signal/Machine/Wrappers/CSOric.mm | 23 --------------- .../Clock Signal/Machine/Wrappers/CSVic20.mm | 2 +- .../Clock Signal/Machine/Wrappers/CSZX8081.mm | 2 +- 19 files changed, 54 insertions(+), 230 deletions(-) create mode 100644 OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.h delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.mm delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.h delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.h delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.mm delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.h delete mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index cc7a17244..8bc87dc20 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -148,7 +148,6 @@ 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 */; }; - 4B1BA08A1FD4967800CB4ADA /* CSMSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B1BA0891FD4967800CB4ADA /* CSMSX.mm */; }; 4B1D08061E0F7A1100763741 /* TimeTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B1D08051E0F7A1100763741 /* TimeTests.mm */; }; 4B1E85811D176468001EF87D /* 6532Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1E85801D176468001EF87D /* 6532Tests.swift */; }; 4B1EDB451E39A0AC009D6819 /* chip.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B1EDB431E39A0AC009D6819 /* chip.png */; }; @@ -156,7 +155,6 @@ 4B2A539F1D117D36003C6002 /* CSAudioQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A53911D117D36003C6002 /* CSAudioQueue.m */; }; 4B2A53A01D117D36003C6002 /* CSMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A53961D117D36003C6002 /* CSMachine.mm */; }; 4B2A53A11D117D36003C6002 /* CSAtari2600.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */; }; - 4B2A53A21D117D36003C6002 /* CSElectron.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539C1D117D36003C6002 /* CSElectron.mm */; }; 4B2A53A31D117D36003C6002 /* CSVic20.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539E1D117D36003C6002 /* CSVic20.mm */; }; 4B2AF8691E513FC20027EE29 /* TIATests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2AF8681E513FC20027EE29 /* TIATests.mm */; }; 4B2B3A4B1F9B8FA70062DABF /* Typer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2B3A471F9B8FA70062DABF /* Typer.cpp */; }; @@ -174,7 +172,6 @@ 4B37EE821D7345A6006A09A4 /* BinaryDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B37EE801D7345A6006A09A4 /* BinaryDump.cpp */; }; 4B38F3441F2EB3E900D9235D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B38F3421F2EB3E900D9235D /* StaticAnalyser.cpp */; }; 4B38F3481F2EC11D00D9235D /* AmstradCPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B38F3461F2EC11D00D9235D /* AmstradCPC.cpp */; }; - 4B38F34C1F2EC3CA00D9235D /* CSAmstradCPC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B38F34B1F2EC3CA00D9235D /* CSAmstradCPC.mm */; }; 4B38F34F1F2EC6BA00D9235D /* AmstradCPCOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B38F34D1F2EC6BA00D9235D /* AmstradCPCOptions.xib */; }; 4B3940E71DA83C8300427841 /* AsyncTaskQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3940E51DA83C8300427841 /* AsyncTaskQueue.cpp */; }; 4B3BA0C31D318AEC005DD7A7 /* C1540Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0C21D318AEB005DD7A7 /* C1540Tests.swift */; }; @@ -259,6 +256,7 @@ 4B8805F71DCFF6C9003085B1 /* Commodore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F51DCFF6C9003085B1 /* Commodore.cpp */; }; 4B8805FB1DCFF807003085B1 /* Oric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F91DCFF807003085B1 /* Oric.cpp */; }; 4B8805FE1DD02552003085B1 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805FC1DD02552003085B1 /* Tape.cpp */; }; + 4B89449520194CB3007DE474 /* MachineForTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B055ABE1FAE98000060FFFF /* MachineForTarget.cpp */; }; 4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */; }; 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; }; 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */; }; @@ -581,7 +579,6 @@ 4BC9E1EE1D23449A003FCEE4 /* 6502InterruptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC9E1ED1D23449A003FCEE4 /* 6502InterruptTests.swift */; }; 4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCA6CC61D9DD9F000C2D7B2 /* CommodoreROM.cpp */; }; 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */; }; - 4BCF1FA81DADC5250039D2E7 /* CSOric.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA71DADC5250039D2E7 /* CSOric.mm */; }; 4BCF1FAB1DADD41B0039D2E7 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA91DADD41B0039D2E7 /* StaticAnalyser.cpp */; }; 4BD14B111D74627C0088EAD6 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD14B0F1D74627C0088EAD6 /* StaticAnalyser.cpp */; }; 4BD3A30B1EE755C800B5B501 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD3A3091EE755C800B5B501 /* Video.cpp */; }; @@ -691,8 +688,6 @@ 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 = ""; }; 4B1667FB1FFF215F00A16032 /* KonamiWithSCC.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = KonamiWithSCC.hpp; path = MSX/Cartridges/KonamiWithSCC.hpp; sourceTree = ""; }; - 4B1BA0881FD4967700CB4ADA /* CSMSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMSX.h; sourceTree = ""; }; - 4B1BA0891FD4967800CB4ADA /* CSMSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSMSX.mm; sourceTree = ""; }; 4B1D08051E0F7A1100763741 /* TimeTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TimeTests.mm; sourceTree = ""; }; 4B1E857B1D174DEC001EF87D /* 6532.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6532.hpp; sourceTree = ""; }; 4B1E85801D176468001EF87D /* 6532Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6532Tests.swift; sourceTree = ""; }; @@ -707,8 +702,6 @@ 4B2A53971D117D36003C6002 /* KeyCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyCodes.h; sourceTree = ""; }; 4B2A53991D117D36003C6002 /* CSAtari2600.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSAtari2600.h; sourceTree = ""; }; 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSAtari2600.mm; sourceTree = ""; }; - 4B2A539B1D117D36003C6002 /* CSElectron.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSElectron.h; sourceTree = ""; }; - 4B2A539C1D117D36003C6002 /* CSElectron.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSElectron.mm; sourceTree = ""; }; 4B2A539D1D117D36003C6002 /* CSVic20.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSVic20.h; sourceTree = ""; }; 4B2A539E1D117D36003C6002 /* CSVic20.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSVic20.mm; sourceTree = ""; }; 4B2AF8681E513FC20027EE29 /* TIATests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TIATests.mm; sourceTree = ""; }; @@ -745,8 +738,6 @@ 4B38F3431F2EB3E900D9235D /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/AmstradCPC/StaticAnalyser.hpp; sourceTree = ""; }; 4B38F3461F2EC11D00D9235D /* AmstradCPC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AmstradCPC.cpp; path = AmstradCPC/AmstradCPC.cpp; sourceTree = ""; }; 4B38F3471F2EC11D00D9235D /* AmstradCPC.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = AmstradCPC.hpp; path = AmstradCPC/AmstradCPC.hpp; sourceTree = ""; }; - 4B38F34A1F2EC3CA00D9235D /* CSAmstradCPC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSAmstradCPC.h; sourceTree = ""; }; - 4B38F34B1F2EC3CA00D9235D /* CSAmstradCPC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSAmstradCPC.mm; sourceTree = ""; }; 4B38F34E1F2EC6BA00D9235D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/AmstradCPCOptions.xib"; sourceTree = SOURCE_ROOT; }; 4B3940E51DA83C8300427841 /* AsyncTaskQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AsyncTaskQueue.cpp; path = ../../Concurrency/AsyncTaskQueue.cpp; sourceTree = ""; }; 4B3940E61DA83C8300427841 /* AsyncTaskQueue.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = AsyncTaskQueue.hpp; path = ../../Concurrency/AsyncTaskQueue.hpp; sourceTree = ""; }; @@ -907,6 +898,7 @@ 4B8805FA1DCFF807003085B1 /* Oric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Oric.hpp; path = Parsers/Oric.hpp; sourceTree = ""; }; 4B8805FC1DD02552003085B1 /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/Oric/Tape.cpp; sourceTree = ""; }; 4B8805FD1DD02552003085B1 /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Oric/Tape.hpp; sourceTree = ""; }; + 4B89449220194A47007DE474 /* CSStaticAnalyser+TargetVector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "CSStaticAnalyser+TargetVector.h"; path = "StaticAnalyser/CSStaticAnalyser+TargetVector.h"; sourceTree = ""; }; 4B8D287E1F77207100645199 /* TrackSerialiser.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TrackSerialiser.hpp; sourceTree = ""; }; 4B8E4ECD1DCE483D003716C3 /* KeyboardMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = KeyboardMachine.hpp; sourceTree = ""; }; 4B8EF6071FE5AF830076CCDD /* LowpassSpeaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = LowpassSpeaker.hpp; sourceTree = ""; }; @@ -1274,8 +1266,6 @@ 4BCA98C21D065CA20062F44C /* 6522.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6522.hpp; sourceTree = ""; }; 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Oric.cpp; path = Oric/Oric.cpp; sourceTree = ""; }; 4BCF1FA31DADC3DD0039D2E7 /* Oric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Oric.hpp; path = Oric/Oric.hpp; sourceTree = ""; }; - 4BCF1FA61DADC5250039D2E7 /* CSOric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSOric.h; sourceTree = ""; }; - 4BCF1FA71DADC5250039D2E7 /* CSOric.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSOric.mm; sourceTree = ""; }; 4BCF1FA91DADD41B0039D2E7 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/Oric/StaticAnalyser.cpp; sourceTree = ""; }; 4BCF1FAA1DADD41B0039D2E7 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/Oric/StaticAnalyser.hpp; sourceTree = ""; }; 4BD060A51FE49D3C006E14BE /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Speaker.hpp; sourceTree = ""; }; @@ -1563,19 +1553,11 @@ 4B2A53981D117D36003C6002 /* Wrappers */ = { isa = PBXGroup; children = ( - 4B38F34A1F2EC3CA00D9235D /* CSAmstradCPC.h */, 4B2A53991D117D36003C6002 /* CSAtari2600.h */, - 4B2A539B1D117D36003C6002 /* CSElectron.h */, - 4B1BA0881FD4967700CB4ADA /* CSMSX.h */, - 4BCF1FA61DADC5250039D2E7 /* CSOric.h */, 4B2A539D1D117D36003C6002 /* CSVic20.h */, 4B14978D1EE4B4D200CE2596 /* CSZX8081.h */, 4BF4A2DA1F5365C600B171F4 /* CSZX8081+Instantiation.h */, - 4B38F34B1F2EC3CA00D9235D /* CSAmstradCPC.mm */, 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */, - 4B2A539C1D117D36003C6002 /* CSElectron.mm */, - 4B1BA0891FD4967800CB4ADA /* CSMSX.mm */, - 4BCF1FA71DADC5250039D2E7 /* CSOric.mm */, 4B2A539E1D117D36003C6002 /* CSVic20.mm */, 4B14978E1EE4B4D200CE2596 /* CSZX8081.mm */, ); @@ -1925,6 +1907,7 @@ children = ( 4B643F381D77AD1900D431D6 /* CSStaticAnalyser.h */, 4B643F391D77AD1900D431D6 /* CSStaticAnalyser.mm */, + 4B89449220194A47007DE474 /* CSStaticAnalyser+TargetVector.h */, ); name = StaticAnalyser; sourceTree = ""; @@ -3520,7 +3503,6 @@ 4B4518A21F75FD1C00926311 /* G64.cpp in Sources */, 4BF829661D8F732B001BAE39 /* Disk.cpp in Sources */, 4B448E811F1C45A00009ABD6 /* TZX.cpp in Sources */, - 4B1BA08A1FD4967800CB4ADA /* CSMSX.mm in Sources */, 4BEBFB512002DB30000708CC /* DiskROM.cpp in Sources */, 4BEA52631DF339D7007E74F2 /* SoundGenerator.cpp in Sources */, 4BC5E4921D7ED365008CF980 /* StaticAnalyser.cpp in Sources */, @@ -3541,7 +3523,6 @@ 4BD468F71D8DF41D0084958B /* 1770.cpp in Sources */, 4BD3A30B1EE755C800B5B501 /* Video.cpp in Sources */, 4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */, - 4BCF1FA81DADC5250039D2E7 /* CSOric.mm in Sources */, 4B5FADBA1DE3151600AEC565 /* FileHolder.cpp in Sources */, 4B643F3A1D77AD1900D431D6 /* CSStaticAnalyser.mm in Sources */, 4B1497881EE4A1DA00CE2596 /* ZX80O81P.cpp in Sources */, @@ -3560,12 +3541,12 @@ 4B54C0C21F8D91CD0050900F /* Keyboard.cpp in Sources */, 4B553A032015855900027510 /* ConfidenceSummary.cpp in Sources */, 4BBC951E1F368D83008F4C34 /* i8272.cpp in Sources */, + 4B89449520194CB3007DE474 /* MachineForTarget.cpp in Sources */, 4BF1354C1D6D2C300054B2EA /* StaticAnalyser.cpp in Sources */, 4B4A76301DB1A3FA007AAE2E /* AY38910.cpp in Sources */, 4B6A4C991F58F09E00E3F787 /* 6502Base.cpp in Sources */, 4B4518871F75E91A00926311 /* DigitalPhaseLockedLoop.cpp in Sources */, 4B2A53A31D117D36003C6002 /* CSVic20.mm in Sources */, - 4B2A53A21D117D36003C6002 /* CSElectron.mm in Sources */, 4B98A05E1FFAD3F600ADF63B /* CSROMFetcher.mm in Sources */, 4B8FE2201DA19D7C0090D3CE /* Atari2600OptionsPanel.swift in Sources */, 4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */, @@ -3573,7 +3554,6 @@ 4B8805FE1DD02552003085B1 /* Tape.cpp in Sources */, 4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */, 4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */, - 4B38F34C1F2EC3CA00D9235D /* CSAmstradCPC.mm in Sources */, 4B38F3441F2EB3E900D9235D /* StaticAnalyser.cpp in Sources */, 4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */, 4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */, diff --git a/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h b/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h index b05c01f4f..18f0f2e7d 100644 --- a/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h +++ b/OSBindings/Mac/Clock Signal/ClockSignal-Bridging-Header.h @@ -6,8 +6,6 @@ #import "CSFastLoading.h" #import "CSAtari2600.h" -#import "CSElectron.h" -#import "CSOric.h" #import "CSVic20.h" #import "CSZX8081.h" diff --git a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift index 1a367787e..1763eddec 100644 --- a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift @@ -114,16 +114,15 @@ class MachineDocument: // MARK: configuring func configureAs(_ analysis: CSStaticAnalyser) { - if let machine = analysis.newMachine() { + if let machine = CSMachine(analyser: analysis) { self.machine = machine } - analysis.apply(to: self.machine) - if let optionsPanelNibName = analysis.optionsPanelNibName { - Bundle.main.loadNibNamed(NSNib.Name(rawValue: optionsPanelNibName), owner: self, topLevelObjects: nil) - self.optionsPanel.machine = self.machine - showOptions(self) - } +// if let optionsPanelNibName = analysis.optionsPanelNibName { +// Bundle.main.loadNibNamed(NSNib.Name(rawValue: optionsPanelNibName), owner: self, topLevelObjects: nil) +// self.optionsPanel.machine = self.machine +// showOptions(self) +// } } override func read(from url: URL, ofType typeName: String) throws { diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.h b/OSBindings/Mac/Clock Signal/Machine/CSMachine.h index e95038a0a..0315a623a 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.h +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.h @@ -7,8 +7,10 @@ // #import -#import "CSOpenGLView.h" + #import "CSAudioQueue.h" +#import "CSOpenGLView.h" +#import "CSStaticAnalyser.h" @class CSMachine; @protocol CSMachineDelegate @@ -22,10 +24,9 @@ /*! Initialises an instance of CSMachine. - @param machine The pointer to an instance of @c Machine::DynamicMachine . C++ type is omitted because - this header is visible to Swift, and the designated initialiser cannot be placed into a category. + @param result The CSStaticAnalyser result that describes the machine needed. */ -- (instancetype)initWithMachine:(void *)machine NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithAnalyser:(CSStaticAnalyser *)result NS_DESIGNATED_INITIALIZER; - (void)runForNumberOfCycles:(int)numberOfCycles; diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm index ae790259c..61aa9d38d 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm @@ -20,6 +20,7 @@ #include "StandardOptions.hpp" #include "Typer.hpp" +#import "CSStaticAnalyser+TargetVector.h" #import "NSBundle+DataResource.h" #import "NSData+StdVector.h" @@ -61,13 +62,16 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg SpeakerDelegate _speakerDelegate; MachineDelegate _machineDelegate; NSLock *_delegateMachineAccessLock; - Machine::DynamicMachine *_machine; + + std::vector _targets; + std::unique_ptr _machine; } -- (instancetype)initWithMachine:(void *)machine { +- (instancetype)initWithAnalyser:(CSStaticAnalyser *)result { self = [super init]; if(self) { - _machine = (Machine::DynamicMachine *)machine; + _targets = result.targets; + _machine.reset(Machine::MachineForTargets(_targets)); _delegateMachineAccessLock = [[NSLock alloc] init]; _machineDelegate.machine = self; @@ -77,6 +81,8 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg _machine->crt_machine()->set_delegate(&_machineDelegate); CSApplyROMFetcher(*_machine->crt_machine()); + + [self applyTarget:_targets.front()]; } return self; } @@ -336,4 +342,10 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg } } +- (NSString *)userDefaultsPrefix { + // Assumes that the first machine in the targets list is the source of user defaults. + std::string name = Machine::ShortNameForTargetMachine(_targets.front().machine); + return [[NSString stringWithUTF8String:name.c_str()] lowercaseString]; +} + @end diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h new file mode 100644 index 000000000..c7bfa41c4 --- /dev/null +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h @@ -0,0 +1,15 @@ +// +// CSStaticAnalyser+ResultVector.h +// Clock Signal +// +// Created by Thomas Harte on 24/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#import "CSStaticAnalyser.h" + +@interface CSStaticAnalyser (ResultVector) + +- (std::vector &)targets; + +@end diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h index bf3499e84..ea7dde231 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h @@ -15,8 +15,6 @@ - (instancetype)initWithFileAtURL:(NSURL *)url; @property(nonatomic, readonly) NSString *optionsPanelNibName; -- (CSMachine *)newMachine; - @property(nonatomic, readonly) NSString *displayName; - (void)applyToMachine:(CSMachine *)machine; diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index dd8661fcc..41c8196ca 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -14,14 +14,6 @@ #include "StaticAnalyser.hpp" -#import "CSAmstradCPC.h" -#import "CSAtari2600.h" -#import "CSElectron.h" -#import "CSMSX.h" -#import "CSOric.h" -#import "CSVic20.h" -#import "CSZX8081+Instantiation.h" - #import "Clock_Signal-Swift.h" @implementation CSStaticAnalyser { @@ -34,7 +26,8 @@ _targets = StaticAnalyser::GetTargets([url fileSystemRepresentation]); if(!_targets.size()) return nil; - // TODO: can this better be supplied by the analyser? + // TODO: could this better be supplied by the analyser? A hypothetical file format might + // provide a better name for it contents than the file name? _displayName = [[url pathComponents] lastObject]; } return self; @@ -53,23 +46,14 @@ } } -- (CSMachine *)newMachine { - switch(_targets.front().machine) { - case StaticAnalyser::Target::AmstradCPC: return [[CSAmstradCPC alloc] init]; - case StaticAnalyser::Target::Atari2600: return [[CSAtari2600 alloc] init]; - case StaticAnalyser::Target::Electron: return [[CSElectron alloc] init]; - case StaticAnalyser::Target::MSX: return [[CSMSX alloc] init]; - case StaticAnalyser::Target::Oric: return [[CSOric alloc] init]; - case StaticAnalyser::Target::Vic20: return [[CSVic20 alloc] init]; - case StaticAnalyser::Target::ZX8081: return [[CSZX8081 alloc] initWithIntendedTarget:_targets.front()]; - default: return nil; - } -} - - (void)applyToMachine:(CSMachine *)machine { [machine applyTarget:_targets.front()]; } +- (std::vector &)targets { + return _targets; +} + @end @implementation CSMediaSet { diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.h deleted file mode 100644 index df34baaf4..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// CSAmstradCPC.h -// Clock Signal -// -// Created by Thomas Harte on 30/07/2017. -// Copyright © 2017 Thomas Harte. All rights reserved. -// - -#import "CSMachine.h" - -@interface CSAmstradCPC : CSMachine - -- (instancetype)init; - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.mm deleted file mode 100644 index 0eea3643a..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAmstradCPC.mm +++ /dev/null @@ -1,25 +0,0 @@ -// -// CSAmstradCPC.m -// Clock Signal -// -// Created by Thomas Harte on 30/07/2017. -// Copyright © 2017 Thomas Harte. All rights reserved. -// - -#import "CSAmstradCPC.h" - -#include "AmstradCPC.hpp" -#include "TypedDynamicMachine.hpp" - -@implementation CSAmstradCPC { - Machine::TypedDynamicMachine _amstradCPC; -} - -- (instancetype)init { - _amstradCPC = Machine::TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); - return [super initWithMachine:&_amstradCPC]; -} - -- (NSString *)userDefaultsPrefix { return @"amstradCPC"; } - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm index d25fcf8bf..07d16c923 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm @@ -18,7 +18,7 @@ - (instancetype)init { _atari2600 = Machine::TypedDynamicMachine(Atari2600::Machine::Atari2600()); - return [super initWithMachine:&_atari2600]; + return nil;//[super initWithMachine:&_atari2600]; } - (void)setResetLineEnabled:(BOOL)enabled { diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.h deleted file mode 100644 index faafa2d87..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// CSElectron.h -// Clock Signal -// -// Created by Thomas Harte on 04/01/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -#import "CSMachine.h" -#import "CSFastLoading.h" - -@interface CSElectron : CSMachine - -- (instancetype)init; - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm deleted file mode 100644 index d855ff949..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSElectron.mm +++ /dev/null @@ -1,27 +0,0 @@ -// -// CSElectron.m -// Clock Signal -// -// Created by Thomas Harte on 04/01/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -#import "CSElectron.h" - -#include "Electron.hpp" -#include "TypedDynamicMachine.hpp" - -@implementation CSElectron { - Machine::TypedDynamicMachine _electron; -} - -- (instancetype)init { - _electron = Machine::TypedDynamicMachine(Electron::Machine::Electron()); - return [super initWithMachine:&_electron]; -} - -#pragma mark - ROM setting - -- (NSString *)userDefaultsPrefix { return @"electron"; } - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.h deleted file mode 100644 index d173dba5b..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// CSMSX.h -// Clock Signal -// -// Created by Thomas Harte on 03/12/2017. -// Copyright © 2017 Thomas Harte. All rights reserved. -// - -#import "CSMachine.h" -#import "CSFastLoading.h" - -@interface CSMSX : CSMachine - -- (instancetype)init; - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.mm deleted file mode 100644 index aac38a6fb..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSMSX.mm +++ /dev/null @@ -1,25 +0,0 @@ -// -// CSMSX.m -// Clock Signal -// -// Created by Thomas Harte on 03/12/2017. -// Copyright © 2017 Thomas Harte. All rights reserved. -// - -#import "CSMSX.h" - -#include "MSX.hpp" -#include "TypedDynamicMachine.hpp" - -@implementation CSMSX { - Machine::TypedDynamicMachine _msx; -} - -- (instancetype)init { - _msx = Machine::TypedDynamicMachine(MSX::Machine::MSX()); - return [super initWithMachine:&_msx]; -} - -- (NSString *)userDefaultsPrefix { return @"MSX"; } - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.h deleted file mode 100644 index b29bde922..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// CSOric.h -// Clock Signal -// -// Created by Thomas Harte on 11/10/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -#import "CSMachine.h" -#import "CSFastLoading.h" - -@interface CSOric : CSMachine - -- (instancetype)init; - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm deleted file mode 100644 index 23fcebae8..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSOric.mm +++ /dev/null @@ -1,23 +0,0 @@ -// -// CSOric.m -// Clock Signal -// -// Created by Thomas Harte on 11/10/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -#import "CSOric.h" - -#include "Oric.hpp" -#include "TypedDynamicMachine.hpp" - -@implementation CSOric { - Machine::TypedDynamicMachine _oric; -} - -- (instancetype)init { - _oric = Machine::TypedDynamicMachine(Oric::Machine::Oric()); - return [super initWithMachine:&_oric]; -} - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm index 5a28d7277..58755b490 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSVic20.mm @@ -17,7 +17,7 @@ - (instancetype)init { _vic20 = Machine::TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); - return [super initWithMachine:&_vic20]; + return nil;//[super initWithMachine:&_vic20]; } - (NSString *)userDefaultsPrefix { return @"vic20"; } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm index 3e6c61067..b66f2c0de 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm @@ -17,7 +17,7 @@ - (instancetype)initWithIntendedTarget:(const StaticAnalyser::Target &)target { _zx8081 = Machine::TypedDynamicMachine(ZX8081::Machine::ZX8081(target)); - return [super initWithMachine:&_zx8081]; + return nil;//[super initWithMachine:&_zx8081]; } - (NSString *)userDefaultsPrefix { return @"zx8081"; } From 21efb32b6f97974dbbfc33ddb0153f8612c250ce Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 24 Jan 2018 21:48:44 -0500 Subject: [PATCH 06/37] Integrates the static and nascent dynamic analyser namespaces. --- .../Dynamic}/ConfidenceCounter.cpp | 0 .../Dynamic}/ConfidenceCounter.hpp | 0 .../Dynamic}/ConfidenceSource.hpp | 0 .../Dynamic}/ConfidenceSummary.cpp | 0 .../Dynamic}/ConfidenceSummary.hpp | 0 Analyser/Machines.hpp | 26 + .../Static}/Acorn/Disk.cpp | 14 +- .../Static}/Acorn/Disk.hpp | 6 +- .../Static}/Acorn/File.hpp | 4 +- .../Static}/Acorn/StaticAnalyser.cpp | 6 +- .../Static}/Acorn/StaticAnalyser.hpp | 4 +- .../Static}/Acorn/Tape.cpp | 9 +- .../Static}/Acorn/Tape.hpp | 6 +- .../Static}/AmstradCPC/StaticAnalyser.cpp | 12 +- .../Static}/AmstradCPC/StaticAnalyser.hpp | 4 +- .../Static}/Atari/StaticAnalyser.cpp | 62 +-- .../Static}/Atari/StaticAnalyser.hpp | 4 +- .../Static}/Commodore/Disk.cpp | 10 +- .../Static}/Commodore/Disk.hpp | 8 +- .../Static}/Commodore/File.cpp | 2 +- .../Static}/Commodore/File.hpp | 4 +- .../Static}/Commodore/StaticAnalyser.cpp | 10 +- .../Static}/Commodore/StaticAnalyser.hpp | 4 +- .../Static}/Commodore/Tape.cpp | 6 +- .../Static}/Commodore/Tape.hpp | 7 +- .../Static}/Disassembler/6502.cpp | 8 +- .../Static}/Disassembler/6502.hpp | 4 +- .../Static}/Disassembler/AddressMapper.cpp | 0 .../Static}/Disassembler/AddressMapper.hpp | 4 +- .../Static}/Disassembler/Kernel.hpp | 4 +- .../Static}/Disassembler/Z80.cpp | 8 +- .../Static}/Disassembler/Z80.hpp | 4 +- .../Static}/MSX/StaticAnalyser.cpp | 46 +- .../Static}/MSX/StaticAnalyser.hpp | 4 +- .../Static}/MSX/Tape.cpp | 6 +- .../Static}/MSX/Tape.hpp | 6 +- .../Static}/Oric/StaticAnalyser.cpp | 16 +- .../Static}/Oric/StaticAnalyser.hpp | 5 +- .../Static}/Oric/Tape.cpp | 6 +- .../Static}/Oric/Tape.hpp | 8 +- .../Static}/StaticAnalyser.cpp | 46 +- .../Static}/StaticAnalyser.hpp | 22 +- .../Static}/ZX8081/StaticAnalyser.cpp | 8 +- .../Static}/ZX8081/StaticAnalyser.hpp | 6 +- Machines/AmstradCPC/AmstradCPC.cpp | 10 +- Machines/Atari2600/Atari2600.cpp | 28 +- Machines/Commodore/Vic-20/Vic20.cpp | 10 +- Machines/ConfigurationTarget.hpp | 8 +- Machines/Electron/Electron.cpp | 4 +- Machines/MSX/MSX.cpp | 12 +- Machines/MSX/ROMSlotHandler.hpp | 2 +- Machines/Oric/Oric.cpp | 4 +- Machines/Utility/MachineForTarget.cpp | 58 +- Machines/Utility/MachineForTarget.hpp | 8 +- Machines/ZX8081/ZX8081.cpp | 12 +- Machines/ZX8081/ZX8081.hpp | 2 +- .../Clock Signal.xcodeproj/project.pbxproj | 502 +++++++++--------- .../Clock Signal/Machine/CSMachine+Target.h | 4 +- .../Mac/Clock Signal/Machine/CSMachine.mm | 6 +- .../CSStaticAnalyser+TargetVector.h | 2 +- .../StaticAnalyser/CSStaticAnalyser.mm | 24 +- .../Machine/Wrappers/CSZX8081+Instantiation.h | 2 +- .../Clock Signal/Machine/Wrappers/CSZX8081.mm | 2 +- .../AtariStaticAnalyserTests.mm | 10 +- .../MSXStaticAnalyserTests.mm | 10 +- OSBindings/SDL/main.cpp | 4 +- Storage/Tape/Parsers/Commodore.cpp | 4 +- Storage/Tape/Parsers/Commodore.hpp | 4 +- 68 files changed, 612 insertions(+), 539 deletions(-) rename {DynamicAnalyser => Analyser/Dynamic}/ConfidenceCounter.cpp (100%) rename {DynamicAnalyser => Analyser/Dynamic}/ConfidenceCounter.hpp (100%) rename {DynamicAnalyser => Analyser/Dynamic}/ConfidenceSource.hpp (100%) rename {DynamicAnalyser => Analyser/Dynamic}/ConfidenceSummary.cpp (100%) rename {DynamicAnalyser => Analyser/Dynamic}/ConfidenceSummary.hpp (100%) create mode 100644 Analyser/Machines.hpp rename {StaticAnalyser => Analyser/Static}/Acorn/Disk.cpp (90%) rename {StaticAnalyser => Analyser/Static}/Acorn/Disk.hpp (89%) rename {StaticAnalyser => Analyser/Static}/Acorn/File.hpp (94%) rename {StaticAnalyser => Analyser/Static}/Acorn/StaticAnalyser.cpp (95%) rename {StaticAnalyser => Analyser/Static}/Acorn/StaticAnalyser.hpp (90%) rename {StaticAnalyser => Analyser/Static}/Acorn/Tape.cpp (94%) rename {StaticAnalyser => Analyser/Static}/Acorn/Tape.hpp (81%) rename {StaticAnalyser => Analyser/Static}/AmstradCPC/StaticAnalyser.cpp (95%) rename {StaticAnalyser => Analyser/Static}/AmstradCPC/StaticAnalyser.hpp (91%) rename {StaticAnalyser => Analyser/Static}/Atari/StaticAnalyser.cpp (67%) rename {StaticAnalyser => Analyser/Static}/Atari/StaticAnalyser.hpp (90%) rename {StaticAnalyser => Analyser/Static}/Commodore/Disk.cpp (95%) rename {StaticAnalyser => Analyser/Static}/Commodore/Disk.hpp (82%) rename {StaticAnalyser => Analyser/Static}/Commodore/File.cpp (96%) rename {StaticAnalyser => Analyser/Static}/Commodore/File.hpp (93%) rename {StaticAnalyser => Analyser/Static}/Commodore/StaticAnalyser.cpp (94%) rename {StaticAnalyser => Analyser/Static}/Commodore/StaticAnalyser.hpp (91%) rename {StaticAnalyser => Analyser/Static}/Commodore/Tape.cpp (90%) rename {StaticAnalyser => Analyser/Static}/Commodore/Tape.hpp (81%) rename {StaticAnalyser => Analyser/Static}/Disassembler/6502.cpp (97%) rename {StaticAnalyser => Analyser/Static}/Disassembler/6502.hpp (98%) rename {StaticAnalyser => Analyser/Static}/Disassembler/AddressMapper.cpp (100%) rename {StaticAnalyser => Analyser/Static}/Disassembler/AddressMapper.hpp (93%) rename {StaticAnalyser => Analyser/Static}/Disassembler/Kernel.hpp (97%) rename {StaticAnalyser => Analyser/Static}/Disassembler/Z80.cpp (98%) rename {StaticAnalyser => Analyser/Static}/Disassembler/Z80.hpp (98%) rename {StaticAnalyser => Analyser/Static}/MSX/StaticAnalyser.cpp (77%) rename {StaticAnalyser => Analyser/Static}/MSX/StaticAnalyser.hpp (90%) rename {StaticAnalyser => Analyser/Static}/MSX/Tape.cpp (96%) rename {StaticAnalyser => Analyser/Static}/MSX/Tape.hpp (89%) rename {StaticAnalyser => Analyser/Static}/Oric/StaticAnalyser.cpp (89%) rename {StaticAnalyser => Analyser/Static}/Oric/StaticAnalyser.hpp (90%) rename {StaticAnalyser => Analyser/Static}/Oric/Tape.cpp (93%) rename {StaticAnalyser => Analyser/Static}/Oric/Tape.hpp (87%) rename {StaticAnalyser => Analyser/Static}/StaticAnalyser.cpp (83%) rename {StaticAnalyser => Analyser/Static}/StaticAnalyser.hpp (90%) rename {StaticAnalyser => Analyser/Static}/ZX8081/StaticAnalyser.cpp (86%) rename {StaticAnalyser => Analyser/Static}/ZX8081/StaticAnalyser.hpp (83%) diff --git a/DynamicAnalyser/ConfidenceCounter.cpp b/Analyser/Dynamic/ConfidenceCounter.cpp similarity index 100% rename from DynamicAnalyser/ConfidenceCounter.cpp rename to Analyser/Dynamic/ConfidenceCounter.cpp diff --git a/DynamicAnalyser/ConfidenceCounter.hpp b/Analyser/Dynamic/ConfidenceCounter.hpp similarity index 100% rename from DynamicAnalyser/ConfidenceCounter.hpp rename to Analyser/Dynamic/ConfidenceCounter.hpp diff --git a/DynamicAnalyser/ConfidenceSource.hpp b/Analyser/Dynamic/ConfidenceSource.hpp similarity index 100% rename from DynamicAnalyser/ConfidenceSource.hpp rename to Analyser/Dynamic/ConfidenceSource.hpp diff --git a/DynamicAnalyser/ConfidenceSummary.cpp b/Analyser/Dynamic/ConfidenceSummary.cpp similarity index 100% rename from DynamicAnalyser/ConfidenceSummary.cpp rename to Analyser/Dynamic/ConfidenceSummary.cpp diff --git a/DynamicAnalyser/ConfidenceSummary.hpp b/Analyser/Dynamic/ConfidenceSummary.hpp similarity index 100% rename from DynamicAnalyser/ConfidenceSummary.hpp rename to Analyser/Dynamic/ConfidenceSummary.hpp diff --git a/Analyser/Machines.hpp b/Analyser/Machines.hpp new file mode 100644 index 000000000..8ccbc5226 --- /dev/null +++ b/Analyser/Machines.hpp @@ -0,0 +1,26 @@ +// +// Machines.h +// Clock Signal +// +// Created by Thomas Harte on 24/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef Machines_h +#define Machines_h + +namespace Analyser { + +enum class Machine { + AmstradCPC, + Atari2600, + Electron, + MSX, + Oric, + Vic20, + ZX8081 +}; + +} + +#endif /* Machines_h */ diff --git a/StaticAnalyser/Acorn/Disk.cpp b/Analyser/Static/Acorn/Disk.cpp similarity index 90% rename from StaticAnalyser/Acorn/Disk.cpp rename to Analyser/Static/Acorn/Disk.cpp index 1249cca36..2dfd80bf5 100644 --- a/StaticAnalyser/Acorn/Disk.cpp +++ b/Analyser/Static/Acorn/Disk.cpp @@ -7,14 +7,16 @@ // #include "Disk.hpp" -#include "../../Storage/Disk/Controller/DiskController.hpp" -#include "../../Storage/Disk/Encodings/MFM/Parser.hpp" -#include "../../NumberTheory/CRC.hpp" + +#include "../../../Storage/Disk/Controller/DiskController.hpp" +#include "../../../Storage/Disk/Encodings/MFM/Parser.hpp" +#include "../../../NumberTheory/CRC.hpp" + #include -using namespace StaticAnalyser::Acorn; +using namespace Analyser::Static::Acorn; -std::unique_ptr StaticAnalyser::Acorn::GetDFSCatalogue(const std::shared_ptr &disk) { +std::unique_ptr Analyser::Static::Acorn::GetDFSCatalogue(const std::shared_ptr &disk) { // c.f. http://beebwiki.mdfs.net/Acorn_DFS_disc_format std::unique_ptr catalogue(new Catalogue); Storage::Encodings::MFM::Parser parser(false, disk); @@ -72,7 +74,7 @@ std::unique_ptr StaticAnalyser::Acorn::GetDFSCatalogue(const std::sha return catalogue; } -std::unique_ptr StaticAnalyser::Acorn::GetADFSCatalogue(const std::shared_ptr &disk) { +std::unique_ptr Analyser::Static::Acorn::GetADFSCatalogue(const std::shared_ptr &disk) { std::unique_ptr catalogue(new Catalogue); Storage::Encodings::MFM::Parser parser(true, disk); diff --git a/StaticAnalyser/Acorn/Disk.hpp b/Analyser/Static/Acorn/Disk.hpp similarity index 89% rename from StaticAnalyser/Acorn/Disk.hpp rename to Analyser/Static/Acorn/Disk.hpp index 2bf33bcb8..447dcbb8a 100644 --- a/StaticAnalyser/Acorn/Disk.hpp +++ b/Analyser/Static/Acorn/Disk.hpp @@ -10,9 +10,10 @@ #define StaticAnalyser_Acorn_Disk_hpp #include "File.hpp" -#include "../../Storage/Disk/Disk.hpp" +#include "../../../Storage/Disk/Disk.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Acorn { /// Describes a DFS- or ADFS-format catalogue(/directory) — the list of files available and the catalogue's boot option. @@ -30,6 +31,7 @@ struct Catalogue { std::unique_ptr GetDFSCatalogue(const std::shared_ptr &disk); std::unique_ptr GetADFSCatalogue(const std::shared_ptr &disk); +} } } diff --git a/StaticAnalyser/Acorn/File.hpp b/Analyser/Static/Acorn/File.hpp similarity index 94% rename from StaticAnalyser/Acorn/File.hpp rename to Analyser/Static/Acorn/File.hpp index d2cfeb59b..29a5d6ea6 100644 --- a/StaticAnalyser/Acorn/File.hpp +++ b/Analyser/Static/Acorn/File.hpp @@ -13,7 +13,8 @@ #include #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Acorn { struct File { @@ -40,6 +41,7 @@ struct File { std::vector chunks; }; +} } } diff --git a/StaticAnalyser/Acorn/StaticAnalyser.cpp b/Analyser/Static/Acorn/StaticAnalyser.cpp similarity index 95% rename from StaticAnalyser/Acorn/StaticAnalyser.cpp rename to Analyser/Static/Acorn/StaticAnalyser.cpp index b7ab067ca..10f653fd0 100644 --- a/StaticAnalyser/Acorn/StaticAnalyser.cpp +++ b/Analyser/Static/Acorn/StaticAnalyser.cpp @@ -11,7 +11,7 @@ #include "Disk.hpp" #include "Tape.hpp" -using namespace StaticAnalyser::Acorn; +using namespace Analyser::Static::Acorn; static std::vector> AcornCartridgesFrom(const std::vector> &cartridges) { @@ -56,9 +56,9 @@ static std::vector> return acorn_cartridges; } -void StaticAnalyser::Acorn::AddTargets(const Media &media, std::vector &destination) { +void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector &destination) { Target target; - target.machine = Target::Electron; + target.machine = Machine::Electron; target.probability = 1.0; // TODO: a proper estimation target.acorn.has_dfs = false; target.acorn.has_adfs = false; diff --git a/StaticAnalyser/Acorn/StaticAnalyser.hpp b/Analyser/Static/Acorn/StaticAnalyser.hpp similarity index 90% rename from StaticAnalyser/Acorn/StaticAnalyser.hpp rename to Analyser/Static/Acorn/StaticAnalyser.hpp index c578321b3..a5f18efb3 100644 --- a/StaticAnalyser/Acorn/StaticAnalyser.hpp +++ b/Analyser/Static/Acorn/StaticAnalyser.hpp @@ -11,11 +11,13 @@ #include "../StaticAnalyser.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Acorn { void AddTargets(const Media &media, std::vector &destination); +} } } diff --git a/StaticAnalyser/Acorn/Tape.cpp b/Analyser/Static/Acorn/Tape.cpp similarity index 94% rename from StaticAnalyser/Acorn/Tape.cpp rename to Analyser/Static/Acorn/Tape.cpp index 60cb030d5..7873e4a52 100644 --- a/StaticAnalyser/Acorn/Tape.cpp +++ b/Analyser/Static/Acorn/Tape.cpp @@ -9,10 +9,11 @@ #include "Tape.hpp" #include -#include "../../NumberTheory/CRC.hpp" -#include "../../Storage/Tape/Parsers/Acorn.hpp" -using namespace StaticAnalyser::Acorn; +#include "../../../NumberTheory/CRC.hpp" +#include "../../../Storage/Tape/Parsers/Acorn.hpp" + +using namespace Analyser::Static::Acorn; static std::unique_ptr GetNextChunk(const std::shared_ptr &tape, Storage::Tape::Acorn::Parser &parser) { std::unique_ptr new_chunk(new File::Chunk); @@ -118,7 +119,7 @@ static std::unique_ptr GetNextFile(std::deque &chunks) { return file; } -std::vector StaticAnalyser::Acorn::GetFiles(const std::shared_ptr &tape) { +std::vector Analyser::Static::Acorn::GetFiles(const std::shared_ptr &tape) { Storage::Tape::Acorn::Parser parser; // populate chunk list diff --git a/StaticAnalyser/Acorn/Tape.hpp b/Analyser/Static/Acorn/Tape.hpp similarity index 81% rename from StaticAnalyser/Acorn/Tape.hpp rename to Analyser/Static/Acorn/Tape.hpp index 3f16aad1d..863acc6ad 100644 --- a/StaticAnalyser/Acorn/Tape.hpp +++ b/Analyser/Static/Acorn/Tape.hpp @@ -12,13 +12,15 @@ #include #include "File.hpp" -#include "../../Storage/Tape/Tape.hpp" +#include "../../../Storage/Tape/Tape.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Acorn { std::vector GetFiles(const std::shared_ptr &tape); +} } } diff --git a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp similarity index 95% rename from StaticAnalyser/AmstradCPC/StaticAnalyser.cpp rename to Analyser/Static/AmstradCPC/StaticAnalyser.cpp index 5fa6bc977..8299da24b 100644 --- a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp +++ b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp @@ -11,8 +11,8 @@ #include #include -#include "../../Storage/Disk/Parsers/CPM.hpp" -#include "../../Storage/Disk/Encodings/MFM/Parser.hpp" +#include "../../../Storage/Disk/Parsers/CPM.hpp" +#include "../../../Storage/Disk/Encodings/MFM/Parser.hpp" static bool strcmp_insensitive(const char *a, const char *b) { if(std::strlen(a) != std::strlen(b)) return false; @@ -58,7 +58,7 @@ static std::string RunCommandFor(const Storage::Disk::CPM::File &file) { static void InspectCatalogue( const Storage::Disk::CPM::Catalogue &catalogue, - StaticAnalyser::Target &target) { + Analyser::Static::Target &target) { std::vector candidate_files; candidate_files.reserve(catalogue.files.size()); @@ -153,7 +153,7 @@ static void InspectCatalogue( target.loading_command = "cat\n"; } -static bool CheckBootSector(const std::shared_ptr &disk, StaticAnalyser::Target &target) { +static bool CheckBootSector(const std::shared_ptr &disk, Analyser::Static::Target &target) { Storage::Encodings::MFM::Parser parser(true, disk); Storage::Encodings::MFM::Sector *boot_sector = parser.get_sector(0, 0, 0x41); if(boot_sector != nullptr && !boot_sector->samples.empty()) { @@ -177,9 +177,9 @@ static bool CheckBootSector(const std::shared_ptr &disk, St return false; } -void StaticAnalyser::AmstradCPC::AddTargets(const Media &media, std::vector &destination) { +void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector &destination) { Target target; - target.machine = Target::AmstradCPC; + target.machine = Machine::AmstradCPC; target.probability = 1.0; target.media.disks = media.disks; target.media.tapes = media.tapes; diff --git a/StaticAnalyser/AmstradCPC/StaticAnalyser.hpp b/Analyser/Static/AmstradCPC/StaticAnalyser.hpp similarity index 91% rename from StaticAnalyser/AmstradCPC/StaticAnalyser.hpp rename to Analyser/Static/AmstradCPC/StaticAnalyser.hpp index 1f91e58bb..ac37b21b5 100644 --- a/StaticAnalyser/AmstradCPC/StaticAnalyser.hpp +++ b/Analyser/Static/AmstradCPC/StaticAnalyser.hpp @@ -11,11 +11,13 @@ #include "../StaticAnalyser.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace AmstradCPC { void AddTargets(const Media &media, std::vector &destination); +} } } diff --git a/StaticAnalyser/Atari/StaticAnalyser.cpp b/Analyser/Static/Atari/StaticAnalyser.cpp similarity index 67% rename from StaticAnalyser/Atari/StaticAnalyser.cpp rename to Analyser/Static/Atari/StaticAnalyser.cpp index fb36d427f..365aa6e8f 100644 --- a/StaticAnalyser/Atari/StaticAnalyser.cpp +++ b/Analyser/Static/Atari/StaticAnalyser.cpp @@ -10,9 +10,9 @@ #include "../Disassembler/6502.hpp" -using namespace StaticAnalyser::Atari; +using namespace Analyser::Static::Atari; -static void DeterminePagingFor2kCartridge(StaticAnalyser::Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { +static void DeterminePagingFor2kCartridge(Analyser::Static::Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { // if this is a 2kb cartridge then it's definitely either unpaged or a CommaVid uint16_t entry_address, break_address; @@ -26,17 +26,17 @@ static void DeterminePagingFor2kCartridge(StaticAnalyser::Target &target, const address &= 0x1fff; return static_cast(address - 0x1800); }; - StaticAnalyser::MOS6502::Disassembly high_location_disassembly = - StaticAnalyser::MOS6502::Disassemble(segment.data, high_location_mapper, {entry_address, break_address}); + Analyser::Static::MOS6502::Disassembly high_location_disassembly = + Analyser::Static::MOS6502::Disassemble(segment.data, high_location_mapper, {entry_address, break_address}); // assume that any kind of store that looks likely to be intended for large amounts of memory implies // large amounts of memory bool has_wide_area_store = false; - for(std::map::value_type &entry : high_location_disassembly.instructions_by_address) { - if(entry.second.operation == StaticAnalyser::MOS6502::Instruction::STA) { - has_wide_area_store |= entry.second.addressing_mode == StaticAnalyser::MOS6502::Instruction::Indirect; - has_wide_area_store |= entry.second.addressing_mode == StaticAnalyser::MOS6502::Instruction::IndexedIndirectX; - has_wide_area_store |= entry.second.addressing_mode == StaticAnalyser::MOS6502::Instruction::IndirectIndexedY; + for(std::map::value_type &entry : high_location_disassembly.instructions_by_address) { + if(entry.second.operation == Analyser::Static::MOS6502::Instruction::STA) { + has_wide_area_store |= entry.second.addressing_mode == Analyser::Static::MOS6502::Instruction::Indirect; + has_wide_area_store |= entry.second.addressing_mode == Analyser::Static::MOS6502::Instruction::IndexedIndirectX; + has_wide_area_store |= entry.second.addressing_mode == Analyser::Static::MOS6502::Instruction::IndirectIndexedY; if(has_wide_area_store) break; } @@ -46,10 +46,10 @@ static void DeterminePagingFor2kCartridge(StaticAnalyser::Target &target, const // caveat: false positives aren't likely to be problematic; a false positive is a 2KB ROM that always addresses // itself so as to land in ROM even if mapped as a CommaVid and this code is on the fence as to whether it // attempts to modify itself but it probably doesn't - if(has_wide_area_store) target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::CommaVid; + if(has_wide_area_store) target.atari.paging_model = Analyser::Static::Atari2600PagingModel::CommaVid; } -static void DeterminePagingFor8kCartridge(StaticAnalyser::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const StaticAnalyser::MOS6502::Disassembly &disassembly) { +static void DeterminePagingFor8kCartridge(Analyser::Static::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { // Activision stack titles have their vectors at the top of the low 4k, not the top, and // always list 0xf000 as both vectors; they do not repeat them, and, inexplicably, they all // issue an SEI as their first instruction (maybe some sort of relic of the development environment?) @@ -58,12 +58,12 @@ static void DeterminePagingFor8kCartridge(StaticAnalyser::Target &target, const (segment.data[8191] != 0xf0 || segment.data[8189] != 0xf0 || segment.data[8190] != 0x00 || segment.data[8188] != 0x00) && segment.data[0] == 0x78 ) { - target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::ActivisionStack; + target.atari.paging_model = Analyser::Static::Atari2600PagingModel::ActivisionStack; return; } // make an assumption that this is the Atari paging model - target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::Atari8k; + target.atari.paging_model = Analyser::Static::Atari2600PagingModel::Atari8k; std::set internal_accesses; internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end()); @@ -83,13 +83,13 @@ static void DeterminePagingFor8kCartridge(StaticAnalyser::Target &target, const tigervision_access_count += masked_address == 0x3f; } - if(parker_access_count > atari_access_count) target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::ParkerBros; - else if(tigervision_access_count > atari_access_count) target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::Tigervision; + if(parker_access_count > atari_access_count) target.atari.paging_model = Analyser::Static::Atari2600PagingModel::ParkerBros; + else if(tigervision_access_count > atari_access_count) target.atari.paging_model = Analyser::Static::Atari2600PagingModel::Tigervision; } -static void DeterminePagingFor16kCartridge(StaticAnalyser::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const StaticAnalyser::MOS6502::Disassembly &disassembly) { +static void DeterminePagingFor16kCartridge(Analyser::Static::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { // make an assumption that this is the Atari paging model - target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::Atari16k; + target.atari.paging_model = Analyser::Static::Atari2600PagingModel::Atari16k; std::set internal_accesses; internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end()); @@ -104,17 +104,17 @@ static void DeterminePagingFor16kCartridge(StaticAnalyser::Target &target, const mnetwork_access_count += masked_address >= 0x1fe0 && masked_address < 0x1ffb; } - if(mnetwork_access_count > atari_access_count) target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::MNetwork; + if(mnetwork_access_count > atari_access_count) target.atari.paging_model = Analyser::Static::Atari2600PagingModel::MNetwork; } -static void DeterminePagingFor64kCartridge(StaticAnalyser::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const StaticAnalyser::MOS6502::Disassembly &disassembly) { +static void DeterminePagingFor64kCartridge(Analyser::Static::Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { // make an assumption that this is a Tigervision if there is a write to 3F target.atari.paging_model = (disassembly.external_stores.find(0x3f) != disassembly.external_stores.end()) ? - StaticAnalyser::Atari2600PagingModel::Tigervision : StaticAnalyser::Atari2600PagingModel::MegaBoy; + Analyser::Static::Atari2600PagingModel::Tigervision : Analyser::Static::Atari2600PagingModel::MegaBoy; } -static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { +static void DeterminePagingForCartridge(Analyser::Static::Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { if(segment.data.size() == 2048) { DeterminePagingFor2kCartridge(target, segment); return; @@ -131,23 +131,23 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St }; std::vector final_4k(segment.data.end() - 4096, segment.data.end()); - StaticAnalyser::MOS6502::Disassembly disassembly = StaticAnalyser::MOS6502::Disassemble(final_4k, address_mapper, {entry_address, break_address}); + Analyser::Static::MOS6502::Disassembly disassembly = Analyser::Static::MOS6502::Disassemble(final_4k, address_mapper, {entry_address, break_address}); switch(segment.data.size()) { case 8192: DeterminePagingFor8kCartridge(target, segment, disassembly); break; case 10495: - target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::Pitfall2; + target.atari.paging_model = Analyser::Static::Atari2600PagingModel::Pitfall2; break; case 12288: - target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::CBSRamPlus; + target.atari.paging_model = Analyser::Static::Atari2600PagingModel::CBSRamPlus; break; case 16384: DeterminePagingFor16kCartridge(target, segment, disassembly); break; case 32768: - target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::Atari32k; + target.atari.paging_model = Analyser::Static::Atari2600PagingModel::Atari32k; break; case 65536: DeterminePagingFor64kCartridge(target, segment, disassembly); @@ -159,8 +159,8 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St // check for a Super Chip. Atari ROM images [almost] always have the same value stored over RAM // regions; when they don't they at least seem to have the first 128 bytes be the same as the // next 128 bytes. So check for that. - if( target.atari.paging_model != StaticAnalyser::Atari2600PagingModel::CBSRamPlus && - target.atari.paging_model != StaticAnalyser::Atari2600PagingModel::MNetwork) { + if( target.atari.paging_model != Analyser::Static::Atari2600PagingModel::CBSRamPlus && + target.atari.paging_model != Analyser::Static::Atari2600PagingModel::MNetwork) { bool has_superchip = true; for(std::size_t address = 0; address < 128; address++) { if(segment.data[address] != segment.data[address+128]) { @@ -172,16 +172,16 @@ static void DeterminePagingForCartridge(StaticAnalyser::Target &target, const St } // check for a Tigervision or Tigervision-esque scheme - if(target.atari.paging_model == StaticAnalyser::Atari2600PagingModel::None && segment.data.size() > 4096) { + if(target.atari.paging_model == Analyser::Static::Atari2600PagingModel::None && segment.data.size() > 4096) { bool looks_like_tigervision = disassembly.external_stores.find(0x3f) != disassembly.external_stores.end(); - if(looks_like_tigervision) target.atari.paging_model = StaticAnalyser::Atari2600PagingModel::Tigervision; + if(looks_like_tigervision) target.atari.paging_model = Analyser::Static::Atari2600PagingModel::Tigervision; } } -void StaticAnalyser::Atari::AddTargets(const Media &media, std::vector &destination) { +void Analyser::Static::Atari::AddTargets(const Media &media, std::vector &destination) { // TODO: sanity checking; is this image really for an Atari 2600. Target target; - target.machine = Target::Atari2600; + target.machine = Machine::Atari2600; target.probability = 1.0; target.media.cartridges = media.cartridges; target.atari.paging_model = Atari2600PagingModel::None; diff --git a/StaticAnalyser/Atari/StaticAnalyser.hpp b/Analyser/Static/Atari/StaticAnalyser.hpp similarity index 90% rename from StaticAnalyser/Atari/StaticAnalyser.hpp rename to Analyser/Static/Atari/StaticAnalyser.hpp index 866e4bead..45957b675 100644 --- a/StaticAnalyser/Atari/StaticAnalyser.hpp +++ b/Analyser/Static/Atari/StaticAnalyser.hpp @@ -11,11 +11,13 @@ #include "../StaticAnalyser.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Atari { void AddTargets(const Media &media, std::vector &destination); +} } } diff --git a/StaticAnalyser/Commodore/Disk.cpp b/Analyser/Static/Commodore/Disk.cpp similarity index 95% rename from StaticAnalyser/Commodore/Disk.cpp rename to Analyser/Static/Commodore/Disk.cpp index 1af2fedb2..d9ee799e6 100644 --- a/StaticAnalyser/Commodore/Disk.cpp +++ b/Analyser/Static/Commodore/Disk.cpp @@ -7,15 +7,15 @@ // #include "Disk.hpp" -#include "../../Storage/Disk/Controller/DiskController.hpp" -#include "../../Storage/Disk/Encodings/CommodoreGCR.hpp" -#include "../../Storage/Data/Commodore.hpp" +#include "../../../Storage/Disk/Controller/DiskController.hpp" +#include "../../../Storage/Disk/Encodings/CommodoreGCR.hpp" +#include "../../../Storage/Data/Commodore.hpp" #include #include #include -using namespace StaticAnalyser::Commodore; +using namespace Analyser::Static::Commodore; class CommodoreGCRParser: public Storage::Disk::Controller { public: @@ -165,7 +165,7 @@ class CommodoreGCRParser: public Storage::Disk::Controller { } }; -std::vector StaticAnalyser::Commodore::GetFiles(const std::shared_ptr &disk) { +std::vector Analyser::Static::Commodore::GetFiles(const std::shared_ptr &disk) { std::vector files; CommodoreGCRParser parser; parser.drive->set_disk(disk); diff --git a/StaticAnalyser/Commodore/Disk.hpp b/Analyser/Static/Commodore/Disk.hpp similarity index 82% rename from StaticAnalyser/Commodore/Disk.hpp rename to Analyser/Static/Commodore/Disk.hpp index ab1d8a0a2..52000d939 100644 --- a/StaticAnalyser/Commodore/Disk.hpp +++ b/Analyser/Static/Commodore/Disk.hpp @@ -9,17 +9,19 @@ #ifndef StaticAnalyser_Commodore_Disk_hpp #define StaticAnalyser_Commodore_Disk_hpp -#include "../../Storage/Disk/Disk.hpp" +#include "../../../Storage/Disk/Disk.hpp" #include "File.hpp" + #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Commodore { std::vector GetFiles(const std::shared_ptr &disk); } } - +} #endif /* Disk_hpp */ diff --git a/StaticAnalyser/Commodore/File.cpp b/Analyser/Static/Commodore/File.cpp similarity index 96% rename from StaticAnalyser/Commodore/File.cpp rename to Analyser/Static/Commodore/File.cpp index 1b923d458..1654336e9 100644 --- a/StaticAnalyser/Commodore/File.cpp +++ b/Analyser/Static/Commodore/File.cpp @@ -8,7 +8,7 @@ #include "File.hpp" -bool StaticAnalyser::Commodore::File::is_basic() { +bool Analyser::Static::Commodore::File::is_basic() { // BASIC files are always relocatable (?) if(type != File::RelocatableProgram) return false; diff --git a/StaticAnalyser/Commodore/File.hpp b/Analyser/Static/Commodore/File.hpp similarity index 93% rename from StaticAnalyser/Commodore/File.hpp rename to Analyser/Static/Commodore/File.hpp index a6bab1e0e..4b084f7fb 100644 --- a/StaticAnalyser/Commodore/File.hpp +++ b/Analyser/Static/Commodore/File.hpp @@ -12,7 +12,8 @@ #include #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Commodore { struct File { @@ -34,6 +35,7 @@ struct File { bool is_basic(); }; +} } } diff --git a/StaticAnalyser/Commodore/StaticAnalyser.cpp b/Analyser/Static/Commodore/StaticAnalyser.cpp similarity index 94% rename from StaticAnalyser/Commodore/StaticAnalyser.cpp rename to Analyser/Static/Commodore/StaticAnalyser.cpp index 9f98b4c7c..2bfa6971a 100644 --- a/StaticAnalyser/Commodore/StaticAnalyser.cpp +++ b/Analyser/Static/Commodore/StaticAnalyser.cpp @@ -8,14 +8,14 @@ #include "StaticAnalyser.hpp" +#include "Disk.hpp" #include "File.hpp" #include "Tape.hpp" -#include "Disk.hpp" -#include "../../Storage/Cartridge/Encodings/CommodoreROM.hpp" +#include "../../../Storage/Cartridge/Encodings/CommodoreROM.hpp" #include -using namespace StaticAnalyser::Commodore; +using namespace Analyser::Static::Commodore; static std::vector> Vic20CartridgesFrom(const std::vector> &cartridges) { @@ -38,9 +38,9 @@ static std::vector> return vic20_cartridges; } -void StaticAnalyser::Commodore::AddTargets(const Media &media, std::vector &destination) { +void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector &destination) { Target target; - target.machine = Target::Vic20; // TODO: machine estimation + target.machine = Machine::Vic20; // TODO: machine estimation target.probability = 1.0; // TODO: a proper estimation int device = 0; diff --git a/StaticAnalyser/Commodore/StaticAnalyser.hpp b/Analyser/Static/Commodore/StaticAnalyser.hpp similarity index 91% rename from StaticAnalyser/Commodore/StaticAnalyser.hpp rename to Analyser/Static/Commodore/StaticAnalyser.hpp index 536560f7f..4a5f3adde 100644 --- a/StaticAnalyser/Commodore/StaticAnalyser.hpp +++ b/Analyser/Static/Commodore/StaticAnalyser.hpp @@ -11,11 +11,13 @@ #include "../StaticAnalyser.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Commodore { void AddTargets(const Media &media, std::vector &destination); +} } } diff --git a/StaticAnalyser/Commodore/Tape.cpp b/Analyser/Static/Commodore/Tape.cpp similarity index 90% rename from StaticAnalyser/Commodore/Tape.cpp rename to Analyser/Static/Commodore/Tape.cpp index 9e20774c1..2609ba66a 100644 --- a/StaticAnalyser/Commodore/Tape.cpp +++ b/Analyser/Static/Commodore/Tape.cpp @@ -8,11 +8,11 @@ #include "Tape.hpp" -#include "../../Storage/Tape/Parsers/Commodore.hpp" +#include "../../../Storage/Tape/Parsers/Commodore.hpp" -using namespace StaticAnalyser::Commodore; +using namespace Analyser::Static::Commodore; -std::vector StaticAnalyser::Commodore::GetFiles(const std::shared_ptr &tape) { +std::vector Analyser::Static::Commodore::GetFiles(const std::shared_ptr &tape) { Storage::Tape::Commodore::Parser parser; std::vector file_list; diff --git a/StaticAnalyser/Commodore/Tape.hpp b/Analyser/Static/Commodore/Tape.hpp similarity index 81% rename from StaticAnalyser/Commodore/Tape.hpp rename to Analyser/Static/Commodore/Tape.hpp index fef2130b0..59c21a96e 100644 --- a/StaticAnalyser/Commodore/Tape.hpp +++ b/Analyser/Static/Commodore/Tape.hpp @@ -9,15 +9,16 @@ #ifndef StaticAnalyser_Commodore_Tape_hpp #define StaticAnalyser_Commodore_Tape_hpp -#include "../../Storage/Tape/Tape.hpp" +#include "../../../Storage/Tape/Tape.hpp" #include "File.hpp" -#include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Commodore { std::vector GetFiles(const std::shared_ptr &tape); +} } } diff --git a/StaticAnalyser/Disassembler/6502.cpp b/Analyser/Static/Disassembler/6502.cpp similarity index 97% rename from StaticAnalyser/Disassembler/6502.cpp rename to Analyser/Static/Disassembler/6502.cpp index 6ddfb67a5..20216a896 100644 --- a/StaticAnalyser/Disassembler/6502.cpp +++ b/Analyser/Static/Disassembler/6502.cpp @@ -10,10 +10,10 @@ #include "Kernel.hpp" -using namespace StaticAnalyser::MOS6502; +using namespace Analyser::Static::MOS6502; namespace { -using PartialDisassembly = StaticAnalyser::Disassembly::PartialDisassembly; +using PartialDisassembly = Analyser::Static::Disassembly::PartialDisassembly; struct MOS6502Disassembler { @@ -312,9 +312,9 @@ static void AddToDisassembly(PartialDisassembly &disassembly, const std::vector< } // end of anonymous namespace -Disassembly StaticAnalyser::MOS6502::Disassemble( +Disassembly Analyser::Static::MOS6502::Disassemble( const std::vector &memory, const std::function &address_mapper, std::vector entry_points) { - return StaticAnalyser::Disassembly::Disassemble(memory, address_mapper, entry_points); + return Analyser::Static::Disassembly::Disassemble(memory, address_mapper, entry_points); } diff --git a/StaticAnalyser/Disassembler/6502.hpp b/Analyser/Static/Disassembler/6502.hpp similarity index 98% rename from StaticAnalyser/Disassembler/6502.hpp rename to Analyser/Static/Disassembler/6502.hpp index a5b0b1fe4..d414c09c7 100644 --- a/StaticAnalyser/Disassembler/6502.hpp +++ b/Analyser/Static/Disassembler/6502.hpp @@ -16,7 +16,8 @@ #include #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace MOS6502 { /*! @@ -95,5 +96,6 @@ Disassembly Disassemble( } } +} #endif /* Disassembler6502_hpp */ diff --git a/StaticAnalyser/Disassembler/AddressMapper.cpp b/Analyser/Static/Disassembler/AddressMapper.cpp similarity index 100% rename from StaticAnalyser/Disassembler/AddressMapper.cpp rename to Analyser/Static/Disassembler/AddressMapper.cpp diff --git a/StaticAnalyser/Disassembler/AddressMapper.hpp b/Analyser/Static/Disassembler/AddressMapper.hpp similarity index 93% rename from StaticAnalyser/Disassembler/AddressMapper.hpp rename to Analyser/Static/Disassembler/AddressMapper.hpp index ffb3f8d14..95d4b4b9f 100644 --- a/StaticAnalyser/Disassembler/AddressMapper.hpp +++ b/Analyser/Static/Disassembler/AddressMapper.hpp @@ -11,7 +11,8 @@ #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Disassembler { /*! @@ -24,6 +25,7 @@ template std::function OffsetMapper(T start_address }; } +} } } diff --git a/StaticAnalyser/Disassembler/Kernel.hpp b/Analyser/Static/Disassembler/Kernel.hpp similarity index 97% rename from StaticAnalyser/Disassembler/Kernel.hpp rename to Analyser/Static/Disassembler/Kernel.hpp index 6c6d45e7a..9fcb89b9d 100644 --- a/StaticAnalyser/Disassembler/Kernel.hpp +++ b/Analyser/Static/Disassembler/Kernel.hpp @@ -9,7 +9,8 @@ #ifndef Kernel_hpp #define Kernel_hpp -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Disassembly { template struct PartialDisassembly { @@ -44,6 +45,7 @@ template D Disassemble( return partial_disassembly.disassembly; } +} } } diff --git a/StaticAnalyser/Disassembler/Z80.cpp b/Analyser/Static/Disassembler/Z80.cpp similarity index 98% rename from StaticAnalyser/Disassembler/Z80.cpp rename to Analyser/Static/Disassembler/Z80.cpp index 918a915d3..695372a14 100644 --- a/StaticAnalyser/Disassembler/Z80.cpp +++ b/Analyser/Static/Disassembler/Z80.cpp @@ -10,10 +10,10 @@ #include "Kernel.hpp" -using namespace StaticAnalyser::Z80; +using namespace Analyser::Static::Z80; namespace { -using PartialDisassembly = StaticAnalyser::Disassembly::PartialDisassembly; +using PartialDisassembly = Analyser::Static::Disassembly::PartialDisassembly; class Accessor { public: @@ -611,9 +611,9 @@ struct Z80Disassembler { } // end of anonymous namespace -Disassembly StaticAnalyser::Z80::Disassemble( +Disassembly Analyser::Static::Z80::Disassemble( const std::vector &memory, const std::function &address_mapper, std::vector entry_points) { - return StaticAnalyser::Disassembly::Disassemble(memory, address_mapper, entry_points); + return Analyser::Static::Disassembly::Disassemble(memory, address_mapper, entry_points); } diff --git a/StaticAnalyser/Disassembler/Z80.hpp b/Analyser/Static/Disassembler/Z80.hpp similarity index 98% rename from StaticAnalyser/Disassembler/Z80.hpp rename to Analyser/Static/Disassembler/Z80.hpp index 8d822f7da..26a05f54a 100644 --- a/StaticAnalyser/Disassembler/Z80.hpp +++ b/Analyser/Static/Disassembler/Z80.hpp @@ -15,7 +15,8 @@ #include #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Z80 { struct Instruction { @@ -84,5 +85,6 @@ Disassembly Disassemble( } } +} #endif /* StaticAnalyser_Disassembler_Z80_hpp */ diff --git a/StaticAnalyser/MSX/StaticAnalyser.cpp b/Analyser/Static/MSX/StaticAnalyser.cpp similarity index 77% rename from StaticAnalyser/MSX/StaticAnalyser.cpp rename to Analyser/Static/MSX/StaticAnalyser.cpp index 7946a1c15..9e7328cad 100644 --- a/StaticAnalyser/MSX/StaticAnalyser.cpp +++ b/Analyser/Static/MSX/StaticAnalyser.cpp @@ -25,7 +25,7 @@ DEFS 6,0 ; room reserved for future extensions */ static std::vector> - MSXCartridgesFrom(const std::vector> &cartridges, StaticAnalyser::Target &target) { + MSXCartridgesFrom(const std::vector> &cartridges, Analyser::Static::Target &target) { std::vector> msx_cartridges; for(const auto &cartridge : cartridges) { @@ -59,20 +59,20 @@ static std::vector> // If this ROM is greater than 48kb in size then some sort of MegaROM scheme must // be at play; disassemble to try to figure it out. - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::None; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::None; if(data_size > 0xc000) { std::vector first_16k; first_16k.insert(first_16k.begin(), segment.data.begin(), segment.data.begin() + 8192); - StaticAnalyser::Z80::Disassembly disassembly = - StaticAnalyser::Z80::Disassemble( + Analyser::Static::Z80::Disassembly disassembly = + Analyser::Static::Z80::Disassemble( first_16k, - StaticAnalyser::Disassembler::OffsetMapper(start_address), + Analyser::Static::Disassembler::OffsetMapper(start_address), { init_address } ); // Look for a indirect store followed by an unconditional JP or CALL into another // segment, that's a fairly explicit sign where found. - using Instruction = StaticAnalyser::Z80::Instruction; + using Instruction = Analyser::Static::Z80::Instruction; std::map &instructions = disassembly.instructions_by_address; bool is_ascii = false; auto iterator = instructions.begin(); @@ -104,17 +104,17 @@ static std::vector> switch(iterator->second.operand) { case 0x6000: if(address >= 0x6000 && address < 0x8000) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; } break; case 0x6800: if(address >= 0x6000 && address < 0x6800) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::ASCII8kb; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII8kb; } break; case 0x7000: if(address >= 0x6000 && address < 0x8000) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; } if(address >= 0x7000 && address < 0x7800) { is_ascii = true; @@ -122,32 +122,32 @@ static std::vector> break; case 0x77ff: if(address >= 0x7000 && address < 0x7800) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::ASCII16kb; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII16kb; } break; case 0x7800: if(address >= 0xa000 && address < 0xc000) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::ASCII8kb; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII8kb; } break; case 0x8000: if(address >= 0x8000 && address < 0xa000) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; } break; case 0x9000: if(address >= 0x8000 && address < 0xa000) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; } break; case 0xa000: if(address >= 0xa000 && address < 0xc000) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::Konami; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::Konami; } break; case 0xb000: if(address >= 0xa000 && address < 0xc000) { - target.msx.cartridge_type = StaticAnalyser::MSXCartridgeType::KonamiWithSCC; + target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; } break; } @@ -156,7 +156,7 @@ static std::vector> iterator = next_iterator; } - if(target.msx.cartridge_type == StaticAnalyser::MSXCartridgeType::None) { + if(target.msx.cartridge_type == Analyser::Static::MSXCartridgeType::None) { // Look for LD (nnnn), A instructions, and collate those addresses. std::map address_counts; for(const auto &instruction_pair : instructions) { @@ -168,14 +168,14 @@ static std::vector> } // Sort possible cartridge types. - using Possibility = std::pair; + using Possibility = std::pair; std::vector possibilities; // Add to list in order of declining probability, so that stable_sort below prefers // the more likely option in a tie. - possibilities.push_back(std::make_pair(StaticAnalyser::MSXCartridgeType::ASCII8kb, address_counts[0x6000] + address_counts[0x6800] + address_counts[0x7000] + address_counts[0x7800])); - possibilities.push_back(std::make_pair(StaticAnalyser::MSXCartridgeType::ASCII16kb, address_counts[0x6000] + address_counts[0x7000] + address_counts[0x77ff])); - if(!is_ascii) possibilities.push_back(std::make_pair(StaticAnalyser::MSXCartridgeType::Konami, address_counts[0x6000] + address_counts[0x8000] + address_counts[0xa000])); - if(!is_ascii) possibilities.push_back(std::make_pair(StaticAnalyser::MSXCartridgeType::KonamiWithSCC, address_counts[0x5000] + address_counts[0x7000] + address_counts[0x9000] + address_counts[0xb000])); + possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::ASCII8kb, address_counts[0x6000] + address_counts[0x6800] + address_counts[0x7000] + address_counts[0x7800])); + possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::ASCII16kb, address_counts[0x6000] + address_counts[0x7000] + address_counts[0x77ff])); + if(!is_ascii) possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::Konami, address_counts[0x6000] + address_counts[0x8000] + address_counts[0xa000])); + if(!is_ascii) possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::KonamiWithSCC, address_counts[0x5000] + address_counts[0x7000] + address_counts[0x9000] + address_counts[0xb000])); std::stable_sort(possibilities.begin(), possibilities.end(), [](const Possibility &a, const Possibility &b) { return a.second > b.second; }); @@ -200,7 +200,7 @@ static std::vector> return msx_cartridges; } -void StaticAnalyser::MSX::AddTargets(const Media &media, std::vector &destination) { +void Analyser::Static::MSX::AddTargets(const Media &media, std::vector &destination) { Target target; // Obtain only those cartridges which it looks like an MSX would understand. @@ -224,7 +224,7 @@ void StaticAnalyser::MSX::AddTargets(const Media &media, std::vector &de target.media.disks = media.disks; if(!target.media.empty()) { - target.machine = Target::MSX; + target.machine = Machine::MSX; target.probability = 1.0; destination.push_back(target); } diff --git a/StaticAnalyser/MSX/StaticAnalyser.hpp b/Analyser/Static/MSX/StaticAnalyser.hpp similarity index 90% rename from StaticAnalyser/MSX/StaticAnalyser.hpp rename to Analyser/Static/MSX/StaticAnalyser.hpp index 22bed2c79..9e03b783e 100644 --- a/StaticAnalyser/MSX/StaticAnalyser.hpp +++ b/Analyser/Static/MSX/StaticAnalyser.hpp @@ -11,11 +11,13 @@ #include "../StaticAnalyser.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace MSX { void AddTargets(const Media &media, std::vector &destination); +} } } diff --git a/StaticAnalyser/MSX/Tape.cpp b/Analyser/Static/MSX/Tape.cpp similarity index 96% rename from StaticAnalyser/MSX/Tape.cpp rename to Analyser/Static/MSX/Tape.cpp index fa49afe90..63d7696f2 100644 --- a/StaticAnalyser/MSX/Tape.cpp +++ b/Analyser/Static/MSX/Tape.cpp @@ -8,9 +8,9 @@ #include "Tape.hpp" -#include "../../Storage/Tape/Parsers/MSX.hpp" +#include "../../../Storage/Tape/Parsers/MSX.hpp" -using namespace StaticAnalyser::MSX; +using namespace Analyser::Static::MSX; File::File(File &&rhs) : name(std::move(rhs.name)), @@ -24,7 +24,7 @@ File::File() : starting_address(0), entry_address(0) {} // For the sake of initialising in a defined state. -std::vector StaticAnalyser::MSX::GetFiles(const std::shared_ptr &tape) { +std::vector Analyser::Static::MSX::GetFiles(const std::shared_ptr &tape) { std::vector files; Storage::Tape::BinaryTapePlayer tape_player(1000000); diff --git a/StaticAnalyser/MSX/Tape.hpp b/Analyser/Static/MSX/Tape.hpp similarity index 89% rename from StaticAnalyser/MSX/Tape.hpp rename to Analyser/Static/MSX/Tape.hpp index c7150852b..b0509b8b9 100644 --- a/StaticAnalyser/MSX/Tape.hpp +++ b/Analyser/Static/MSX/Tape.hpp @@ -9,12 +9,13 @@ #ifndef StaticAnalyser_MSX_Tape_hpp #define StaticAnalyser_MSX_Tape_hpp -#include "../../Storage/Tape/Tape.hpp" +#include "../../../Storage/Tape/Tape.hpp" #include #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace MSX { struct File { @@ -36,6 +37,7 @@ struct File { std::vector GetFiles(const std::shared_ptr &tape); +} } } diff --git a/StaticAnalyser/Oric/StaticAnalyser.cpp b/Analyser/Static/Oric/StaticAnalyser.cpp similarity index 89% rename from StaticAnalyser/Oric/StaticAnalyser.cpp rename to Analyser/Static/Oric/StaticAnalyser.cpp index 1aea8e986..53dfb2990 100644 --- a/StaticAnalyser/Oric/StaticAnalyser.cpp +++ b/Analyser/Static/Oric/StaticAnalyser.cpp @@ -12,9 +12,9 @@ #include "../Disassembler/6502.hpp" #include "../Disassembler/AddressMapper.hpp" -using namespace StaticAnalyser::Oric; +using namespace Analyser::Static::Oric; -static int Score(const StaticAnalyser::MOS6502::Disassembly &disassembly, const std::set &rom_functions, const std::set &variable_locations) { +static int Score(const Analyser::Static::MOS6502::Disassembly &disassembly, const std::set &rom_functions, const std::set &variable_locations) { int score = 0; for(auto address : disassembly.outward_calls) score += (rom_functions.find(address) != rom_functions.end()) ? 1 : -1; @@ -24,7 +24,7 @@ static int Score(const StaticAnalyser::MOS6502::Disassembly &disassembly, const return score; } -static int Basic10Score(const StaticAnalyser::MOS6502::Disassembly &disassembly) { +static int Basic10Score(const Analyser::Static::MOS6502::Disassembly &disassembly) { std::set rom_functions = { 0x0228, 0x022b, 0xc3ca, 0xc3f8, 0xc448, 0xc47c, 0xc4b5, 0xc4e3, 0xc4e0, 0xc524, 0xc56f, 0xc5a2, 0xc5f8, 0xc60a, 0xc6a5, 0xc6de, 0xc719, 0xc738, @@ -48,7 +48,7 @@ static int Basic10Score(const StaticAnalyser::MOS6502::Disassembly &disassembly) return Score(disassembly, rom_functions, variable_locations); } -static int Basic11Score(const StaticAnalyser::MOS6502::Disassembly &disassembly) { +static int Basic11Score(const Analyser::Static::MOS6502::Disassembly &disassembly) { std::set rom_functions = { 0x0238, 0x023b, 0x023e, 0x0241, 0x0244, 0x0247, 0xc3c6, 0xc3f4, 0xc444, 0xc47c, 0xc4a8, 0xc4d3, 0xc4e0, 0xc524, 0xc55f, 0xc592, 0xc5e8, 0xc5fa, 0xc692, 0xc6b3, 0xc6ee, 0xc70d, @@ -73,9 +73,9 @@ static int Basic11Score(const StaticAnalyser::MOS6502::Disassembly &disassembly) return Score(disassembly, rom_functions, variable_locations); } -void StaticAnalyser::Oric::AddTargets(const Media &media, std::vector &destination) { +void Analyser::Static::Oric::AddTargets(const Media &media, std::vector &destination) { Target target; - target.machine = Target::Oric; + target.machine = Machine::Oric; target.probability = 1.0; int basic10_votes = 0; @@ -88,8 +88,8 @@ void StaticAnalyser::Oric::AddTargets(const Media &media, std::vector &d for(auto file : tape_files) { if(file.data_type == File::MachineCode) { std::vector entry_points = {file.starting_address}; - StaticAnalyser::MOS6502::Disassembly disassembly = - StaticAnalyser::MOS6502::Disassemble(file.data, StaticAnalyser::Disassembler::OffsetMapper(file.starting_address), entry_points); + Analyser::Static::MOS6502::Disassembly disassembly = + Analyser::Static::MOS6502::Disassemble(file.data, Analyser::Static::Disassembler::OffsetMapper(file.starting_address), entry_points); int basic10_score = Basic10Score(disassembly); int basic11_score = Basic11Score(disassembly); diff --git a/StaticAnalyser/Oric/StaticAnalyser.hpp b/Analyser/Static/Oric/StaticAnalyser.hpp similarity index 90% rename from StaticAnalyser/Oric/StaticAnalyser.hpp rename to Analyser/Static/Oric/StaticAnalyser.hpp index 53a1f6085..decf9ebd1 100644 --- a/StaticAnalyser/Oric/StaticAnalyser.hpp +++ b/Analyser/Static/Oric/StaticAnalyser.hpp @@ -11,13 +11,14 @@ #include "../StaticAnalyser.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Oric { void AddTargets(const Media &media, std::vector &destination); } } - +} #endif /* StaticAnalyser_hpp */ diff --git a/StaticAnalyser/Oric/Tape.cpp b/Analyser/Static/Oric/Tape.cpp similarity index 93% rename from StaticAnalyser/Oric/Tape.cpp rename to Analyser/Static/Oric/Tape.cpp index 7e1aeefd6..7409abaa0 100644 --- a/StaticAnalyser/Oric/Tape.cpp +++ b/Analyser/Static/Oric/Tape.cpp @@ -7,11 +7,11 @@ // #include "Tape.hpp" -#include "../../Storage/Tape/Parsers/Oric.hpp" +#include "../../../Storage/Tape/Parsers/Oric.hpp" -using namespace StaticAnalyser::Oric; +using namespace Analyser::Static::Oric; -std::vector StaticAnalyser::Oric::GetFiles(const std::shared_ptr &tape) { +std::vector Analyser::Static::Oric::GetFiles(const std::shared_ptr &tape) { std::vector files; Storage::Tape::Oric::Parser parser; diff --git a/StaticAnalyser/Oric/Tape.hpp b/Analyser/Static/Oric/Tape.hpp similarity index 87% rename from StaticAnalyser/Oric/Tape.hpp rename to Analyser/Static/Oric/Tape.hpp index 00073df6d..e81a85a6b 100644 --- a/StaticAnalyser/Oric/Tape.hpp +++ b/Analyser/Static/Oric/Tape.hpp @@ -9,12 +9,13 @@ #ifndef StaticAnalyser_Oric_Tape_hpp #define StaticAnalyser_Oric_Tape_hpp -#include "../../Storage/Tape/Tape.hpp" -#include +#include "../../../Storage/Tape/Tape.hpp" + #include #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace Oric { struct File { @@ -32,6 +33,7 @@ struct File { std::vector GetFiles(const std::shared_ptr &tape); +} } } diff --git a/StaticAnalyser/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp similarity index 83% rename from StaticAnalyser/StaticAnalyser.cpp rename to Analyser/Static/StaticAnalyser.cpp index eb63f3b7b..9851a6d09 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -21,34 +21,34 @@ #include "ZX8081/StaticAnalyser.hpp" // Cartridges -#include "../Storage/Cartridge/Formats/BinaryDump.hpp" -#include "../Storage/Cartridge/Formats/PRG.hpp" +#include "../../Storage/Cartridge/Formats/BinaryDump.hpp" +#include "../../Storage/Cartridge/Formats/PRG.hpp" // Disks -#include "../Storage/Disk/DiskImage/Formats/AcornADF.hpp" -#include "../Storage/Disk/DiskImage/Formats/CPCDSK.hpp" -#include "../Storage/Disk/DiskImage/Formats/D64.hpp" -#include "../Storage/Disk/DiskImage/Formats/G64.hpp" -#include "../Storage/Disk/DiskImage/Formats/DMK.hpp" -#include "../Storage/Disk/DiskImage/Formats/HFE.hpp" -#include "../Storage/Disk/DiskImage/Formats/MSXDSK.hpp" -#include "../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp" -#include "../Storage/Disk/DiskImage/Formats/SSD.hpp" +#include "../../Storage/Disk/DiskImage/Formats/AcornADF.hpp" +#include "../../Storage/Disk/DiskImage/Formats/CPCDSK.hpp" +#include "../../Storage/Disk/DiskImage/Formats/D64.hpp" +#include "../../Storage/Disk/DiskImage/Formats/G64.hpp" +#include "../../Storage/Disk/DiskImage/Formats/DMK.hpp" +#include "../../Storage/Disk/DiskImage/Formats/HFE.hpp" +#include "../../Storage/Disk/DiskImage/Formats/MSXDSK.hpp" +#include "../../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp" +#include "../../Storage/Disk/DiskImage/Formats/SSD.hpp" // Tapes -#include "../Storage/Tape/Formats/CAS.hpp" -#include "../Storage/Tape/Formats/CommodoreTAP.hpp" -#include "../Storage/Tape/Formats/CSW.hpp" -#include "../Storage/Tape/Formats/OricTAP.hpp" -#include "../Storage/Tape/Formats/TapePRG.hpp" -#include "../Storage/Tape/Formats/TapeUEF.hpp" -#include "../Storage/Tape/Formats/TZX.hpp" -#include "../Storage/Tape/Formats/ZX80O81P.hpp" +#include "../../Storage/Tape/Formats/CAS.hpp" +#include "../../Storage/Tape/Formats/CommodoreTAP.hpp" +#include "../../Storage/Tape/Formats/CSW.hpp" +#include "../../Storage/Tape/Formats/OricTAP.hpp" +#include "../../Storage/Tape/Formats/TapePRG.hpp" +#include "../../Storage/Tape/Formats/TapeUEF.hpp" +#include "../../Storage/Tape/Formats/TZX.hpp" +#include "../../Storage/Tape/Formats/ZX80O81P.hpp" // Target Platform Types -#include "../Storage/TargetPlatforms.hpp" +#include "../../Storage/TargetPlatforms.hpp" -using namespace StaticAnalyser; +using namespace Analyser::Static; static Media GetMediaAndPlatforms(const char *file_name, TargetPlatform::IntType &potential_platforms) { // Get the extension, if any; it will be assumed that extensions are reliable, so an extension is a broad-phase @@ -134,12 +134,12 @@ static Media GetMediaAndPlatforms(const char *file_name, TargetPlatform::IntType return result; } -Media StaticAnalyser::GetMedia(const char *file_name) { +Media Analyser::Static::GetMedia(const char *file_name) { TargetPlatform::IntType throwaway; return GetMediaAndPlatforms(file_name, throwaway); } -std::vector StaticAnalyser::GetTargets(const char *file_name) { +std::vector Analyser::Static::GetTargets(const char *file_name) { std::vector targets; // Collect all disks, tapes and ROMs as can be extrapolated from this file, forming the diff --git a/StaticAnalyser/StaticAnalyser.hpp b/Analyser/Static/StaticAnalyser.hpp similarity index 90% rename from StaticAnalyser/StaticAnalyser.hpp rename to Analyser/Static/StaticAnalyser.hpp index 3b44864ba..b027245f0 100644 --- a/StaticAnalyser/StaticAnalyser.hpp +++ b/Analyser/Static/StaticAnalyser.hpp @@ -9,14 +9,17 @@ #ifndef StaticAnalyser_hpp #define StaticAnalyser_hpp -#include "../Storage/Tape/Tape.hpp" -#include "../Storage/Disk/Disk.hpp" -#include "../Storage/Cartridge/Cartridge.hpp" +#include "../Machines.hpp" + +#include "../../Storage/Tape/Tape.hpp" +#include "../../Storage/Disk/Disk.hpp" +#include "../../Storage/Cartridge/Cartridge.hpp" #include #include -namespace StaticAnalyser { +namespace Analyser { +namespace Static { enum class Vic20MemoryModel { Unexpanded, @@ -78,15 +81,7 @@ struct Media { and instructions on how to launch the software attached, plus a measure of confidence in this target's correctness. */ struct Target { - enum Machine { - AmstradCPC, - Atari2600, - Electron, - MSX, - Oric, - Vic20, - ZX8081 - } machine; + Machine machine; float probability; // TODO: this is too C-like a solution; make Target a base class and @@ -143,6 +138,7 @@ std::vector GetTargets(const char *file_name); */ Media GetMedia(const char *file_name); +} } #endif /* StaticAnalyser_hpp */ diff --git a/StaticAnalyser/ZX8081/StaticAnalyser.cpp b/Analyser/Static/ZX8081/StaticAnalyser.cpp similarity index 86% rename from StaticAnalyser/ZX8081/StaticAnalyser.cpp rename to Analyser/Static/ZX8081/StaticAnalyser.cpp index 464bc6041..8e1aefa4a 100644 --- a/StaticAnalyser/ZX8081/StaticAnalyser.cpp +++ b/Analyser/Static/ZX8081/StaticAnalyser.cpp @@ -11,7 +11,7 @@ #include #include -#include "../../Storage/Tape/Parsers/ZX8081.hpp" +#include "../../../Storage/Tape/Parsers/ZX8081.hpp" static std::vector GetFiles(const std::shared_ptr &tape) { std::vector files; @@ -27,13 +27,13 @@ static std::vector GetFiles(const std::shared_ptr &destination, TargetPlatform::IntType potential_platforms) { +void Analyser::Static::ZX8081::AddTargets(const Media &media, std::vector &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; + Analyser::Static::Target target; + target.machine = Machine::ZX8081; // Guess the machine type from the file only if it isn't already known. switch(potential_platforms & (TargetPlatform::ZX80 | TargetPlatform::ZX81)) { diff --git a/StaticAnalyser/ZX8081/StaticAnalyser.hpp b/Analyser/Static/ZX8081/StaticAnalyser.hpp similarity index 83% rename from StaticAnalyser/ZX8081/StaticAnalyser.hpp rename to Analyser/Static/ZX8081/StaticAnalyser.hpp index 4cc381c46..bf1f071ec 100644 --- a/StaticAnalyser/ZX8081/StaticAnalyser.hpp +++ b/Analyser/Static/ZX8081/StaticAnalyser.hpp @@ -10,13 +10,15 @@ #define StaticAnalyser_ZX8081_StaticAnalyser_hpp #include "../StaticAnalyser.hpp" -#include "../../Storage/TargetPlatforms.hpp" +#include "../../../Storage/TargetPlatforms.hpp" -namespace StaticAnalyser { +namespace Analyser { +namespace Static { namespace ZX8081 { void AddTargets(const Media &media, std::vector &destination, TargetPlatform::IntType potential_platforms); +} } } diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 3faa8397c..880b6a335 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -867,19 +867,19 @@ class ConcreteMachine: } /// The ConfigurationTarget entry point; should configure this meachine as described by @c target. - void configure_as_target(const StaticAnalyser::Target &target) override final { + void configure_as_target(const Analyser::Static::Target &target) override final { switch(target.amstradcpc.model) { - case StaticAnalyser::AmstradCPCModel::CPC464: + case Analyser::Static::AmstradCPCModel::CPC464: rom_model_ = ROMType::OS464; has_128k_ = false; has_fdc_ = false; break; - case StaticAnalyser::AmstradCPCModel::CPC664: + case Analyser::Static::AmstradCPCModel::CPC664: rom_model_ = ROMType::OS664; has_128k_ = false; has_fdc_ = true; break; - case StaticAnalyser::AmstradCPCModel::CPC6128: + case Analyser::Static::AmstradCPCModel::CPC6128: rom_model_ = ROMType::OS6128; has_128k_ = true; has_fdc_ = true; @@ -908,7 +908,7 @@ class ConcreteMachine: insert_media(target.media); } - bool insert_media(const StaticAnalyser::Media &media) override final { + bool insert_media(const Analyser::Static::Media &media) override final { // If there are any tapes supplied, use the first of them. if(!media.tapes.empty()) { tape_player_.set_tape(media.tapes.front()); diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index edfef0680..109b1e7a1 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -72,34 +72,34 @@ class ConcreteMachine: close_output(); } - void configure_as_target(const StaticAnalyser::Target &target) override { + void configure_as_target(const Analyser::Static::Target &target) override { const std::vector &rom = target.media.cartridges.front()->get_segments().front().data; switch(target.atari.paging_model) { - case StaticAnalyser::Atari2600PagingModel::ActivisionStack: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::CBSRamPlus: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::CommaVid: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::MegaBoy: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::MNetwork: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::None: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::ParkerBros: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::Pitfall2: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::Tigervision: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::ActivisionStack: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::CBSRamPlus: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::CommaVid: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::MegaBoy: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::MNetwork: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::None: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::ParkerBros: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::Pitfall2: bus_.reset(new Cartridge::Cartridge(rom)); break; + case Analyser::Static::Atari2600PagingModel::Tigervision: bus_.reset(new Cartridge::Cartridge(rom)); break; - case StaticAnalyser::Atari2600PagingModel::Atari8k: + case Analyser::Static::Atari2600PagingModel::Atari8k: if(target.atari.uses_superchip) { bus_.reset(new Cartridge::Cartridge(rom)); } else { bus_.reset(new Cartridge::Cartridge(rom)); } break; - case StaticAnalyser::Atari2600PagingModel::Atari16k: + case Analyser::Static::Atari2600PagingModel::Atari16k: if(target.atari.uses_superchip) { bus_.reset(new Cartridge::Cartridge(rom)); } else { bus_.reset(new Cartridge::Cartridge(rom)); } break; - case StaticAnalyser::Atari2600PagingModel::Atari32k: + case Analyser::Static::Atari2600PagingModel::Atari32k: if(target.atari.uses_superchip) { bus_.reset(new Cartridge::Cartridge(rom)); } else { @@ -112,7 +112,7 @@ class ConcreteMachine: joysticks_.emplace_back(new Joystick(bus_.get(), 4, 1)); } - bool insert_media(const StaticAnalyser::Media &media) override { + bool insert_media(const Analyser::Static::Media &media) override { return false; } diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index c1b5825e6..8a4754218 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -346,19 +346,19 @@ class ConcreteMachine: return true; } - void configure_as_target(const StaticAnalyser::Target &target) override final { + void configure_as_target(const Analyser::Static::Target &target) override final { if(target.loading_command.length()) { type_string(target.loading_command); } switch(target.vic20.memory_model) { - case StaticAnalyser::Vic20MemoryModel::Unexpanded: + case Analyser::Static::Vic20MemoryModel::Unexpanded: set_memory_size(Default); break; - case StaticAnalyser::Vic20MemoryModel::EightKB: + case Analyser::Static::Vic20MemoryModel::EightKB: set_memory_size(ThreeKB); break; - case StaticAnalyser::Vic20MemoryModel::ThirtyTwoKB: + case Analyser::Static::Vic20MemoryModel::ThirtyTwoKB: set_memory_size(ThirtyTwoKB); break; } @@ -377,7 +377,7 @@ class ConcreteMachine: insert_media(target.media); } - bool insert_media(const StaticAnalyser::Media &media) override final { + bool insert_media(const Analyser::Static::Media &media) override final { if(!media.tapes.empty()) { tape_->set_tape(media.tapes.front()); } diff --git a/Machines/ConfigurationTarget.hpp b/Machines/ConfigurationTarget.hpp index 1dd5f54ec..600f76730 100644 --- a/Machines/ConfigurationTarget.hpp +++ b/Machines/ConfigurationTarget.hpp @@ -9,7 +9,7 @@ #ifndef ConfigurationTarget_hpp #define ConfigurationTarget_hpp -#include "../StaticAnalyser/StaticAnalyser.hpp" +#include "../Analyser/Static/StaticAnalyser.hpp" #include "../Configurable/Configurable.hpp" #include @@ -17,20 +17,20 @@ namespace ConfigurationTarget { /*! - A ConfigurationTarget::Machine is anything that can accept a StaticAnalyser::Target + A ConfigurationTarget::Machine is anything that can accept a Analyser::Static::Target and configure itself appropriately, or accept a list of media subsequently to insert. */ class Machine { public: /// Instructs the machine to configure itself as described by @c target and insert the included media. - virtual void configure_as_target(const StaticAnalyser::Target &target) = 0; + virtual void configure_as_target(const Analyser::Static::Target &target) = 0; /*! Requests that the machine insert @c media as a modification to current state @returns @c true if any media was inserted; @c false otherwise. */ - virtual bool insert_media(const StaticAnalyser::Media &media) = 0; + virtual bool insert_media(const Analyser::Static::Media &media) = 0; }; } diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index b48a6f675..7697ceef8 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -119,7 +119,7 @@ class ConcreteMachine: use_fast_tape_hack_ = activate; } - void configure_as_target(const StaticAnalyser::Target &target) override final { + void configure_as_target(const Analyser::Static::Target &target) override final { if(target.loading_command.length()) { type_string(target.loading_command); } @@ -143,7 +143,7 @@ class ConcreteMachine: insert_media(target.media); } - bool insert_media(const StaticAnalyser::Media &media) override final { + bool insert_media(const Analyser::Static::Media &media) override final { if(!media.tapes.empty()) { tape_.set_tape(media.tapes.front()); } diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index ed926a5f0..40a697f06 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -160,7 +160,7 @@ class ConcreteMachine: } } - void configure_as_target(const StaticAnalyser::Target &target) override { + void configure_as_target(const Analyser::Static::Target &target) override { // Add a disk cartridge if any disks were supplied. if(!target.media.disks.empty()) { map(2, 0, 0x4000, 0x2000); @@ -179,22 +179,22 @@ class ConcreteMachine: // Attach the hardware necessary for a game cartridge, if any. switch(target.msx.cartridge_type) { default: break; - case StaticAnalyser::MSXCartridgeType::Konami: + case Analyser::Static::MSXCartridgeType::Konami: memory_slots_[1].set_handler(new Cartridge::KonamiROMSlotHandler(*this, 1)); break; - case StaticAnalyser::MSXCartridgeType::KonamiWithSCC: + case Analyser::Static::MSXCartridgeType::KonamiWithSCC: memory_slots_[1].set_handler(new Cartridge::KonamiWithSCCROMSlotHandler(*this, 1, scc_)); break; - case StaticAnalyser::MSXCartridgeType::ASCII8kb: + case Analyser::Static::MSXCartridgeType::ASCII8kb: memory_slots_[1].set_handler(new Cartridge::ASCII8kbROMSlotHandler(*this, 1)); break; - case StaticAnalyser::MSXCartridgeType::ASCII16kb: + case Analyser::Static::MSXCartridgeType::ASCII16kb: memory_slots_[1].set_handler(new Cartridge::ASCII16kbROMSlotHandler(*this, 1)); break; } } - bool insert_media(const StaticAnalyser::Media &media) override { + bool insert_media(const Analyser::Static::Media &media) override { if(!media.cartridges.empty()) { const auto &segment = media.cartridges.front()->get_segments().front(); memory_slots_[1].source = segment.data; diff --git a/Machines/MSX/ROMSlotHandler.hpp b/Machines/MSX/ROMSlotHandler.hpp index ba62db932..6d3c53b0f 100644 --- a/Machines/MSX/ROMSlotHandler.hpp +++ b/Machines/MSX/ROMSlotHandler.hpp @@ -10,7 +10,7 @@ #define ROMSlotHandler_hpp #include "../../ClockReceiver/ClockReceiver.hpp" -#include "../../DynamicAnalyser/ConfidenceCounter.hpp" +#include "../../Analyser/Dynamic/ConfidenceCounter.hpp" #include #include diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 63e7abb5c..6a0e42b27 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -254,7 +254,7 @@ class ConcreteMachine: } // to satisfy ConfigurationTarget::Machine - void configure_as_target(const StaticAnalyser::Target &target) override final { + void configure_as_target(const Analyser::Static::Target &target) override final { if(target.oric.has_microdisc) { microdisc_is_enabled_ = true; microdisc_did_change_paging_flags(µdisc_); @@ -284,7 +284,7 @@ class ConcreteMachine: insert_media(target.media); } - bool insert_media(const StaticAnalyser::Media &media) override final { + bool insert_media(const Analyser::Static::Media &media) override final { if(media.tapes.size()) { tape_player_.set_tape(media.tapes.front()); } diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index ef96f1d15..78f962495 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -18,44 +18,44 @@ #include "TypedDynamicMachine.hpp" -::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector &targets) { +::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector &targets) { // TODO: deal with target lists containing more than one machine. switch(targets.front().machine) { - case StaticAnalyser::Target::AmstradCPC: return new TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); - case StaticAnalyser::Target::Atari2600: return new TypedDynamicMachine(Atari2600::Machine::Atari2600()); - case StaticAnalyser::Target::Electron: return new TypedDynamicMachine(Electron::Machine::Electron()); - case StaticAnalyser::Target::MSX: return new TypedDynamicMachine(MSX::Machine::MSX()); - case StaticAnalyser::Target::Oric: return new TypedDynamicMachine(Oric::Machine::Oric()); - case StaticAnalyser::Target::Vic20: return new TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); - case StaticAnalyser::Target::ZX8081: return new TypedDynamicMachine(ZX8081::Machine::ZX8081(targets.front())); + case Analyser::Machine::AmstradCPC: return new TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); + case Analyser::Machine::Atari2600: return new TypedDynamicMachine(Atari2600::Machine::Atari2600()); + case Analyser::Machine::Electron: return new TypedDynamicMachine(Electron::Machine::Electron()); + case Analyser::Machine::MSX: return new TypedDynamicMachine(MSX::Machine::MSX()); + case Analyser::Machine::Oric: return new TypedDynamicMachine(Oric::Machine::Oric()); + case Analyser::Machine::Vic20: return new TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); + case Analyser::Machine::ZX8081: return new TypedDynamicMachine(ZX8081::Machine::ZX8081(targets.front())); default: return nullptr; } } -std::string Machine::ShortNameForTargetMachine(const StaticAnalyser::Target::Machine machine) { +std::string Machine::ShortNameForTargetMachine(const Analyser::Machine machine) { switch(machine) { - case StaticAnalyser::Target::AmstradCPC: return "AmstradCPC"; - case StaticAnalyser::Target::Atari2600: return "Atari2600"; - case StaticAnalyser::Target::Electron: return "Electron"; - case StaticAnalyser::Target::MSX: return "MSX"; - case StaticAnalyser::Target::Oric: return "Oric"; - case StaticAnalyser::Target::Vic20: return "Vic20"; - case StaticAnalyser::Target::ZX8081: return "ZX8081"; + case Analyser::Machine::AmstradCPC: return "AmstradCPC"; + case Analyser::Machine::Atari2600: return "Atari2600"; + case Analyser::Machine::Electron: return "Electron"; + case Analyser::Machine::MSX: return "MSX"; + case Analyser::Machine::Oric: return "Oric"; + case Analyser::Machine::Vic20: return "Vic20"; + case Analyser::Machine::ZX8081: return "ZX8081"; default: return ""; } } -std::string Machine::LongNameForTargetMachine(StaticAnalyser::Target::Machine machine) { +std::string Machine::LongNameForTargetMachine(Analyser::Machine machine) { switch(machine) { - case StaticAnalyser::Target::AmstradCPC: return "Amstrad CPC"; - case StaticAnalyser::Target::Atari2600: return "Atari 2600"; - case StaticAnalyser::Target::Electron: return "Acorn Electron"; - case StaticAnalyser::Target::MSX: return "MSX"; - case StaticAnalyser::Target::Oric: return "Oric"; - case StaticAnalyser::Target::Vic20: return "Vic 20"; - case StaticAnalyser::Target::ZX8081: return "ZX80/81"; + case Analyser::Machine::AmstradCPC: return "Amstrad CPC"; + case Analyser::Machine::Atari2600: return "Atari 2600"; + case Analyser::Machine::Electron: return "Acorn Electron"; + case Analyser::Machine::MSX: return "MSX"; + case Analyser::Machine::Oric: return "Oric"; + case Analyser::Machine::Vic20: return "Vic 20"; + case Analyser::Machine::ZX8081: return "ZX80/81"; default: return ""; } @@ -64,11 +64,11 @@ std::string Machine::LongNameForTargetMachine(StaticAnalyser::Target::Machine ma std::map>> Machine::AllOptionsByMachineName() { std::map>> options; - options.emplace(std::make_pair(LongNameForTargetMachine(StaticAnalyser::Target::Electron), Electron::get_options())); - options.emplace(std::make_pair(LongNameForTargetMachine(StaticAnalyser::Target::MSX), MSX::get_options())); - options.emplace(std::make_pair(LongNameForTargetMachine(StaticAnalyser::Target::Oric), Oric::get_options())); - options.emplace(std::make_pair(LongNameForTargetMachine(StaticAnalyser::Target::Vic20), Commodore::Vic20::get_options())); - options.emplace(std::make_pair(LongNameForTargetMachine(StaticAnalyser::Target::ZX8081), ZX8081::get_options())); + options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Electron), Electron::get_options())); + options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::MSX), MSX::get_options())); + options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Oric), Oric::get_options())); + options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Vic20), Commodore::Vic20::get_options())); + options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::ZX8081), ZX8081::get_options())); return options; } diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index 95f0ef035..0b04e3853 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -9,7 +9,7 @@ #ifndef MachineForTarget_hpp #define MachineForTarget_hpp -#include "../../StaticAnalyser/StaticAnalyser.hpp" +#include "../../Analyser/Static/StaticAnalyser.hpp" #include "../../Configurable/Configurable.hpp" #include "../ConfigurationTarget.hpp" @@ -42,20 +42,20 @@ struct DynamicMachine { receive the supplied static analyser result. The machine has been allocated on the heap. It is the caller's responsibility to delete the class when finished. */ -DynamicMachine *MachineForTargets(const std::vector &target); +DynamicMachine *MachineForTargets(const std::vector &target); /*! Returns a short string name for the machine identified by the target, which is guaranteed not to have any spaces or other potentially filesystem-bothering contents. */ -std::string ShortNameForTargetMachine(const StaticAnalyser::Target::Machine target); +std::string ShortNameForTargetMachine(const Analyser::Machine target); /*! Returns a long string name for the machine identified by the target, usable for presentation to a human. */ -std::string LongNameForTargetMachine(const StaticAnalyser::Target::Machine target); +std::string LongNameForTargetMachine(const Analyser::Machine target); /*! Returns a map from machine name to the list of options that machine diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 3061726af..6906915c4 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -238,7 +238,7 @@ template class ConcreteMachine: z80_.run_for(cycles); } - void configure_as_target(const StaticAnalyser::Target &target) override final { + void configure_as_target(const Analyser::Static::Target &target) override final { is_zx81_ = target.zx8081.isZX81; if(is_zx81_) { rom_ = zx81_rom_; @@ -260,17 +260,17 @@ template class ConcreteMachine: rom_mask_ = static_cast(rom_.size() - 1); switch(target.zx8081.memory_model) { - case StaticAnalyser::ZX8081MemoryModel::Unexpanded: + case Analyser::Static::ZX8081MemoryModel::Unexpanded: ram_.resize(1024); ram_base_ = 16384; ram_mask_ = 1023; break; - case StaticAnalyser::ZX8081MemoryModel::SixteenKB: + case Analyser::Static::ZX8081MemoryModel::SixteenKB: ram_.resize(16384); ram_base_ = 16384; ram_mask_ = 16383; break; - case StaticAnalyser::ZX8081MemoryModel::SixtyFourKB: + case Analyser::Static::ZX8081MemoryModel::SixtyFourKB: ram_.resize(65536); ram_base_ = 8192; ram_mask_ = 65535; @@ -285,7 +285,7 @@ template class ConcreteMachine: insert_media(target.media); } - bool insert_media(const StaticAnalyser::Media &media) override final { + bool insert_media(const Analyser::Static::Media &media) override final { if(!media.tapes.empty()) { tape_player_.set_tape(media.tapes.front()); } @@ -442,7 +442,7 @@ template class ConcreteMachine: using namespace ZX8081; // See header; constructs and returns an instance of the ZX80 or 81. -Machine *Machine::ZX8081(const StaticAnalyser::Target &target_hint) { +Machine *Machine::ZX8081(const Analyser::Static::Target &target_hint) { // Instantiate the correct type of machine. if(target_hint.zx8081.isZX81) return new ZX8081::ConcreteMachine(); diff --git a/Machines/ZX8081/ZX8081.hpp b/Machines/ZX8081/ZX8081.hpp index 6f70a03c1..14993c44e 100644 --- a/Machines/ZX8081/ZX8081.hpp +++ b/Machines/ZX8081/ZX8081.hpp @@ -27,7 +27,7 @@ class Machine: public: virtual ~Machine(); - static Machine *ZX8081(const StaticAnalyser::Target &target_hint); + static Machine *ZX8081(const Analyser::Static::Target &target_hint); virtual void set_tape_is_playing(bool is_playing) = 0; }; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 8bc87dc20..994095090 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -11,20 +11,6 @@ 4B049CDD1DA3C82F00322067 /* BCDTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B049CDC1DA3C82F00322067 /* BCDTest.swift */; }; 4B055A7A1FAE78A00060FFFF /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B055A771FAE78210060FFFF /* SDL2.framework */; }; 4B055A7E1FAE84AA0060FFFF /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B055A7C1FAE84A50060FFFF /* main.cpp */; }; - 4B055A7F1FAE852F0060FFFF /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */; }; - 4B055A801FAE85350060FFFF /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA799931D8B656E0045123D /* StaticAnalyser.cpp */; }; - 4B055A811FAE853A0060FFFF /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF829641D8F732B001BAE39 /* Disk.cpp */; }; - 4B055A821FAE853D0060FFFF /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD14B0F1D74627C0088EAD6 /* StaticAnalyser.cpp */; }; - 4B055A831FAE85410060FFFF /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B96F7201D75119A0058BB2D /* Tape.cpp */; }; - 4B055A841FAE85450060FFFF /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA22B051D8817CE0008C640 /* Disk.cpp */; }; - 4B055A851FAE85480060FFFF /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE77A2C1D84ADFB00BC3827 /* File.cpp */; }; - 4B055A861FAE854C0060FFFF /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC5E4901D7ED365008CF980 /* StaticAnalyser.cpp */; }; - 4B055A871FAE854F0060FFFF /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC830CF1D6E7C690000A26F /* Tape.cpp */; }; - 4B055A881FAE85530060FFFF /* 6502.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5A12551DD55862007A2231 /* 6502.cpp */; }; - 4B055A891FAE85580060FFFF /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA91DADD41B0039D2E7 /* StaticAnalyser.cpp */; }; - 4B055A8A1FAE855B0060FFFF /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805FC1DD02552003085B1 /* Tape.cpp */; }; - 4B055A8B1FAE85670060FFFF /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1497891EE4AC5E00CE2596 /* StaticAnalyser.cpp */; }; - 4B055A8C1FAE85670060FFFF /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B38F3421F2EB3E900D9235D /* StaticAnalyser.cpp */; }; 4B055A8D1FAE85920060FFFF /* AsyncTaskQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3940E51DA83C8300427841 /* AsyncTaskQueue.cpp */; }; 4B055A8E1FAE85920060FFFF /* BestEffortUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80ACFE1F85CAC900176895 /* BestEffortUpdater.cpp */; }; 4B055A8F1FAE85A90060FFFF /* FileHolder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5FADB81DE3151600AEC565 /* FileHolder.cpp */; }; @@ -130,9 +116,7 @@ 4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0CCC421C62D0B3001CAC5F /* CRT.cpp */; }; 4B0E04EA1FC9E5DA00F43484 /* CAS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04E81FC9E5DA00F43484 /* CAS.cpp */; }; 4B0E04EB1FC9E78800F43484 /* CAS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04E81FC9E5DA00F43484 /* CAS.cpp */; }; - 4B0E04EE1FC9E88300F43484 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04EC1FC9E88300F43484 /* StaticAnalyser.cpp */; }; 4B0E04F11FC9EA9500F43484 /* MSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B79A4FF1FC913C900EEDAD5 /* MSX.cpp */; }; - 4B0E04F21FC9EAA800F43484 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04EC1FC9E88300F43484 /* StaticAnalyser.cpp */; }; 4B0E04FA1FC9FA3100F43484 /* 9918.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04F91FC9FA3100F43484 /* 9918.cpp */; }; 4B0E04FB1FC9FA3100F43484 /* 9918.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04F91FC9FA3100F43484 /* 9918.cpp */; }; 4B0E61071FF34737002A9DBD /* MSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E61051FF34737002A9DBD /* MSX.cpp */; }; @@ -143,7 +127,6 @@ 4B1414601B58885000E04248 /* WolfgangLorenzTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14145F1B58885000E04248 /* WolfgangLorenzTests.swift */; }; 4B1414621B58888700E04248 /* KlausDormannTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1414611B58888700E04248 /* KlausDormannTests.swift */; }; 4B1497881EE4A1DA00CE2596 /* ZX80O81P.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1497861EE4A1DA00CE2596 /* ZX80O81P.cpp */; }; - 4B14978B1EE4AC5E00CE2596 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1497891EE4AC5E00CE2596 /* StaticAnalyser.cpp */; }; 4B14978F1EE4B4D200CE2596 /* CSZX8081.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B14978E1EE4B4D200CE2596 /* CSZX8081.mm */; }; 4B1497921EE4B5A800CE2596 /* ZX8081.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1497901EE4B5A800CE2596 /* ZX8081.cpp */; }; 4B1497981EE4B97F00CE2596 /* ZX8081Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B1497961EE4B97F00CE2596 /* ZX8081Options.xib */; }; @@ -164,13 +147,11 @@ 4B2C45421E3C3896002A2389 /* cartridge.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B2C45411E3C3896002A2389 /* cartridge.png */; }; 4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2E2D971C3A06EC00138695 /* Atari2600.cpp */; }; 4B2E2D9D1C3A070400138695 /* Electron.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2E2D9B1C3A070400138695 /* Electron.cpp */; }; - 4B2F67F12018312F00251FB5 /* Z80.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9C9D731FF81CC00030A129 /* Z80.cpp */; }; 4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B30512B1D989E2200B4FED8 /* Drive.cpp */; }; 4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B30512E1D98ACC600B4FED8 /* Plus3.cpp */; }; 4B322E011F5A2990004EB04C /* Z80AllRAM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B322DFD1F5A2981004EB04C /* Z80AllRAM.cpp */; }; 4B322E041F5A2E3C004EB04C /* Z80Base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B322E031F5A2E3C004EB04C /* Z80Base.cpp */; }; 4B37EE821D7345A6006A09A4 /* BinaryDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B37EE801D7345A6006A09A4 /* BinaryDump.cpp */; }; - 4B38F3441F2EB3E900D9235D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B38F3421F2EB3E900D9235D /* StaticAnalyser.cpp */; }; 4B38F3481F2EC11D00D9235D /* AmstradCPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B38F3461F2EC11D00D9235D /* AmstradCPC.cpp */; }; 4B38F34F1F2EC6BA00D9235D /* AmstradCPCOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B38F34D1F2EC6BA00D9235D /* AmstradCPCOptions.xib */; }; 4B3940E71DA83C8300427841 /* AsyncTaskQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3940E51DA83C8300427841 /* AsyncTaskQueue.cpp */; }; @@ -213,21 +194,14 @@ 4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C41F8D91D90050900F /* Keyboard.cpp */; }; 4B54C0C81F8D91E50050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C61F8D91E50050900F /* Keyboard.cpp */; }; 4B54C0CB1F8D92590050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0CA1F8D92580050900F /* Keyboard.cpp */; }; - 4B5539FF201583AD00027510 /* ConfidenceCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */; }; - 4B553A00201583AD00027510 /* ConfidenceCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */; }; - 4B553A032015855900027510 /* ConfidenceSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B553A012015855900027510 /* ConfidenceSummary.cpp */; }; - 4B553A042015855900027510 /* ConfidenceSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B553A012015855900027510 /* ConfidenceSummary.cpp */; }; 4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */; }; 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */; }; 4B58601E1F806AB200AEE2E3 /* MFMSectorDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B58601C1F806AB200AEE2E3 /* MFMSectorDump.cpp */; }; 4B59199C1DAC6C46005BB85C /* OricTAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B59199A1DAC6C46005BB85C /* OricTAP.cpp */; }; - 4B5A12571DD55862007A2231 /* 6502.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5A12551DD55862007A2231 /* 6502.cpp */; }; 4B5FADBA1DE3151600AEC565 /* FileHolder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5FADB81DE3151600AEC565 /* FileHolder.cpp */; }; 4B5FADC01DE3BF2B00AEC565 /* Microdisc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B5FADBE1DE3BF2B00AEC565 /* Microdisc.cpp */; }; 4B643F3A1D77AD1900D431D6 /* CSStaticAnalyser.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B643F391D77AD1900D431D6 /* CSStaticAnalyser.mm */; }; 4B643F3F1D77B88000D431D6 /* DocumentController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B643F3E1D77B88000D431D6 /* DocumentController.swift */; }; - 4B651F9E1FF1B04100E18D9A /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B651F9C1FF1B04100E18D9A /* Tape.cpp */; }; - 4B651F9F1FF1B2AE00E18D9A /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B651F9C1FF1B04100E18D9A /* Tape.cpp */; }; 4B69FB3D1C4D908A00B5F0AA /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB3B1C4D908A00B5F0AA /* Tape.cpp */; }; 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; }; 4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; }; @@ -255,8 +229,47 @@ 4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F21DCFD22A003085B1 /* Commodore.cpp */; }; 4B8805F71DCFF6C9003085B1 /* Commodore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F51DCFF6C9003085B1 /* Commodore.cpp */; }; 4B8805FB1DCFF807003085B1 /* Oric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F91DCFF807003085B1 /* Oric.cpp */; }; - 4B8805FE1DD02552003085B1 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805FC1DD02552003085B1 /* Tape.cpp */; }; 4B89449520194CB3007DE474 /* MachineForTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B055ABE1FAE98000060FFFF /* MachineForTarget.cpp */; }; + 4B894518201967B4007DE474 /* ConfidenceCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944E6201967B4007DE474 /* ConfidenceCounter.cpp */; }; + 4B894519201967B4007DE474 /* ConfidenceCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944E6201967B4007DE474 /* ConfidenceCounter.cpp */; }; + 4B89451A201967B4007DE474 /* ConfidenceSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944E8201967B4007DE474 /* ConfidenceSummary.cpp */; }; + 4B89451B201967B4007DE474 /* ConfidenceSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944E8201967B4007DE474 /* ConfidenceSummary.cpp */; }; + 4B89451C201967B4007DE474 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944EC201967B4007DE474 /* Disk.cpp */; }; + 4B89451D201967B4007DE474 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944EC201967B4007DE474 /* Disk.cpp */; }; + 4B89451E201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F0201967B4007DE474 /* Tape.cpp */; }; + 4B89451F201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F0201967B4007DE474 /* Tape.cpp */; }; + 4B894520201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F2201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894521201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F2201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894522201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F5201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894523201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F5201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894524201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F9201967B4007DE474 /* Tape.cpp */; }; + 4B894525201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944F9201967B4007DE474 /* Tape.cpp */; }; + 4B894526201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944FA201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894527201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944FA201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894528201967B4007DE474 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944FC201967B4007DE474 /* Disk.cpp */; }; + 4B894529201967B4007DE474 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8944FC201967B4007DE474 /* Disk.cpp */; }; + 4B89452A201967B4007DE474 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894500201967B4007DE474 /* File.cpp */; }; + 4B89452B201967B4007DE474 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894500201967B4007DE474 /* File.cpp */; }; + 4B89452C201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894501201967B4007DE474 /* Tape.cpp */; }; + 4B89452D201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894501201967B4007DE474 /* Tape.cpp */; }; + 4B89452E201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894503201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B89452F201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894503201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894530201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894506201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894531201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894506201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B894532201967B4007DE474 /* 6502.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89450B201967B4007DE474 /* 6502.cpp */; }; + 4B894533201967B4007DE474 /* 6502.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89450B201967B4007DE474 /* 6502.cpp */; }; + 4B894534201967B4007DE474 /* AddressMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89450C201967B4007DE474 /* AddressMapper.cpp */; }; + 4B894535201967B4007DE474 /* AddressMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89450C201967B4007DE474 /* AddressMapper.cpp */; }; + 4B894536201967B4007DE474 /* Z80.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89450D201967B4007DE474 /* Z80.cpp */; }; + 4B894537201967B4007DE474 /* Z80.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89450D201967B4007DE474 /* Z80.cpp */; }; + 4B894538201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894512201967B4007DE474 /* Tape.cpp */; }; + 4B894539201967B4007DE474 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894512201967B4007DE474 /* Tape.cpp */; }; + 4B89453A201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894513201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B89453B201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894513201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B89453C201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894516201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B89453D201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894516201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B89453E201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894517201967B4007DE474 /* StaticAnalyser.cpp */; }; + 4B89453F201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894517201967B4007DE474 /* StaticAnalyser.cpp */; }; 4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */; }; 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; }; 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */; }; @@ -268,18 +281,13 @@ 4B9252CE1E74D28200B76AF1 /* Atari ROMs in Resources */ = {isa = PBXBuildFile; fileRef = 4B9252CD1E74D28200B76AF1 /* Atari ROMs */; }; 4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */; }; 4B95FA9D1F11893B0008E395 /* ZX8081OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B95FA9C1F11893B0008E395 /* ZX8081OptionsPanel.swift */; }; - 4B96F7221D75119A0058BB2D /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B96F7201D75119A0058BB2D /* Tape.cpp */; }; 4B98A05E1FFAD3F600ADF63B /* CSROMFetcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A05D1FFAD3F600ADF63B /* CSROMFetcher.mm */; }; 4B98A05F1FFAD62400ADF63B /* CSROMFetcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A05D1FFAD3F600ADF63B /* CSROMFetcher.mm */; }; 4B98A0611FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A0601FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm */; }; 4B98A1CE1FFADEC500ADF63B /* MSX ROMs in Resources */ = {isa = PBXBuildFile; fileRef = 4B98A1CD1FFADEC400ADF63B /* MSX ROMs */; }; - 4B9C9D751FF81CC00030A129 /* Z80.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9C9D731FF81CC00030A129 /* Z80.cpp */; }; - 4B9C9D781FF81ED30030A129 /* AddressMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9C9D761FF81ED30030A129 /* AddressMapper.cpp */; }; 4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */; }; 4BA0F68E1EEA0E8400E9489E /* ZX8081.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA0F68C1EEA0E8400E9489E /* ZX8081.cpp */; }; - 4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA22B051D8817CE0008C640 /* Disk.cpp */; }; 4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */; }; - 4BA799951D8B656E0045123D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA799931D8B656E0045123D /* StaticAnalyser.cpp */; }; 4BAD13441FF709C700FD114A /* MSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E61051FF34737002A9DBD /* MSX.cpp */; }; 4BAF2B4E2004580C00480230 /* DMK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAF2B4C2004580C00480230 /* DMK.cpp */; }; 4BAF2B4F2004580C00480230 /* DMK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAF2B4C2004580C00480230 /* DMK.cpp */; }; @@ -568,25 +576,20 @@ 4BBFFEE61F7B27F1005F3FEB /* TrackSerialiser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBFFEE51F7B27F1005F3FEB /* TrackSerialiser.cpp */; }; 4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B74D1CD194CC00F86E85 /* Shader.cpp */; }; 4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */; }; - 4BC5E4921D7ED365008CF980 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC5E4901D7ED365008CF980 /* StaticAnalyser.cpp */; }; 4BC751B21D157E61006C31D9 /* 6522Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC751B11D157E61006C31D9 /* 6522Tests.swift */; }; 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC76E671C98E31700E6EF73 /* FIRFilter.cpp */; }; 4BC76E6B1C98F43700E6EF73 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */; }; - 4BC830D11D6E7C690000A26F /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC830CF1D6E7C690000A26F /* Tape.cpp */; }; 4BC91B831D1F160E00884B76 /* CommodoreTAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC91B811D1F160E00884B76 /* CommodoreTAP.cpp */; }; 4BC9DF451D044FCA00F44158 /* ROMImages in Resources */ = {isa = PBXBuildFile; fileRef = 4BC9DF441D044FCA00F44158 /* ROMImages */; }; 4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC9DF4D1D04691600F44158 /* 6560.cpp */; }; 4BC9E1EE1D23449A003FCEE4 /* 6502InterruptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC9E1ED1D23449A003FCEE4 /* 6502InterruptTests.swift */; }; 4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCA6CC61D9DD9F000C2D7B2 /* CommodoreROM.cpp */; }; 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */; }; - 4BCF1FAB1DADD41B0039D2E7 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA91DADD41B0039D2E7 /* StaticAnalyser.cpp */; }; - 4BD14B111D74627C0088EAD6 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD14B0F1D74627C0088EAD6 /* StaticAnalyser.cpp */; }; 4BD3A30B1EE755C800B5B501 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD3A3091EE755C800B5B501 /* Video.cpp */; }; 4BD468F71D8DF41D0084958B /* 1770.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD468F51D8DF41D0084958B /* 1770.cpp */; }; 4BD4A8D01E077FD20020D856 /* PCMTrackTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4A8CF1E077FD20020D856 /* PCMTrackTests.mm */; }; 4BD5F1951D13528900631CD1 /* CSBestEffortUpdater.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BD5F1941D13528900631CD1 /* CSBestEffortUpdater.mm */; }; 4BDDBA991EF3451200347E61 /* Z80MachineCycleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */; }; - 4BE77A2E1D84ADFB00BC3827 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE77A2C1D84ADFB00BC3827 /* File.cpp */; }; 4BE7C9181E3D397100A5496D /* TIA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE7C9161E3D397100A5496D /* TIA.cpp */; }; 4BE9A6B11EDE293000CBCB47 /* zexdoc.com in Resources */ = {isa = PBXBuildFile; fileRef = 4BE9A6B01EDE293000CBCB47 /* zexdoc.com */; }; 4BEA525E1DF33323007E74F2 /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEA525D1DF33323007E74F2 /* Tape.cpp */; }; @@ -600,8 +603,6 @@ 4BEE0A701D72496600532C7B /* PRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6D1D72496600532C7B /* PRG.cpp */; }; 4BEF6AAA1D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */; }; 4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */; }; - 4BF1354C1D6D2C300054B2EA /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */; }; - 4BF829661D8F732B001BAE39 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF829641D8F732B001BAE39 /* Disk.cpp */; }; 4BFCA1241ECBDCB400AC40C1 /* AllRAMProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1211ECBDCAF00AC40C1 /* AllRAMProcessor.cpp */; }; 4BFCA1271ECBE33200AC40C1 /* TestMachineZ80.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1261ECBE33200AC40C1 /* TestMachineZ80.mm */; }; 4BFCA1291ECBE7A700AC40C1 /* zexall.com in Resources */ = {isa = PBXBuildFile; fileRef = 4BFCA1281ECBE7A700AC40C1 /* zexall.com */; }; @@ -660,8 +661,6 @@ 4B0CCC431C62D0B3001CAC5F /* CRT.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRT.hpp; sourceTree = ""; }; 4B0E04E81FC9E5DA00F43484 /* CAS.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CAS.cpp; sourceTree = ""; }; 4B0E04E91FC9E5DA00F43484 /* CAS.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CAS.hpp; sourceTree = ""; }; - 4B0E04EC1FC9E88300F43484 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/MSX/StaticAnalyser.cpp; sourceTree = ""; }; - 4B0E04ED1FC9E88300F43484 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/MSX/StaticAnalyser.hpp; sourceTree = ""; }; 4B0E04F81FC9FA3000F43484 /* 9918.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = 9918.hpp; path = 9918/9918.hpp; sourceTree = ""; }; 4B0E04F91FC9FA3100F43484 /* 9918.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 9918.cpp; path = 9918/9918.cpp; sourceTree = ""; }; 4B0E61051FF34737002A9DBD /* MSX.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MSX.cpp; path = Parsers/MSX.cpp; sourceTree = ""; }; @@ -675,8 +674,6 @@ 4B1414611B58888700E04248 /* KlausDormannTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KlausDormannTests.swift; sourceTree = ""; }; 4B1497861EE4A1DA00CE2596 /* ZX80O81P.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ZX80O81P.cpp; sourceTree = ""; }; 4B1497871EE4A1DA00CE2596 /* ZX80O81P.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ZX80O81P.hpp; sourceTree = ""; }; - 4B1497891EE4AC5E00CE2596 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/ZX8081/StaticAnalyser.cpp; sourceTree = ""; }; - 4B14978A1EE4AC5E00CE2596 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/ZX8081/StaticAnalyser.hpp; sourceTree = ""; }; 4B14978D1EE4B4D200CE2596 /* CSZX8081.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSZX8081.h; sourceTree = ""; }; 4B14978E1EE4B4D200CE2596 /* CSZX8081.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSZX8081.mm; sourceTree = ""; }; 4B1497901EE4B5A800CE2596 /* ZX8081.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ZX8081.cpp; path = ZX8081/ZX8081.cpp; sourceTree = ""; }; @@ -734,8 +731,6 @@ 4B322E051F5A30F5004EB04C /* Z80Implementation.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Z80Implementation.hpp; sourceTree = ""; }; 4B37EE801D7345A6006A09A4 /* BinaryDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinaryDump.cpp; sourceTree = ""; }; 4B37EE811D7345A6006A09A4 /* BinaryDump.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = BinaryDump.hpp; sourceTree = ""; }; - 4B38F3421F2EB3E900D9235D /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/AmstradCPC/StaticAnalyser.cpp; sourceTree = ""; }; - 4B38F3431F2EB3E900D9235D /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/AmstradCPC/StaticAnalyser.hpp; sourceTree = ""; }; 4B38F3461F2EC11D00D9235D /* AmstradCPC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AmstradCPC.cpp; path = AmstradCPC/AmstradCPC.cpp; sourceTree = ""; }; 4B38F3471F2EC11D00D9235D /* AmstradCPC.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = AmstradCPC.hpp; path = AmstradCPC/AmstradCPC.hpp; sourceTree = ""; }; 4B38F34E1F2EC6BA00D9235D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/AmstradCPCOptions.xib"; sourceTree = SOURCE_ROOT; }; @@ -806,7 +801,6 @@ 4B5073051DDD3B9400C48FBD /* ArrayBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayBuilder.cpp; sourceTree = ""; }; 4B5073061DDD3B9400C48FBD /* ArrayBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ArrayBuilder.hpp; sourceTree = ""; }; 4B5073091DDFCFDF00C48FBD /* ArrayBuilderTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ArrayBuilderTests.mm; sourceTree = ""; }; - 4B5342211FF9A30800D42660 /* Kernel.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Kernel.hpp; path = ../../StaticAnalyser/Disassembler/Kernel.hpp; sourceTree = ""; }; 4B54C0BB1F8D8E790050900F /* KeyboardMachine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardMachine.cpp; sourceTree = ""; }; 4B54C0BD1F8D8F450050900F /* Keyboard.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Keyboard.cpp; path = Oric/Keyboard.cpp; sourceTree = ""; }; 4B54C0BE1F8D8F450050900F /* Keyboard.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Keyboard.hpp; path = Oric/Keyboard.hpp; sourceTree = ""; }; @@ -818,11 +812,6 @@ 4B54C0C71F8D91E50050900F /* Keyboard.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Keyboard.hpp; path = Electron/Keyboard.hpp; sourceTree = ""; }; 4B54C0C91F8D92580050900F /* Keyboard.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Keyboard.hpp; path = ZX8081/Keyboard.hpp; sourceTree = ""; }; 4B54C0CA1F8D92580050900F /* Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Keyboard.cpp; path = ZX8081/Keyboard.cpp; sourceTree = ""; }; - 4B5539F62015820B00027510 /* ConfidenceSource.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceSource.hpp; sourceTree = ""; }; - 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ConfidenceCounter.cpp; sourceTree = ""; }; - 4B5539FE201583AD00027510 /* ConfidenceCounter.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceCounter.hpp; sourceTree = ""; }; - 4B553A012015855900027510 /* ConfidenceSummary.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ConfidenceSummary.cpp; sourceTree = ""; }; - 4B553A022015855900027510 /* ConfidenceSummary.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceSummary.hpp; sourceTree = ""; }; 4B55CE5B1C3B7D6F0093A61B /* CSOpenGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSOpenGLView.h; sourceTree = ""; }; 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSOpenGLView.m; sourceTree = ""; }; 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MachineDocument.swift; sourceTree = ""; }; @@ -830,8 +819,6 @@ 4B58601D1F806AB200AEE2E3 /* MFMSectorDump.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MFMSectorDump.hpp; sourceTree = ""; }; 4B59199A1DAC6C46005BB85C /* OricTAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OricTAP.cpp; sourceTree = ""; }; 4B59199B1DAC6C46005BB85C /* OricTAP.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = OricTAP.hpp; sourceTree = ""; }; - 4B5A12551DD55862007A2231 /* 6502.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 6502.cpp; path = ../../StaticAnalyser/Disassembler/6502.cpp; sourceTree = ""; }; - 4B5A12561DD55862007A2231 /* 6502.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = 6502.hpp; path = ../../StaticAnalyser/Disassembler/6502.hpp; sourceTree = ""; }; 4B5FADB81DE3151600AEC565 /* FileHolder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileHolder.cpp; sourceTree = ""; }; 4B5FADB91DE3151600AEC565 /* FileHolder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FileHolder.hpp; sourceTree = ""; }; 4B5FADBE1DE3BF2B00AEC565 /* Microdisc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Microdisc.cpp; path = Oric/Microdisc.cpp; sourceTree = ""; }; @@ -840,8 +827,6 @@ 4B643F391D77AD1900D431D6 /* CSStaticAnalyser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CSStaticAnalyser.mm; path = StaticAnalyser/CSStaticAnalyser.mm; sourceTree = ""; }; 4B643F3C1D77AE5C00D431D6 /* CSMachine+Target.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CSMachine+Target.h"; sourceTree = ""; }; 4B643F3E1D77B88000D431D6 /* DocumentController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DocumentController.swift; sourceTree = ""; }; - 4B651F9C1FF1B04100E18D9A /* Tape.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/MSX/Tape.cpp; sourceTree = ""; }; - 4B651F9D1FF1B04100E18D9A /* Tape.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/MSX/Tape.hpp; sourceTree = ""; }; 4B698D1A1FE768A100696C91 /* SampleSource.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SampleSource.hpp; sourceTree = ""; }; 4B69FB3B1C4D908A00B5F0AA /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tape.cpp; sourceTree = ""; }; 4B69FB3C1C4D908A00B5F0AA /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tape.hpp; sourceTree = ""; }; @@ -896,9 +881,51 @@ 4B8805F61DCFF6C9003085B1 /* Commodore.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Commodore.hpp; path = Data/Commodore.hpp; sourceTree = ""; }; 4B8805F91DCFF807003085B1 /* Oric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Oric.cpp; path = Parsers/Oric.cpp; sourceTree = ""; }; 4B8805FA1DCFF807003085B1 /* Oric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Oric.hpp; path = Parsers/Oric.hpp; sourceTree = ""; }; - 4B8805FC1DD02552003085B1 /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/Oric/Tape.cpp; sourceTree = ""; }; - 4B8805FD1DD02552003085B1 /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Oric/Tape.hpp; sourceTree = ""; }; 4B89449220194A47007DE474 /* CSStaticAnalyser+TargetVector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "CSStaticAnalyser+TargetVector.h"; path = "StaticAnalyser/CSStaticAnalyser+TargetVector.h"; sourceTree = ""; }; + 4B8944E4201967B4007DE474 /* ConfidenceSummary.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceSummary.hpp; sourceTree = ""; }; + 4B8944E5201967B4007DE474 /* ConfidenceSource.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceSource.hpp; sourceTree = ""; }; + 4B8944E6201967B4007DE474 /* ConfidenceCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConfidenceCounter.cpp; sourceTree = ""; }; + 4B8944E7201967B4007DE474 /* ConfidenceCounter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ConfidenceCounter.hpp; sourceTree = ""; }; + 4B8944E8201967B4007DE474 /* ConfidenceSummary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConfidenceSummary.cpp; sourceTree = ""; }; + 4B8944EA201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B8944EC201967B4007DE474 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Disk.cpp; sourceTree = ""; }; + 4B8944ED201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B8944EE201967B4007DE474 /* File.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = File.hpp; sourceTree = ""; }; + 4B8944EF201967B4007DE474 /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tape.hpp; sourceTree = ""; }; + 4B8944F0201967B4007DE474 /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tape.cpp; sourceTree = ""; }; + 4B8944F1201967B4007DE474 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Disk.hpp; sourceTree = ""; }; + 4B8944F2201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B8944F4201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B8944F5201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B8944F7201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B8944F8201967B4007DE474 /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tape.hpp; sourceTree = ""; }; + 4B8944F9201967B4007DE474 /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tape.cpp; sourceTree = ""; }; + 4B8944FA201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B8944FC201967B4007DE474 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Disk.cpp; sourceTree = ""; }; + 4B8944FD201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B8944FE201967B4007DE474 /* File.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = File.hpp; sourceTree = ""; }; + 4B8944FF201967B4007DE474 /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tape.hpp; sourceTree = ""; }; + 4B894500201967B4007DE474 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = ""; }; + 4B894501201967B4007DE474 /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tape.cpp; sourceTree = ""; }; + 4B894502201967B4007DE474 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Disk.hpp; sourceTree = ""; }; + 4B894503201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B894505201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B894506201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B894508201967B4007DE474 /* 6502.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6502.hpp; sourceTree = ""; }; + 4B894509201967B4007DE474 /* AddressMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = AddressMapper.hpp; sourceTree = ""; }; + 4B89450A201967B4007DE474 /* Z80.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Z80.hpp; sourceTree = ""; }; + 4B89450B201967B4007DE474 /* 6502.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6502.cpp; sourceTree = ""; }; + 4B89450C201967B4007DE474 /* AddressMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AddressMapper.cpp; sourceTree = ""; }; + 4B89450D201967B4007DE474 /* Z80.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Z80.cpp; sourceTree = ""; }; + 4B89450E201967B4007DE474 /* Kernel.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Kernel.hpp; sourceTree = ""; }; + 4B894510201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B894511201967B4007DE474 /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Tape.hpp; sourceTree = ""; }; + 4B894512201967B4007DE474 /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tape.cpp; sourceTree = ""; }; + 4B894513201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B894515201967B4007DE474 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; + 4B894516201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B894517201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B894540201967D6007DE474 /* Machines.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Machines.hpp; sourceTree = ""; }; 4B8D287E1F77207100645199 /* TrackSerialiser.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TrackSerialiser.hpp; sourceTree = ""; }; 4B8E4ECD1DCE483D003716C3 /* KeyboardMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = KeyboardMachine.hpp; sourceTree = ""; }; 4B8EF6071FE5AF830076CCDD /* LowpassSpeaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = LowpassSpeaker.hpp; sourceTree = ""; }; @@ -914,25 +941,15 @@ 4B9252CD1E74D28200B76AF1 /* Atari ROMs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Atari ROMs"; sourceTree = ""; }; 4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6502TimingTests.swift; sourceTree = ""; }; 4B95FA9C1F11893B0008E395 /* ZX8081OptionsPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZX8081OptionsPanel.swift; sourceTree = ""; }; - 4B96F7201D75119A0058BB2D /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/Acorn/Tape.cpp; sourceTree = ""; }; - 4B96F7211D75119A0058BB2D /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Acorn/Tape.hpp; sourceTree = ""; }; 4B98A05C1FFAD3F600ADF63B /* CSROMFetcher.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CSROMFetcher.hpp; sourceTree = ""; }; 4B98A05D1FFAD3F600ADF63B /* CSROMFetcher.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CSROMFetcher.mm; sourceTree = ""; }; 4B98A0601FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MSXStaticAnalyserTests.mm; sourceTree = ""; }; 4B98A1CD1FFADEC400ADF63B /* MSX ROMs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "MSX ROMs"; sourceTree = ""; }; - 4B9C9D731FF81CC00030A129 /* Z80.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Z80.cpp; path = ../../StaticAnalyser/Disassembler/Z80.cpp; sourceTree = ""; }; - 4B9C9D741FF81CC00030A129 /* Z80.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Z80.hpp; path = ../../StaticAnalyser/Disassembler/Z80.hpp; sourceTree = ""; }; - 4B9C9D761FF81ED30030A129 /* AddressMapper.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = AddressMapper.cpp; path = ../../StaticAnalyser/Disassembler/AddressMapper.cpp; sourceTree = ""; }; - 4B9C9D771FF81ED30030A129 /* AddressMapper.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = AddressMapper.hpp; path = ../../StaticAnalyser/Disassembler/AddressMapper.hpp; sourceTree = ""; }; 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vic20OptionsPanel.swift; sourceTree = ""; }; 4BA0F68C1EEA0E8400E9489E /* ZX8081.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ZX8081.cpp; path = Data/ZX8081.cpp; sourceTree = ""; }; 4BA0F68D1EEA0E8400E9489E /* ZX8081.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ZX8081.hpp; path = Data/ZX8081.hpp; sourceTree = ""; }; - 4BA22B051D8817CE0008C640 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disk.cpp; path = ../../StaticAnalyser/Commodore/Disk.cpp; sourceTree = ""; }; - 4BA22B061D8817CE0008C640 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Disk.hpp; path = ../../StaticAnalyser/Commodore/Disk.hpp; sourceTree = ""; }; 4BA61EAE1D91515900B3C876 /* NSData+StdVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+StdVector.h"; sourceTree = ""; }; 4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSData+StdVector.mm"; sourceTree = ""; }; - 4BA799931D8B656E0045123D /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/Atari/StaticAnalyser.cpp; sourceTree = ""; }; - 4BA799941D8B656E0045123D /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/Atari/StaticAnalyser.hpp; sourceTree = ""; }; 4BA9C3CF1D8164A9002DDB61 /* ConfigurationTarget.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ConfigurationTarget.hpp; sourceTree = ""; }; 4BAB62AC1D3272D200DF5BA0 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Disk.hpp; sourceTree = ""; }; 4BAB62AE1D32730D00DF5BA0 /* Storage.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Storage.hpp; sourceTree = ""; }; @@ -1247,14 +1264,10 @@ 4BC3B74E1CD194CC00F86E85 /* Shader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Shader.hpp; sourceTree = ""; }; 4BC3B7501CD1956900F86E85 /* OutputShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputShader.cpp; sourceTree = ""; }; 4BC3B7511CD1956900F86E85 /* OutputShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = OutputShader.hpp; sourceTree = ""; }; - 4BC5E4901D7ED365008CF980 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/Commodore/StaticAnalyser.cpp; sourceTree = ""; }; - 4BC5E4911D7ED365008CF980 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/Commodore/StaticAnalyser.hpp; sourceTree = ""; }; 4BC751B11D157E61006C31D9 /* 6522Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6522Tests.swift; sourceTree = ""; }; 4BC76E671C98E31700E6EF73 /* FIRFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FIRFilter.cpp; sourceTree = ""; }; 4BC76E681C98E31700E6EF73 /* FIRFilter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FIRFilter.hpp; sourceTree = ""; }; 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - 4BC830CF1D6E7C690000A26F /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/Commodore/Tape.cpp; sourceTree = ""; }; - 4BC830D01D6E7C690000A26F /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Commodore/Tape.hpp; sourceTree = ""; }; 4BC91B811D1F160E00884B76 /* CommodoreTAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommodoreTAP.cpp; sourceTree = ""; }; 4BC91B821D1F160E00884B76 /* CommodoreTAP.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CommodoreTAP.hpp; sourceTree = ""; }; 4BC9DF441D044FCA00F44158 /* ROMImages */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ROMImages; path = ../../../../ROMImages; sourceTree = ""; }; @@ -1266,11 +1279,7 @@ 4BCA98C21D065CA20062F44C /* 6522.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6522.hpp; sourceTree = ""; }; 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Oric.cpp; path = Oric/Oric.cpp; sourceTree = ""; }; 4BCF1FA31DADC3DD0039D2E7 /* Oric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Oric.hpp; path = Oric/Oric.hpp; sourceTree = ""; }; - 4BCF1FA91DADD41B0039D2E7 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/Oric/StaticAnalyser.cpp; sourceTree = ""; }; - 4BCF1FAA1DADD41B0039D2E7 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/Oric/StaticAnalyser.hpp; sourceTree = ""; }; 4BD060A51FE49D3C006E14BE /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Speaker.hpp; sourceTree = ""; }; - 4BD14B0F1D74627C0088EAD6 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/Acorn/StaticAnalyser.cpp; sourceTree = ""; }; - 4BD14B101D74627C0088EAD6 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/Acorn/StaticAnalyser.hpp; sourceTree = ""; }; 4BD388411FE34E010042B588 /* 9918Base.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = 9918Base.hpp; path = 9918/Implementation/9918Base.hpp; sourceTree = ""; }; 4BD3A3091EE755C800B5B501 /* Video.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Video.cpp; path = ZX8081/Video.cpp; sourceTree = ""; }; 4BD3A30A1EE755C800B5B501 /* Video.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Video.hpp; path = ZX8081/Video.hpp; sourceTree = ""; }; @@ -1282,8 +1291,6 @@ 4BD9137D1F311BC5009BCF85 /* i8255.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = i8255.hpp; path = 8255/i8255.hpp; sourceTree = ""; }; 4BDCC5F81FB27A5E001220C5 /* ROMMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ROMMachine.hpp; sourceTree = ""; }; 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MachineCycleTests.swift; sourceTree = ""; }; - 4BE77A2C1D84ADFB00BC3827 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = File.cpp; path = ../../StaticAnalyser/Commodore/File.cpp; sourceTree = ""; }; - 4BE77A2D1D84ADFB00BC3827 /* File.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = File.hpp; path = ../../StaticAnalyser/Commodore/File.hpp; sourceTree = ""; }; 4BE7C9161E3D397100A5496D /* TIA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TIA.cpp; sourceTree = ""; }; 4BE7C9171E3D397100A5496D /* TIA.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TIA.hpp; sourceTree = ""; }; 4BE845201F2FF7F100A5EA22 /* CRTC6845.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CRTC6845.hpp; path = 6845/CRTC6845.hpp; sourceTree = ""; }; @@ -1321,15 +1328,10 @@ 4BEF6AA81D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DigitalPhaseLockedLoopBridge.h; sourceTree = ""; }; 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DigitalPhaseLockedLoopBridge.mm; sourceTree = ""; }; 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DPLLTests.swift; sourceTree = ""; }; - 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/StaticAnalyser.cpp; sourceTree = ""; }; - 4BF1354B1D6D2C300054B2EA /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/StaticAnalyser.hpp; sourceTree = ""; }; 4BF4A2D91F534DB300B171F4 /* TargetPlatforms.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TargetPlatforms.hpp; sourceTree = ""; }; 4BF4A2DA1F5365C600B171F4 /* CSZX8081+Instantiation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CSZX8081+Instantiation.h"; sourceTree = ""; }; 4BF6606A1F281573002CB053 /* ClockReceiver.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ClockReceiver.hpp; sourceTree = ""; }; 4BF8295F1D8F3C87001BAE39 /* CRC.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CRC.hpp; path = ../../NumberTheory/CRC.hpp; sourceTree = ""; }; - 4BF829641D8F732B001BAE39 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disk.cpp; path = ../../StaticAnalyser/Acorn/Disk.cpp; sourceTree = ""; }; - 4BF829651D8F732B001BAE39 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Disk.hpp; path = ../../StaticAnalyser/Acorn/Disk.hpp; sourceTree = ""; }; - 4BF829681D8F7361001BAE39 /* File.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = File.hpp; path = ../../StaticAnalyser/Acorn/File.hpp; sourceTree = ""; }; 4BFCA1211ECBDCAF00AC40C1 /* AllRAMProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AllRAMProcessor.cpp; sourceTree = ""; }; 4BFCA1221ECBDCAF00AC40C1 /* AllRAMProcessor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = AllRAMProcessor.hpp; sourceTree = ""; }; 4BFCA1251ECBE33200AC40C1 /* TestMachineZ80.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMachineZ80.h; sourceTree = ""; }; @@ -1410,17 +1412,6 @@ path = ../../Outputs/CRT; sourceTree = ""; }; - 4B0E04F01FC9E89100F43484 /* MSX */ = { - isa = PBXGroup; - children = ( - 4B0E04EC1FC9E88300F43484 /* StaticAnalyser.cpp */, - 4B0E04ED1FC9E88300F43484 /* StaticAnalyser.hpp */, - 4B651F9C1FF1B04100E18D9A /* Tape.cpp */, - 4B651F9D1FF1B04100E18D9A /* Tape.hpp */, - ); - name = MSX; - sourceTree = ""; - }; 4B0E04F71FC9F2C800F43484 /* 9918 */ = { isa = PBXGroup; children = ( @@ -1456,15 +1447,6 @@ name = "Test Binaries"; sourceTree = ""; }; - 4B14978C1EE4AC6200CE2596 /* ZX80/81 */ = { - isa = PBXGroup; - children = ( - 4B1497891EE4AC5E00CE2596 /* StaticAnalyser.cpp */, - 4B14978A1EE4AC5E00CE2596 /* StaticAnalyser.hpp */, - ); - name = ZX80/81; - sourceTree = ""; - }; 4B1497931EE4B5AC00CE2596 /* ZX8081 */ = { isa = PBXGroup; children = ( @@ -1659,15 +1641,6 @@ name = Outputs; sourceTree = ""; }; - 4B38F3451F2EB41800D9235D /* AmstradCPC */ = { - isa = PBXGroup; - children = ( - 4B38F3421F2EB3E900D9235D /* StaticAnalyser.cpp */, - 4B38F3431F2EB3E900D9235D /* StaticAnalyser.hpp */, - ); - name = AmstradCPC; - sourceTree = ""; - }; 4B38F3491F2EC12000D9235D /* AmstradCPC */ = { isa = PBXGroup; children = ( @@ -1847,19 +1820,6 @@ path = 1540; sourceTree = ""; }; - 4B5539F52015820B00027510 /* DynamicAnalyser */ = { - isa = PBXGroup; - children = ( - 4B5539F62015820B00027510 /* ConfidenceSource.hpp */, - 4B5539FD201583AD00027510 /* ConfidenceCounter.cpp */, - 4B5539FE201583AD00027510 /* ConfidenceCounter.hpp */, - 4B553A012015855900027510 /* ConfidenceSummary.cpp */, - 4B553A022015855900027510 /* ConfidenceSummary.hpp */, - ); - name = DynamicAnalyser; - path = ../../DynamicAnalyser; - sourceTree = ""; - }; 4B55CE551C3B7D360093A61B /* Documents */ = { isa = PBXGroup; children = ( @@ -1888,20 +1848,6 @@ path = Views; sourceTree = ""; }; - 4B5A12581DD55873007A2231 /* Disassembler */ = { - isa = PBXGroup; - children = ( - 4B5A12551DD55862007A2231 /* 6502.cpp */, - 4B9C9D761FF81ED30030A129 /* AddressMapper.cpp */, - 4B9C9D731FF81CC00030A129 /* Z80.cpp */, - 4B5A12561DD55862007A2231 /* 6502.hpp */, - 4B9C9D771FF81ED30030A129 /* AddressMapper.hpp */, - 4B5342211FF9A30800D42660 /* Kernel.hpp */, - 4B9C9D741FF81CC00030A129 /* Z80.hpp */, - ); - name = Disassembler; - sourceTree = ""; - }; 4B643F3B1D77AD6D00D431D6 /* StaticAnalyser */ = { isa = PBXGroup; children = ( @@ -2100,6 +2046,138 @@ name = Data; sourceTree = ""; }; + 4B8944E2201967B4007DE474 /* Analyser */ = { + isa = PBXGroup; + children = ( + 4B894540201967D6007DE474 /* Machines.hpp */, + 4B8944E3201967B4007DE474 /* Dynamic */, + 4B8944E9201967B4007DE474 /* Static */, + ); + name = Analyser; + path = ../../Analyser; + sourceTree = ""; + }; + 4B8944E3201967B4007DE474 /* Dynamic */ = { + isa = PBXGroup; + children = ( + 4B8944E4201967B4007DE474 /* ConfidenceSummary.hpp */, + 4B8944E5201967B4007DE474 /* ConfidenceSource.hpp */, + 4B8944E6201967B4007DE474 /* ConfidenceCounter.cpp */, + 4B8944E7201967B4007DE474 /* ConfidenceCounter.hpp */, + 4B8944E8201967B4007DE474 /* ConfidenceSummary.cpp */, + ); + path = Dynamic; + sourceTree = ""; + }; + 4B8944E9201967B4007DE474 /* Static */ = { + isa = PBXGroup; + children = ( + 4B894517201967B4007DE474 /* StaticAnalyser.cpp */, + 4B8944EA201967B4007DE474 /* StaticAnalyser.hpp */, + 4B8944EB201967B4007DE474 /* Acorn */, + 4B894514201967B4007DE474 /* AmstradCPC */, + 4B8944F3201967B4007DE474 /* Atari */, + 4B8944FB201967B4007DE474 /* Commodore */, + 4B894507201967B4007DE474 /* Disassembler */, + 4B89450F201967B4007DE474 /* MSX */, + 4B8944F6201967B4007DE474 /* Oric */, + 4B894504201967B4007DE474 /* ZX8081 */, + ); + path = Static; + sourceTree = ""; + }; + 4B8944EB201967B4007DE474 /* Acorn */ = { + isa = PBXGroup; + children = ( + 4B8944EC201967B4007DE474 /* Disk.cpp */, + 4B8944ED201967B4007DE474 /* StaticAnalyser.hpp */, + 4B8944EE201967B4007DE474 /* File.hpp */, + 4B8944EF201967B4007DE474 /* Tape.hpp */, + 4B8944F0201967B4007DE474 /* Tape.cpp */, + 4B8944F1201967B4007DE474 /* Disk.hpp */, + 4B8944F2201967B4007DE474 /* StaticAnalyser.cpp */, + ); + path = Acorn; + sourceTree = ""; + }; + 4B8944F3201967B4007DE474 /* Atari */ = { + isa = PBXGroup; + children = ( + 4B8944F4201967B4007DE474 /* StaticAnalyser.hpp */, + 4B8944F5201967B4007DE474 /* StaticAnalyser.cpp */, + ); + path = Atari; + sourceTree = ""; + }; + 4B8944F6201967B4007DE474 /* Oric */ = { + isa = PBXGroup; + children = ( + 4B8944F7201967B4007DE474 /* StaticAnalyser.hpp */, + 4B8944F8201967B4007DE474 /* Tape.hpp */, + 4B8944F9201967B4007DE474 /* Tape.cpp */, + 4B8944FA201967B4007DE474 /* StaticAnalyser.cpp */, + ); + path = Oric; + sourceTree = ""; + }; + 4B8944FB201967B4007DE474 /* Commodore */ = { + isa = PBXGroup; + children = ( + 4B8944FC201967B4007DE474 /* Disk.cpp */, + 4B894502201967B4007DE474 /* Disk.hpp */, + 4B894500201967B4007DE474 /* File.cpp */, + 4B8944FE201967B4007DE474 /* File.hpp */, + 4B894503201967B4007DE474 /* StaticAnalyser.cpp */, + 4B8944FD201967B4007DE474 /* StaticAnalyser.hpp */, + 4B894501201967B4007DE474 /* Tape.cpp */, + 4B8944FF201967B4007DE474 /* Tape.hpp */, + ); + path = Commodore; + sourceTree = ""; + }; + 4B894504201967B4007DE474 /* ZX8081 */ = { + isa = PBXGroup; + children = ( + 4B894505201967B4007DE474 /* StaticAnalyser.hpp */, + 4B894506201967B4007DE474 /* StaticAnalyser.cpp */, + ); + path = ZX8081; + sourceTree = ""; + }; + 4B894507201967B4007DE474 /* Disassembler */ = { + isa = PBXGroup; + children = ( + 4B894508201967B4007DE474 /* 6502.hpp */, + 4B894509201967B4007DE474 /* AddressMapper.hpp */, + 4B89450A201967B4007DE474 /* Z80.hpp */, + 4B89450B201967B4007DE474 /* 6502.cpp */, + 4B89450C201967B4007DE474 /* AddressMapper.cpp */, + 4B89450D201967B4007DE474 /* Z80.cpp */, + 4B89450E201967B4007DE474 /* Kernel.hpp */, + ); + path = Disassembler; + sourceTree = ""; + }; + 4B89450F201967B4007DE474 /* MSX */ = { + isa = PBXGroup; + children = ( + 4B894510201967B4007DE474 /* StaticAnalyser.hpp */, + 4B894511201967B4007DE474 /* Tape.hpp */, + 4B894512201967B4007DE474 /* Tape.cpp */, + 4B894513201967B4007DE474 /* StaticAnalyser.cpp */, + ); + path = MSX; + sourceTree = ""; + }; + 4B894514201967B4007DE474 /* AmstradCPC */ = { + isa = PBXGroup; + children = ( + 4B894515201967B4007DE474 /* StaticAnalyser.hpp */, + 4B894516201967B4007DE474 /* StaticAnalyser.cpp */, + ); + path = AmstradCPC; + sourceTree = ""; + }; 4B8EF6051FE5AF830076CCDD /* Implementation */ = { isa = PBXGroup; children = ( @@ -2110,15 +2188,6 @@ path = Implementation; sourceTree = ""; }; - 4BA799961D8B65730045123D /* Atari */ = { - isa = PBXGroup; - children = ( - 4BA799931D8B656E0045123D /* StaticAnalyser.cpp */, - 4BA799941D8B656E0045123D /* StaticAnalyser.hpp */, - ); - name = Atari; - sourceTree = ""; - }; 4BAB62AA1D3272D200DF5BA0 /* Disk */ = { isa = PBXGroup; children = ( @@ -2430,6 +2499,7 @@ isa = PBXGroup; children = ( 4BC76E6A1C98F43700E6EF73 /* Accelerate.framework */, + 4B8944E2201967B4007DE474 /* Analyser */, 4BB73EA01B587A5100552FC2 /* Clock Signal */, 4BB73EB51B587A5100552FC2 /* Clock SignalTests */, 4BB73EC01B587A5100552FC2 /* Clock SignalUITests */, @@ -2437,7 +2507,6 @@ 4BC9DF4A1D04691600F44158 /* Components */, 4B3940E81DA83C8700427841 /* Concurrency */, 4B31B88E1FBFBCD800C140D5 /* Configurable */, - 4B5539F52015820B00027510 /* DynamicAnalyser */, 4B055A761FAE78210060FFFF /* Frameworks */, 4B86E2581F8C628F006FAA45 /* Inputs */, 4BB73EDC1B587CA500552FC2 /* Machines */, @@ -2447,7 +2516,6 @@ 4BB73E9F1B587A5100552FC2 /* Products */, 4B055A7B1FAE84A50060FFFF /* SDL */, 4B2409591C45DF85004DA684 /* SignalProcessing */, - 4BF1354D1D6D2C360054B2EA /* StaticAnalyser */, 4B69FB391C4D908A00B5F0AA /* Storage */, ); indentWidth = 4; @@ -2614,21 +2682,6 @@ path = Shaders; sourceTree = ""; }; - 4BC830D21D6E7C6D0000A26F /* Commodore */ = { - isa = PBXGroup; - children = ( - 4BA22B051D8817CE0008C640 /* Disk.cpp */, - 4BA22B061D8817CE0008C640 /* Disk.hpp */, - 4BE77A2C1D84ADFB00BC3827 /* File.cpp */, - 4BE77A2D1D84ADFB00BC3827 /* File.hpp */, - 4BC5E4901D7ED365008CF980 /* StaticAnalyser.cpp */, - 4BC5E4911D7ED365008CF980 /* StaticAnalyser.hpp */, - 4BC830CF1D6E7C690000A26F /* Tape.cpp */, - 4BC830D01D6E7C690000A26F /* Tape.hpp */, - ); - name = Commodore; - sourceTree = ""; - }; 4BC9DF4A1D04691600F44158 /* Components */ = { isa = PBXGroup; children = ( @@ -2689,17 +2742,6 @@ name = Oric; sourceTree = ""; }; - 4BCF1FAC1DADD41F0039D2E7 /* Oric */ = { - isa = PBXGroup; - children = ( - 4BCF1FA91DADD41B0039D2E7 /* StaticAnalyser.cpp */, - 4BCF1FAA1DADD41B0039D2E7 /* StaticAnalyser.hpp */, - 4B8805FC1DD02552003085B1 /* Tape.cpp */, - 4B8805FD1DD02552003085B1 /* Tape.hpp */, - ); - name = Oric; - sourceTree = ""; - }; 4BD060A41FE49D3C006E14BE /* Speaker */ = { isa = PBXGroup; children = ( @@ -2710,20 +2752,6 @@ path = ../../Outputs/Speaker; sourceTree = ""; }; - 4BD14B121D7462810088EAD6 /* Acorn */ = { - isa = PBXGroup; - children = ( - 4BF829641D8F732B001BAE39 /* Disk.cpp */, - 4BF829651D8F732B001BAE39 /* Disk.hpp */, - 4BF829681D8F7361001BAE39 /* File.hpp */, - 4BD14B0F1D74627C0088EAD6 /* StaticAnalyser.cpp */, - 4BD14B101D74627C0088EAD6 /* StaticAnalyser.hpp */, - 4B96F7201D75119A0058BB2D /* Tape.cpp */, - 4B96F7211D75119A0058BB2D /* Tape.hpp */, - ); - name = Acorn; - sourceTree = ""; - }; 4BD388431FE34E060042B588 /* Implementation */ = { isa = PBXGroup; children = ( @@ -2826,23 +2854,6 @@ path = Formats; sourceTree = ""; }; - 4BF1354D1D6D2C360054B2EA /* StaticAnalyser */ = { - isa = PBXGroup; - children = ( - 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */, - 4BF1354B1D6D2C300054B2EA /* StaticAnalyser.hpp */, - 4BD14B121D7462810088EAD6 /* Acorn */, - 4B38F3451F2EB41800D9235D /* AmstradCPC */, - 4BA799961D8B65730045123D /* Atari */, - 4BC830D21D6E7C6D0000A26F /* Commodore */, - 4B5A12581DD55873007A2231 /* Disassembler */, - 4B0E04F01FC9E89100F43484 /* MSX */, - 4BCF1FAC1DADD41F0039D2E7 /* Oric */, - 4B14978C1EE4AC6200CE2596 /* ZX80/81 */, - ); - name = StaticAnalyser; - sourceTree = ""; - }; 4BF660691F281573002CB053 /* ClockReceiver */ = { isa = PBXGroup; children = ( @@ -3319,21 +3330,21 @@ 4B055A9B1FAE85DA0060FFFF /* AcornADF.cpp in Sources */, 4B0E04F11FC9EA9500F43484 /* MSX.cpp in Sources */, 4B055AD51FAE9B0B0060FFFF /* Video.cpp in Sources */, - 4B055A811FAE853A0060FFFF /* Disk.cpp in Sources */, 4B055AE11FAE9B6F0060FFFF /* ArrayBuilder.cpp in Sources */, + 4B894521201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B055AA51FAE85EF0060FFFF /* Encoder.cpp in Sources */, + 4B894529201967B4007DE474 /* Disk.cpp in Sources */, 4B055AEA1FAE9B990060FFFF /* 6502Storage.cpp in Sources */, - 4B055A8A1FAE855B0060FFFF /* Tape.cpp in Sources */, - 4B553A042015855900027510 /* ConfidenceSummary.cpp in Sources */, 4B055AA71FAE85EF0060FFFF /* SegmentParser.cpp in Sources */, 4B055AC11FAE98DC0060FFFF /* MachineForTarget.cpp in Sources */, 4B055AD81FAE9B180060FFFF /* Video.cpp in Sources */, + 4B89452F201967B4007DE474 /* StaticAnalyser.cpp in Sources */, + 4B894531201967B4007DE474 /* StaticAnalyser.cpp in Sources */, + 4B894539201967B4007DE474 /* Tape.cpp in Sources */, 4B055AE51FAE9B6F0060FFFF /* IntermediateShader.cpp in Sources */, - 4B055A851FAE85480060FFFF /* File.cpp in Sources */, 4B055AD31FAE9B0B0060FFFF /* Microdisc.cpp in Sources */, 4B055AB41FAE860F0060FFFF /* OricTAP.cpp in Sources */, 4B055AB71FAE860F0060FFFF /* TZX.cpp in Sources */, - 4B055A8C1FAE85670060FFFF /* StaticAnalyser.cpp in Sources */, 4B055ADA1FAE9B460060FFFF /* 1770.cpp in Sources */, 4B055ADC1FAE9B460060FFFF /* AY38910.cpp in Sources */, 4B055AD71FAE9B180060FFFF /* Keyboard.cpp in Sources */, @@ -3346,8 +3357,10 @@ 4B055AAB1FAE85FD0060FFFF /* PCMPatchedTrack.cpp in Sources */, 4B055AC71FAE9AEE0060FFFF /* TIA.cpp in Sources */, 4B055AD21FAE9B0B0060FFFF /* Keyboard.cpp in Sources */, + 4B89451B201967B4007DE474 /* ConfidenceSummary.cpp in Sources */, 4B055AA31FAE85DF0060FFFF /* ImplicitSectors.cpp in Sources */, 4B055AAE1FAE85FD0060FFFF /* TrackSerialiser.cpp in Sources */, + 4B89452B201967B4007DE474 /* File.cpp in Sources */, 4B055A981FAE85C50060FFFF /* Drive.cpp in Sources */, 4B4B1A3D200198CA00A0F866 /* KonamiSCC.cpp in Sources */, 4B055AE21FAE9B6F0060FFFF /* CRTOpenGL.cpp in Sources */, @@ -3356,15 +3369,14 @@ 4B055AB81FAE860F0060FFFF /* ZX80O81P.cpp in Sources */, 4B055A8E1FAE85920060FFFF /* BestEffortUpdater.cpp in Sources */, 4B055AB01FAE86070060FFFF /* PulseQueuedTape.cpp in Sources */, - 4B055A801FAE85350060FFFF /* StaticAnalyser.cpp in Sources */, 4B055AAC1FAE85FD0060FFFF /* PCMSegment.cpp in Sources */, 4B055AB31FAE860F0060FFFF /* CSW.cpp in Sources */, + 4B89451D201967B4007DE474 /* Disk.cpp in Sources */, 4B055ACF1FAE9B030060FFFF /* SoundGenerator.cpp in Sources */, + 4B894519201967B4007DE474 /* ConfidenceCounter.cpp in Sources */, 4B055AEE1FAE9BBF0060FFFF /* Keyboard.cpp in Sources */, - 4B055A881FAE85530060FFFF /* 6502.cpp in Sources */, 4B055AED1FAE9BA20060FFFF /* Z80Storage.cpp in Sources */, 4B055AD11FAE9B030060FFFF /* Video.cpp in Sources */, - 4B2F67F12018312F00251FB5 /* Z80.cpp in Sources */, 4B055AA21FAE85DA0060FFFF /* SSD.cpp in Sources */, 4BEBFB4E2002C4BF000708CC /* MSXDSK.cpp in Sources */, 4B055ADD1FAE9B460060FFFF /* i8272.cpp in Sources */, @@ -3374,8 +3386,9 @@ 4B055ABA1FAE86170060FFFF /* Commodore.cpp in Sources */, 4B055AA61FAE85EF0060FFFF /* Parser.cpp in Sources */, 4B055AE91FAE9B990060FFFF /* 6502Base.cpp in Sources */, - 4B055A861FAE854C0060FFFF /* StaticAnalyser.cpp in Sources */, 4B055AEF1FAE9BF00060FFFF /* Typer.cpp in Sources */, + 4B89453F201967B4007DE474 /* StaticAnalyser.cpp in Sources */, + 4B89453D201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B055ACA1FAE9AFB0060FFFF /* Vic20.cpp in Sources */, 4B055ABC1FAE86170060FFFF /* ZX8081.cpp in Sources */, 4B055AC91FAE9AFB0060FFFF /* Keyboard.cpp in Sources */, @@ -3383,14 +3396,13 @@ 4B055ACC1FAE9B030060FFFF /* Electron.cpp in Sources */, 4B055AB11FAE86070060FFFF /* Tape.cpp in Sources */, 4BFE7B881FC39D8900160B38 /* StandardOptions.cpp in Sources */, + 4B894533201967B4007DE474 /* 6502.cpp in Sources */, 4B055AA91FAE85EF0060FFFF /* CommodoreGCR.cpp in Sources */, - 4B055A7F1FAE852F0060FFFF /* StaticAnalyser.cpp in Sources */, 4B055ADB1FAE9B460060FFFF /* 6560.cpp in Sources */, 4B055AA01FAE85DA0060FFFF /* MFMSectorDump.cpp in Sources */, 4BEBFB522002DB30000708CC /* DiskROM.cpp in Sources */, 4B055AA11FAE85DA0060FFFF /* OricMFMDSK.cpp in Sources */, 4B055A951FAE85BB0060FFFF /* BitReverse.cpp in Sources */, - 4B055A891FAE85580060FFFF /* StaticAnalyser.cpp in Sources */, 4B055ACE1FAE9B030060FFFF /* Plus3.cpp in Sources */, 4B055A8D1FAE85920060FFFF /* AsyncTaskQueue.cpp in Sources */, 4BAD13441FF709C700FD114A /* MSX.cpp in Sources */, @@ -3398,44 +3410,44 @@ 4B055A941FAE85B50060FFFF /* CommodoreROM.cpp in Sources */, 4B055A971FAE85BB0060FFFF /* ZX8081.cpp in Sources */, 4B055AAD1FAE85FD0060FFFF /* PCMTrack.cpp in Sources */, - 4B055A841FAE85450060FFFF /* Disk.cpp in Sources */, - 4B055A831FAE85410060FFFF /* Tape.cpp in Sources */, - 4B553A00201583AD00027510 /* ConfidenceCounter.cpp in Sources */, 4B055AC61FAE9AEE0060FFFF /* TIASound.cpp in Sources */, + 4B89451F201967B4007DE474 /* Tape.cpp in Sources */, 4B055AA81FAE85EF0060FFFF /* Shifter.cpp in Sources */, 4B055AC81FAE9AFB0060FFFF /* C1540.cpp in Sources */, 4B055A8F1FAE85A90060FFFF /* FileHolder.cpp in Sources */, 4B055A911FAE85B50060FFFF /* Cartridge.cpp in Sources */, + 4B894525201967B4007DE474 /* Tape.cpp in Sources */, 4B055ACD1FAE9B030060FFFF /* Keyboard.cpp in Sources */, - 4B055A8B1FAE85670060FFFF /* StaticAnalyser.cpp in Sources */, 4B055AB21FAE860F0060FFFF /* CommodoreTAP.cpp in Sources */, 4B055ADF1FAE9B4C0060FFFF /* IRQDelegatePortHandler.cpp in Sources */, 4B055AB51FAE860F0060FFFF /* TapePRG.cpp in Sources */, 4B055AE01FAE9B660060FFFF /* CRT.cpp in Sources */, + 4B894527201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BAF2B4F2004580C00480230 /* DMK.cpp in Sources */, - 4B0E04F21FC9EAA800F43484 /* StaticAnalyser.cpp in Sources */, 4B055AD01FAE9B030060FFFF /* Tape.cpp in Sources */, 4B055A961FAE85BB0060FFFF /* Commodore.cpp in Sources */, 4B055ADE1FAE9B4C0060FFFF /* 6522Base.cpp in Sources */, + 4B894535201967B4007DE474 /* AddressMapper.cpp in Sources */, 4B055AD41FAE9B0B0060FFFF /* Oric.cpp in Sources */, - 4B055A821FAE853D0060FFFF /* StaticAnalyser.cpp in Sources */, 4B055A921FAE85B50060FFFF /* PRG.cpp in Sources */, 4B055AAF1FAE85FD0060FFFF /* UnformattedTrack.cpp in Sources */, 4B055A7E1FAE84AA0060FFFF /* main.cpp in Sources */, + 4B894537201967B4007DE474 /* Z80.cpp in Sources */, 4B055A9F1FAE85DA0060FFFF /* HFE.cpp in Sources */, 4B07835B1FC11D42001D12BB /* Configurable.cpp in Sources */, 4B055AE71FAE9B6F0060FFFF /* Shader.cpp in Sources */, + 4B894523201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B055AEC1FAE9BA20060FFFF /* Z80Base.cpp in Sources */, 4B0E04EB1FC9E78800F43484 /* CAS.cpp in Sources */, 4B055AE31FAE9B6F0060FFFF /* TextureBuilder.cpp in Sources */, 4B055AB91FAE86170060FFFF /* Acorn.cpp in Sources */, 4B055A931FAE85B50060FFFF /* BinaryDump.cpp in Sources */, + 4B89452D201967B4007DE474 /* Tape.cpp in Sources */, 4B055AD61FAE9B130060FFFF /* MemoryFuzzer.cpp in Sources */, - 4B651F9F1FF1B2AE00E18D9A /* Tape.cpp in Sources */, 4B055AC21FAE9AE30060FFFF /* KeyboardMachine.cpp in Sources */, 4B055AD91FAE9B180060FFFF /* ZX8081.cpp in Sources */, + 4B89453B201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B055AEB1FAE9BA20060FFFF /* PartialMachineCycle.cpp in Sources */, - 4B055A871FAE854F0060FFFF /* Tape.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3446,6 +3458,7 @@ 4B2BFC5F1D613E0200BA3AA9 /* TapePRG.cpp in Sources */, 4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */, 4B59199C1DAC6C46005BB85C /* OricTAP.cpp in Sources */, + 4B89451E201967B4007DE474 /* Tape.cpp in Sources */, 4BAF2B4E2004580C00480230 /* DMK.cpp in Sources */, 4BB697CE1D4BA44400248BDF /* CommodoreGCR.cpp in Sources */, 4B7136861F78724F008B8ED9 /* Encoder.cpp in Sources */, @@ -3453,71 +3466,69 @@ 4B58601E1F806AB200AEE2E3 /* MFMSectorDump.cpp in Sources */, 4B448E841F1C4C480009ABD6 /* PulseQueuedTape.cpp in Sources */, 4B0E61071FF34737002A9DBD /* MSX.cpp in Sources */, - 4BD14B111D74627C0088EAD6 /* StaticAnalyser.cpp in Sources */, 4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */, 4B4518A01F75FD1C00926311 /* CPCDSK.cpp in Sources */, 4B95FA9D1F11893B0008E395 /* ZX8081OptionsPanel.swift in Sources */, 4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */, 4B322E041F5A2E3C004EB04C /* Z80Base.cpp in Sources */, + 4B894530201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B4518A31F75FD1C00926311 /* HFE.cpp in Sources */, 4B4518A11F75FD1C00926311 /* D64.cpp in Sources */, 4B1558C01F844ECD006E9A97 /* BitReverse.cpp in Sources */, 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */, + 4B894538201967B4007DE474 /* Tape.cpp in Sources */, 4B54C0CB1F8D92590050900F /* Keyboard.cpp in Sources */, 4BEA525E1DF33323007E74F2 /* Tape.cpp in Sources */, 4B07835A1FC11D10001D12BB /* Configurable.cpp in Sources */, 4B8334951F5E25B60097E338 /* C1540.cpp in Sources */, + 4B89453C201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B1497921EE4B5A800CE2596 /* ZX8081.cpp in Sources */, 4B643F3F1D77B88000D431D6 /* DocumentController.swift in Sources */, 4B4518861F75E91A00926311 /* MFMDiskController.cpp in Sources */, - 4BA799951D8B656E0045123D /* StaticAnalyser.cpp in Sources */, 4B54C0BF1F8D8F450050900F /* Keyboard.cpp in Sources */, 4B3FE75E1F3CF68B00448EE4 /* CPM.cpp in Sources */, - 4B9C9D781FF81ED30030A129 /* AddressMapper.cpp in Sources */, 4B2BFDB21DAEF5FF001A68B8 /* Video.cpp in Sources */, 4B4DC82B1D2C27A4003C5BF8 /* SerialBus.cpp in Sources */, 4BBFFEE61F7B27F1005F3FEB /* TrackSerialiser.cpp in Sources */, 4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */, + 4B894518201967B4007DE474 /* ConfidenceCounter.cpp in Sources */, + 4B89452E201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B38F3481F2EC11D00D9235D /* AmstradCPC.cpp in Sources */, 4B8FE2221DA19FB20090D3CE /* MachinePanel.swift in Sources */, 4B4518A41F75FD1C00926311 /* OricMFMDSK.cpp in Sources */, 4BBB14311CD2CECE00BDB55C /* IntermediateShader.cpp in Sources */, 4B4B1A3C200198CA00A0F866 /* KonamiSCC.cpp in Sources */, 4BD5F1951D13528900631CD1 /* CSBestEffortUpdater.mm in Sources */, - 4B96F7221D75119A0058BB2D /* Tape.cpp in Sources */, + 4B894532201967B4007DE474 /* 6502.cpp in Sources */, 4B4518811F75E91A00926311 /* PCMPatchedTrack.cpp in Sources */, 4B8805F71DCFF6C9003085B1 /* Commodore.cpp in Sources */, 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */, - 4B9C9D751FF81CC00030A129 /* Z80.cpp in Sources */, 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */, 4B3BF5B01F146265005B6C36 /* CSW.cpp in Sources */, 4B4518A51F75FD1C00926311 /* SSD.cpp in Sources */, 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */, 4B2B3A4C1F9B8FA70062DABF /* MemoryFuzzer.cpp in Sources */, 4B7913CC1DFCD80E00175A82 /* Video.cpp in Sources */, - 4B0E04EE1FC9E88300F43484 /* StaticAnalyser.cpp in Sources */, 4B4518831F75E91A00926311 /* PCMTrack.cpp in Sources */, 4B45189F1F75FD1C00926311 /* AcornADF.cpp in Sources */, 4B2A53A11D117D36003C6002 /* CSAtari2600.mm in Sources */, 4B7136911F789C93008B8ED9 /* SegmentParser.cpp in Sources */, 4B4518A21F75FD1C00926311 /* G64.cpp in Sources */, - 4BF829661D8F732B001BAE39 /* Disk.cpp in Sources */, + 4B89452C201967B4007DE474 /* Tape.cpp in Sources */, 4B448E811F1C45A00009ABD6 /* TZX.cpp in Sources */, 4BEBFB512002DB30000708CC /* DiskROM.cpp in Sources */, + 4B89451C201967B4007DE474 /* Disk.cpp in Sources */, 4BEA52631DF339D7007E74F2 /* SoundGenerator.cpp in Sources */, - 4BC5E4921D7ED365008CF980 /* StaticAnalyser.cpp in Sources */, - 4BC830D11D6E7C690000A26F /* Tape.cpp in Sources */, + 4B89451A201967B4007DE474 /* ConfidenceSummary.cpp in Sources */, 4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */, 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */, 4B86E25B1F8C628F006FAA45 /* Keyboard.cpp in Sources */, - 4B651F9E1FF1B04100E18D9A /* Tape.cpp in Sources */, 4B4518851F75E91A00926311 /* DiskController.cpp in Sources */, 4B8334841F5DA0360097E338 /* Z80Storage.cpp in Sources */, 4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */, + 4B89452A201967B4007DE474 /* File.cpp in Sources */, 4B4DC8211D2C2425003C5BF8 /* Vic20.cpp in Sources */, 4B71368E1F788112008B8ED9 /* Parser.cpp in Sources */, - 4BE77A2E1D84ADFB00BC3827 /* File.cpp in Sources */, - 4B14978B1EE4AC5E00CE2596 /* StaticAnalyser.cpp in Sources */, 4B12C0ED1FCFA98D005BFD93 /* Keyboard.cpp in Sources */, 4BA0F68E1EEA0E8400E9489E /* ZX8081.cpp in Sources */, 4BD468F71D8DF41D0084958B /* 1770.cpp in Sources */, @@ -3526,9 +3537,10 @@ 4B5FADBA1DE3151600AEC565 /* FileHolder.cpp in Sources */, 4B643F3A1D77AD1900D431D6 /* CSStaticAnalyser.mm in Sources */, 4B1497881EE4A1DA00CE2596 /* ZX80O81P.cpp in Sources */, - 4B5A12571DD55862007A2231 /* 6502.cpp in Sources */, + 4B894520201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B2B3A4B1F9B8FA70062DABF /* Typer.cpp in Sources */, 4B4518821F75E91A00926311 /* PCMSegment.cpp in Sources */, + 4B894522201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BE7C9181E3D397100A5496D /* TIA.cpp in Sources */, 4B80AD001F85CACA00176895 /* BestEffortUpdater.cpp in Sources */, 4B2E2D9D1C3A070400138695 /* Electron.cpp in Sources */, @@ -3537,12 +3549,12 @@ 4B69FB3D1C4D908A00B5F0AA /* Tape.cpp in Sources */, 4B4518841F75E91A00926311 /* UnformattedTrack.cpp in Sources */, 4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */, + 4B894528201967B4007DE474 /* Disk.cpp in Sources */, + 4B89453A201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BB697CB1D4B6D3E00248BDF /* TimedEventLoop.cpp in Sources */, 4B54C0C21F8D91CD0050900F /* Keyboard.cpp in Sources */, - 4B553A032015855900027510 /* ConfidenceSummary.cpp in Sources */, 4BBC951E1F368D83008F4C34 /* i8272.cpp in Sources */, 4B89449520194CB3007DE474 /* MachineForTarget.cpp in Sources */, - 4BF1354C1D6D2C300054B2EA /* StaticAnalyser.cpp in Sources */, 4B4A76301DB1A3FA007AAE2E /* AY38910.cpp in Sources */, 4B6A4C991F58F09E00E3F787 /* 6502Base.cpp in Sources */, 4B4518871F75E91A00926311 /* DigitalPhaseLockedLoop.cpp in Sources */, @@ -3551,29 +3563,28 @@ 4B8FE2201DA19D7C0090D3CE /* Atari2600OptionsPanel.swift in Sources */, 4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */, 4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */, - 4B8805FE1DD02552003085B1 /* Tape.cpp in Sources */, 4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */, 4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */, - 4B38F3441F2EB3E900D9235D /* StaticAnalyser.cpp in Sources */, 4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */, 4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */, 4B83348C1F5DB99C0097E338 /* 6522Base.cpp in Sources */, + 4B894536201967B4007DE474 /* Z80.cpp in Sources */, 4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */, - 4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */, 4BEA52661DF3472B007E74F2 /* TIASound.cpp in Sources */, 4BEBFB4D2002C4BF000708CC /* MSXDSK.cpp in Sources */, 4BBFBB6C1EE8401E00C01E7A /* ZX8081.cpp in Sources */, 4B83348A1F5DB94B0097E338 /* IRQDelegatePortHandler.cpp in Sources */, + 4B894524201967B4007DE474 /* Tape.cpp in Sources */, 4B7136891F78725F008B8ED9 /* Shifter.cpp in Sources */, 4BFDD78C1F7F2DB4008579B9 /* ImplicitSectors.cpp in Sources */, 4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */, 4B5073071DDD3B9400C48FBD /* ArrayBuilder.cpp in Sources */, + 4B894526201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */, 4B8805FB1DCFF807003085B1 /* Oric.cpp in Sources */, 4BFE7B871FC39BF100160B38 /* StandardOptions.cpp in Sources */, 4B5FADC01DE3BF2B00AEC565 /* Microdisc.cpp in Sources */, 4B54C0C81F8D91E50050900F /* Keyboard.cpp in Sources */, - 4B5539FF201583AD00027510 /* ConfidenceCounter.cpp in Sources */, 4B79A5011FC913C900EEDAD5 /* MSX.cpp in Sources */, 4BEE0A701D72496600532C7B /* PRG.cpp in Sources */, 4B8334861F5DA3780097E338 /* 6502Storage.cpp in Sources */, @@ -3581,12 +3592,13 @@ 4B2A53A01D117D36003C6002 /* CSMachine.mm in Sources */, 4B14978F1EE4B4D200CE2596 /* CSZX8081.mm in Sources */, 4BC91B831D1F160E00884B76 /* CommodoreTAP.cpp in Sources */, - 4BCF1FAB1DADD41B0039D2E7 /* StaticAnalyser.cpp in Sources */, 4B2A539F1D117D36003C6002 /* CSAudioQueue.m in Sources */, + 4B89453E201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B37EE821D7345A6006A09A4 /* BinaryDump.cpp in Sources */, 4B8334821F5D9FF70097E338 /* PartialMachineCycle.cpp in Sources */, 4B54C0BC1F8D8E790050900F /* KeyboardMachine.cpp in Sources */, 4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */, + 4B894534201967B4007DE474 /* AddressMapper.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h b/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h index f2f299396..c754dd1a2 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h @@ -12,7 +12,7 @@ @interface CSMachine(Target) -- (void)applyTarget:(const StaticAnalyser::Target &)target; -- (void)applyMedia:(const StaticAnalyser::Media &)media; +- (void)applyTarget:(const Analyser::Static::Target &)target; +- (void)applyMedia:(const Analyser::Static::Media &)media; @end diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm index 61aa9d38d..af37e18e4 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm @@ -63,7 +63,7 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg MachineDelegate _machineDelegate; NSLock *_delegateMachineAccessLock; - std::vector _targets; + std::vector _targets; std::unique_ptr _machine; } @@ -185,14 +185,14 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg keyboardMachine->type_string([paste UTF8String]); } -- (void)applyTarget:(const StaticAnalyser::Target &)target { +- (void)applyTarget:(const Analyser::Static::Target &)target { @synchronized(self) { ConfigurationTarget::Machine *const configurationTarget = _machine->configuration_target(); if(configurationTarget) configurationTarget->configure_as_target(target); } } -- (void)applyMedia:(const StaticAnalyser::Media &)media { +- (void)applyMedia:(const Analyser::Static::Media &)media { @synchronized(self) { ConfigurationTarget::Machine *const configurationTarget = _machine->configuration_target(); if(configurationTarget) configurationTarget->insert_media(media); diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h index c7bfa41c4..a7d0dc5a0 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h @@ -10,6 +10,6 @@ @interface CSStaticAnalyser (ResultVector) -- (std::vector &)targets; +- (std::vector &)targets; @end diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index 41c8196ca..fc29fbc25 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -17,13 +17,13 @@ #import "Clock_Signal-Swift.h" @implementation CSStaticAnalyser { - std::vector _targets; + std::vector _targets; } - (instancetype)initWithFileAtURL:(NSURL *)url { self = [super init]; if(self) { - _targets = StaticAnalyser::GetTargets([url fileSystemRepresentation]); + _targets = Analyser::Static::GetTargets([url fileSystemRepresentation]); if(!_targets.size()) return nil; // TODO: could this better be supplied by the analyser? A hypothetical file format might @@ -35,13 +35,13 @@ - (NSString *)optionsPanelNibName { switch(_targets.front().machine) { - case StaticAnalyser::Target::AmstradCPC: return nil; - case StaticAnalyser::Target::Atari2600: return @"Atari2600Options"; - case StaticAnalyser::Target::Electron: return @"QuickLoadCompositeOptions"; - case StaticAnalyser::Target::MSX: return @"QuickLoadCompositeOptions"; - case StaticAnalyser::Target::Oric: return @"OricOptions"; - case StaticAnalyser::Target::Vic20: return @"Vic20Options"; - case StaticAnalyser::Target::ZX8081: return @"ZX8081Options"; + case Analyser::Machine::AmstradCPC: return nil; + case Analyser::Machine::Atari2600: return @"Atari2600Options"; + case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions"; + case Analyser::Machine::MSX: return @"QuickLoadCompositeOptions"; + case Analyser::Machine::Oric: return @"OricOptions"; + case Analyser::Machine::Vic20: return @"Vic20Options"; + case Analyser::Machine::ZX8081: return @"ZX8081Options"; default: return nil; } } @@ -50,20 +50,20 @@ [machine applyTarget:_targets.front()]; } -- (std::vector &)targets { +- (std::vector &)targets { return _targets; } @end @implementation CSMediaSet { - StaticAnalyser::Media _media; + Analyser::Static::Media _media; } - (instancetype)initWithFileAtURL:(NSURL *)url { self = [super init]; if(self) { - _media = StaticAnalyser::GetMedia([url fileSystemRepresentation]); + _media = Analyser::Static::GetMedia([url fileSystemRepresentation]); } return self; } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h index 42930215a..600046fb2 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h @@ -11,6 +11,6 @@ @interface CSZX8081 (Instantiation) -- (instancetype)initWithIntendedTarget:(const StaticAnalyser::Target &)target; +- (instancetype)initWithIntendedTarget:(const Analyser::Static::Target &)target; @end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm index b66f2c0de..86b1adf5b 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm @@ -15,7 +15,7 @@ Machine::TypedDynamicMachine _zx8081; } -- (instancetype)initWithIntendedTarget:(const StaticAnalyser::Target &)target { +- (instancetype)initWithIntendedTarget:(const Analyser::Static::Target &)target { _zx8081 = Machine::TypedDynamicMachine(ZX8081::Machine::ZX8081(target)); return nil;//[super initWithMachine:&_zx8081]; } diff --git a/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm b/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm index 49af40019..8d6319118 100644 --- a/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm +++ b/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm @@ -12,13 +12,13 @@ #include "../../../StaticAnalyser/StaticAnalyser.hpp" @interface AtariROMRecord : NSObject -@property(nonatomic, readonly) StaticAnalyser::Atari2600PagingModel pagingModel; +@property(nonatomic, readonly) Analyser::Static::Atari2600PagingModel pagingModel; @property(nonatomic, readonly) BOOL usesSuperchip; -+ (instancetype)recordWithPagingModel:(StaticAnalyser::Atari2600PagingModel)pagingModel usesSuperchip:(BOOL)usesSuperchip; ++ (instancetype)recordWithPagingModel:(Analyser::Static::Atari2600PagingModel)pagingModel usesSuperchip:(BOOL)usesSuperchip; @end @implementation AtariROMRecord -+ (instancetype)recordWithPagingModel:(StaticAnalyser::Atari2600PagingModel)pagingModel usesSuperchip:(BOOL)usesSuperchip ++ (instancetype)recordWithPagingModel:(Analyser::Static::Atari2600PagingModel)pagingModel usesSuperchip:(BOOL)usesSuperchip { AtariROMRecord *record = [[AtariROMRecord alloc] init]; record->_pagingModel = pagingModel; @@ -27,7 +27,7 @@ } @end -#define Record(sha, model, uses) sha : [AtariROMRecord recordWithPagingModel:StaticAnalyser::Atari2600PagingModel::model usesSuperchip:uses], +#define Record(sha, model, uses) sha : [AtariROMRecord recordWithPagingModel:Analyser::Static::Atari2600PagingModel::model usesSuperchip:uses], static NSDictionary *romRecordsBySHA1 = @{ Record(@"58dbcbdffbe80be97746e94a0a75614e64458fdc", None, NO) // 4kraVCS Record(@"9967a76efb68017f793188f691159f04e6bb4447", None, NO) // 'X'Mission @@ -591,7 +591,7 @@ static NSDictionary *romRecordsBySHA1 = @{ for(int c = 0; c < CC_SHA1_DIGEST_LENGTH; c++) [sha1 appendFormat:@"%02x", sha1Bytes[c]]; // get an analysis of the file - std::list targets = StaticAnalyser::GetTargets([fullPath UTF8String]); + std::list targets = Analyser::Static::GetTargets([fullPath UTF8String]); // grab the ROM record AtariROMRecord *romRecord = romRecordsBySHA1[sha1]; diff --git a/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm b/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm index 5a628a09d..89db00c89 100644 --- a/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm +++ b/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm @@ -12,19 +12,19 @@ #include "../../../StaticAnalyser/StaticAnalyser.hpp" @interface MSXROMRecord : NSObject -@property(nonatomic, readonly) StaticAnalyser::MSXCartridgeType cartridgeType; -+ (instancetype)recordWithCartridgeType:(StaticAnalyser::MSXCartridgeType)cartridgeType; +@property(nonatomic, readonly) Analyser::Static::MSXCartridgeType cartridgeType; ++ (instancetype)recordWithCartridgeType:(Analyser::Static::MSXCartridgeType)cartridgeType; @end @implementation MSXROMRecord -+ (instancetype)recordWithCartridgeType:(StaticAnalyser::MSXCartridgeType)cartridgeType { ++ (instancetype)recordWithCartridgeType:(Analyser::Static::MSXCartridgeType)cartridgeType { MSXROMRecord *record = [[MSXROMRecord alloc] init]; record->_cartridgeType = cartridgeType; return record; } @end -#define Record(sha, type) sha : [MSXROMRecord recordWithCartridgeType:StaticAnalyser::MSXCartridgeType::type], +#define Record(sha, type) sha : [MSXROMRecord recordWithCartridgeType:Analyser::Static::MSXCartridgeType::type], static NSDictionary *romRecordsBySHA1 = @{ Record(@"da397e783d677d1a78fff222d9d6cb48b915dada", ASCII8kb) // 1942 (1986)(ASCII)(JP).rom Record(@"0733cd627467a866846e15caf1770a5594eaf4cc", ASCII8kb) // 1942 (1986)(ASCII)(JP)[a].rom @@ -211,7 +211,7 @@ static NSDictionary *romRecordsBySHA1 = @{ for(int c = 0; c < CC_SHA1_DIGEST_LENGTH; c++) [sha1 appendFormat:@"%02x", sha1Bytes[c]]; // get an analysis of the file - std::list targets = StaticAnalyser::GetTargets([fullPath UTF8String]); + std::list targets = Analyser::Static::GetTargets([fullPath UTF8String]); // grab the ROM record MSXROMRecord *romRecord = romRecordsBySHA1[sha1]; diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index d9faf5067..ee2e45f50 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) { } // Determine the machine for the supplied file. - std::vector targets = StaticAnalyser::GetTargets(arguments.file_name.c_str()); + std::vector targets = Analyser::Static::GetTargets(arguments.file_name.c_str()); if(targets.empty()) { std::cerr << "Cannot open " << arguments.file_name << std::endl; return -1; @@ -432,7 +432,7 @@ int main(int argc, char *argv[]) { break; case SDL_DROPFILE: { - StaticAnalyser::Media media = StaticAnalyser::GetMedia(event.drop.file); + Analyser::Static::Media media = Analyser::Static::GetMedia(event.drop.file); machine->configuration_target()->insert_media(media); } break; diff --git a/Storage/Tape/Parsers/Commodore.cpp b/Storage/Tape/Parsers/Commodore.cpp index 2d9556a4b..59e619b9f 100644 --- a/Storage/Tape/Parsers/Commodore.cpp +++ b/Storage/Tape/Parsers/Commodore.cpp @@ -257,7 +257,7 @@ uint16_t Parser::get_next_short(const std::shared_ptr &tape } /*! - Per the contract with StaticAnalyser::TapeParser; sums time across pulses. If this pulse + Per the contract with Analyser::Static::TapeParser; sums time across pulses. If this pulse indicates a high to low transition, inspects the time since the last transition, to produce a long, medium, short or unrecognised wave period. */ @@ -284,7 +284,7 @@ void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse) } /*! - Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker, + Per the contract with Analyser::Static::TapeParser; produces any of a word marker, an end-of-block marker, a zero, a one or a lead-in symbol based on the currently captured waves. */ void Parser::inspect_waves(const std::vector &waves) diff --git a/Storage/Tape/Parsers/Commodore.hpp b/Storage/Tape/Parsers/Commodore.hpp index 991168595..c1b7eb863 100644 --- a/Storage/Tape/Parsers/Commodore.hpp +++ b/Storage/Tape/Parsers/Commodore.hpp @@ -122,7 +122,7 @@ class Parser: public Storage::Tape::PulseClassificationParser &tape); /*! - Per the contract with StaticAnalyser::TapeParser; sums time across pulses. If this pulse + Per the contract with Analyser::Static::TapeParser; sums time across pulses. If this pulse indicates a high to low transition, inspects the time since the last transition, to produce a long, medium, short or unrecognised wave period. */ @@ -131,7 +131,7 @@ class Parser: public Storage::Tape::PulseClassificationParser &waves); From 11abc99ef8f1636eab51b56957d1f1864a714b72 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 24 Jan 2018 22:35:54 -0500 Subject: [PATCH 07/37] Introduces the extra level of indirection necessary to make Analyser::Static::Target polymorphic. --- Analyser/Static/Acorn/StaticAnalyser.cpp | 34 +++++++------- Analyser/Static/Acorn/StaticAnalyser.hpp | 2 +- Analyser/Static/AmstradCPC/StaticAnalyser.cpp | 44 +++++++++---------- Analyser/Static/AmstradCPC/StaticAnalyser.hpp | 2 +- Analyser/Static/Atari/StaticAnalyser.cpp | 18 ++++---- Analyser/Static/Atari/StaticAnalyser.hpp | 2 +- Analyser/Static/Commodore/StaticAnalyser.cpp | 38 ++++++++-------- Analyser/Static/Commodore/StaticAnalyser.hpp | 2 +- Analyser/Static/MSX/StaticAnalyser.cpp | 24 +++++----- Analyser/Static/MSX/StaticAnalyser.hpp | 2 +- Analyser/Static/Oric/StaticAnalyser.cpp | 26 +++++------ Analyser/Static/Oric/StaticAnalyser.hpp | 2 +- Analyser/Static/StaticAnalyser.cpp | 12 ++--- Analyser/Static/StaticAnalyser.hpp | 8 ++-- Analyser/Static/ZX8081/StaticAnalyser.cpp | 28 ++++++------ Analyser/Static/ZX8081/StaticAnalyser.hpp | 2 +- Machines/Utility/MachineForTarget.cpp | 6 +-- Machines/Utility/MachineForTarget.hpp | 2 +- .../Clock Signal.xcodeproj/project.pbxproj | 40 ++++++++--------- .../Mac/Clock Signal/Machine/CSMachine.mm | 10 ++--- .../CSStaticAnalyser+TargetVector.h | 2 +- .../Machine/StaticAnalyser/CSStaticAnalyser.h | 2 - .../StaticAnalyser/CSStaticAnalyser.mm | 10 ++--- OSBindings/SDL/main.cpp | 6 +-- 24 files changed, 159 insertions(+), 165 deletions(-) diff --git a/Analyser/Static/Acorn/StaticAnalyser.cpp b/Analyser/Static/Acorn/StaticAnalyser.cpp index 10f653fd0..a251ef8c9 100644 --- a/Analyser/Static/Acorn/StaticAnalyser.cpp +++ b/Analyser/Static/Acorn/StaticAnalyser.cpp @@ -56,16 +56,16 @@ static std::vector> return acorn_cartridges; } -void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector &destination) { - Target target; - target.machine = Machine::Electron; - target.probability = 1.0; // TODO: a proper estimation - target.acorn.has_dfs = false; - target.acorn.has_adfs = false; - target.acorn.should_shift_restart = false; +void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector> &destination) { + std::unique_ptr target(new Target); + target->machine = Machine::Electron; + target->probability = 1.0; // TODO: a proper estimation + target->acorn.has_dfs = false; + target->acorn.has_adfs = false; + target->acorn.should_shift_restart = false; // strip out inappropriate cartridges - target.media.cartridges = AcornCartridgesFrom(media.cartridges); + target->media.cartridges = AcornCartridgesFrom(media.cartridges); // if there are any tapes, attempt to get data from the first if(media.tapes.size() > 0) { @@ -96,9 +96,9 @@ void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector // Inspect first file. If it's protected or doesn't look like BASIC // then the loading command is *RUN. Otherwise it's CHAIN"". - target.loading_command = is_basic ? "CHAIN\"\"\n" : "*RUN\n"; + target->loading_command = is_basic ? "CHAIN\"\"\n" : "*RUN\n"; - target.media.tapes = media.tapes; + target->media.tapes = media.tapes; } } @@ -108,18 +108,18 @@ void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector dfs_catalogue = GetDFSCatalogue(disk); if(dfs_catalogue == nullptr) adfs_catalogue = GetADFSCatalogue(disk); if(dfs_catalogue || adfs_catalogue) { - target.media.disks = media.disks; - target.acorn.has_dfs = !!dfs_catalogue; - target.acorn.has_adfs = !!adfs_catalogue; + target->media.disks = media.disks; + target->acorn.has_dfs = !!dfs_catalogue; + target->acorn.has_adfs = !!adfs_catalogue; Catalogue::BootOption bootOption = (dfs_catalogue ?: adfs_catalogue)->bootOption; if(bootOption != Catalogue::BootOption::None) - target.acorn.should_shift_restart = true; + target->acorn.should_shift_restart = true; else - target.loading_command = "*CAT\n"; + target->loading_command = "*CAT\n"; } } - if(target.media.tapes.size() || target.media.disks.size() || target.media.cartridges.size()) - destination.push_back(target); + if(target->media.tapes.size() || target->media.disks.size() || target->media.cartridges.size()) + destination.push_back(std::move(target)); } diff --git a/Analyser/Static/Acorn/StaticAnalyser.hpp b/Analyser/Static/Acorn/StaticAnalyser.hpp index a5f18efb3..695b5e183 100644 --- a/Analyser/Static/Acorn/StaticAnalyser.hpp +++ b/Analyser/Static/Acorn/StaticAnalyser.hpp @@ -15,7 +15,7 @@ namespace Analyser { namespace Static { namespace Acorn { -void AddTargets(const Media &media, std::vector &destination); +void AddTargets(const Media &media, std::vector> &destination); } } diff --git a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp index 8299da24b..04bae8d70 100644 --- a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp +++ b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp @@ -58,7 +58,7 @@ static std::string RunCommandFor(const Storage::Disk::CPM::File &file) { static void InspectCatalogue( const Storage::Disk::CPM::Catalogue &catalogue, - Analyser::Static::Target &target) { + const std::unique_ptr &target) { std::vector candidate_files; candidate_files.reserve(catalogue.files.size()); @@ -95,7 +95,7 @@ static void InspectCatalogue( // If there's just one file, run that. if(candidate_files.size() == 1) { - target.loading_command = RunCommandFor(*candidate_files[0]); + target->loading_command = RunCommandFor(*candidate_files[0]); return; } @@ -126,7 +126,7 @@ static void InspectCatalogue( } if(basic_files == 1 || implicit_suffixed_files == 1) { std::size_t selected_file = (basic_files == 1) ? last_basic_file : last_implicit_suffixed_file; - target.loading_command = RunCommandFor(*candidate_files[selected_file]); + target->loading_command = RunCommandFor(*candidate_files[selected_file]); return; } @@ -143,17 +143,17 @@ static void InspectCatalogue( if(name_counts.size() == 2) { for(auto &pair : name_counts) { if(pair.second == 1) { - target.loading_command = RunCommandFor(*candidate_files[indices_by_name[pair.first]]); + target->loading_command = RunCommandFor(*candidate_files[indices_by_name[pair.first]]); return; } } } // Desperation. - target.loading_command = "cat\n"; + target->loading_command = "cat\n"; } -static bool CheckBootSector(const std::shared_ptr &disk, Analyser::Static::Target &target) { +static bool CheckBootSector(const std::shared_ptr &disk, const std::unique_ptr &target) { Storage::Encodings::MFM::Parser parser(true, disk); Storage::Encodings::MFM::Sector *boot_sector = parser.get_sector(0, 0, 0x41); if(boot_sector != nullptr && !boot_sector->samples.empty()) { @@ -169,7 +169,7 @@ static bool CheckBootSector(const std::shared_ptr &disk, An // This is a system disk, then launch it as though it were CP/M. if(!matched) { - target.loading_command = "|cpm\n"; + target->loading_command = "|cpm\n"; return true; } } @@ -177,24 +177,24 @@ static bool CheckBootSector(const std::shared_ptr &disk, An return false; } -void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector &destination) { - Target target; - target.machine = Machine::AmstradCPC; - target.probability = 1.0; - target.media.disks = media.disks; - target.media.tapes = media.tapes; - target.media.cartridges = media.cartridges; +void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector> &destination) { + std::unique_ptr target(new Target); + target->machine = Machine::AmstradCPC; + target->probability = 1.0; + target->media.disks = media.disks; + target->media.tapes = media.tapes; + target->media.cartridges = media.cartridges; - target.amstradcpc.model = AmstradCPCModel::CPC6128; + target->amstradcpc.model = AmstradCPCModel::CPC6128; - if(!target.media.tapes.empty()) { + if(!target->media.tapes.empty()) { // Ugliness flows here: assume the CPC isn't smart enough to pause between pressing // enter and responding to the follow-on prompt to press a key, so just type for // a while. Yuck! - target.loading_command = "|tape\nrun\"\n1234567890"; + target->loading_command = "|tape\nrun\"\n1234567890"; } - if(!target.media.disks.empty()) { + if(!target->media.disks.empty()) { Storage::Disk::CPM::ParameterBlock data_format; data_format.sectors_per_track = 9; data_format.tracks = 40; @@ -203,11 +203,11 @@ void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector data_catalogue = Storage::Disk::CPM::GetCatalogue(target.media.disks.front(), data_format); + std::unique_ptr data_catalogue = Storage::Disk::CPM::GetCatalogue(target->media.disks.front(), data_format); if(data_catalogue) { InspectCatalogue(*data_catalogue, target); } else { - if(!CheckBootSector(target.media.disks.front(), target)) { + if(!CheckBootSector(target->media.disks.front(), target)) { Storage::Disk::CPM::ParameterBlock system_format; system_format.sectors_per_track = 9; system_format.tracks = 40; @@ -216,7 +216,7 @@ void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector system_catalogue = Storage::Disk::CPM::GetCatalogue(target.media.disks.front(), system_format); + std::unique_ptr system_catalogue = Storage::Disk::CPM::GetCatalogue(target->media.disks.front(), system_format); if(system_catalogue) { InspectCatalogue(*system_catalogue, target); } @@ -224,5 +224,5 @@ void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector &destination); +void AddTargets(const Media &media, std::vector> &destination); } } diff --git a/Analyser/Static/Atari/StaticAnalyser.cpp b/Analyser/Static/Atari/StaticAnalyser.cpp index 365aa6e8f..b687c0ada 100644 --- a/Analyser/Static/Atari/StaticAnalyser.cpp +++ b/Analyser/Static/Atari/StaticAnalyser.cpp @@ -178,14 +178,14 @@ static void DeterminePagingForCartridge(Analyser::Static::Target &target, const } } -void Analyser::Static::Atari::AddTargets(const Media &media, std::vector &destination) { +void Analyser::Static::Atari::AddTargets(const Media &media, std::vector> &destination) { // TODO: sanity checking; is this image really for an Atari 2600. - Target target; - target.machine = Machine::Atari2600; - target.probability = 1.0; - target.media.cartridges = media.cartridges; - target.atari.paging_model = Atari2600PagingModel::None; - target.atari.uses_superchip = false; + std::unique_ptr target(new Target); + target->machine = Machine::Atari2600; + target->probability = 1.0; + target->media.cartridges = media.cartridges; + target->atari.paging_model = Atari2600PagingModel::None; + target->atari.uses_superchip = false; // try to figure out the paging scheme if(!media.cartridges.empty()) { @@ -193,9 +193,9 @@ void Analyser::Static::Atari::AddTargets(const Media &media, std::vector if(segments.size() == 1) { const Storage::Cartridge::Cartridge::Segment &segment = segments.front(); - DeterminePagingForCartridge(target, segment); + DeterminePagingForCartridge(*target, segment); } } - destination.push_back(target); + destination.push_back(std::move(target)); } diff --git a/Analyser/Static/Atari/StaticAnalyser.hpp b/Analyser/Static/Atari/StaticAnalyser.hpp index 45957b675..8b3f03208 100644 --- a/Analyser/Static/Atari/StaticAnalyser.hpp +++ b/Analyser/Static/Atari/StaticAnalyser.hpp @@ -15,7 +15,7 @@ namespace Analyser { namespace Static { namespace Atari { -void AddTargets(const Media &media, std::vector &destination); +void AddTargets(const Media &media, std::vector> &destination); } } diff --git a/Analyser/Static/Commodore/StaticAnalyser.cpp b/Analyser/Static/Commodore/StaticAnalyser.cpp index 2bfa6971a..09aaf15fd 100644 --- a/Analyser/Static/Commodore/StaticAnalyser.cpp +++ b/Analyser/Static/Commodore/StaticAnalyser.cpp @@ -38,17 +38,17 @@ static std::vector> return vic20_cartridges; } -void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector &destination) { - Target target; - target.machine = Machine::Vic20; // TODO: machine estimation - target.probability = 1.0; // TODO: a proper estimation +void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector> &destination) { + std::unique_ptr target(new Target); + target->machine = Machine::Vic20; // TODO: machine estimation + target->probability = 1.0; // TODO: a proper estimation int device = 0; std::vector files; bool is_disk = false; // strip out inappropriate cartridges - target.media.cartridges = Vic20CartridgesFrom(media.cartridges); + target->media.cartridges = Vic20CartridgesFrom(media.cartridges); // check disks for(auto &disk : media.disks) { @@ -56,7 +56,7 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vectormedia.disks.push_back(disk); if(!device) device = 8; } } @@ -67,13 +67,13 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vectorreset(); if(!tape_files.empty()) { files.insert(files.end(), tape_files.begin(), tape_files.end()); - target.media.tapes.push_back(tape); + target->media.tapes.push_back(tape); if(!device) device = 1; } } if(!files.empty()) { - target.vic20.memory_model = Vic20MemoryModel::Unexpanded; + target->vic20.memory_model = Vic20MemoryModel::Unexpanded; std::ostringstream string_stream; string_stream << "LOAD\"" << (is_disk ? "*" : "") << "\"," << device << ","; if(files.front().is_basic()) { @@ -82,17 +82,17 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vectorloading_command = string_stream.str(); // make a first guess based on loading address switch(files.front().starting_address) { case 0x1001: default: break; case 0x1201: - target.vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; + target->vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; break; case 0x0401: - target.vic20.memory_model = Vic20MemoryModel::EightKB; + target->vic20.memory_model = Vic20MemoryModel::EightKB; break; } @@ -108,9 +108,9 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector 6655) - target.vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; - else if(target.vic20.memory_model == Vic20MemoryModel::Unexpanded && file_size > 3583) - target.vic20.memory_model = Vic20MemoryModel::EightKB; + target->vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; + else if(target->vic20.memory_model == Vic20MemoryModel::Unexpanded && file_size > 3583) + target->vic20.memory_model = Vic20MemoryModel::EightKB; } else {*/ @@ -129,13 +129,13 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector 0x2000) - target.vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; - else if(target.vic20.memory_model == Vic20MemoryModel::Unexpanded && !(starting_address >= 0x1000 || starting_address+file_size < 0x0400)) - target.vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; + target->vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; + else if(target->vic20.memory_model == Vic20MemoryModel::Unexpanded && !(starting_address >= 0x1000 || starting_address+file_size < 0x0400)) + target->vic20.memory_model = Vic20MemoryModel::ThirtyTwoKB; // } } } - if(!target.media.tapes.empty() || !target.media.cartridges.empty() || !target.media.disks.empty()) - destination.push_back(target); + if(!target->media.empty()) + destination.push_back(std::move(target)); } diff --git a/Analyser/Static/Commodore/StaticAnalyser.hpp b/Analyser/Static/Commodore/StaticAnalyser.hpp index 4a5f3adde..a318cd16e 100644 --- a/Analyser/Static/Commodore/StaticAnalyser.hpp +++ b/Analyser/Static/Commodore/StaticAnalyser.hpp @@ -15,7 +15,7 @@ namespace Analyser { namespace Static { namespace Commodore { -void AddTargets(const Media &media, std::vector &destination); +void AddTargets(const Media &media, std::vector> &destination); } } diff --git a/Analyser/Static/MSX/StaticAnalyser.cpp b/Analyser/Static/MSX/StaticAnalyser.cpp index 9e7328cad..1a0ae98b1 100644 --- a/Analyser/Static/MSX/StaticAnalyser.cpp +++ b/Analyser/Static/MSX/StaticAnalyser.cpp @@ -200,32 +200,32 @@ static std::vector> return msx_cartridges; } -void Analyser::Static::MSX::AddTargets(const Media &media, std::vector &destination) { - Target target; +void Analyser::Static::MSX::AddTargets(const Media &media, std::vector> &destination) { + std::unique_ptr target(new Target); // Obtain only those cartridges which it looks like an MSX would understand. - target.media.cartridges = MSXCartridgesFrom(media.cartridges, target); + target->media.cartridges = MSXCartridgesFrom(media.cartridges, *target); // Check tapes for loadable files. for(const auto &tape : media.tapes) { std::vector files_on_tape = GetFiles(tape); if(!files_on_tape.empty()) { switch(files_on_tape.front().type) { - case File::Type::ASCII: target.loading_command = "RUN\"CAS:\r"; break; - case File::Type::TokenisedBASIC: target.loading_command = "CLOAD\rRUN\r"; break; - case File::Type::Binary: target.loading_command = "BLOAD\"CAS:\",R\r"; break; + case File::Type::ASCII: target->loading_command = "RUN\"CAS:\r"; break; + case File::Type::TokenisedBASIC: target->loading_command = "CLOAD\rRUN\r"; break; + case File::Type::Binary: target->loading_command = "BLOAD\"CAS:\",R\r"; break; default: break; } - target.media.tapes.push_back(tape); + target->media.tapes.push_back(tape); } } // Blindly accept disks for now. - target.media.disks = media.disks; + target->media.disks = media.disks; - if(!target.media.empty()) { - target.machine = Machine::MSX; - target.probability = 1.0; - destination.push_back(target); + if(!target->media.empty()) { + target->machine = Machine::MSX; + target->probability = 1.0; + destination.push_back(std::move(target)); } } diff --git a/Analyser/Static/MSX/StaticAnalyser.hpp b/Analyser/Static/MSX/StaticAnalyser.hpp index 9e03b783e..4f08ebb9d 100644 --- a/Analyser/Static/MSX/StaticAnalyser.hpp +++ b/Analyser/Static/MSX/StaticAnalyser.hpp @@ -15,7 +15,7 @@ namespace Analyser { namespace Static { namespace MSX { -void AddTargets(const Media &media, std::vector &destination); +void AddTargets(const Media &media, std::vector> &destination); } } diff --git a/Analyser/Static/Oric/StaticAnalyser.cpp b/Analyser/Static/Oric/StaticAnalyser.cpp index 53dfb2990..42101d52d 100644 --- a/Analyser/Static/Oric/StaticAnalyser.cpp +++ b/Analyser/Static/Oric/StaticAnalyser.cpp @@ -73,10 +73,10 @@ static int Basic11Score(const Analyser::Static::MOS6502::Disassembly &disassembl return Score(disassembly, rom_functions, variable_locations); } -void Analyser::Static::Oric::AddTargets(const Media &media, std::vector &destination) { - Target target; - target.machine = Machine::Oric; - target.probability = 1.0; +void Analyser::Static::Oric::AddTargets(const Media &media, std::vector> &destination) { + std::unique_ptr target(new Target); + target->machine = Machine::Oric; + target->probability = 1.0; int basic10_votes = 0; int basic11_votes = 0; @@ -97,23 +97,23 @@ void Analyser::Static::Oric::AddTargets(const Media &media, std::vector } } - target.media.tapes.push_back(tape); - target.loading_command = "CLOAD\"\"\n"; + target->media.tapes.push_back(tape); + target->loading_command = "CLOAD\"\"\n"; } } // trust that any disk supplied can be handled by the Microdisc. TODO: check. if(!media.disks.empty()) { - target.oric.has_microdisc = true; - target.media.disks = media.disks; + target->oric.has_microdisc = true; + target->media.disks = media.disks; } else { - target.oric.has_microdisc = false; + target->oric.has_microdisc = false; } // TODO: really this should add two targets if not all votes agree - target.oric.use_atmos_rom = basic11_votes >= basic10_votes; - if(target.oric.has_microdisc) target.oric.use_atmos_rom = true; + target->oric.use_atmos_rom = basic11_votes >= basic10_votes; + if(target->oric.has_microdisc) target->oric.use_atmos_rom = true; - if(target.media.tapes.size() || target.media.disks.size() || target.media.cartridges.size()) - destination.push_back(target); + if(target->media.tapes.size() || target->media.disks.size() || target->media.cartridges.size()) + destination.push_back(std::move(target)); } diff --git a/Analyser/Static/Oric/StaticAnalyser.hpp b/Analyser/Static/Oric/StaticAnalyser.hpp index decf9ebd1..1f2823be6 100644 --- a/Analyser/Static/Oric/StaticAnalyser.hpp +++ b/Analyser/Static/Oric/StaticAnalyser.hpp @@ -15,7 +15,7 @@ namespace Analyser { namespace Static { namespace Oric { -void AddTargets(const Media &media, std::vector &destination); +void AddTargets(const Media &media, std::vector> &destination); } } diff --git a/Analyser/Static/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp index 9851a6d09..6f59f8853 100644 --- a/Analyser/Static/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -88,8 +88,8 @@ static Media GetMediaAndPlatforms(const char *file_name, TargetPlatform::IntType Format("adf", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // ADF Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // BIN Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS - Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT - Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW + Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT + Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW Format("d64", result.disks, Disk::DiskImageHolder, TargetPlatform::Commodore) // D64 Format("dmk", result.disks, Disk::DiskImageHolder, TargetPlatform::MSX) // DMK Format("dsd", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // DSD @@ -139,8 +139,8 @@ Media Analyser::Static::GetMedia(const char *file_name) { return GetMediaAndPlatforms(file_name, throwaway); } -std::vector Analyser::Static::GetTargets(const char *file_name) { - std::vector targets; +std::vector> Analyser::Static::GetTargets(const char *file_name) { + std::vector> 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. @@ -158,8 +158,8 @@ std::vector Analyser::Static::GetTargets(const char *file_name) { if(potential_platforms & TargetPlatform::ZX8081) ZX8081::AddTargets(media, targets, potential_platforms); // Reset any tapes to their initial position - for(auto target : targets) { - for(auto tape : media.tapes) { + for(auto &target : targets) { + for(auto &tape : target->media.tapes) { tape->reset(); } } diff --git a/Analyser/Static/StaticAnalyser.hpp b/Analyser/Static/StaticAnalyser.hpp index b027245f0..86d49bd76 100644 --- a/Analyser/Static/StaticAnalyser.hpp +++ b/Analyser/Static/StaticAnalyser.hpp @@ -82,7 +82,10 @@ struct Media { */ struct Target { Machine machine; + Media media; + float probability; + std::string loading_command; // TODO: this is too C-like a solution; make Target a base class and // turn the following into information held by more specific subclasses. @@ -121,9 +124,6 @@ struct Target { MSXCartridgeType cartridge_type; } msx; }; - - std::string loading_command; - Media media; }; /*! @@ -131,7 +131,7 @@ struct Target { @returns The list of potential targets, sorted from most to least probable. */ -std::vector GetTargets(const char *file_name); +std::vector> GetTargets(const char *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 8e1aefa4a..266b4c9df 100644 --- a/Analyser/Static/ZX8081/StaticAnalyser.cpp +++ b/Analyser/Static/ZX8081/StaticAnalyser.cpp @@ -27,41 +27,41 @@ static std::vector GetFiles(const std::shared_ptr &destination, TargetPlatform::IntType potential_platforms) { +void Analyser::Static::ZX8081::AddTargets(const Media &media, std::vector> &destination, TargetPlatform::IntType potential_platforms) { if(!media.tapes.empty()) { std::vector files = GetFiles(media.tapes.front()); media.tapes.front()->reset(); if(!files.empty()) { - Analyser::Static::Target target; - target.machine = Machine::ZX8081; + std::unique_ptr target(new Target); + target->machine = Machine::ZX8081; // 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; + target->zx8081.isZX81 = files.front().isZX81; break; - case TargetPlatform::ZX80: target.zx8081.isZX81 = false; break; - case TargetPlatform::ZX81: target.zx8081.isZX81 = true; 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; + target->zx8081.memory_model = ZX8081MemoryModel::SixtyFourKB; } else*/ if(files.front().data.size() > 1024) { - target.zx8081.memory_model = ZX8081MemoryModel::SixteenKB; + target->zx8081.memory_model = ZX8081MemoryModel::SixteenKB; } else { - target.zx8081.memory_model = ZX8081MemoryModel::Unexpanded; + target->zx8081.memory_model = ZX8081MemoryModel::Unexpanded; } - target.media.tapes = media.tapes; + target->media.tapes = media.tapes; // TODO: how to run software once loaded? Might require a BASIC detokeniser. - if(target.zx8081.isZX81) { - target.loading_command = "J\"\"\n"; + if(target->zx8081.isZX81) { + target->loading_command = "J\"\"\n"; } else { - target.loading_command = "W\n"; + target->loading_command = "W\n"; } - destination.push_back(target); + destination.push_back(std::move(target)); } } } diff --git a/Analyser/Static/ZX8081/StaticAnalyser.hpp b/Analyser/Static/ZX8081/StaticAnalyser.hpp index bf1f071ec..420f21136 100644 --- a/Analyser/Static/ZX8081/StaticAnalyser.hpp +++ b/Analyser/Static/ZX8081/StaticAnalyser.hpp @@ -16,7 +16,7 @@ namespace Analyser { namespace Static { namespace ZX8081 { -void AddTargets(const Media &media, std::vector &destination, TargetPlatform::IntType potential_platforms); +void AddTargets(const Media &media, std::vector> &destination, TargetPlatform::IntType potential_platforms); } } diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 78f962495..6769e8aa0 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -18,16 +18,16 @@ #include "TypedDynamicMachine.hpp" -::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector &targets) { +::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector> &targets) { // TODO: deal with target lists containing more than one machine. - switch(targets.front().machine) { + switch(targets.front()->machine) { case Analyser::Machine::AmstradCPC: return new TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); case Analyser::Machine::Atari2600: return new TypedDynamicMachine(Atari2600::Machine::Atari2600()); case Analyser::Machine::Electron: return new TypedDynamicMachine(Electron::Machine::Electron()); case Analyser::Machine::MSX: return new TypedDynamicMachine(MSX::Machine::MSX()); case Analyser::Machine::Oric: return new TypedDynamicMachine(Oric::Machine::Oric()); case Analyser::Machine::Vic20: return new TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); - case Analyser::Machine::ZX8081: return new TypedDynamicMachine(ZX8081::Machine::ZX8081(targets.front())); + case Analyser::Machine::ZX8081: return new TypedDynamicMachine(ZX8081::Machine::ZX8081(*targets.front())); default: return nullptr; } diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index 0b04e3853..e78b215ad 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -42,7 +42,7 @@ struct DynamicMachine { receive the supplied static analyser result. The machine has been allocated on the heap. It is the caller's responsibility to delete the class when finished. */ -DynamicMachine *MachineForTargets(const std::vector &target); +DynamicMachine *MachineForTargets(const std::vector> &targets); /*! Returns a short string name for the machine identified by the target, diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 994095090..bceb8e7dc 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -2060,11 +2060,11 @@ 4B8944E3201967B4007DE474 /* Dynamic */ = { isa = PBXGroup; children = ( - 4B8944E4201967B4007DE474 /* ConfidenceSummary.hpp */, - 4B8944E5201967B4007DE474 /* ConfidenceSource.hpp */, 4B8944E6201967B4007DE474 /* ConfidenceCounter.cpp */, - 4B8944E7201967B4007DE474 /* ConfidenceCounter.hpp */, 4B8944E8201967B4007DE474 /* ConfidenceSummary.cpp */, + 4B8944E7201967B4007DE474 /* ConfidenceCounter.hpp */, + 4B8944E5201967B4007DE474 /* ConfidenceSource.hpp */, + 4B8944E4201967B4007DE474 /* ConfidenceSummary.hpp */, ); path = Dynamic; sourceTree = ""; @@ -2090,12 +2090,12 @@ isa = PBXGroup; children = ( 4B8944EC201967B4007DE474 /* Disk.cpp */, - 4B8944ED201967B4007DE474 /* StaticAnalyser.hpp */, - 4B8944EE201967B4007DE474 /* File.hpp */, - 4B8944EF201967B4007DE474 /* Tape.hpp */, + 4B8944F2201967B4007DE474 /* StaticAnalyser.cpp */, 4B8944F0201967B4007DE474 /* Tape.cpp */, 4B8944F1201967B4007DE474 /* Disk.hpp */, - 4B8944F2201967B4007DE474 /* StaticAnalyser.cpp */, + 4B8944EE201967B4007DE474 /* File.hpp */, + 4B8944ED201967B4007DE474 /* StaticAnalyser.hpp */, + 4B8944EF201967B4007DE474 /* Tape.hpp */, ); path = Acorn; sourceTree = ""; @@ -2103,8 +2103,8 @@ 4B8944F3201967B4007DE474 /* Atari */ = { isa = PBXGroup; children = ( - 4B8944F4201967B4007DE474 /* StaticAnalyser.hpp */, 4B8944F5201967B4007DE474 /* StaticAnalyser.cpp */, + 4B8944F4201967B4007DE474 /* StaticAnalyser.hpp */, ); path = Atari; sourceTree = ""; @@ -2112,10 +2112,10 @@ 4B8944F6201967B4007DE474 /* Oric */ = { isa = PBXGroup; children = ( + 4B8944FA201967B4007DE474 /* StaticAnalyser.cpp */, + 4B8944F9201967B4007DE474 /* Tape.cpp */, 4B8944F7201967B4007DE474 /* StaticAnalyser.hpp */, 4B8944F8201967B4007DE474 /* Tape.hpp */, - 4B8944F9201967B4007DE474 /* Tape.cpp */, - 4B8944FA201967B4007DE474 /* StaticAnalyser.cpp */, ); path = Oric; sourceTree = ""; @@ -2124,12 +2124,12 @@ isa = PBXGroup; children = ( 4B8944FC201967B4007DE474 /* Disk.cpp */, - 4B894502201967B4007DE474 /* Disk.hpp */, 4B894500201967B4007DE474 /* File.cpp */, - 4B8944FE201967B4007DE474 /* File.hpp */, 4B894503201967B4007DE474 /* StaticAnalyser.cpp */, - 4B8944FD201967B4007DE474 /* StaticAnalyser.hpp */, 4B894501201967B4007DE474 /* Tape.cpp */, + 4B894502201967B4007DE474 /* Disk.hpp */, + 4B8944FE201967B4007DE474 /* File.hpp */, + 4B8944FD201967B4007DE474 /* StaticAnalyser.hpp */, 4B8944FF201967B4007DE474 /* Tape.hpp */, ); path = Commodore; @@ -2138,8 +2138,8 @@ 4B894504201967B4007DE474 /* ZX8081 */ = { isa = PBXGroup; children = ( - 4B894505201967B4007DE474 /* StaticAnalyser.hpp */, 4B894506201967B4007DE474 /* StaticAnalyser.cpp */, + 4B894505201967B4007DE474 /* StaticAnalyser.hpp */, ); path = ZX8081; sourceTree = ""; @@ -2147,13 +2147,13 @@ 4B894507201967B4007DE474 /* Disassembler */ = { isa = PBXGroup; children = ( - 4B894508201967B4007DE474 /* 6502.hpp */, - 4B894509201967B4007DE474 /* AddressMapper.hpp */, - 4B89450A201967B4007DE474 /* Z80.hpp */, 4B89450B201967B4007DE474 /* 6502.cpp */, 4B89450C201967B4007DE474 /* AddressMapper.cpp */, 4B89450D201967B4007DE474 /* Z80.cpp */, + 4B894508201967B4007DE474 /* 6502.hpp */, + 4B894509201967B4007DE474 /* AddressMapper.hpp */, 4B89450E201967B4007DE474 /* Kernel.hpp */, + 4B89450A201967B4007DE474 /* Z80.hpp */, ); path = Disassembler; sourceTree = ""; @@ -2161,10 +2161,10 @@ 4B89450F201967B4007DE474 /* MSX */ = { isa = PBXGroup; children = ( + 4B894513201967B4007DE474 /* StaticAnalyser.cpp */, + 4B894512201967B4007DE474 /* Tape.cpp */, 4B894510201967B4007DE474 /* StaticAnalyser.hpp */, 4B894511201967B4007DE474 /* Tape.hpp */, - 4B894512201967B4007DE474 /* Tape.cpp */, - 4B894513201967B4007DE474 /* StaticAnalyser.cpp */, ); path = MSX; sourceTree = ""; @@ -2172,8 +2172,8 @@ 4B894514201967B4007DE474 /* AmstradCPC */ = { isa = PBXGroup; children = ( - 4B894515201967B4007DE474 /* StaticAnalyser.hpp */, 4B894516201967B4007DE474 /* StaticAnalyser.cpp */, + 4B894515201967B4007DE474 /* StaticAnalyser.hpp */, ); path = AmstradCPC; sourceTree = ""; diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm index af37e18e4..4d0b5900c 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm @@ -63,15 +63,15 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg MachineDelegate _machineDelegate; NSLock *_delegateMachineAccessLock; - std::vector _targets; + CSStaticAnalyser *_analyser; std::unique_ptr _machine; } - (instancetype)initWithAnalyser:(CSStaticAnalyser *)result { self = [super init]; if(self) { - _targets = result.targets; - _machine.reset(Machine::MachineForTargets(_targets)); + _analyser = result; + _machine.reset(Machine::MachineForTargets(_analyser.targets)); _delegateMachineAccessLock = [[NSLock alloc] init]; _machineDelegate.machine = self; @@ -82,7 +82,7 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg _machine->crt_machine()->set_delegate(&_machineDelegate); CSApplyROMFetcher(*_machine->crt_machine()); - [self applyTarget:_targets.front()]; + [self applyTarget:*_analyser.targets.front()]; } return self; } @@ -344,7 +344,7 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg - (NSString *)userDefaultsPrefix { // Assumes that the first machine in the targets list is the source of user defaults. - std::string name = Machine::ShortNameForTargetMachine(_targets.front().machine); + std::string name = Machine::ShortNameForTargetMachine(_analyser.targets.front()->machine); return [[NSString stringWithUTF8String:name.c_str()] lowercaseString]; } diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h index a7d0dc5a0..6d563c4b2 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser+TargetVector.h @@ -10,6 +10,6 @@ @interface CSStaticAnalyser (ResultVector) -- (std::vector &)targets; +- (std::vector> &)targets; @end diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h index ea7dde231..47457adeb 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h @@ -17,8 +17,6 @@ @property(nonatomic, readonly) NSString *optionsPanelNibName; @property(nonatomic, readonly) NSString *displayName; -- (void)applyToMachine:(CSMachine *)machine; - @end @interface CSMediaSet : NSObject diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index fc29fbc25..da59b2b01 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -17,7 +17,7 @@ #import "Clock_Signal-Swift.h" @implementation CSStaticAnalyser { - std::vector _targets; + std::vector> _targets; } - (instancetype)initWithFileAtURL:(NSURL *)url { @@ -34,7 +34,7 @@ } - (NSString *)optionsPanelNibName { - switch(_targets.front().machine) { + switch(_targets.front()->machine) { case Analyser::Machine::AmstradCPC: return nil; case Analyser::Machine::Atari2600: return @"Atari2600Options"; case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions"; @@ -46,11 +46,7 @@ } } -- (void)applyToMachine:(CSMachine *)machine { - [machine applyTarget:_targets.front()]; -} - -- (std::vector &)targets { +- (std::vector> &)targets { return _targets; } diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index ee2e45f50..da7098b1d 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -13,7 +13,7 @@ #include -#include "../../StaticAnalyser/StaticAnalyser.hpp" +#include "../../Analyser/Static/StaticAnalyser.hpp" #include "../../Machines/Utility/MachineForTarget.hpp" #include "../../Machines/ConfigurationTarget.hpp" @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) { } // Determine the machine for the supplied file. - std::vector targets = Analyser::Static::GetTargets(arguments.file_name.c_str()); + std::vector> targets = Analyser::Static::GetTargets(arguments.file_name.c_str()); if(targets.empty()) { std::cerr << "Cannot open " << arguments.file_name << std::endl; return -1; @@ -353,7 +353,7 @@ int main(int argc, char *argv[]) { return -1; } - machine->configuration_target()->configure_as_target(targets.front()); + machine->configuration_target()->configure_as_target(*targets.front()); // Setup output, assuming a CRT machine for now, and prepare a best-effort updater. machine->crt_machine()->setup_output(4.0 / 3.0); From 66faed40087ec77e1cfb21ca5efe04197ccd16ad Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 25 Jan 2018 18:28:19 -0500 Subject: [PATCH 08/37] Gives `MachineForTargets` complete responsibility for initial machine state. --- Machines/ROMMachine.hpp | 4 +- Machines/Utility/MachineForTarget.cpp | 42 +++++-- Machines/Utility/MachineForTarget.hpp | 9 +- .../Clock Signal/Machine/CSMachine+Target.h | 1 - .../Mac/Clock Signal/Machine/CSMachine.mm | 16 +-- .../Mac/Clock Signal/Machine/CSROMFetcher.hpp | 2 +- .../Mac/Clock Signal/Machine/CSROMFetcher.mm | 6 +- .../AtariStaticAnalyserTests.mm | 8 +- .../Clock SignalTests/Bridges/C1540Bridge.mm | 2 +- .../MSXStaticAnalyserTests.mm | 6 +- OSBindings/SDL/main.cpp | 112 +++++++++--------- 11 files changed, 119 insertions(+), 89 deletions(-) diff --git a/Machines/ROMMachine.hpp b/Machines/ROMMachine.hpp index d95ae7042..4c40e8bad 100644 --- a/Machines/ROMMachine.hpp +++ b/Machines/ROMMachine.hpp @@ -15,11 +15,13 @@ namespace ROMMachine { +typedef std::function>>(const std::string &machine, const std::vector &names)> ROMFetcher; + struct Machine { /*! Provides the machine with a way to obtain such ROMs as it needs. */ - virtual bool set_rom_fetcher(const std::function>>(const std::string &machine, const std::vector &names)> &rom_with_name) { return true; } + virtual bool set_rom_fetcher(const ROMFetcher &rom_with_name) { return true; } }; } diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 6769e8aa0..c71e33303 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -18,19 +18,41 @@ #include "TypedDynamicMachine.hpp" -::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector> &targets) { +::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector> &targets, const ROMMachine::ROMFetcher &rom_fetcher, Error &error) { // TODO: deal with target lists containing more than one machine. - switch(targets.front()->machine) { - case Analyser::Machine::AmstradCPC: return new TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); - case Analyser::Machine::Atari2600: return new TypedDynamicMachine(Atari2600::Machine::Atari2600()); - case Analyser::Machine::Electron: return new TypedDynamicMachine(Electron::Machine::Electron()); - case Analyser::Machine::MSX: return new TypedDynamicMachine(MSX::Machine::MSX()); - case Analyser::Machine::Oric: return new TypedDynamicMachine(Oric::Machine::Oric()); - case Analyser::Machine::Vic20: return new TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); - case Analyser::Machine::ZX8081: return new TypedDynamicMachine(ZX8081::Machine::ZX8081(*targets.front())); - default: return nullptr; + error = Error::None; + ::Machine::DynamicMachine *machine = nullptr; + switch(targets.front()->machine) { + case Analyser::Machine::AmstradCPC: machine = new TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); break; + case Analyser::Machine::Atari2600: machine = new TypedDynamicMachine(Atari2600::Machine::Atari2600()); break; + case Analyser::Machine::Electron: machine = new TypedDynamicMachine(Electron::Machine::Electron()); break; + case Analyser::Machine::MSX: machine = new TypedDynamicMachine(MSX::Machine::MSX()); break; + case Analyser::Machine::Oric: machine = new TypedDynamicMachine(Oric::Machine::Oric()); break; + case Analyser::Machine::Vic20: machine = new TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); break; + case Analyser::Machine::ZX8081: machine = new TypedDynamicMachine(ZX8081::Machine::ZX8081(*targets.front())); break; + + default: + error = Error::UnknownMachine; + return nullptr; } + + // TODO: this shouldn't depend on CRT machine's inclusion of ROM machine. + CRTMachine::Machine *crt_machine = machine->crt_machine(); + if(crt_machine) { + if(!machine->crt_machine()->set_rom_fetcher(rom_fetcher)) { + delete machine; + error = Error::MissingROM; + return nullptr; + } + } + + ConfigurationTarget::Machine *configuration_target = machine->configuration_target(); + if(configuration_target) { + machine->configuration_target()->configure_as_target(*targets.front()); + } + + return machine; } std::string Machine::ShortNameForTargetMachine(const Analyser::Machine machine) { diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index e78b215ad..b54fbc120 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -29,6 +29,7 @@ namespace Machine { the machine's parent class or, therefore, the need to establish a common one. */ struct DynamicMachine { + virtual ~DynamicMachine() {} virtual ConfigurationTarget::Machine *configuration_target() = 0; virtual CRTMachine::Machine *crt_machine() = 0; virtual JoystickMachine::Machine *joystick_machine() = 0; @@ -37,12 +38,18 @@ struct DynamicMachine { virtual Utility::TypeRecipient *type_recipient() = 0; }; +enum class Error { + None, + UnknownMachine, + MissingROM +}; + /*! Allocates an instance of DynamicMachine holding a machine that can receive the supplied static analyser result. The machine has been allocated on the heap. It is the caller's responsibility to delete the class when finished. */ -DynamicMachine *MachineForTargets(const std::vector> &targets); +DynamicMachine *MachineForTargets(const std::vector> &targets, const ::ROMMachine::ROMFetcher &rom_fetcher, Error &error); /*! Returns a short string name for the machine identified by the target, diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h b/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h index c754dd1a2..83f25a981 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine+Target.h @@ -12,7 +12,6 @@ @interface CSMachine(Target) -- (void)applyTarget:(const Analyser::Static::Target &)target; - (void)applyMedia:(const Analyser::Static::Media &)media; @end diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm index 4d0b5900c..15fd31701 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm @@ -71,7 +71,11 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg self = [super init]; if(self) { _analyser = result; - _machine.reset(Machine::MachineForTargets(_analyser.targets)); + + Machine::Error error; + _machine.reset(Machine::MachineForTargets(_analyser.targets, CSROMFetcher(), error)); + if(!_machine) return nil; + _delegateMachineAccessLock = [[NSLock alloc] init]; _machineDelegate.machine = self; @@ -80,9 +84,6 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg _speakerDelegate.machineAccessLock = _delegateMachineAccessLock; _machine->crt_machine()->set_delegate(&_machineDelegate); - CSApplyROMFetcher(*_machine->crt_machine()); - - [self applyTarget:*_analyser.targets.front()]; } return self; } @@ -185,13 +186,6 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg keyboardMachine->type_string([paste UTF8String]); } -- (void)applyTarget:(const Analyser::Static::Target &)target { - @synchronized(self) { - ConfigurationTarget::Machine *const configurationTarget = _machine->configuration_target(); - if(configurationTarget) configurationTarget->configure_as_target(target); - } -} - - (void)applyMedia:(const Analyser::Static::Media &)media { @synchronized(self) { ConfigurationTarget::Machine *const configurationTarget = _machine->configuration_target(); diff --git a/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.hpp b/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.hpp index 0580df92e..0cf1201b2 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.hpp +++ b/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.hpp @@ -8,4 +8,4 @@ #include "ROMMachine.hpp" -void CSApplyROMFetcher(ROMMachine::Machine &rom_machine); +ROMMachine::ROMFetcher CSROMFetcher(); diff --git a/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm b/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm index b6e995c7c..e95259a07 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSROMFetcher.mm @@ -14,8 +14,8 @@ #include -void CSApplyROMFetcher(ROMMachine::Machine &rom_machine) { - rom_machine.set_rom_fetcher( [] (const std::string &machine, const std::vector &names) -> std::vector>> { +ROMMachine::ROMFetcher CSROMFetcher() { + return [] (const std::string &machine, const std::vector &names) -> std::vector>> { NSString *subDirectory = [@"ROMImages/" stringByAppendingString:[NSString stringWithUTF8String:machine.c_str()]]; std::vector>> results; for(auto &name: names) { @@ -31,5 +31,5 @@ void CSApplyROMFetcher(ROMMachine::Machine &rom_machine) { } return results; - }); + }; } diff --git a/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm b/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm index 8d6319118..f4c4264ee 100644 --- a/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm +++ b/OSBindings/Mac/Clock SignalTests/AtariStaticAnalyserTests.mm @@ -9,7 +9,7 @@ #import #import -#include "../../../StaticAnalyser/StaticAnalyser.hpp" +#include "../../../Analyser/Static/StaticAnalyser.hpp" @interface AtariROMRecord : NSObject @property(nonatomic, readonly) Analyser::Static::Atari2600PagingModel pagingModel; @@ -591,15 +591,15 @@ static NSDictionary *romRecordsBySHA1 = @{ for(int c = 0; c < CC_SHA1_DIGEST_LENGTH; c++) [sha1 appendFormat:@"%02x", sha1Bytes[c]]; // get an analysis of the file - std::list targets = Analyser::Static::GetTargets([fullPath UTF8String]); + std::vector> targets = Analyser::Static::GetTargets([fullPath UTF8String]); // grab the ROM record AtariROMRecord *romRecord = romRecordsBySHA1[sha1]; if(!romRecord) continue; // assert equality - XCTAssert(targets.front().atari.paging_model == romRecord.pagingModel, @"%@; should be %d, is %d", testFile, romRecord.pagingModel, targets.front().atari.paging_model); - XCTAssert(targets.front().atari.uses_superchip == romRecord.usesSuperchip, @"%@; should be %@", testFile, romRecord.usesSuperchip ? @"true" : @"false"); + XCTAssert(targets.front()->atari.paging_model == romRecord.pagingModel, @"%@; should be %d, is %d", testFile, romRecord.pagingModel, targets.front()->atari.paging_model); + XCTAssert(targets.front()->atari.uses_superchip == romRecord.usesSuperchip, @"%@; should be %@", testFile, romRecord.usesSuperchip ? @"true" : @"false"); } } diff --git a/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm b/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm index 7cd2f495a..89abd2b98 100644 --- a/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm +++ b/OSBindings/Mac/Clock SignalTests/Bridges/C1540Bridge.mm @@ -33,7 +33,7 @@ class VanillaSerialPort: public Commodore::Serial::Port { _serialPort.reset(new VanillaSerialPort); _c1540.reset(new Commodore::C1540::Machine(Commodore::C1540::Machine::C1540)); - CSApplyROMFetcher(*_c1540); + _c1540->set_rom_fetcher(CSROMFetcher()); _c1540->set_serial_bus(_serialBus); Commodore::Serial::AttachPortAndBus(_serialPort, _serialBus); } diff --git a/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm b/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm index 89db00c89..3f3f6afce 100644 --- a/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm +++ b/OSBindings/Mac/Clock SignalTests/MSXStaticAnalyserTests.mm @@ -9,7 +9,7 @@ #import #import -#include "../../../StaticAnalyser/StaticAnalyser.hpp" +#include "../../../Analyser/Static/StaticAnalyser.hpp" @interface MSXROMRecord : NSObject @property(nonatomic, readonly) Analyser::Static::MSXCartridgeType cartridgeType; @@ -211,7 +211,7 @@ static NSDictionary *romRecordsBySHA1 = @{ for(int c = 0; c < CC_SHA1_DIGEST_LENGTH; c++) [sha1 appendFormat:@"%02x", sha1Bytes[c]]; // get an analysis of the file - std::list targets = Analyser::Static::GetTargets([fullPath UTF8String]); + std::vector> targets = Analyser::Static::GetTargets([fullPath UTF8String]); // grab the ROM record MSXROMRecord *romRecord = romRecordsBySHA1[sha1]; @@ -222,7 +222,7 @@ static NSDictionary *romRecordsBySHA1 = @{ // assert equality XCTAssert(!targets.empty(), "%@ should be recognised as an MSX file", testFile); if(!targets.empty()) { - XCTAssert(targets.front().msx.cartridge_type == romRecord.cartridgeType, @"%@; should be %d, is %d", testFile, romRecord.cartridgeType, targets.front().msx.cartridge_type); + XCTAssert(targets.front()->msx.cartridge_type == romRecord.cartridgeType, @"%@; should be %d, is %d", testFile, romRecord.cartridgeType, targets.front()->msx.cartridge_type); } } } diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index da7098b1d..e27b213c6 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -261,8 +261,65 @@ int main(int argc, char *argv[]) { CRTMachineDelegate crt_delegate; SpeakerDelegate speaker_delegate; + // For vanilla SDL purposes, assume system ROMs can be found in one of: + // + // /usr/local/share/CLK/[system]; or + // /usr/share/CLK/[system] + std::vector rom_names; + std::string machine_name; + ROMMachine::ROMFetcher rom_fetcher = [&rom_names, &machine_name] + (const std::string &machine, const std::vector &names) -> std::vector>> { + rom_names.insert(rom_names.end(), names.begin(), names.end()); + machine_name = machine; + + std::vector>> results; + for(auto &name: names) { + std::string local_path = "/usr/local/share/CLK/" + machine + "/" + name; + FILE *file = std::fopen(local_path.c_str(), "rb"); + if(!file) { + std::string path = "/usr/share/CLK/" + machine + "/" + name; + file = std::fopen(path.c_str(), "rb"); + } + + if(!file) { + results.emplace_back(nullptr); + continue; + } + + std::unique_ptr> data(new std::vector); + + std::fseek(file, 0, SEEK_END); + data->resize(std::ftell(file)); + std::fseek(file, 0, SEEK_SET); + std::size_t read = fread(data->data(), 1, data->size(), file); + std::fclose(file); + + if(read == data->size()) + results.emplace_back(std::move(data)); + else + results.emplace_back(nullptr); + } + + return results; + }; + // Create and configure a machine. - std::unique_ptr<::Machine::DynamicMachine> machine(::Machine::MachineForTargets(targets)); + ::Machine::Error error; + std::unique_ptr<::Machine::DynamicMachine> machine(::Machine::MachineForTargets(targets, rom_fetcher, error)); + if(!machine) { + switch(error) { + default: break; + case ::Machine::Error::MissingROM: + std::cerr << "Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/." << std::endl; + std::cerr << "One or more of the following were needed but not found:" << std::endl; + for(auto &name: rom_names) { + std::cerr << machine_name << '/' << name << std::endl; + } + break; + } + + return -1; + } updater.set_clock_rate(machine->crt_machine()->get_clock_rate()); crt_delegate.best_effort_updater = &updater; @@ -302,57 +359,6 @@ int main(int argc, char *argv[]) { GLint target_framebuffer = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &target_framebuffer); - // For vanilla SDL purposes, assume system ROMs can be found in one of: - // - // /usr/local/share/CLK/[system]; or - // /usr/share/CLK/[system] - std::vector rom_names; - std::string machine_name; - bool roms_loaded = machine->crt_machine()->set_rom_fetcher( [&rom_names, &machine_name] - (const std::string &machine, const std::vector &names) -> std::vector>> { - rom_names.insert(rom_names.end(), names.begin(), names.end()); - machine_name = machine; - - std::vector>> results; - for(auto &name: names) { - std::string local_path = "/usr/local/share/CLK/" + machine + "/" + name; - FILE *file = std::fopen(local_path.c_str(), "rb"); - if(!file) { - std::string path = "/usr/share/CLK/" + machine + "/" + name; - file = std::fopen(path.c_str(), "rb"); - } - - if(!file) { - results.emplace_back(nullptr); - continue; - } - - std::unique_ptr> data(new std::vector); - - std::fseek(file, 0, SEEK_END); - data->resize(std::ftell(file)); - std::fseek(file, 0, SEEK_SET); - std::size_t read = fread(data->data(), 1, data->size(), file); - std::fclose(file); - - if(read == data->size()) - results.emplace_back(std::move(data)); - else - results.emplace_back(nullptr); - } - - return results; - }); - - if(!roms_loaded) { - std::cerr << "Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/." << std::endl; - std::cerr << "One or more of the following were needed but not found:" << std::endl; - for(auto &name: rom_names) { - std::cerr << machine_name << '/' << name << std::endl; - } - return -1; - } - machine->configuration_target()->configure_as_target(*targets.front()); // Setup output, assuming a CRT machine for now, and prepare a best-effort updater. @@ -435,7 +441,7 @@ int main(int argc, char *argv[]) { Analyser::Static::Media media = Analyser::Static::GetMedia(event.drop.file); machine->configuration_target()->insert_media(media); } break; - + case SDL_KEYDOWN: // Syphon off the key-press if it's control+shift+V (paste). if(event.key.keysym.sym == SDLK_v && (SDL_GetModState()&KMOD_CTRL) && (SDL_GetModState()&KMOD_SHIFT)) { From db914d8c56b5a5fb5ec8d465f7b6240d84d923b9 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 25 Jan 2018 18:50:23 -0500 Subject: [PATCH 09/37] Removes redundant second configuration. --- OSBindings/SDL/main.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index e27b213c6..d8713c595 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) { // Determine the machine for the supplied file. std::vector> targets = Analyser::Static::GetTargets(arguments.file_name.c_str()); if(targets.empty()) { - std::cerr << "Cannot open " << arguments.file_name << std::endl; + std::cerr << "Cannot open " << arguments.file_name << "; no target machine found" << std::endl; return -1; } @@ -359,8 +359,6 @@ int main(int argc, char *argv[]) { GLint target_framebuffer = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &target_framebuffer); - machine->configuration_target()->configure_as_target(*targets.front()); - // Setup output, assuming a CRT machine for now, and prepare a best-effort updater. machine->crt_machine()->setup_output(4.0 / 3.0); machine->crt_machine()->get_crt()->set_output_gamma(2.2f); From f2519f4fd74368779aab37aaac92db648f5c6b07 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 25 Jan 2018 19:02:16 -0500 Subject: [PATCH 10/37] Decided to focus on 'confidence' over 'probability'. Besides anything else, it individualises the measure. E.g. two targets can each have a confidence of 0.8 without each giving the wrong answer about probability. --- Analyser/Dynamic/ConfidenceCounter.cpp | 2 +- Analyser/Dynamic/ConfidenceCounter.hpp | 2 +- Analyser/Dynamic/ConfidenceSource.hpp | 2 +- Analyser/Dynamic/ConfidenceSummary.cpp | 4 ++-- Analyser/Dynamic/ConfidenceSummary.hpp | 2 +- Analyser/Static/Acorn/StaticAnalyser.cpp | 2 +- Analyser/Static/AmstradCPC/StaticAnalyser.cpp | 2 +- Analyser/Static/Atari/StaticAnalyser.cpp | 2 +- Analyser/Static/Commodore/StaticAnalyser.cpp | 2 +- Analyser/Static/MSX/StaticAnalyser.cpp | 2 +- Analyser/Static/Oric/StaticAnalyser.cpp | 2 +- Analyser/Static/StaticAnalyser.hpp | 2 +- Machines/MSX/ROMSlotHandler.hpp | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Analyser/Dynamic/ConfidenceCounter.cpp b/Analyser/Dynamic/ConfidenceCounter.cpp index 2a7ebfae9..8a39a474c 100644 --- a/Analyser/Dynamic/ConfidenceCounter.cpp +++ b/Analyser/Dynamic/ConfidenceCounter.cpp @@ -10,7 +10,7 @@ using namespace DynamicAnalyser; -float ConfidenceCounter::get_probability() { +float ConfidenceCounter::get_confidence() { return static_cast(hits_) / static_cast(hits_ + misses_); } diff --git a/Analyser/Dynamic/ConfidenceCounter.hpp b/Analyser/Dynamic/ConfidenceCounter.hpp index 68f8ef91e..ed1be56d4 100644 --- a/Analyser/Dynamic/ConfidenceCounter.hpp +++ b/Analyser/Dynamic/ConfidenceCounter.hpp @@ -21,7 +21,7 @@ namespace DynamicAnalyser { class ConfidenceCounter: public ConfidenceSource { public: /*! @returns The computed probability, based on the history of events. */ - float get_probability() override; + float get_confidence() override; /*! Records an event that implies this is the appropriate class — pushes probability up towards 1.0. */ void add_hit(); diff --git a/Analyser/Dynamic/ConfidenceSource.hpp b/Analyser/Dynamic/ConfidenceSource.hpp index 0f959f9d1..2754a8fdb 100644 --- a/Analyser/Dynamic/ConfidenceSource.hpp +++ b/Analyser/Dynamic/ConfidenceSource.hpp @@ -18,7 +18,7 @@ namespace DynamicAnalyser { program is handed to an Atari 2600 then its confidence should grow towards 1.0. */ struct ConfidenceSource { - virtual float get_probability() = 0; + virtual float get_confidence() = 0; }; } diff --git a/Analyser/Dynamic/ConfidenceSummary.cpp b/Analyser/Dynamic/ConfidenceSummary.cpp index f2888a4d8..4306fba13 100644 --- a/Analyser/Dynamic/ConfidenceSummary.cpp +++ b/Analyser/Dynamic/ConfidenceSummary.cpp @@ -19,10 +19,10 @@ ConfidenceSummary::ConfidenceSummary(const std::vector &sour weight_sum_ = std::accumulate(weights.begin(), weights.end(), 0.0f); } -float ConfidenceSummary::get_probability() { +float ConfidenceSummary::get_confidence() { float result = 0.0f; for(std::size_t index = 0; index < sources_.size(); ++index) { - result += sources_[index]->get_probability() * weights_[index]; + result += sources_[index]->get_confidence() * weights_[index]; } return result / weight_sum_; } diff --git a/Analyser/Dynamic/ConfidenceSummary.hpp b/Analyser/Dynamic/ConfidenceSummary.hpp index a3f8f2fb7..cb8cdac55 100644 --- a/Analyser/Dynamic/ConfidenceSummary.hpp +++ b/Analyser/Dynamic/ConfidenceSummary.hpp @@ -31,7 +31,7 @@ class ConfidenceSummary: public ConfidenceSource { const std::vector &weights); /*! @returns The weighted sum of all sources. */ - float get_probability() override; + float get_confidence() override; private: std::vector sources_; diff --git a/Analyser/Static/Acorn/StaticAnalyser.cpp b/Analyser/Static/Acorn/StaticAnalyser.cpp index a251ef8c9..cff55c8a1 100644 --- a/Analyser/Static/Acorn/StaticAnalyser.cpp +++ b/Analyser/Static/Acorn/StaticAnalyser.cpp @@ -59,7 +59,7 @@ static std::vector> void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector> &destination) { std::unique_ptr target(new Target); target->machine = Machine::Electron; - target->probability = 1.0; // TODO: a proper estimation + target->confidence = 1.0; // TODO: a proper estimation target->acorn.has_dfs = false; target->acorn.has_adfs = false; target->acorn.should_shift_restart = false; diff --git a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp index 04bae8d70..e048af1c4 100644 --- a/Analyser/Static/AmstradCPC/StaticAnalyser.cpp +++ b/Analyser/Static/AmstradCPC/StaticAnalyser.cpp @@ -180,7 +180,7 @@ static bool CheckBootSector(const std::shared_ptr &disk, co void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector> &destination) { std::unique_ptr target(new Target); target->machine = Machine::AmstradCPC; - target->probability = 1.0; + target->confidence = 1.0; target->media.disks = media.disks; target->media.tapes = media.tapes; target->media.cartridges = media.cartridges; diff --git a/Analyser/Static/Atari/StaticAnalyser.cpp b/Analyser/Static/Atari/StaticAnalyser.cpp index b687c0ada..e3691e30a 100644 --- a/Analyser/Static/Atari/StaticAnalyser.cpp +++ b/Analyser/Static/Atari/StaticAnalyser.cpp @@ -182,7 +182,7 @@ void Analyser::Static::Atari::AddTargets(const Media &media, std::vector target(new Target); target->machine = Machine::Atari2600; - target->probability = 1.0; + target->confidence = 1.0; target->media.cartridges = media.cartridges; target->atari.paging_model = Atari2600PagingModel::None; target->atari.uses_superchip = false; diff --git a/Analyser/Static/Commodore/StaticAnalyser.cpp b/Analyser/Static/Commodore/StaticAnalyser.cpp index 09aaf15fd..055404f9d 100644 --- a/Analyser/Static/Commodore/StaticAnalyser.cpp +++ b/Analyser/Static/Commodore/StaticAnalyser.cpp @@ -41,7 +41,7 @@ static std::vector> void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector> &destination) { std::unique_ptr target(new Target); target->machine = Machine::Vic20; // TODO: machine estimation - target->probability = 1.0; // TODO: a proper estimation + target->confidence = 1.0; // TODO: a proper estimation int device = 0; std::vector files; diff --git a/Analyser/Static/MSX/StaticAnalyser.cpp b/Analyser/Static/MSX/StaticAnalyser.cpp index 1a0ae98b1..78f3d582f 100644 --- a/Analyser/Static/MSX/StaticAnalyser.cpp +++ b/Analyser/Static/MSX/StaticAnalyser.cpp @@ -225,7 +225,7 @@ void Analyser::Static::MSX::AddTargets(const Media &media, std::vectormedia.empty()) { target->machine = Machine::MSX; - target->probability = 1.0; + target->confidence = 1.0; destination.push_back(std::move(target)); } } diff --git a/Analyser/Static/Oric/StaticAnalyser.cpp b/Analyser/Static/Oric/StaticAnalyser.cpp index 42101d52d..67c3c867e 100644 --- a/Analyser/Static/Oric/StaticAnalyser.cpp +++ b/Analyser/Static/Oric/StaticAnalyser.cpp @@ -76,7 +76,7 @@ static int Basic11Score(const Analyser::Static::MOS6502::Disassembly &disassembl void Analyser::Static::Oric::AddTargets(const Media &media, std::vector> &destination) { std::unique_ptr target(new Target); target->machine = Machine::Oric; - target->probability = 1.0; + target->confidence = 1.0; int basic10_votes = 0; int basic11_votes = 0; diff --git a/Analyser/Static/StaticAnalyser.hpp b/Analyser/Static/StaticAnalyser.hpp index 86d49bd76..7cf4a738d 100644 --- a/Analyser/Static/StaticAnalyser.hpp +++ b/Analyser/Static/StaticAnalyser.hpp @@ -84,7 +84,7 @@ struct Target { Machine machine; Media media; - float probability; + float confidence; std::string loading_command; // TODO: this is too C-like a solution; make Target a base class and diff --git a/Machines/MSX/ROMSlotHandler.hpp b/Machines/MSX/ROMSlotHandler.hpp index 6d3c53b0f..5c8f8a533 100644 --- a/Machines/MSX/ROMSlotHandler.hpp +++ b/Machines/MSX/ROMSlotHandler.hpp @@ -66,7 +66,7 @@ class ROMSlotHandler { /*! @returns The probability that this handler is correct for the data it owns. */ float get_confidence() { - return confidence_counter_.get_probability(); + return confidence_counter_.get_confidence(); } protected: From e025674eb2452aecf3582f847ac5ec5cfdf6bfce Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 25 Jan 2018 22:16:46 -0500 Subject: [PATCH 11/37] The MSX analyser is now smart enough not to be definitive when it's uncertain. The cartridge type has also migrated to being a property of the cartridge, prefiguring my intention to discard the static analyser union. --- Analyser/Static/MSX/Cartridge.hpp | 40 +++ Analyser/Static/MSX/StaticAnalyser.cpp | 337 +++++++++++------- Analyser/Static/StaticAnalyser.cpp | 6 + Analyser/Static/StaticAnalyser.hpp | 13 - Machines/MSX/MSX.cpp | 37 +- .../Clock Signal.xcodeproj/project.pbxproj | 2 + 6 files changed, 267 insertions(+), 168 deletions(-) create mode 100644 Analyser/Static/MSX/Cartridge.hpp diff --git a/Analyser/Static/MSX/Cartridge.hpp b/Analyser/Static/MSX/Cartridge.hpp new file mode 100644 index 000000000..a2d4f8a71 --- /dev/null +++ b/Analyser/Static/MSX/Cartridge.hpp @@ -0,0 +1,40 @@ +// +// Cartridge.hpp +// Clock Signal +// +// Created by Thomas Harte on 25/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef Cartridge_hpp +#define Cartridge_hpp + +#include "../../../Storage/Cartridge/Cartridge.hpp" + +namespace Analyser { +namespace Static { +namespace MSX { + +/*! + Extends the base cartridge class by adding a (guess at) the banking scheme. +*/ +struct Cartridge: public ::Storage::Cartridge::Cartridge { + enum Type { + None, + Konami, + KonamiWithSCC, + ASCII8kb, + ASCII16kb, + FMPac + }; + const Type type; + + Cartridge(const std::vector &segments, Type type) : + Storage::Cartridge::Cartridge(segments), type(type) {} +}; + +} +} +} + +#endif /* Cartridge_hpp */ diff --git a/Analyser/Static/MSX/StaticAnalyser.cpp b/Analyser/Static/MSX/StaticAnalyser.cpp index 78f3d582f..de0d0ef76 100644 --- a/Analyser/Static/MSX/StaticAnalyser.cpp +++ b/Analyser/Static/MSX/StaticAnalyser.cpp @@ -8,12 +8,43 @@ #include "StaticAnalyser.hpp" +#include "Cartridge.hpp" #include "Tape.hpp" #include "../Disassembler/Z80.hpp" #include "../Disassembler/AddressMapper.hpp" #include +static std::unique_ptr CartridgeTarget( + const Storage::Cartridge::Cartridge::Segment &segment, + uint16_t start_address, + Analyser::Static::MSX::Cartridge::Type type, + float confidence) { + + // Size down to a multiple of 8kb in size and apply the start address. + std::vector output_segments; + if(segment.data.size() & 0x1fff) { + std::vector truncated_data; + std::vector::difference_type truncated_size = static_cast::difference_type>(segment.data.size()) & ~0x1fff; + truncated_data.insert(truncated_data.begin(), segment.data.begin(), segment.data.begin() + truncated_size); + output_segments.emplace_back(start_address, truncated_data); + } else { + output_segments.emplace_back(start_address, segment.data); + } + + std::unique_ptr target(new Analyser::Static::Target); + target->machine = Analyser::Machine::MSX; + target->confidence = confidence; + + if(type == Analyser::Static::MSX::Cartridge::Type::None) { + target->media.cartridges.emplace_back(new Storage::Cartridge::Cartridge(output_segments)); + } else { + target->media.cartridges.emplace_back(new Analyser::Static::MSX::Cartridge(output_segments, type)); + } + + return target; +} + /* Expected standard cartridge format: @@ -23,11 +54,21 @@ DEFW device; pointer to expansion device handler, 0 if no such handler DEFW basic ; pointer to the start of a tokenized basicprogram, 0 if no basicprogram DEFS 6,0 ; room reserved for future extensions -*/ -static std::vector> - MSXCartridgesFrom(const std::vector> &cartridges, Analyser::Static::Target &target) { - std::vector> msx_cartridges; + MSX cartridges often include banking hardware; those games were marketed as MegaROMs. The file + format that the MSX community has decided upon doesn't retain the type of hardware included, so + this analyser has to guess. + + (additional audio hardware is also sometimes included, but it's implied by the banking hardware) +*/ +static std::vector> CartridgeTargetsFrom( + const std::vector> &cartridges) { + // No cartridges implies no targets. + if(cartridges.empty()) { + return {}; + } + + std::vector> targets; for(const auto &cartridge : cartridges) { const auto &segments = cartridge->get_segments(); @@ -57,154 +98,174 @@ static std::vector> uint16_t init_address = static_cast(segment.data[2] | (segment.data[3] << 8)); // TODO: check for a rational init address? + // If this ROM is less than 48kb in size then it's an ordinary ROM. Just emplace it and move on. + if(data_size <= 0xc000) { + targets.emplace_back(CartridgeTarget(segment, start_address, Analyser::Static::MSX::Cartridge::Type::None, 1.0)); + continue; + } + // If this ROM is greater than 48kb in size then some sort of MegaROM scheme must // be at play; disassemble to try to figure it out. - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::None; - if(data_size > 0xc000) { - std::vector first_16k; - first_16k.insert(first_16k.begin(), segment.data.begin(), segment.data.begin() + 8192); - Analyser::Static::Z80::Disassembly disassembly = - Analyser::Static::Z80::Disassemble( - first_16k, - Analyser::Static::Disassembler::OffsetMapper(start_address), - { init_address } - ); + std::vector first_8k; + first_8k.insert(first_8k.begin(), segment.data.begin(), segment.data.begin() + 8192); + Analyser::Static::Z80::Disassembly disassembly = + Analyser::Static::Z80::Disassemble( + first_8k, + Analyser::Static::Disassembler::OffsetMapper(start_address), + { init_address } + ); - // Look for a indirect store followed by an unconditional JP or CALL into another - // segment, that's a fairly explicit sign where found. - using Instruction = Analyser::Static::Z80::Instruction; - std::map &instructions = disassembly.instructions_by_address; - bool is_ascii = false; - auto iterator = instructions.begin(); - while(iterator != instructions.end()) { - auto next_iterator = iterator; - next_iterator++; - if(next_iterator == instructions.end()) break; +// // Look for a indirect store followed by an unconditional JP or CALL into another +// // segment, that's a fairly explicit sign where found. + using Instruction = Analyser::Static::Z80::Instruction; + std::map &instructions = disassembly.instructions_by_address; + bool is_ascii = false; +// auto iterator = instructions.begin(); +// while(iterator != instructions.end()) { +// auto next_iterator = iterator; +// next_iterator++; +// if(next_iterator == instructions.end()) break; +// +// if( iterator->second.operation == Instruction::Operation::LD && +// iterator->second.destination == Instruction::Location::Operand_Indirect && +// ( +// iterator->second.operand == 0x5000 || +// iterator->second.operand == 0x6000 || +// iterator->second.operand == 0x6800 || +// iterator->second.operand == 0x7000 || +// iterator->second.operand == 0x77ff || +// iterator->second.operand == 0x7800 || +// iterator->second.operand == 0x8000 || +// iterator->second.operand == 0x9000 || +// iterator->second.operand == 0xa000 +// ) && +// ( +// next_iterator->second.operation == Instruction::Operation::CALL || +// next_iterator->second.operation == Instruction::Operation::JP +// ) && +// ((next_iterator->second.operand >> 13) != (0x4000 >> 13)) +// ) { +// const uint16_t address = static_cast(next_iterator->second.operand); +// switch(iterator->second.operand) { +// case 0x6000: +// if(address >= 0x6000 && address < 0x8000) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; +// } +// break; +// case 0x6800: +// if(address >= 0x6000 && address < 0x6800) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII8kb; +// } +// break; +// case 0x7000: +// if(address >= 0x6000 && address < 0x8000) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; +// } +// if(address >= 0x7000 && address < 0x7800) { +// is_ascii = true; +// } +// break; +// case 0x77ff: +// if(address >= 0x7000 && address < 0x7800) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII16kb; +// } +// break; +// case 0x7800: +// if(address >= 0xa000 && address < 0xc000) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII8kb; +// } +// break; +// case 0x8000: +// if(address >= 0x8000 && address < 0xa000) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; +// } +// break; +// case 0x9000: +// if(address >= 0x8000 && address < 0xa000) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; +// } +// break; +// case 0xa000: +// if(address >= 0xa000 && address < 0xc000) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::Konami; +// } +// break; +// case 0xb000: +// if(address >= 0xa000 && address < 0xc000) { +// target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; +// } +// break; +// } +// } +// +// iterator = next_iterator; - if( iterator->second.operation == Instruction::Operation::LD && - iterator->second.destination == Instruction::Location::Operand_Indirect && - ( - iterator->second.operand == 0x5000 || - iterator->second.operand == 0x6000 || - iterator->second.operand == 0x6800 || - iterator->second.operand == 0x7000 || - iterator->second.operand == 0x77ff || - iterator->second.operand == 0x7800 || - iterator->second.operand == 0x8000 || - iterator->second.operand == 0x9000 || - iterator->second.operand == 0xa000 - ) && - ( - next_iterator->second.operation == Instruction::Operation::CALL || - next_iterator->second.operation == Instruction::Operation::JP - ) && - ((next_iterator->second.operand >> 13) != (0x4000 >> 13)) - ) { - const uint16_t address = static_cast(next_iterator->second.operand); - switch(iterator->second.operand) { - case 0x6000: - if(address >= 0x6000 && address < 0x8000) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; - } - break; - case 0x6800: - if(address >= 0x6000 && address < 0x6800) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII8kb; - } - break; - case 0x7000: - if(address >= 0x6000 && address < 0x8000) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; - } - if(address >= 0x7000 && address < 0x7800) { - is_ascii = true; - } - break; - case 0x77ff: - if(address >= 0x7000 && address < 0x7800) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII16kb; - } - break; - case 0x7800: - if(address >= 0xa000 && address < 0xc000) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::ASCII8kb; - } - break; - case 0x8000: - if(address >= 0x8000 && address < 0xa000) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; - } - break; - case 0x9000: - if(address >= 0x8000 && address < 0xa000) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; - } - break; - case 0xa000: - if(address >= 0xa000 && address < 0xc000) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::Konami; - } - break; - case 0xb000: - if(address >= 0xa000 && address < 0xc000) { - target.msx.cartridge_type = Analyser::Static::MSXCartridgeType::KonamiWithSCC; - } - break; - } - } - - iterator = next_iterator; - } - - if(target.msx.cartridge_type == Analyser::Static::MSXCartridgeType::None) { - // Look for LD (nnnn), A instructions, and collate those addresses. - std::map address_counts; - for(const auto &instruction_pair : instructions) { - if( instruction_pair.second.operation == Instruction::Operation::LD && - instruction_pair.second.destination == Instruction::Location::Operand_Indirect && - instruction_pair.second.source == Instruction::Location::A) { - address_counts[static_cast(instruction_pair.second.operand)]++; - } - } - - // Sort possible cartridge types. - using Possibility = std::pair; - std::vector possibilities; - // Add to list in order of declining probability, so that stable_sort below prefers - // the more likely option in a tie. - possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::ASCII8kb, address_counts[0x6000] + address_counts[0x6800] + address_counts[0x7000] + address_counts[0x7800])); - possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::ASCII16kb, address_counts[0x6000] + address_counts[0x7000] + address_counts[0x77ff])); - if(!is_ascii) possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::Konami, address_counts[0x6000] + address_counts[0x8000] + address_counts[0xa000])); - if(!is_ascii) possibilities.push_back(std::make_pair(Analyser::Static::MSXCartridgeType::KonamiWithSCC, address_counts[0x5000] + address_counts[0x7000] + address_counts[0x9000] + address_counts[0xb000])); - std::stable_sort(possibilities.begin(), possibilities.end(), [](const Possibility &a, const Possibility &b) { - return a.second > b.second; - }); - - target.msx.cartridge_type = possibilities[0].first; + // Look for LD (nnnn), A instructions, and collate those addresses. + std::map address_counts; + for(const auto &instruction_pair : instructions) { + if( instruction_pair.second.operation == Instruction::Operation::LD && + instruction_pair.second.destination == Instruction::Location::Operand_Indirect && + instruction_pair.second.source == Instruction::Location::A) { + address_counts[static_cast(instruction_pair.second.operand)]++; } } - // Size down to a multiple of 8kb in size and apply the start address. - std::vector output_segments; - if(segment.data.size() & 0x1fff) { - std::vector truncated_data; - std::vector::difference_type truncated_size = static_cast::difference_type>(segment.data.size()) & ~0x1fff; - truncated_data.insert(truncated_data.begin(), segment.data.begin(), segment.data.begin() + truncated_size); - output_segments.emplace_back(start_address, truncated_data); - } else { - output_segments.emplace_back(start_address, segment.data); + // Weight confidences by number of observed hits. + float total_hits = + static_cast( + address_counts[0x6000] + address_counts[0x6800] + + address_counts[0x7000] + address_counts[0x7800] + + address_counts[0x77ff] + address_counts[0x8000] + + address_counts[0xa000] + address_counts[0x5000] + + address_counts[0x9000] + address_counts[0xb000] + ); + + targets.push_back(CartridgeTarget( + segment, + start_address, + Analyser::Static::MSX::Cartridge::ASCII8kb, + static_cast( address_counts[0x6000] + + address_counts[0x6800] + + address_counts[0x7000] + + address_counts[0x7800]) / total_hits)); + targets.push_back(CartridgeTarget( + segment, + start_address, + Analyser::Static::MSX::Cartridge::ASCII16kb, + static_cast( address_counts[0x6000] + + address_counts[0x7000] + + address_counts[0x77ff]) / total_hits)); + if(!is_ascii) { + targets.push_back(CartridgeTarget( + segment, + start_address, + Analyser::Static::MSX::Cartridge::Konami, + static_cast( address_counts[0x6000] + + address_counts[0x8000] + + address_counts[0xa000]) / total_hits)); + } + if(!is_ascii) { + targets.push_back(CartridgeTarget( + segment, + start_address, + Analyser::Static::MSX::Cartridge::KonamiWithSCC, + static_cast( address_counts[0x5000] + + address_counts[0x7000] + + address_counts[0x9000] + + address_counts[0xb000]) / total_hits)); } - msx_cartridges.emplace_back(new Storage::Cartridge::Cartridge(output_segments)); } - return msx_cartridges; + return targets; } void Analyser::Static::MSX::AddTargets(const Media &media, std::vector> &destination) { - std::unique_ptr target(new Target); + // Append targets for any cartridges that look correct. + std::vector> cartridge_targets = CartridgeTargetsFrom(media.cartridges); + std::move(cartridge_targets.begin(), cartridge_targets.end(), std::back_inserter(destination)); - // Obtain only those cartridges which it looks like an MSX would understand. - target->media.cartridges = MSXCartridgesFrom(media.cartridges, *target); + // Consider building a target for disks and/or tapes. + std::unique_ptr target(new Target); // Check tapes for loadable files. for(const auto &tape : media.tapes) { diff --git a/Analyser/Static/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp index 6f59f8853..dab1e7705 100644 --- a/Analyser/Static/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -164,5 +164,11 @@ std::vector> Analyser::Static::GetTargets(const char *fi } } + // Sort by initial confidence. Use a stable sort in case any of the machine-specific analysers + // picked their insertion order carefully. + std::stable_sort(targets.begin(), targets.end(), [](auto &a, auto &b) { + return a->confidence > b->confidence; + }); + return targets; } diff --git a/Analyser/Static/StaticAnalyser.hpp b/Analyser/Static/StaticAnalyser.hpp index 7cf4a738d..3a679c0a8 100644 --- a/Analyser/Static/StaticAnalyser.hpp +++ b/Analyser/Static/StaticAnalyser.hpp @@ -42,15 +42,6 @@ enum class Atari2600PagingModel { Pitfall2 }; -enum class MSXCartridgeType { - None, - Konami, - KonamiWithSCC, - ASCII8kb, - ASCII16kb, - FMPac -}; - enum class ZX8081MemoryModel { Unexpanded, SixteenKB, @@ -119,10 +110,6 @@ struct Target { struct { AmstradCPCModel model; } amstradcpc; - - struct { - MSXCartridgeType cartridge_type; - } msx; }; }; diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 40a697f06..2d550408b 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -12,6 +12,7 @@ #include "Keyboard.hpp" #include "ROMSlotHandler.hpp" +#include "../../Analyser/Static/MSX/Cartridge.hpp" #include "Cartridges/ASCII8kb.hpp" #include "Cartridges/ASCII16kb.hpp" #include "Cartridges/Konami.hpp" @@ -175,23 +176,6 @@ class ConcreteMachine: if(target.loading_command.length()) { type_string(target.loading_command); } - - // Attach the hardware necessary for a game cartridge, if any. - switch(target.msx.cartridge_type) { - default: break; - case Analyser::Static::MSXCartridgeType::Konami: - memory_slots_[1].set_handler(new Cartridge::KonamiROMSlotHandler(*this, 1)); - break; - case Analyser::Static::MSXCartridgeType::KonamiWithSCC: - memory_slots_[1].set_handler(new Cartridge::KonamiWithSCCROMSlotHandler(*this, 1, scc_)); - break; - case Analyser::Static::MSXCartridgeType::ASCII8kb: - memory_slots_[1].set_handler(new Cartridge::ASCII8kbROMSlotHandler(*this, 1)); - break; - case Analyser::Static::MSXCartridgeType::ASCII16kb: - memory_slots_[1].set_handler(new Cartridge::ASCII16kbROMSlotHandler(*this, 1)); - break; - } } bool insert_media(const Analyser::Static::Media &media) override { @@ -199,6 +183,25 @@ class ConcreteMachine: const auto &segment = media.cartridges.front()->get_segments().front(); memory_slots_[1].source = segment.data; map(1, 0, static_cast(segment.start_address), std::min(segment.data.size(), 65536 - segment.start_address)); + + auto msx_cartridge = dynamic_cast(media.cartridges.front().get()); + if(msx_cartridge) { + switch(msx_cartridge->type) { + default: break; + case Analyser::Static::MSX::Cartridge::Konami: + memory_slots_[1].set_handler(new Cartridge::KonamiROMSlotHandler(*this, 1)); + break; + case Analyser::Static::MSX::Cartridge::KonamiWithSCC: + memory_slots_[1].set_handler(new Cartridge::KonamiWithSCCROMSlotHandler(*this, 1, scc_)); + break; + case Analyser::Static::MSX::Cartridge::ASCII8kb: + memory_slots_[1].set_handler(new Cartridge::ASCII8kbROMSlotHandler(*this, 1)); + break; + case Analyser::Static::MSX::Cartridge::ASCII16kb: + memory_slots_[1].set_handler(new Cartridge::ASCII16kbROMSlotHandler(*this, 1)); + break; + } + } } if(!media.tapes.empty()) { diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index bceb8e7dc..11f66c982 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -644,6 +644,7 @@ /* Begin PBXFileReference section */ 4B01A6871F22F0DB001FD6E3 /* Z80MemptrTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MemptrTests.swift; sourceTree = ""; }; 4B046DC31CFE651500E9E45E /* CRTMachine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRTMachine.hpp; sourceTree = ""; }; + 4B047075201ABC180047AB0D /* Cartridge.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Cartridge.hpp; sourceTree = ""; }; 4B049CDC1DA3C82F00322067 /* BCDTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BCDTest.swift; sourceTree = ""; }; 4B055A6A1FAE763F0060FFFF /* Clock Signal Kiosk */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Clock Signal Kiosk"; sourceTree = BUILT_PRODUCTS_DIR; }; 4B055A771FAE78210060FFFF /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = ../../../../Library/Frameworks/SDL2.framework; sourceTree = SOURCE_ROOT; }; @@ -2163,6 +2164,7 @@ children = ( 4B894513201967B4007DE474 /* StaticAnalyser.cpp */, 4B894512201967B4007DE474 /* Tape.cpp */, + 4B047075201ABC180047AB0D /* Cartridge.hpp */, 4B894510201967B4007DE474 /* StaticAnalyser.hpp */, 4B894511201967B4007DE474 /* Tape.hpp */, ); From d493ea4bcae5bcd11a9b517d4d168a99372ecd80 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 28 Jan 2018 22:22:21 -0500 Subject: [PATCH 12/37] Introduces a multimachine to handle multi-target static analyser outputs. Non-functional as of yet. --- Analyser/Dynamic/ConfidenceCounter.cpp | 2 +- Analyser/Dynamic/ConfidenceCounter.hpp | 4 +- Analyser/Dynamic/ConfidenceSource.hpp | 4 +- Analyser/Dynamic/ConfidenceSummary.cpp | 2 +- Analyser/Dynamic/ConfidenceSummary.hpp | 4 +- .../Dynamic/MultiMachine/MultiMachine.cpp | 38 ++++++++++++++ .../Dynamic/MultiMachine/MultiMachine.hpp | 50 ++++++++++++++++++ Machines/MSX/ROMSlotHandler.hpp | 2 +- Machines/Utility/MachineForTarget.cpp | 52 ++++++++++++++----- Machines/Utility/MachineForTarget.hpp | 3 +- .../Clock Signal.xcodeproj/project.pbxproj | 14 +++++ 11 files changed, 154 insertions(+), 21 deletions(-) create mode 100644 Analyser/Dynamic/MultiMachine/MultiMachine.cpp create mode 100644 Analyser/Dynamic/MultiMachine/MultiMachine.hpp diff --git a/Analyser/Dynamic/ConfidenceCounter.cpp b/Analyser/Dynamic/ConfidenceCounter.cpp index 8a39a474c..c2ce5bbc4 100644 --- a/Analyser/Dynamic/ConfidenceCounter.cpp +++ b/Analyser/Dynamic/ConfidenceCounter.cpp @@ -8,7 +8,7 @@ #include "ConfidenceCounter.hpp" -using namespace DynamicAnalyser; +using namespace Analyser::Dynamic; float ConfidenceCounter::get_confidence() { return static_cast(hits_) / static_cast(hits_ + misses_); diff --git a/Analyser/Dynamic/ConfidenceCounter.hpp b/Analyser/Dynamic/ConfidenceCounter.hpp index ed1be56d4..9d424c0c5 100644 --- a/Analyser/Dynamic/ConfidenceCounter.hpp +++ b/Analyser/Dynamic/ConfidenceCounter.hpp @@ -11,7 +11,8 @@ #include "ConfidenceSource.hpp" -namespace DynamicAnalyser { +namespace Analyser { +namespace Dynamic { /*! Provides a confidence source that calculates its probability by virtual of a history of events. @@ -40,6 +41,7 @@ class ConfidenceCounter: public ConfidenceSource { int misses_ = 1; }; +} } #endif /* ConfidenceCounter_hpp */ diff --git a/Analyser/Dynamic/ConfidenceSource.hpp b/Analyser/Dynamic/ConfidenceSource.hpp index 2754a8fdb..b0e57648c 100644 --- a/Analyser/Dynamic/ConfidenceSource.hpp +++ b/Analyser/Dynamic/ConfidenceSource.hpp @@ -9,7 +9,8 @@ #ifndef ConfidenceSource_hpp #define ConfidenceSource_hpp -namespace DynamicAnalyser { +namespace Analyser { +namespace Dynamic { /*! Provides an abstract interface through which objects can declare the probability @@ -21,6 +22,7 @@ struct ConfidenceSource { virtual float get_confidence() = 0; }; +} } #endif /* ConfidenceSource_hpp */ diff --git a/Analyser/Dynamic/ConfidenceSummary.cpp b/Analyser/Dynamic/ConfidenceSummary.cpp index 4306fba13..d18328f2c 100644 --- a/Analyser/Dynamic/ConfidenceSummary.cpp +++ b/Analyser/Dynamic/ConfidenceSummary.cpp @@ -11,7 +11,7 @@ #include #include -using namespace DynamicAnalyser; +using namespace Analyser::Dynamic; ConfidenceSummary::ConfidenceSummary(const std::vector &sources, const std::vector &weights) : sources_(sources), weights_(weights) { diff --git a/Analyser/Dynamic/ConfidenceSummary.hpp b/Analyser/Dynamic/ConfidenceSummary.hpp index cb8cdac55..5952e00a9 100644 --- a/Analyser/Dynamic/ConfidenceSummary.hpp +++ b/Analyser/Dynamic/ConfidenceSummary.hpp @@ -13,7 +13,8 @@ #include -namespace DynamicAnalyser { +namespace Analyser { +namespace Dynamic { /*! Summaries a collection of confidence sources by calculating their weighted sum. @@ -39,6 +40,7 @@ class ConfidenceSummary: public ConfidenceSource { float weight_sum_; }; +} } #endif /* ConfidenceSummary_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp new file mode 100644 index 000000000..71649c016 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -0,0 +1,38 @@ +// +// MultiMachine.cpp +// Clock Signal +// +// Created by Thomas Harte on 28/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "MultiMachine.hpp" + +using namespace Analyser::Dynamic; + +MultiMachine::MultiMachine(std::vector> &&machines) : + machines_(std::move(machines)) {} + +ConfigurationTarget::Machine *MultiMachine::configuration_target() { + return nullptr; +} + +CRTMachine::Machine *MultiMachine::crt_machine() { + return nullptr; +} + +JoystickMachine::Machine *MultiMachine::joystick_machine() { + return nullptr; +} + +KeyboardMachine::Machine *MultiMachine::keyboard_machine() { + return nullptr; +} + +Configurable::Device *MultiMachine::configurable_device() { + return nullptr; +} + +Utility::TypeRecipient *MultiMachine::type_recipient() { + return nullptr; +} diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp new file mode 100644 index 000000000..e1f86760c --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -0,0 +1,50 @@ +// +// MultiMachine.hpp +// Clock Signal +// +// Created by Thomas Harte on 28/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef MultiMachine_hpp +#define MultiMachine_hpp + +#include "../../../Machines/Utility/MachineForTarget.hpp" + +#include +#include + +namespace Analyser { +namespace Dynamic { + +/*! + Provides the same interface as to a single machine, while multiplexing all + underlying calls to an array of real dynamic machines. + + Calls to crt_machine->get_crt will return that for the first machine. + + Following each crt_machine->run_for, reorders the supplied machines by + confidence. + + If confidence for any machine becomes disproportionately low compared to + the others in the set, that machine is removed from the array. +*/ +class MultiMachine: public ::Machine::DynamicMachine { + public: + MultiMachine(std::vector> &&machines); + + ConfigurationTarget::Machine *configuration_target() override; + CRTMachine::Machine *crt_machine() override; + JoystickMachine::Machine *joystick_machine() override; + KeyboardMachine::Machine *keyboard_machine() override; + Configurable::Device *configurable_device() override; + Utility::TypeRecipient *type_recipient() override; + + private: + std::vector> machines_; +}; + +} +} + +#endif /* MultiMachine_hpp */ diff --git a/Machines/MSX/ROMSlotHandler.hpp b/Machines/MSX/ROMSlotHandler.hpp index 5c8f8a533..cf742daa8 100644 --- a/Machines/MSX/ROMSlotHandler.hpp +++ b/Machines/MSX/ROMSlotHandler.hpp @@ -70,7 +70,7 @@ class ROMSlotHandler { } protected: - DynamicAnalyser::ConfidenceCounter confidence_counter_; + Analyser::Dynamic::ConfidenceCounter confidence_counter_; }; } diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index c71e33303..c523032ed 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -16,24 +16,25 @@ #include "../Oric/Oric.hpp" #include "../ZX8081/ZX8081.hpp" +#include "../../Analyser/Dynamic/MultiMachine/MultiMachine.hpp" #include "TypedDynamicMachine.hpp" -::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector> &targets, const ROMMachine::ROMFetcher &rom_fetcher, Error &error) { - // TODO: deal with target lists containing more than one machine. +namespace { - error = Error::None; +::Machine::DynamicMachine *MachineForTarget(const Analyser::Static::Target &target, const ROMMachine::ROMFetcher &rom_fetcher, Machine::Error &error) { + error = Machine::Error::None; ::Machine::DynamicMachine *machine = nullptr; - switch(targets.front()->machine) { - case Analyser::Machine::AmstradCPC: machine = new TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); break; - case Analyser::Machine::Atari2600: machine = new TypedDynamicMachine(Atari2600::Machine::Atari2600()); break; - case Analyser::Machine::Electron: machine = new TypedDynamicMachine(Electron::Machine::Electron()); break; - case Analyser::Machine::MSX: machine = new TypedDynamicMachine(MSX::Machine::MSX()); break; - case Analyser::Machine::Oric: machine = new TypedDynamicMachine(Oric::Machine::Oric()); break; - case Analyser::Machine::Vic20: machine = new TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); break; - case Analyser::Machine::ZX8081: machine = new TypedDynamicMachine(ZX8081::Machine::ZX8081(*targets.front())); break; + switch(target.machine) { + case Analyser::Machine::AmstradCPC: machine = new Machine::TypedDynamicMachine(AmstradCPC::Machine::AmstradCPC()); break; + case Analyser::Machine::Atari2600: machine = new Machine::TypedDynamicMachine(Atari2600::Machine::Atari2600()); break; + case Analyser::Machine::Electron: machine = new Machine::TypedDynamicMachine(Electron::Machine::Electron()); break; + case Analyser::Machine::MSX: machine = new Machine::TypedDynamicMachine(MSX::Machine::MSX()); break; + case Analyser::Machine::Oric: machine = new Machine::TypedDynamicMachine(Oric::Machine::Oric()); break; + case Analyser::Machine::Vic20: machine = new Machine::TypedDynamicMachine(Commodore::Vic20::Machine::Vic20()); break; + case Analyser::Machine::ZX8081: machine = new Machine::TypedDynamicMachine(ZX8081::Machine::ZX8081(target)); break; default: - error = Error::UnknownMachine; + error = Machine::Error::UnknownMachine; return nullptr; } @@ -42,19 +43,42 @@ if(crt_machine) { if(!machine->crt_machine()->set_rom_fetcher(rom_fetcher)) { delete machine; - error = Error::MissingROM; + error = Machine::Error::MissingROM; return nullptr; } } ConfigurationTarget::Machine *configuration_target = machine->configuration_target(); if(configuration_target) { - machine->configuration_target()->configure_as_target(*targets.front()); + machine->configuration_target()->configure_as_target(target); } return machine; } +} + +::Machine::DynamicMachine *::Machine::MachineForTargets(const std::vector> &targets, const ROMMachine::ROMFetcher &rom_fetcher, Error &error) { + // Zero targets implies no machine. + if(targets.empty()) { + error = Error::NoTargets; + return nullptr; + } + + // If there's more than one target, get all the machines and combine them into a multimachine. + if(targets.size() > 1) { + std::vector> machines; + for(const auto &target: targets) { + machines.emplace_back(MachineForTarget(*target, rom_fetcher, error)); + } + + return new Analyser::Dynamic::MultiMachine(std::move(machines)); + } + + // There's definitely exactly one target. + return MachineForTarget(*targets.front(), rom_fetcher, error); +} + std::string Machine::ShortNameForTargetMachine(const Analyser::Machine machine) { switch(machine) { case Analyser::Machine::AmstradCPC: return "AmstradCPC"; diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index b54fbc120..490f8ac59 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -41,7 +41,8 @@ struct DynamicMachine { enum class Error { None, UnknownMachine, - MissingROM + MissingROM, + NoTargets }; /*! diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 11f66c982..707dad95f 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -161,6 +161,7 @@ 4B3BA0D01D318B44005DD7A7 /* MOS6532Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */; }; 4B3BA0D11D318B44005DD7A7 /* TestMachine6502.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CD1D318B44005DD7A7 /* TestMachine6502.mm */; }; 4B3BF5B01F146265005B6C36 /* CSW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BF5AE1F146264005B6C36 /* CSW.cpp */; }; + 4B3FCC40201EC24200960631 /* MultiMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3FCC3F201EC24200960631 /* MultiMachine.cpp */; }; 4B3FE75E1F3CF68B00448EE4 /* CPM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3FE75C1F3CF68B00448EE4 /* CPM.cpp */; }; 4B448E811F1C45A00009ABD6 /* TZX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B448E7F1F1C45A00009ABD6 /* TZX.cpp */; }; 4B448E841F1C4C480009ABD6 /* PulseQueuedTape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B448E821F1C4C480009ABD6 /* PulseQueuedTape.cpp */; }; @@ -749,6 +750,8 @@ 4B3BA0CD1D318B44005DD7A7 /* TestMachine6502.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestMachine6502.mm; sourceTree = ""; }; 4B3BF5AE1F146264005B6C36 /* CSW.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSW.cpp; sourceTree = ""; }; 4B3BF5AF1F146264005B6C36 /* CSW.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CSW.hpp; sourceTree = ""; }; + 4B3FCC3E201EC24200960631 /* MultiMachine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MultiMachine.hpp; sourceTree = ""; }; + 4B3FCC3F201EC24200960631 /* MultiMachine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiMachine.cpp; sourceTree = ""; }; 4B3FE75C1F3CF68B00448EE4 /* CPM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CPM.cpp; path = Parsers/CPM.cpp; sourceTree = ""; }; 4B3FE75D1F3CF68B00448EE4 /* CPM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CPM.hpp; path = Parsers/CPM.hpp; sourceTree = ""; }; 4B448E7F1F1C45A00009ABD6 /* TZX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TZX.cpp; sourceTree = ""; }; @@ -1687,6 +1690,15 @@ path = Bridges; sourceTree = ""; }; + 4B3FCC3D201EC24200960631 /* MultiMachine */ = { + isa = PBXGroup; + children = ( + 4B3FCC3E201EC24200960631 /* MultiMachine.hpp */, + 4B3FCC3F201EC24200960631 /* MultiMachine.cpp */, + ); + path = MultiMachine; + sourceTree = ""; + }; 4B3FE75F1F3CF6BA00448EE4 /* Parsers */ = { isa = PBXGroup; children = ( @@ -2066,6 +2078,7 @@ 4B8944E7201967B4007DE474 /* ConfidenceCounter.hpp */, 4B8944E5201967B4007DE474 /* ConfidenceSource.hpp */, 4B8944E4201967B4007DE474 /* ConfidenceSummary.hpp */, + 4B3FCC3D201EC24200960631 /* MultiMachine */, ); path = Dynamic; sourceTree = ""; @@ -3564,6 +3577,7 @@ 4B98A05E1FFAD3F600ADF63B /* CSROMFetcher.mm in Sources */, 4B8FE2201DA19D7C0090D3CE /* Atari2600OptionsPanel.swift in Sources */, 4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */, + 4B3FCC40201EC24200960631 /* MultiMachine.cpp in Sources */, 4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */, 4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */, 4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */, From ca48497e8787e8b48434b114b158942b57726093 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 29 Jan 2018 21:49:49 -0500 Subject: [PATCH 13/37] Pulls `DynamicMachine` out of `MachineForTarget` and adds `MultiConfigurationTarget` as a first multiplexer. --- .../MultiConfigurationTarget.cpp | 28 ++++++++++++++ .../MultiConfigurationTarget.hpp | 35 ++++++++++++++++++ .../Dynamic/MultiMachine/MultiMachine.cpp | 5 ++- .../Dynamic/MultiMachine/MultiMachine.hpp | 6 ++- Machines/DynamicMachine.hpp | 37 +++++++++++++++++++ Machines/Utility/MachineForTarget.hpp | 21 +---------- .../Clock Signal.xcodeproj/project.pbxproj | 20 +++++++++- 7 files changed, 128 insertions(+), 24 deletions(-) create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp create mode 100644 Machines/DynamicMachine.hpp diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp new file mode 100644 index 000000000..da13ca227 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp @@ -0,0 +1,28 @@ +// +// MultiConfigurationTarget.cpp +// Clock Signal +// +// Created by Thomas Harte on 29/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "MultiConfigurationTarget.hpp" + +using namespace Analyser::Dynamic; + +MultiConfigurationTarget::MultiConfigurationTarget(const std::vector> &machines) : + machines_(machines) {} + +void MultiConfigurationTarget::configure_as_target(const Analyser::Static::Target &target) { +} + +bool MultiConfigurationTarget::insert_media(const Analyser::Static::Media &media) { + bool inserted = false; + for(const auto &machine : machines_) { + ConfigurationTarget::Machine *configuration_target = machine->configuration_target(); + if(configuration_target) { + inserted |= configuration_target->insert_media(media); + } + } + return inserted; +} diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp new file mode 100644 index 000000000..f8790ce9d --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp @@ -0,0 +1,35 @@ +// +// MultiConfigurationTarget.hpp +// Clock Signal +// +// Created by Thomas Harte on 29/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef MultiConfigurationTarget_hpp +#define MultiConfigurationTarget_hpp + +#include "../../../../Machines/ConfigurationTarget.hpp" +#include "../../../../Machines/DynamicMachine.hpp" + +#include +#include + +namespace Analyser { +namespace Dynamic { + +struct MultiConfigurationTarget: public ::ConfigurationTarget::Machine { + public: + MultiConfigurationTarget(const std::vector> &machines); + + void configure_as_target(const Analyser::Static::Target &target) override; + bool insert_media(const Analyser::Static::Media &media) override; + + private: + const std::vector> &machines_; +}; + +} +} + +#endif /* MultiConfigurationTarget_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index 71649c016..32a30a9a9 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -11,10 +11,11 @@ using namespace Analyser::Dynamic; MultiMachine::MultiMachine(std::vector> &&machines) : - machines_(std::move(machines)) {} + machines_(std::move(machines)), + configuration_target_(machines_) {} ConfigurationTarget::Machine *MultiMachine::configuration_target() { - return nullptr; + return &configuration_target_; } CRTMachine::Machine *MultiMachine::crt_machine() { diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index e1f86760c..e255bb7b1 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -9,7 +9,9 @@ #ifndef MultiMachine_hpp #define MultiMachine_hpp -#include "../../../Machines/Utility/MachineForTarget.hpp" +#include "../../../Machines/DynamicMachine.hpp" + +#include "Implementation/MultiConfigurationTarget.hpp" #include #include @@ -42,6 +44,8 @@ class MultiMachine: public ::Machine::DynamicMachine { private: std::vector> machines_; + + MultiConfigurationTarget configuration_target_; }; } diff --git a/Machines/DynamicMachine.hpp b/Machines/DynamicMachine.hpp new file mode 100644 index 000000000..1182120ee --- /dev/null +++ b/Machines/DynamicMachine.hpp @@ -0,0 +1,37 @@ +// +// DynamicMachine.hpp +// Clock Signal +// +// Created by Thomas Harte on 29/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef DynamicMachine_h +#define DynamicMachine_h + +#include "../Configurable/Configurable.hpp" +#include "ConfigurationTarget.hpp" +#include "CRTMachine.hpp" +#include "JoystickMachine.hpp" +#include "KeyboardMachine.hpp" +#include "Utility/Typer.hpp" + +namespace Machine { + +/*! + Provides the structure for owning a machine and dynamically casting it as desired without knowledge of + the machine's parent class or, therefore, the need to establish a common one. +*/ +struct DynamicMachine { + virtual ~DynamicMachine() {} + virtual ConfigurationTarget::Machine *configuration_target() = 0; + virtual CRTMachine::Machine *crt_machine() = 0; + virtual JoystickMachine::Machine *joystick_machine() = 0; + virtual KeyboardMachine::Machine *keyboard_machine() = 0; + virtual Configurable::Device *configurable_device() = 0; + virtual Utility::TypeRecipient *type_recipient() = 0; +}; + +} + +#endif /* DynamicMachine_h */ diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index 490f8ac59..dfa00269e 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -11,12 +11,7 @@ #include "../../Analyser/Static/StaticAnalyser.hpp" -#include "../../Configurable/Configurable.hpp" -#include "../ConfigurationTarget.hpp" -#include "../CRTMachine.hpp" -#include "../JoystickMachine.hpp" -#include "../KeyboardMachine.hpp" -#include "Typer.hpp" +#include "../DynamicMachine.hpp" #include #include @@ -24,20 +19,6 @@ namespace Machine { -/*! - Provides the structure for owning a machine and dynamically casting it as desired without knowledge of - the machine's parent class or, therefore, the need to establish a common one. -*/ -struct DynamicMachine { - virtual ~DynamicMachine() {} - virtual ConfigurationTarget::Machine *configuration_target() = 0; - virtual CRTMachine::Machine *crt_machine() = 0; - virtual JoystickMachine::Machine *joystick_machine() = 0; - virtual KeyboardMachine::Machine *keyboard_machine() = 0; - virtual Configurable::Device *configurable_device() = 0; - virtual Utility::TypeRecipient *type_recipient() = 0; -}; - enum class Error { None, UnknownMachine, diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 707dad95f..4c1c3ebb5 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -568,6 +568,8 @@ 4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EB61B587A5100552FC2 /* AllSuiteATests.swift */; }; 4BB73EC21B587A5100552FC2 /* Clock_SignalUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EC11B587A5100552FC2 /* Clock_SignalUITests.swift */; }; 4BBB14311CD2CECE00BDB55C /* IntermediateShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */; }; + 4BBB70A4202011C2002FE009 /* MultiConfigurationTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */; }; + 4BBB70A5202011C2002FE009 /* MultiConfigurationTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */; }; 4BBC951E1F368D83008F4C34 /* i8272.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBC951C1F368D83008F4C34 /* i8272.cpp */; }; 4BBF49AF1ED2880200AB3669 /* FUSETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF49AE1ED2880200AB3669 /* FUSETests.swift */; }; 4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */; }; @@ -1248,6 +1250,9 @@ 4BB73ECF1B587A6700552FC2 /* Clock Signal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Clock Signal.entitlements"; sourceTree = ""; }; 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermediateShader.cpp; sourceTree = ""; }; 4BBB14301CD2CECE00BDB55C /* IntermediateShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = IntermediateShader.hpp; sourceTree = ""; }; + 4BBB709C2020109C002FE009 /* DynamicMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DynamicMachine.hpp; sourceTree = ""; }; + 4BBB70A2202011C2002FE009 /* MultiConfigurationTarget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MultiConfigurationTarget.hpp; sourceTree = ""; }; + 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiConfigurationTarget.cpp; sourceTree = ""; }; 4BBC34241D2208B100FFC9DF /* CSFastLoading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSFastLoading.h; sourceTree = ""; }; 4BBC951C1F368D83008F4C34 /* i8272.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = i8272.cpp; path = 8272/i8272.cpp; sourceTree = ""; }; 4BBC951D1F368D83008F4C34 /* i8272.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = i8272.hpp; path = 8272/i8272.hpp; sourceTree = ""; }; @@ -1693,8 +1698,9 @@ 4B3FCC3D201EC24200960631 /* MultiMachine */ = { isa = PBXGroup; children = ( - 4B3FCC3E201EC24200960631 /* MultiMachine.hpp */, 4B3FCC3F201EC24200960631 /* MultiMachine.cpp */, + 4B3FCC3E201EC24200960631 /* MultiMachine.hpp */, + 4BBB70A1202011C2002FE009 /* Implementation */, ); path = MultiMachine; sourceTree = ""; @@ -2618,6 +2624,7 @@ 4B54C0BB1F8D8E790050900F /* KeyboardMachine.cpp */, 4BA9C3CF1D8164A9002DDB61 /* ConfigurationTarget.hpp */, 4B046DC31CFE651500E9E45E /* CRTMachine.hpp */, + 4BBB709C2020109C002FE009 /* DynamicMachine.hpp */, 4B7041271F92C26900735E45 /* JoystickMachine.hpp */, 4B8E4ECD1DCE483D003716C3 /* KeyboardMachine.hpp */, 4BDCC5F81FB27A5E001220C5 /* ROMMachine.hpp */, @@ -2647,6 +2654,15 @@ path = ../../Processors; sourceTree = ""; }; + 4BBB70A1202011C2002FE009 /* Implementation */ = { + isa = PBXGroup; + children = ( + 4BBB70A2202011C2002FE009 /* MultiConfigurationTarget.hpp */, + 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */, + ); + path = Implementation; + sourceTree = ""; + }; 4BBC951F1F368D87008F4C34 /* 8272 */ = { isa = PBXGroup; children = ( @@ -3423,6 +3439,7 @@ 4BAD13441FF709C700FD114A /* MSX.cpp in Sources */, 4B055AC41FAE9AE80060FFFF /* Keyboard.cpp in Sources */, 4B055A941FAE85B50060FFFF /* CommodoreROM.cpp in Sources */, + 4BBB70A5202011C2002FE009 /* MultiConfigurationTarget.cpp in Sources */, 4B055A971FAE85BB0060FFFF /* ZX8081.cpp in Sources */, 4B055AAD1FAE85FD0060FFFF /* PCMTrack.cpp in Sources */, 4B055AC61FAE9AEE0060FFFF /* TIASound.cpp in Sources */, @@ -3565,6 +3582,7 @@ 4B4518841F75E91A00926311 /* UnformattedTrack.cpp in Sources */, 4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */, 4B894528201967B4007DE474 /* Disk.cpp in Sources */, + 4BBB70A4202011C2002FE009 /* MultiConfigurationTarget.cpp in Sources */, 4B89453A201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BB697CB1D4B6D3E00248BDF /* TimedEventLoop.cpp in Sources */, 4B54C0C21F8D91CD0050900F /* Keyboard.cpp in Sources */, From c12aaea7474e90c88fbdfd5675eb3bd9da3efaa7 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 30 Jan 2018 22:23:06 -0500 Subject: [PATCH 14/37] Attempts to get as far as running the MultiMachine. In doing so, fixes the long-standing bug that machines that output audio but don't have a listener produce a divide by zero. --- .../Implementation/MultiCRTMachine.cpp | 70 +++++++++++++++++++ .../Implementation/MultiCRTMachine.hpp | 45 ++++++++++++ .../Dynamic/MultiMachine/MultiMachine.cpp | 5 +- .../Dynamic/MultiMachine/MultiMachine.hpp | 2 + Machines/CRTMachine.hpp | 6 +- .../Clock Signal.xcodeproj/project.pbxproj | 8 +++ .../Speaker/Implementation/LowpassSpeaker.hpp | 10 ++- 7 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp new file mode 100644 index 000000000..3aeabe886 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -0,0 +1,70 @@ +// +// MultiCRTMachine.cpp +// Clock Signal +// +// Created by Thomas Harte on 29/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "MultiCRTMachine.hpp" + +using namespace Analyser::Dynamic; + +MultiCRTMachine::MultiCRTMachine(const std::vector> &machines) : + machines_(machines) {} + +void MultiCRTMachine::setup_output(float aspect_ratio) { + for(const auto &machine: machines_) { + CRTMachine::Machine *crt_machine = machine->crt_machine(); + if(crt_machine) crt_machine->setup_output(aspect_ratio); + } +} + +void MultiCRTMachine::close_output() { + for(const auto &machine: machines_) { + CRTMachine::Machine *crt_machine = machine->crt_machine(); + if(crt_machine) crt_machine->close_output(); + } +} + +Outputs::CRT::CRT *MultiCRTMachine::get_crt() { + CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); + return crt_machine ? crt_machine->get_crt() : nullptr; +} + +Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() { + CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); + return crt_machine ? crt_machine->get_speaker() : nullptr; +} + +void MultiCRTMachine::run_for(const Cycles cycles) { + for(const auto &machine: machines_) { + CRTMachine::Machine *crt_machine = machine->crt_machine(); + if(crt_machine) crt_machine->run_for(cycles); + } + + // TODO: announce an opportunity potentially to reorder the list of machines. +} + +double MultiCRTMachine::get_clock_rate() { + // TODO: something smarter than this? Not all clock rates will necessarily be the same. + CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); + return crt_machine ? crt_machine->get_clock_rate() : 0.0; +} + +bool MultiCRTMachine::get_clock_is_unlimited() { + CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); + return crt_machine ? crt_machine->get_clock_is_unlimited() : false; +} + +void MultiCRTMachine::set_delegate(::CRTMachine::Machine::Delegate *delegate) { + // TODO +} + +void MultiCRTMachine::machine_did_change_clock_rate(Machine *machine) { + // TODO +} + +void MultiCRTMachine::machine_did_change_clock_is_unlimited(Machine *machine) { + // TODO +} diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp new file mode 100644 index 000000000..662db277c --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp @@ -0,0 +1,45 @@ +// +// MultiCRTMachine.hpp +// Clock Signal +// +// Created by Thomas Harte on 29/01/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef MultiCRTMachine_hpp +#define MultiCRTMachine_hpp + +#include "../../../../Machines/CRTMachine.hpp" +#include "../../../../Machines/DynamicMachine.hpp" + +#include +#include + +namespace Analyser { +namespace Dynamic { + +struct MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machine::Delegate { + public: + MultiCRTMachine(const std::vector> &machines); + + void setup_output(float aspect_ratio) override; + void close_output() override; + Outputs::CRT::CRT *get_crt() override; + Outputs::Speaker::Speaker *get_speaker() override; + void run_for(const Cycles cycles) override; + double get_clock_rate() override; + bool get_clock_is_unlimited() override; + void set_delegate(::CRTMachine::Machine::Delegate *delegate) override; + + void machine_did_change_clock_rate(Machine *machine) override; + void machine_did_change_clock_is_unlimited(Machine *machine) override; + + private: + const std::vector> &machines_; +}; + +} +} + + +#endif /* MultiCRTMachine_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index 32a30a9a9..d668c66a9 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -12,14 +12,15 @@ using namespace Analyser::Dynamic; MultiMachine::MultiMachine(std::vector> &&machines) : machines_(std::move(machines)), - configuration_target_(machines_) {} + configuration_target_(machines_), + crt_machine_(machines_) {} ConfigurationTarget::Machine *MultiMachine::configuration_target() { return &configuration_target_; } CRTMachine::Machine *MultiMachine::crt_machine() { - return nullptr; + return &crt_machine_; } JoystickMachine::Machine *MultiMachine::joystick_machine() { diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index e255bb7b1..759e9452a 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -12,6 +12,7 @@ #include "../../../Machines/DynamicMachine.hpp" #include "Implementation/MultiConfigurationTarget.hpp" +#include "Implementation/MultiCRTMachine.hpp" #include #include @@ -46,6 +47,7 @@ class MultiMachine: public ::Machine::DynamicMachine { std::vector> machines_; MultiConfigurationTarget configuration_target_; + MultiCRTMachine crt_machine_; }; } diff --git a/Machines/CRTMachine.hpp b/Machines/CRTMachine.hpp index 06c796e36..538bb29cd 100644 --- a/Machines/CRTMachine.hpp +++ b/Machines/CRTMachine.hpp @@ -45,10 +45,10 @@ class Machine: public ROMMachine::Machine { virtual void run_for(const Cycles cycles) = 0; // TODO: sever the clock-rate stuff. - double get_clock_rate() { + virtual double get_clock_rate() { return clock_rate_; } - bool get_clock_is_unlimited() { + virtual bool get_clock_is_unlimited() { return clock_is_unlimited_; } class Delegate { @@ -56,7 +56,7 @@ class Machine: public ROMMachine::Machine { virtual void machine_did_change_clock_rate(Machine *machine) = 0; virtual void machine_did_change_clock_is_unlimited(Machine *machine) = 0; }; - void set_delegate(Delegate *delegate) { delegate_ = delegate; } + virtual void set_delegate(Delegate *delegate) { delegate_ = delegate; } protected: void set_clock_rate(double clock_rate) { diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 4c1c3ebb5..c28a5e7a9 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -570,6 +570,8 @@ 4BBB14311CD2CECE00BDB55C /* IntermediateShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */; }; 4BBB70A4202011C2002FE009 /* MultiConfigurationTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */; }; 4BBB70A5202011C2002FE009 /* MultiConfigurationTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */; }; + 4BBB70A8202014E2002FE009 /* MultiCRTMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */; }; + 4BBB70A9202014E2002FE009 /* MultiCRTMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */; }; 4BBC951E1F368D83008F4C34 /* i8272.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBC951C1F368D83008F4C34 /* i8272.cpp */; }; 4BBF49AF1ED2880200AB3669 /* FUSETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF49AE1ED2880200AB3669 /* FUSETests.swift */; }; 4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */; }; @@ -1253,6 +1255,8 @@ 4BBB709C2020109C002FE009 /* DynamicMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DynamicMachine.hpp; sourceTree = ""; }; 4BBB70A2202011C2002FE009 /* MultiConfigurationTarget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MultiConfigurationTarget.hpp; sourceTree = ""; }; 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiConfigurationTarget.cpp; sourceTree = ""; }; + 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiCRTMachine.cpp; sourceTree = ""; }; + 4BBB70A7202014E2002FE009 /* MultiCRTMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MultiCRTMachine.hpp; sourceTree = ""; }; 4BBC34241D2208B100FFC9DF /* CSFastLoading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSFastLoading.h; sourceTree = ""; }; 4BBC951C1F368D83008F4C34 /* i8272.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = i8272.cpp; path = 8272/i8272.cpp; sourceTree = ""; }; 4BBC951D1F368D83008F4C34 /* i8272.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = i8272.hpp; path = 8272/i8272.hpp; sourceTree = ""; }; @@ -2659,6 +2663,8 @@ children = ( 4BBB70A2202011C2002FE009 /* MultiConfigurationTarget.hpp */, 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */, + 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */, + 4BBB70A7202014E2002FE009 /* MultiCRTMachine.hpp */, ); path = Implementation; sourceTree = ""; @@ -3368,6 +3374,7 @@ 4B055AEA1FAE9B990060FFFF /* 6502Storage.cpp in Sources */, 4B055AA71FAE85EF0060FFFF /* SegmentParser.cpp in Sources */, 4B055AC11FAE98DC0060FFFF /* MachineForTarget.cpp in Sources */, + 4BBB70A9202014E2002FE009 /* MultiCRTMachine.cpp in Sources */, 4B055AD81FAE9B180060FFFF /* Video.cpp in Sources */, 4B89452F201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B894531201967B4007DE474 /* StaticAnalyser.cpp in Sources */, @@ -3533,6 +3540,7 @@ 4BD5F1951D13528900631CD1 /* CSBestEffortUpdater.mm in Sources */, 4B894532201967B4007DE474 /* 6502.cpp in Sources */, 4B4518811F75E91A00926311 /* PCMPatchedTrack.cpp in Sources */, + 4BBB70A8202014E2002FE009 /* MultiCRTMachine.cpp in Sources */, 4B8805F71DCFF6C9003085B1 /* Commodore.cpp in Sources */, 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */, 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */, diff --git a/Outputs/Speaker/Implementation/LowpassSpeaker.hpp b/Outputs/Speaker/Implementation/LowpassSpeaker.hpp index 406f8fe10..3ca42e477 100644 --- a/Outputs/Speaker/Implementation/LowpassSpeaker.hpp +++ b/Outputs/Speaker/Implementation/LowpassSpeaker.hpp @@ -82,6 +82,8 @@ template class LowpassSpeaker: public Speaker { at construction, filtering it and passing it on to the speaker's delegate if there is one. */ void run_for(const Cycles cycles) { + if(!delegate_) return; + std::size_t cycles_remaining = static_cast(cycles.as_int()); if(!cycles_remaining) return; if(filter_parameters_.parameters_are_dirty) update_filter_coefficients(); @@ -99,9 +101,7 @@ template class LowpassSpeaker: public Speaker { // announce to delegate if full if(output_buffer_pointer_ == output_buffer_.size()) { output_buffer_pointer_ = 0; - if(delegate_) { - delegate_->speaker_did_complete_samples(this, output_buffer_); - } + delegate_->speaker_did_complete_samples(this, output_buffer_); } cycles_remaining -= cycles_to_read; @@ -126,9 +126,7 @@ template class LowpassSpeaker: public Speaker { // Announce to delegate if full. if(output_buffer_pointer_ == output_buffer_.size()) { output_buffer_pointer_ = 0; - if(delegate_) { - delegate_->speaker_did_complete_samples(this, output_buffer_); - } + delegate_->speaker_did_complete_samples(this, output_buffer_); } // If the next loop around is going to reuse some of the samples just collected, use a memmove to From 4e720d57b258110a0b29255aab50196c9eac5fe9 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 1 Feb 2018 07:53:52 -0500 Subject: [PATCH 15/37] With debugging hooks still on display, makes first attempt at dynamic analysis. --- .../Implementation/MultiCRTMachine.cpp | 12 +++++++++- .../Implementation/MultiCRTMachine.hpp | 10 ++++++++ .../Dynamic/MultiMachine/MultiMachine.cpp | 24 ++++++++++++++++++- .../Dynamic/MultiMachine/MultiMachine.hpp | 4 +++- Machines/CRTMachine.hpp | 4 ++++ Machines/MSX/Cartridges/ASCII16kb.hpp | 6 ++++- Machines/MSX/Cartridges/ASCII8kb.hpp | 6 ++++- Machines/MSX/Cartridges/Konami.hpp | 5 +++- Machines/MSX/Cartridges/KonamiWithSCC.hpp | 4 ++++ Machines/MSX/MSX.cpp | 11 ++++++++- Machines/MSX/ROMSlotHandler.hpp | 3 +++ Outputs/CRT/CRT.hpp | 3 +-- Outputs/CRT/Internals/CRTOpenGL.cpp | 7 ++++++ Outputs/CRT/Internals/TextureBuilder.cpp | 18 ++++++++------ Outputs/CRT/Internals/TextureBuilder.hpp | 6 ++++- Outputs/CRT/Internals/TextureTarget.cpp | 4 ++-- 16 files changed, 108 insertions(+), 19 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index 3aeabe886..d83b937e6 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -14,6 +14,12 @@ MultiCRTMachine::MultiCRTMachine(const std::vectorcrt_machine(); +// if(crt_machine) crt_machine->setup_output(aspect_ratio); +// reverse_iterator++; +// } for(const auto &machine: machines_) { CRTMachine::Machine *crt_machine = machine->crt_machine(); if(crt_machine) crt_machine->setup_output(aspect_ratio); @@ -43,7 +49,7 @@ void MultiCRTMachine::run_for(const Cycles cycles) { if(crt_machine) crt_machine->run_for(cycles); } - // TODO: announce an opportunity potentially to reorder the list of machines. + if(delegate_) delegate_->multi_crt_did_run_machines(); } double MultiCRTMachine::get_clock_rate() { @@ -57,6 +63,10 @@ bool MultiCRTMachine::get_clock_is_unlimited() { return crt_machine ? crt_machine->get_clock_is_unlimited() : false; } +void MultiCRTMachine::did_change_machine_order() { + // TODO +} + void MultiCRTMachine::set_delegate(::CRTMachine::Machine::Delegate *delegate) { // TODO } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp index 662db277c..a667ef9ff 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp @@ -34,8 +34,18 @@ struct MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machi void machine_did_change_clock_rate(Machine *machine) override; void machine_did_change_clock_is_unlimited(Machine *machine) override; + void did_change_machine_order(); + + struct Delegate { + virtual void multi_crt_did_run_machines() = 0; + }; + void set_delegate(Delegate *delegate) { + delegate_ = delegate; + } + private: const std::vector> &machines_; + Delegate *delegate_ = nullptr; }; } diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index d668c66a9..380347e98 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -13,7 +13,9 @@ using namespace Analyser::Dynamic; MultiMachine::MultiMachine(std::vector> &&machines) : machines_(std::move(machines)), configuration_target_(machines_), - crt_machine_(machines_) {} + crt_machine_(machines_) { + crt_machine_.set_delegate(this); +} ConfigurationTarget::Machine *MultiMachine::configuration_target() { return &configuration_target_; @@ -38,3 +40,23 @@ Configurable::Device *MultiMachine::configurable_device() { Utility::TypeRecipient *MultiMachine::type_recipient() { return nullptr; } + +void MultiMachine::multi_crt_did_run_machines() { + DynamicMachine *front = machines_.front().get(); +// for(const auto &machine: machines_) { +// CRTMachine::Machine *crt = machine->crt_machine(); +// printf("%0.2f ", crt->get_confidence()); +// crt->print_type(); +// printf("; "); +// } +// printf("\n"); + std::stable_sort(machines_.begin(), machines_.end(), [] (const auto &lhs, const auto &rhs){ + CRTMachine::Machine *lhs_crt = lhs->crt_machine(); + CRTMachine::Machine *rhs_crt = rhs->crt_machine(); + return lhs_crt->get_confidence() > rhs_crt->get_confidence(); + }); + + if(machines_.front().get() != front) { + crt_machine_.did_change_machine_order(); + } +} diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index 759e9452a..bcf3d10ed 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -32,7 +32,7 @@ namespace Dynamic { If confidence for any machine becomes disproportionately low compared to the others in the set, that machine is removed from the array. */ -class MultiMachine: public ::Machine::DynamicMachine { +class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::Delegate { public: MultiMachine(std::vector> &&machines); @@ -43,6 +43,8 @@ class MultiMachine: public ::Machine::DynamicMachine { Configurable::Device *configurable_device() override; Utility::TypeRecipient *type_recipient() override; + void multi_crt_did_run_machines() override; + private: std::vector> machines_; diff --git a/Machines/CRTMachine.hpp b/Machines/CRTMachine.hpp index 538bb29cd..67c4286bb 100644 --- a/Machines/CRTMachine.hpp +++ b/Machines/CRTMachine.hpp @@ -44,6 +44,10 @@ class Machine: public ROMMachine::Machine { /// Runs the machine for @c cycles. virtual void run_for(const Cycles cycles) = 0; + /// @returns The confidence that this machine is running content it understands. + virtual float get_confidence() { return 0.5f; } + virtual void print_type() {} + // TODO: sever the clock-rate stuff. virtual double get_clock_rate() { return clock_rate_; diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index 644a9f69e..73b4ac16f 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -19,7 +19,7 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { ASCII16kbROMSlotHandler(MSX::MemoryMap &map, int slot) : map_(map), slot_(slot) {} - void write(uint16_t address, uint8_t value) { + void write(uint16_t address, uint8_t value) override { switch(address >> 11) { default: confidence_counter_.add_miss(); @@ -35,6 +35,10 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { } } + virtual void print_type() override { + printf("A16"); + } + private: MSX::MemoryMap &map_; int slot_; diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index 8230ded1d..76016e9ff 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -19,7 +19,7 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { ASCII8kbROMSlotHandler(MSX::MemoryMap &map, int slot) : map_(map), slot_(slot) {} - void write(uint16_t address, uint8_t value) { + void write(uint16_t address, uint8_t value) override { switch(address >> 11) { default: confidence_counter_.add_miss(); @@ -43,6 +43,10 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { } } + virtual void print_type() override { + printf("A8"); + } + private: MSX::MemoryMap &map_; int slot_; diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp index a4d7fb594..aa8be8c4c 100644 --- a/Machines/MSX/Cartridges/Konami.hpp +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -19,7 +19,7 @@ class KonamiROMSlotHandler: public ROMSlotHandler { KonamiROMSlotHandler(MSX::MemoryMap &map, int slot) : map_(map), slot_(slot) {} - void write(uint16_t address, uint8_t value) { + void write(uint16_t address, uint8_t value) override { switch(address >> 13) { default: confidence_counter_.add_miss(); @@ -39,6 +39,9 @@ class KonamiROMSlotHandler: public ROMSlotHandler { } } + virtual void print_type() override { + printf("K"); + } private: MSX::MemoryMap &map_; int slot_; diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp index 7ecdfd2af..caf74c085 100644 --- a/Machines/MSX/Cartridges/KonamiWithSCC.hpp +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -67,6 +67,10 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { return 0xff; } + virtual void print_type() override { + printf("KSCC"); + } + private: MSX::MemoryMap &map_; int slot_; diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 2d550408b..f8d5ee544 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -155,9 +155,18 @@ class ConcreteMachine: void run_for(const Cycles cycles) override { z80_.run_for(cycles); + } + float get_confidence() override { if(memory_slots_[1].handler) { - printf("%0.2f\n", memory_slots_[1].handler->get_confidence()); + return memory_slots_[1].handler->get_confidence(); + } + return 0.5f; + } + + void print_type() override { + if(memory_slots_[1].handler) { + memory_slots_[1].handler->print_type(); } } diff --git a/Machines/MSX/ROMSlotHandler.hpp b/Machines/MSX/ROMSlotHandler.hpp index cf742daa8..2ae628785 100644 --- a/Machines/MSX/ROMSlotHandler.hpp +++ b/Machines/MSX/ROMSlotHandler.hpp @@ -69,6 +69,9 @@ class ROMSlotHandler { return confidence_counter_.get_confidence(); } + virtual void print_type() { + } + protected: Analyser::Dynamic::ConfidenceCounter confidence_counter_; }; diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp index 374cfcb91..521f1833b 100644 --- a/Outputs/CRT/CRT.hpp +++ b/Outputs/CRT/CRT.hpp @@ -232,8 +232,7 @@ class CRT { inline void draw_frame(unsigned int output_width, unsigned int output_height, bool only_if_dirty) { { std::lock_guard function_guard(function_mutex_); - for(std::function function : enqueued_openGL_functions_) - { + for(std::function function : enqueued_openGL_functions_) { function(); } enqueued_openGL_functions_.clear(); diff --git a/Outputs/CRT/Internals/CRTOpenGL.cpp b/Outputs/CRT/Internals/CRTOpenGL.cpp index a95a15cb9..9bd1b7184 100644 --- a/Outputs/CRT/Internals/CRTOpenGL.cpp +++ b/Outputs/CRT/Internals/CRTOpenGL.cpp @@ -107,6 +107,12 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out glDeleteSync(fence_); } + // make sure everything is bound + composite_texture_->bind_texture(); + separated_texture_->bind_texture(); + filtered_texture_->bind_texture(); + if(work_texture_) work_texture_->bind_texture(); + // make sure there's a target to draw to if(!framebuffer_ || static_cast(framebuffer_->get_height()) != output_height || static_cast(framebuffer_->get_width()) != output_width) { std::unique_ptr new_framebuffer(new OpenGL::TextureTarget((GLsizei)output_width, (GLsizei)output_height, pixel_accumulation_texture_unit, GL_LINEAR)); @@ -131,6 +137,7 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out // upload new source pixels, if any glActiveTexture(source_data_texture_unit); + texture_builder.bind(); texture_builder.submit(); // buffer usage restart from 0 for the next time around diff --git a/Outputs/CRT/Internals/TextureBuilder.cpp b/Outputs/CRT/Internals/TextureBuilder.cpp index 5a61fa10c..df005f5d2 100644 --- a/Outputs/CRT/Internals/TextureBuilder.cpp +++ b/Outputs/CRT/Internals/TextureBuilder.cpp @@ -52,16 +52,11 @@ struct DefaultBookender: public TextureBuilder::Bookender { } TextureBuilder::TextureBuilder(std::size_t bytes_per_pixel, GLenum texture_unit) : - bytes_per_pixel_(bytes_per_pixel) { + bytes_per_pixel_(bytes_per_pixel), texture_unit_(texture_unit) { image_.resize(bytes_per_pixel * InputBufferBuilderWidth * InputBufferBuilderHeight); glGenTextures(1, &texture_name_); - glActiveTexture(texture_unit); - glBindTexture(GL_TEXTURE_2D, texture_name_); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + bind(); glTexImage2D(GL_TEXTURE_2D, 0, internalFormatForDepth(bytes_per_pixel), InputBufferBuilderWidth, InputBufferBuilderHeight, 0, formatForDepth(bytes_per_pixel), GL_UNSIGNED_BYTE, nullptr); set_bookender(nullptr); @@ -71,6 +66,15 @@ TextureBuilder::~TextureBuilder() { glDeleteTextures(1, &texture_name_); } +void TextureBuilder::bind() { + glActiveTexture(texture_unit_); + glBindTexture(GL_TEXTURE_2D, texture_name_); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +} + inline uint8_t *TextureBuilder::pointer_to_location(uint16_t x, uint16_t y) { return &image_[((y * InputBufferBuilderWidth) + x) * bytes_per_pixel_]; } diff --git a/Outputs/CRT/Internals/TextureBuilder.hpp b/Outputs/CRT/Internals/TextureBuilder.hpp index 50917a69e..11e3ff4fe 100644 --- a/Outputs/CRT/Internals/TextureBuilder.hpp +++ b/Outputs/CRT/Internals/TextureBuilder.hpp @@ -114,9 +114,13 @@ class TextureBuilder { /// Supply nullptr to engage the default bookender. void set_bookender(std::unique_ptr bookender); + /// Binds this texture to the unit supplied at instantiation. + void bind(); + private: - // the buffer size + // the buffer size and target unit std::size_t bytes_per_pixel_; + GLenum texture_unit_; // the buffer std::vector image_; diff --git a/Outputs/CRT/Internals/TextureTarget.cpp b/Outputs/CRT/Internals/TextureTarget.cpp index 5742249bf..3dee17c6b 100644 --- a/Outputs/CRT/Internals/TextureTarget.cpp +++ b/Outputs/CRT/Internals/TextureTarget.cpp @@ -26,8 +26,7 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit, while(expanded_height_ < height) expanded_height_ <<= 1; glGenTextures(1, &texture_); - glActiveTexture(texture_unit); - glBindTexture(GL_TEXTURE_2D, texture_); + bind_texture(); std::vector blank_buffer(static_cast(expanded_width_ * expanded_height_ * 4), 0); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast(expanded_width_), static_cast(expanded_height_), 0, GL_RGBA, GL_UNSIGNED_BYTE, blank_buffer.data()); @@ -53,6 +52,7 @@ void TextureTarget::bind_framebuffer() { } void TextureTarget::bind_texture() { + glActiveTexture(texture_unit_); glBindTexture(GL_TEXTURE_2D, texture_); } From 4cf258f9521069c9c4a19e11e430350fb3aa3662 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 8 Feb 2018 20:33:57 -0500 Subject: [PATCH 16/37] Parallelises MultiMachine running, and ensures errors propagate. --- .../Implementation/MultiCRTMachine.cpp | 59 +++++++++++++------ .../Implementation/MultiCRTMachine.hpp | 17 ++++++ Machines/Utility/MachineForTarget.cpp | 5 ++ 3 files changed, 64 insertions(+), 17 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index d83b937e6..4321c3070 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -8,29 +8,55 @@ #include "MultiCRTMachine.hpp" +#include +#include + using namespace Analyser::Dynamic; MultiCRTMachine::MultiCRTMachine(const std::vector> &machines) : - machines_(machines) {} + machines_(machines), queues_(machines.size()) {} -void MultiCRTMachine::setup_output(float aspect_ratio) { -// auto reverse_iterator = machines_.rbegin(); -// while(reverse_iterator != machines_.rend()) { -// CRTMachine::Machine *crt_machine = (*reverse_iterator)->crt_machine(); -// if(crt_machine) crt_machine->setup_output(aspect_ratio); -// reverse_iterator++; -// } +void MultiCRTMachine::perform_parallel(const std::function &function) { + // Apply a blunt force parallelisation of the machines; each run_for is dispatched + // to a separate queue and this queue will block until all are done. + std::condition_variable condition; + std::mutex mutex; + std::size_t outstanding_machines = machines_.size(); + + for(std::size_t index = 0; index < machines_.size(); ++index) { + queues_[index].enqueue([&mutex, &condition, this, index, function, &outstanding_machines]() { + CRTMachine::Machine *crt_machine = machines_[index]->crt_machine(); + if(crt_machine) function(crt_machine); + + std::unique_lock lock(mutex); + outstanding_machines--; + condition.notify_all(); + }); + } + + do { + std::unique_lock lock(mutex); + condition.wait(lock); + } while(outstanding_machines); +} + +void MultiCRTMachine::perform_serial(const std::function &function) { for(const auto &machine: machines_) { CRTMachine::Machine *crt_machine = machine->crt_machine(); - if(crt_machine) crt_machine->setup_output(aspect_ratio); + if(crt_machine) function(crt_machine); } } +void MultiCRTMachine::setup_output(float aspect_ratio) { + perform_serial([=](::CRTMachine::Machine *machine) { + machine->setup_output(aspect_ratio); + }); +} + void MultiCRTMachine::close_output() { - for(const auto &machine: machines_) { - CRTMachine::Machine *crt_machine = machine->crt_machine(); - if(crt_machine) crt_machine->close_output(); - } + perform_serial([=](::CRTMachine::Machine *machine) { + machine->close_output(); + }); } Outputs::CRT::CRT *MultiCRTMachine::get_crt() { @@ -44,10 +70,9 @@ Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() { } void MultiCRTMachine::run_for(const Cycles cycles) { - for(const auto &machine: machines_) { - CRTMachine::Machine *crt_machine = machine->crt_machine(); - if(crt_machine) crt_machine->run_for(cycles); - } + perform_parallel([=](::CRTMachine::Machine *machine) { + machine->run_for(cycles); + }); if(delegate_) delegate_->multi_crt_did_run_machines(); } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp index a667ef9ff..9480fb50a 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp @@ -9,9 +9,11 @@ #ifndef MultiCRTMachine_hpp #define MultiCRTMachine_hpp +#include "../../../../Concurrency/AsyncTaskQueue.hpp" #include "../../../../Machines/CRTMachine.hpp" #include "../../../../Machines/DynamicMachine.hpp" + #include #include @@ -45,7 +47,22 @@ struct MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machi private: const std::vector> &machines_; + std::vector queues_; Delegate *delegate_ = nullptr; + + /*! + Performs a parallel for operation across all machines, performing the supplied + function on each and returning only once all applications have completed. + + No guarantees are extended as to which thread operations will occur on. + */ + void perform_parallel(const std::function &); + + /*! + Performs a serial for operation across all machines, performing the supplied + function on each on the calling thread. + */ + void perform_serial(const std::function &); }; } diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index c523032ed..3c1641fcc 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -70,6 +70,11 @@ namespace { std::vector> machines; for(const auto &target: targets) { machines.emplace_back(MachineForTarget(*target, rom_fetcher, error)); + + // Exit early if any errors have occurred. + if(error != Error::None) { + return nullptr; + } } return new Analyser::Dynamic::MultiMachine(std::move(machines)); From d63a95983d98547e562a80cb91ad359133914916 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 9 Feb 2018 09:10:56 -0500 Subject: [PATCH 17/37] Adds a couple of hard-stop conditions to the MSX, and respect for hard stops. --- .../MultiMachine/Implementation/MultiCRTMachine.cpp | 2 +- Machines/MSX/Cartridges/ASCII16kb.hpp | 1 + Machines/MSX/Cartridges/ASCII8kb.hpp | 1 + Machines/MSX/Cartridges/Konami.hpp | 1 + Machines/MSX/Cartridges/KonamiWithSCC.hpp | 1 + Machines/MSX/MSX.cpp | 11 +++++++++++ 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index d83b937e6..2f6bc1433 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -46,7 +46,7 @@ Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() { void MultiCRTMachine::run_for(const Cycles cycles) { for(const auto &machine: machines_) { CRTMachine::Machine *crt_machine = machine->crt_machine(); - if(crt_machine) crt_machine->run_for(cycles); + if(crt_machine && crt_machine->get_confidence() >= 0.01f) crt_machine->run_for(cycles); } if(delegate_) delegate_->multi_crt_did_run_machines(); diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index 73b4ac16f..35b5c22b7 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -20,6 +20,7 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { map_(map), slot_(slot) {} void write(uint16_t address, uint8_t value) override { +// printf("A16 %04x ", address); switch(address >> 11) { default: confidence_counter_.add_miss(); diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index 76016e9ff..ae6e48656 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -20,6 +20,7 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { map_(map), slot_(slot) {} void write(uint16_t address, uint8_t value) override { +// printf("A8 %04x ", address); switch(address >> 11) { default: confidence_counter_.add_miss(); diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp index aa8be8c4c..047844a07 100644 --- a/Machines/MSX/Cartridges/Konami.hpp +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -20,6 +20,7 @@ class KonamiROMSlotHandler: public ROMSlotHandler { map_(map), slot_(slot) {} void write(uint16_t address, uint8_t value) override { +// printf("K %04x ", address); switch(address >> 13) { default: confidence_counter_.add_miss(); diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp index caf74c085..f5a579b42 100644 --- a/Machines/MSX/Cartridges/KonamiWithSCC.hpp +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -21,6 +21,7 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { map_(map), slot_(slot), scc_(scc) {} void write(uint16_t address, uint8_t value) override { +// printf("KSCC %04x ", address); switch(address >> 11) { default: confidence_counter_.add_miss(); diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index f8d5ee544..5bbcce091 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -158,6 +158,7 @@ class ConcreteMachine: } float get_confidence() override { + if(performed_unmapped_access_ || pc_zero_accesses_ > 1) return 0.0f; if(memory_slots_[1].handler) { return memory_slots_[1].handler->get_confidence(); } @@ -340,6 +341,13 @@ class ConcreteMachine: break; } } + + if(!address) { + pc_zero_accesses_++; + } + if(read_pointers_[address >> 13] == unpopulated_) { + performed_unmapped_access_ = true; + } case CPU::Z80::PartialMachineCycle::Read: if(read_pointers_[address >> 13]) { *cycle.value = read_pointers_[address >> 13][address & 8191]; @@ -653,6 +661,9 @@ class ConcreteMachine: std::string input_text_; MSX::KeyboardMapper keyboard_mapper_; + + int pc_zero_accesses_ = 0; + bool performed_unmapped_access_ = false; }; } From 43b682a5afadb49108e81740d1a04cc02a002ff1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 9 Feb 2018 16:31:05 -0500 Subject: [PATCH 18/37] Adds multiple target versions of all the DynamicMachine-vended types. --- .../Implementation/MultiCRTMachine.hpp | 3 +- .../Implementation/MultiConfigurable.cpp | 62 +++++++++++++++++++ .../Implementation/MultiConfigurable.hpp | 36 +++++++++++ .../Implementation/MultiJoystickMachine.cpp | 22 +++++++ .../Implementation/MultiJoystickMachine.hpp | 35 +++++++++++ .../Implementation/MultiKeyboardMachine.cpp | 43 +++++++++++++ .../Implementation/MultiKeyboardMachine.hpp | 37 +++++++++++ .../Dynamic/MultiMachine/MultiMachine.cpp | 15 +++-- .../Dynamic/MultiMachine/MultiMachine.hpp | 7 ++- Configurable/Configurable.hpp | 10 +++ Machines/AmstradCPC/AmstradCPC.cpp | 4 +- Machines/Commodore/Vic-20/Vic20.cpp | 4 +- Machines/DynamicMachine.hpp | 1 - Machines/Electron/Electron.cpp | 4 +- Machines/KeyboardMachine.cpp | 6 +- Machines/KeyboardMachine.hpp | 3 +- Machines/MSX/MSX.cpp | 4 +- Machines/Oric/Oric.cpp | 4 +- Machines/Utility/TypedDynamicMachine.hpp | 4 -- Machines/ZX8081/ZX8081.cpp | 4 +- .../Clock Signal.xcodeproj/project.pbxproj | 26 ++++++++ .../Mac/Clock Signal/Machine/CSMachine.mm | 2 +- 22 files changed, 304 insertions(+), 32 deletions(-) create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp index 9480fb50a..1152483d9 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp @@ -13,14 +13,13 @@ #include "../../../../Machines/CRTMachine.hpp" #include "../../../../Machines/DynamicMachine.hpp" - #include #include namespace Analyser { namespace Dynamic { -struct MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machine::Delegate { +class MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machine::Delegate { public: MultiCRTMachine(const std::vector> &machines); diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp new file mode 100644 index 000000000..8d288cfb1 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp @@ -0,0 +1,62 @@ +// +// MultiConfigurable.cpp +// Clock Signal +// +// Created by Thomas Harte on 09/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "MultiConfigurable.hpp" + +using namespace Analyser::Dynamic; + +MultiConfigurable::MultiConfigurable(const std::vector> &machines) { + for(const auto &machine: machines) { + Configurable::Device *device = machine->configurable_device(); + if(device) devices_.push_back(device); + } +} + +std::vector> MultiConfigurable::get_options() { + std::vector> options; + + // Produce the list of unique options. + for(const auto &device : devices_) { + std::vector> device_options = device->get_options(); + for(auto &option : device_options) { + if(std::find(options.begin(), options.end(), option) == options.end()) { + options.push_back(std::move(option)); + } + } + } + + return options; +} + +void MultiConfigurable::set_selections(const Configurable::SelectionSet &selection_by_option) { + for(const auto &device : devices_) { + device->set_selections(selection_by_option); + } +} + +Configurable::SelectionSet MultiConfigurable::get_accurate_selections() { + Configurable::SelectionSet set; + for(const auto &device : devices_) { + Configurable::SelectionSet device_set = device->get_accurate_selections(); + for(auto &selection : device_set) { + set.insert(std::move(selection)); + } + } + return set; +} + +Configurable::SelectionSet MultiConfigurable::get_user_friendly_selections() { + Configurable::SelectionSet set; + for(const auto &device : devices_) { + Configurable::SelectionSet device_set = device->get_user_friendly_selections(); + for(auto &selection : device_set) { + set.insert(std::move(selection)); + } + } + return set; +} diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp new file mode 100644 index 000000000..8f00057e8 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp @@ -0,0 +1,36 @@ +// +// MultiConfigurable.hpp +// Clock Signal +// +// Created by Thomas Harte on 09/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef MultiConfigurable_hpp +#define MultiConfigurable_hpp + +#include "../../../../Machines/DynamicMachine.hpp" + +#include +#include + +namespace Analyser { +namespace Dynamic { + +class MultiConfigurable: public Configurable::Device { + public: + MultiConfigurable(const std::vector> &machines); + + std::vector> get_options() override; + void set_selections(const Configurable::SelectionSet &selection_by_option) override; + Configurable::SelectionSet get_accurate_selections() override; + Configurable::SelectionSet get_user_friendly_selections() override; + + private: + std::vector devices_; +}; + +} +} + +#endif /* MultiConfigurable_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp new file mode 100644 index 000000000..d899b9e36 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp @@ -0,0 +1,22 @@ +// +// MultiJoystickMachine.cpp +// Clock Signal +// +// Created by Thomas Harte on 09/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "MultiJoystickMachine.hpp" + +using namespace Analyser::Dynamic; + +MultiJoystickMachine::MultiJoystickMachine(const std::vector> &machines) { + for(const auto &machine: machines) { + JoystickMachine::Machine *joystick_machine = machine->joystick_machine(); + if(joystick_machine) machines_.push_back(joystick_machine); + } +} + +std::vector> &MultiJoystickMachine::get_joysticks() { + return joysticks_; +} diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp new file mode 100644 index 000000000..dad324354 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp @@ -0,0 +1,35 @@ +// +// MultiJoystickMachine.hpp +// Clock Signal +// +// Created by Thomas Harte on 09/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef MultiJoystickMachine_hpp +#define MultiJoystickMachine_hpp + +#include "../../../../Machines/DynamicMachine.hpp" + +#include +#include + +namespace Analyser { +namespace Dynamic { + +class MultiJoystickMachine: public JoystickMachine::Machine { + public: + MultiJoystickMachine(const std::vector> &machines); + + std::vector> &get_joysticks() override; + + private: + std::vector machines_; + std::vector> joysticks_; + +}; + +} +} + +#endif /* MultiJoystickMachine_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp new file mode 100644 index 000000000..2806801a7 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp @@ -0,0 +1,43 @@ +// +// MultiKeyboardMachine.cpp +// Clock Signal +// +// Created by Thomas Harte on 09/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "MultiKeyboardMachine.hpp" + +using namespace Analyser::Dynamic; + +MultiKeyboardMachine::MultiKeyboardMachine(const std::vector> &machines) { + for(const auto &machine: machines) { + KeyboardMachine::Machine *keyboard_machine = machine->keyboard_machine(); + if(keyboard_machine) machines_.push_back(keyboard_machine); + } +} + +void MultiKeyboardMachine::clear_all_keys() { + for(const auto &machine: machines_) { + machine->clear_all_keys(); + } +} + +void MultiKeyboardMachine::set_key_state(uint16_t key, bool is_pressed) { + for(const auto &machine: machines_) { + machine->set_key_state(key, is_pressed); + } +} + +void MultiKeyboardMachine::type_string(const std::string &string) { + for(const auto &machine: machines_) { + machine->type_string(string); + } +} + +void MultiKeyboardMachine::keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) { + for(const auto &machine: machines_) { + uint16_t mapped_key = machine->get_keyboard_mapper()->mapped_key_for_key(key); + if(mapped_key != KeyNotMapped) machine->set_key_state(mapped_key, is_pressed); + } +} diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp new file mode 100644 index 000000000..47df189a0 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp @@ -0,0 +1,37 @@ +// +// MultiKeyboardMachine.hpp +// Clock Signal +// +// Created by Thomas Harte on 09/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef MultiKeyboardMachine_hpp +#define MultiKeyboardMachine_hpp + +#include "../../../../Machines/DynamicMachine.hpp" +#include "../../../../Machines/KeyboardMachine.hpp" + +#include +#include + +namespace Analyser { +namespace Dynamic { + +class MultiKeyboardMachine: public ::KeyboardMachine::Machine { + public: + MultiKeyboardMachine(const std::vector> &machines); + + void clear_all_keys() override; + void set_key_state(uint16_t key, bool is_pressed) override; + void type_string(const std::string &) override; + void keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) override; + + private: + std::vector<::KeyboardMachine::Machine *> machines_; +}; + +} +} + +#endif /* MultiKeyboardMachine_hpp */ diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index 380347e98..daceb8a7a 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -12,8 +12,11 @@ using namespace Analyser::Dynamic; MultiMachine::MultiMachine(std::vector> &&machines) : machines_(std::move(machines)), + configurable_(machines_), configuration_target_(machines_), - crt_machine_(machines_) { + crt_machine_(machines_), + joystick_machine_(machines), + keyboard_machine_(machines_) { crt_machine_.set_delegate(this); } @@ -26,19 +29,15 @@ CRTMachine::Machine *MultiMachine::crt_machine() { } JoystickMachine::Machine *MultiMachine::joystick_machine() { - return nullptr; + return &joystick_machine_; } KeyboardMachine::Machine *MultiMachine::keyboard_machine() { - return nullptr; + return &keyboard_machine_; } Configurable::Device *MultiMachine::configurable_device() { - return nullptr; -} - -Utility::TypeRecipient *MultiMachine::type_recipient() { - return nullptr; + return &configurable_; } void MultiMachine::multi_crt_did_run_machines() { diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index bcf3d10ed..6afa5bd22 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -11,8 +11,11 @@ #include "../../../Machines/DynamicMachine.hpp" +#include "Implementation/MultiConfigurable.hpp" #include "Implementation/MultiConfigurationTarget.hpp" #include "Implementation/MultiCRTMachine.hpp" +#include "Implementation/MultiJoystickMachine.hpp" +#include "Implementation/MultiKeyboardMachine.hpp" #include #include @@ -41,15 +44,17 @@ class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::De JoystickMachine::Machine *joystick_machine() override; KeyboardMachine::Machine *keyboard_machine() override; Configurable::Device *configurable_device() override; - Utility::TypeRecipient *type_recipient() override; void multi_crt_did_run_machines() override; private: std::vector> machines_; + MultiConfigurable configurable_; MultiConfigurationTarget configuration_target_; MultiCRTMachine crt_machine_; + MultiJoystickMachine joystick_machine_; + MultiKeyboardMachine keyboard_machine_; }; } diff --git a/Configurable/Configurable.hpp b/Configurable/Configurable.hpp index 7def8d64a..e08e72b8d 100644 --- a/Configurable/Configurable.hpp +++ b/Configurable/Configurable.hpp @@ -26,6 +26,10 @@ struct Option { virtual ~Option() {} Option(const std::string &long_name, const std::string &short_name) : long_name(long_name), short_name(short_name) {} + + virtual bool operator==(const Option &rhs) { + return long_name == rhs.long_name && short_name == rhs.short_name; + } }; struct BooleanOption: public Option { @@ -35,6 +39,12 @@ struct BooleanOption: public Option { struct ListOption: public Option { std::vector options; ListOption(const std::string &long_name, const std::string &short_name, const std::vector &options) : Option(long_name, short_name), options(options) {} + + virtual bool operator==(const Option &rhs) { + const ListOption *list_rhs = dynamic_cast(&rhs); + if(!list_rhs) return false; + return long_name == rhs.long_name && short_name == rhs.short_name && options == list_rhs->options; + } }; struct BooleanSelection; diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 880b6a335..ed646e856 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -976,8 +976,8 @@ class ConcreteMachine: key_state_.clear_all_keys(); } - KeyboardMapper &get_keyboard_mapper() override { - return keyboard_mapper_; + KeyboardMapper *get_keyboard_mapper() override { + return &keyboard_mapper_; } private: diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 8a4754218..551404825 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -662,8 +662,8 @@ class ConcreteMachine: keyboard_via_.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !tape->get_input()); } - KeyboardMapper &get_keyboard_mapper() override { - return keyboard_mapper_; + KeyboardMapper *get_keyboard_mapper() override { + return &keyboard_mapper_; } // MARK: - Configuration options. diff --git a/Machines/DynamicMachine.hpp b/Machines/DynamicMachine.hpp index 1182120ee..96839410d 100644 --- a/Machines/DynamicMachine.hpp +++ b/Machines/DynamicMachine.hpp @@ -29,7 +29,6 @@ struct DynamicMachine { virtual JoystickMachine::Machine *joystick_machine() = 0; virtual KeyboardMachine::Machine *keyboard_machine() = 0; virtual Configurable::Device *configurable_device() = 0; - virtual Utility::TypeRecipient *type_recipient() = 0; }; } diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 7697ceef8..714348515 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -425,8 +425,8 @@ class ConcreteMachine: Utility::TypeRecipient::add_typer(string, std::move(mapper)); } - KeyboardMapper &get_keyboard_mapper() override { - return keyboard_mapper_; + KeyboardMapper *get_keyboard_mapper() override { + return &keyboard_mapper_; } // MARK: - Configuration options. diff --git a/Machines/KeyboardMachine.cpp b/Machines/KeyboardMachine.cpp index ff21ddf44..1cbdc28d3 100644 --- a/Machines/KeyboardMachine.cpp +++ b/Machines/KeyboardMachine.cpp @@ -15,7 +15,7 @@ Machine::Machine() { } void Machine::keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) { - uint16_t mapped_key = get_keyboard_mapper().mapped_key_for_key(key); + uint16_t mapped_key = get_keyboard_mapper()->mapped_key_for_key(key); if(mapped_key != KeyNotMapped) set_key_state(mapped_key, is_pressed); } @@ -30,3 +30,7 @@ Inputs::Keyboard &Machine::get_keyboard() { void Machine::type_string(const std::string &) { } + +Machine::KeyboardMapper *Machine::get_keyboard_mapper() { + return nullptr; +} diff --git a/Machines/KeyboardMachine.hpp b/Machines/KeyboardMachine.hpp index da911412b..4f65855f3 100644 --- a/Machines/KeyboardMachine.hpp +++ b/Machines/KeyboardMachine.hpp @@ -61,12 +61,11 @@ class Machine: public Inputs::Keyboard::Delegate { */ static const uint16_t KeyNotMapped = 0xfffe; - protected: /*! Allows individual machines to provide the mapping between host keys as per Inputs::Keyboard and their native scheme. */ - virtual KeyboardMapper &get_keyboard_mapper() = 0; + virtual KeyboardMapper *get_keyboard_mapper(); private: void keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) override; diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 5bbcce091..43fa774b4 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -529,8 +529,8 @@ class ConcreteMachine: if(is_pressed) key_states_[line] &= ~mask; else key_states_[line] |= mask; } - KeyboardMapper &get_keyboard_mapper() override { - return keyboard_mapper_; + KeyboardMapper *get_keyboard_mapper() override { + return &keyboard_mapper_; } // MARK: - Configuration options. diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 6a0e42b27..262b55050 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -432,8 +432,8 @@ class ConcreteMachine: set_interrupt_line(); } - KeyboardMapper &get_keyboard_mapper() override { - return keyboard_mapper_; + KeyboardMapper *get_keyboard_mapper() override { + return &keyboard_mapper_; } // MARK: - Configuration options. diff --git a/Machines/Utility/TypedDynamicMachine.hpp b/Machines/Utility/TypedDynamicMachine.hpp index a39f710d1..83b3f7087 100644 --- a/Machines/Utility/TypedDynamicMachine.hpp +++ b/Machines/Utility/TypedDynamicMachine.hpp @@ -45,10 +45,6 @@ template class TypedDynamicMachine: public ::Machine::DynamicMachine return get(); } - Utility::TypeRecipient *type_recipient() override { - return get(); - } - private: template Class *get() { return dynamic_cast(machine_.get()); diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 6906915c4..a5e044c53 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -349,8 +349,8 @@ template class ConcreteMachine: HalfCycles get_typer_delay() override final { return Cycles(7000000); } HalfCycles get_typer_frequency() override final { return Cycles(390000); } - KeyboardMapper &get_keyboard_mapper() override { - return keyboard_mapper_; + KeyboardMapper *get_keyboard_mapper() override { + return &keyboard_mapper_; } // MARK: - Configuration options. diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index c28a5e7a9..bf70503cc 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -131,6 +131,13 @@ 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 */; }; + 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 */; }; + 4B1B88C0202E3DB200B67DFF /* MultiConfigurable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88BE202E3DB200B67DFF /* MultiConfigurable.cpp */; }; + 4B1B88C1202E3DB200B67DFF /* MultiConfigurable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88BE202E3DB200B67DFF /* MultiConfigurable.cpp */; }; + 4B1B88C8202E469300B67DFF /* MultiJoystickMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88C6202E469300B67DFF /* MultiJoystickMachine.cpp */; }; + 4B1B88C9202E469400B67DFF /* MultiJoystickMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1B88C6202E469300B67DFF /* MultiJoystickMachine.cpp */; }; 4B1D08061E0F7A1100763741 /* TimeTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B1D08051E0F7A1100763741 /* TimeTests.mm */; }; 4B1E85811D176468001EF87D /* 6532Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1E85801D176468001EF87D /* 6532Tests.swift */; }; 4B1EDB451E39A0AC009D6819 /* chip.png in Resources */ = {isa = PBXBuildFile; fileRef = 4B1EDB431E39A0AC009D6819 /* chip.png */; }; @@ -691,6 +698,12 @@ 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 = ""; }; 4B1667FB1FFF215F00A16032 /* KonamiWithSCC.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = KonamiWithSCC.hpp; path = MSX/Cartridges/KonamiWithSCC.hpp; sourceTree = ""; }; + 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiKeyboardMachine.cpp; sourceTree = ""; }; + 4B1B88BA202E2EC100B67DFF /* MultiKeyboardMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MultiKeyboardMachine.hpp; sourceTree = ""; }; + 4B1B88BE202E3DB200B67DFF /* MultiConfigurable.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiConfigurable.cpp; sourceTree = ""; }; + 4B1B88BF202E3DB200B67DFF /* MultiConfigurable.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MultiConfigurable.hpp; sourceTree = ""; }; + 4B1B88C6202E469300B67DFF /* MultiJoystickMachine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiJoystickMachine.cpp; sourceTree = ""; }; + 4B1B88C7202E469300B67DFF /* MultiJoystickMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MultiJoystickMachine.hpp; sourceTree = ""; }; 4B1D08051E0F7A1100763741 /* TimeTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TimeTests.mm; sourceTree = ""; }; 4B1E857B1D174DEC001EF87D /* 6532.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6532.hpp; sourceTree = ""; }; 4B1E85801D176468001EF87D /* 6532Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6532Tests.swift; sourceTree = ""; }; @@ -2665,6 +2678,12 @@ 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */, 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */, 4BBB70A7202014E2002FE009 /* MultiCRTMachine.hpp */, + 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */, + 4B1B88BA202E2EC100B67DFF /* MultiKeyboardMachine.hpp */, + 4B1B88BE202E3DB200B67DFF /* MultiConfigurable.cpp */, + 4B1B88BF202E3DB200B67DFF /* MultiConfigurable.hpp */, + 4B1B88C6202E469300B67DFF /* MultiJoystickMachine.cpp */, + 4B1B88C7202E469300B67DFF /* MultiJoystickMachine.hpp */, ); path = Implementation; sourceTree = ""; @@ -3359,6 +3378,7 @@ buildActionMask = 2147483647; files = ( 4B0E04FB1FC9FA3100F43484 /* 9918.cpp in Sources */, + 4B1B88C9202E469400B67DFF /* MultiJoystickMachine.cpp in Sources */, 4B055AAA1FAE85F50060FFFF /* CPM.cpp in Sources */, 4B055A9A1FAE85CB0060FFFF /* MFMDiskController.cpp in Sources */, 4B055ACB1FAE9AFB0060FFFF /* SerialBus.cpp in Sources */, @@ -3396,6 +3416,7 @@ 4B055AC71FAE9AEE0060FFFF /* TIA.cpp in Sources */, 4B055AD21FAE9B0B0060FFFF /* Keyboard.cpp in Sources */, 4B89451B201967B4007DE474 /* ConfidenceSummary.cpp in Sources */, + 4B1B88C1202E3DB200B67DFF /* MultiConfigurable.cpp in Sources */, 4B055AA31FAE85DF0060FFFF /* ImplicitSectors.cpp in Sources */, 4B055AAE1FAE85FD0060FFFF /* TrackSerialiser.cpp in Sources */, 4B89452B201967B4007DE474 /* File.cpp in Sources */, @@ -3414,6 +3435,7 @@ 4B894519201967B4007DE474 /* ConfidenceCounter.cpp in Sources */, 4B055AEE1FAE9BBF0060FFFF /* Keyboard.cpp in Sources */, 4B055AED1FAE9BA20060FFFF /* Z80Storage.cpp in Sources */, + 4B1B88BC202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */, 4B055AD11FAE9B030060FFFF /* Video.cpp in Sources */, 4B055AA21FAE85DA0060FFFF /* SSD.cpp in Sources */, 4BEBFB4E2002C4BF000708CC /* MSXDSK.cpp in Sources */, @@ -3447,6 +3469,7 @@ 4B055AC41FAE9AE80060FFFF /* Keyboard.cpp in Sources */, 4B055A941FAE85B50060FFFF /* CommodoreROM.cpp in Sources */, 4BBB70A5202011C2002FE009 /* MultiConfigurationTarget.cpp in Sources */, + 4B1B88BD202E3D3D00B67DFF /* MultiMachine.cpp in Sources */, 4B055A971FAE85BB0060FFFF /* ZX8081.cpp in Sources */, 4B055AAD1FAE85FD0060FFFF /* PCMTrack.cpp in Sources */, 4B055AC61FAE9AEE0060FFFF /* TIASound.cpp in Sources */, @@ -3512,6 +3535,7 @@ 4B322E041F5A2E3C004EB04C /* Z80Base.cpp in Sources */, 4B894530201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B4518A31F75FD1C00926311 /* HFE.cpp in Sources */, + 4B1B88BB202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */, 4B4518A11F75FD1C00926311 /* D64.cpp in Sources */, 4B1558C01F844ECD006E9A97 /* BitReverse.cpp in Sources */, 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */, @@ -3638,9 +3662,11 @@ 4B89453E201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4B37EE821D7345A6006A09A4 /* BinaryDump.cpp in Sources */, 4B8334821F5D9FF70097E338 /* PartialMachineCycle.cpp in Sources */, + 4B1B88C0202E3DB200B67DFF /* MultiConfigurable.cpp in Sources */, 4B54C0BC1F8D8E790050900F /* KeyboardMachine.cpp in Sources */, 4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */, 4B894534201967B4007DE474 /* AddressMapper.cpp in Sources */, + 4B1B88C8202E469300B67DFF /* MultiJoystickMachine.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm index 15fd31701..b0fe69d5d 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm @@ -181,7 +181,7 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg } - (void)paste:(NSString *)paste { - KeyboardMachine::Machine *keyboardMachine = _machine->type_recipient(); + KeyboardMachine::Machine *keyboardMachine = _machine->keyboard_machine(); if(keyboardMachine) keyboardMachine->type_string([paste UTF8String]); } From eb39617ad0bd6a6aa8ce589f66e880396389d7a5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 10 Feb 2018 17:11:16 -0500 Subject: [PATCH 19/37] Allows cartridges to filter based on the actor talking to them; corrects outstanding_machines access error. --- .../Implementation/MultiCRTMachine.cpp | 13 +++++++------ Machines/MSX/Cartridges/ASCII16kb.hpp | 6 +++--- Machines/MSX/Cartridges/ASCII8kb.hpp | 10 +++++----- Machines/MSX/Cartridges/Konami.hpp | 12 ++++++------ Machines/MSX/Cartridges/KonamiWithSCC.hpp | 16 ++++++++-------- Machines/MSX/DiskROM.cpp | 2 +- Machines/MSX/DiskROM.hpp | 2 +- Machines/MSX/MSX.cpp | 4 +++- Machines/MSX/ROMSlotHandler.hpp | 2 +- .../Mac/Clock Signal.xcodeproj/project.pbxproj | 12 ++++++------ 10 files changed, 41 insertions(+), 38 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index 5f6cb013a..a735b5a76 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -34,10 +34,11 @@ void MultiCRTMachine::perform_parallel(const std::function lock(mutex); condition.wait(lock); - } while(outstanding_machines); + if(!outstanding_machines) break; + } } void MultiCRTMachine::perform_serial(const std::function &function) { @@ -89,17 +90,17 @@ bool MultiCRTMachine::get_clock_is_unlimited() { } void MultiCRTMachine::did_change_machine_order() { - // TODO + // TODO: shuffle delegates and announce potential output rate changes. } void MultiCRTMachine::set_delegate(::CRTMachine::Machine::Delegate *delegate) { - // TODO + // TODO: } void MultiCRTMachine::machine_did_change_clock_rate(Machine *machine) { - // TODO + // TODO: consider passing along. } void MultiCRTMachine::machine_did_change_clock_is_unlimited(Machine *machine) { - // TODO + // TODO: consider passing along. } diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index 35b5c22b7..3b34f86a0 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -19,18 +19,18 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { ASCII16kbROMSlotHandler(MSX::MemoryMap &map, int slot) : map_(map), slot_(slot) {} - void write(uint16_t address, uint8_t value) override { + void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) override { // printf("A16 %04x ", address); switch(address >> 11) { default: confidence_counter_.add_miss(); break; case 0xc: - if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x4000, 0x4000, 0x4000); break; case 0xe: - if(address == 0x7000 || address == 0x77ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && (address == 0x7000 || address == 0x77ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x4000, 0x8000, 0x4000); break; } diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index ae6e48656..dab987e98 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -19,26 +19,26 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { ASCII8kbROMSlotHandler(MSX::MemoryMap &map, int slot) : map_(map), slot_(slot) {} - void write(uint16_t address, uint8_t value) override { + void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) override { // printf("A8 %04x ", address); switch(address >> 11) { default: confidence_counter_.add_miss(); break; case 0xc: - if(address == 0x6000 || address == 0x60ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && (address == 0x6000 || address == 0x60ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0x4000, 0x2000); break; case 0xd: - if(address == 0x6800 || address == 0x68ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && (address == 0x6800 || address == 0x68ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 0xe: - if(address == 0x7000 || address == 0x70ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && (address == 0x7000 || address == 0x70ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0x8000, 0x2000); break; case 0xf: - if(address == 0x7800 || address == 0x78ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && (address == 0x7800 || address == 0x78ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp index 047844a07..5d15d38ce 100644 --- a/Machines/MSX/Cartridges/Konami.hpp +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -19,22 +19,22 @@ class KonamiROMSlotHandler: public ROMSlotHandler { KonamiROMSlotHandler(MSX::MemoryMap &map, int slot) : map_(map), slot_(slot) {} - void write(uint16_t address, uint8_t value) override { -// printf("K %04x ", address); + void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) override { +// printf("K %04x[%c] ", address, pc_is_outside_bios ? '.' : '+'); switch(address >> 13) { default: - confidence_counter_.add_miss(); + if(pc_is_outside_bios) confidence_counter_.add_miss(); break; case 3: - if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 4: - if(address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0x8000, 0x2000); break; case 5: - if(address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp index f5a579b42..b7327d0df 100644 --- a/Machines/MSX/Cartridges/KonamiWithSCC.hpp +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -20,22 +20,22 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { KonamiWithSCCROMSlotHandler(MSX::MemoryMap &map, int slot, Konami::SCC &scc) : map_(map), slot_(slot), scc_(scc) {} - void write(uint16_t address, uint8_t value) override { + void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) override { // printf("KSCC %04x ", address); switch(address >> 11) { default: - confidence_counter_.add_miss(); + if(pc_is_outside_bios) confidence_counter_.add_miss(); break; case 0x0a: - if(address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0x4000, 0x2000); break; case 0x0e: - if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 0x12: - if(address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); if((value&0x3f) == 0x3f) { scc_is_visible_ = true; map_.unmap(slot_, 0x8000, 0x2000); @@ -46,14 +46,14 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { break; case 0x13: if(scc_is_visible_) { - confidence_counter_.add_hit(); + if(pc_is_outside_bios) confidence_counter_.add_hit(); scc_.write(address, value); } else { - confidence_counter_.add_miss(); + if(pc_is_outside_bios) confidence_counter_.add_miss(); } break; case 0x16: - if(address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios && address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } diff --git a/Machines/MSX/DiskROM.cpp b/Machines/MSX/DiskROM.cpp index 4382768f4..2025098b9 100644 --- a/Machines/MSX/DiskROM.cpp +++ b/Machines/MSX/DiskROM.cpp @@ -16,7 +16,7 @@ DiskROM::DiskROM(const std::vector &rom) : set_is_double_density(true); } -void DiskROM::write(uint16_t address, uint8_t value) { +void DiskROM::write(uint16_t address, uint8_t value, bool pc_is_outside_bios) { switch(address) { case 0x7ff8: case 0x7ff9: case 0x7ffa: case 0x7ffb: set_register(address, value); diff --git a/Machines/MSX/DiskROM.hpp b/Machines/MSX/DiskROM.hpp index b7cce1c1d..bab03d380 100644 --- a/Machines/MSX/DiskROM.hpp +++ b/Machines/MSX/DiskROM.hpp @@ -22,7 +22,7 @@ class DiskROM: public ROMSlotHandler, public WD::WD1770 { public: DiskROM(const std::vector &rom); - void write(uint16_t address, uint8_t value) override; + void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) override; uint8_t read(uint16_t address) override; void run_for(HalfCycles half_cycles) override; diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 43fa774b4..c5b61e83a 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -348,6 +348,7 @@ class ConcreteMachine: if(read_pointers_[address >> 13] == unpopulated_) { performed_unmapped_access_ = true; } + pc_address_ = address; // This is retained so as to be able to name the source of an access to cartridge handlers. case CPU::Z80::PartialMachineCycle::Read: if(read_pointers_[address >> 13]) { *cycle.value = read_pointers_[address >> 13][address & 8191]; @@ -365,7 +366,7 @@ class ConcreteMachine: if(memory_slots_[slot_hit].handler) { update_audio(); memory_slots_[slot_hit].handler->run_for(memory_slots_[slot_hit].cycles_since_update.flush()); - memory_slots_[slot_hit].handler->write(address, *cycle.value); + memory_slots_[slot_hit].handler->write(address, *cycle.value, read_pointers_[pc_address_ >> 13] != memory_slots_[0].read_pointers[pc_address_ >> 13]); } } break; @@ -664,6 +665,7 @@ class ConcreteMachine: int pc_zero_accesses_ = 0; bool performed_unmapped_access_ = false; + uint16_t pc_address_; }; } diff --git a/Machines/MSX/ROMSlotHandler.hpp b/Machines/MSX/ROMSlotHandler.hpp index 2ae628785..4dc567e6c 100644 --- a/Machines/MSX/ROMSlotHandler.hpp +++ b/Machines/MSX/ROMSlotHandler.hpp @@ -47,7 +47,7 @@ class ROMSlotHandler { virtual void run_for(HalfCycles half_cycles) {} /*! Announces an attempt to write @c value to @c address. */ - virtual void write(uint16_t address, uint8_t value) = 0; + virtual void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) = 0; /*! Seeks the result of a read at @c address; this is used only if the area is unmapped. */ virtual uint8_t read(uint16_t address) { return 0xff; } diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index bf70503cc..617d6fc15 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -2674,16 +2674,16 @@ 4BBB70A1202011C2002FE009 /* Implementation */ = { isa = PBXGroup; children = ( - 4BBB70A2202011C2002FE009 /* MultiConfigurationTarget.hpp */, + 4B1B88BE202E3DB200B67DFF /* MultiConfigurable.cpp */, 4BBB70A3202011C2002FE009 /* MultiConfigurationTarget.cpp */, 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */, - 4BBB70A7202014E2002FE009 /* MultiCRTMachine.hpp */, - 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */, - 4B1B88BA202E2EC100B67DFF /* MultiKeyboardMachine.hpp */, - 4B1B88BE202E3DB200B67DFF /* MultiConfigurable.cpp */, - 4B1B88BF202E3DB200B67DFF /* MultiConfigurable.hpp */, 4B1B88C6202E469300B67DFF /* MultiJoystickMachine.cpp */, + 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */, + 4B1B88BF202E3DB200B67DFF /* MultiConfigurable.hpp */, + 4BBB70A2202011C2002FE009 /* MultiConfigurationTarget.hpp */, + 4BBB70A7202014E2002FE009 /* MultiCRTMachine.hpp */, 4B1B88C7202E469300B67DFF /* MultiJoystickMachine.hpp */, + 4B1B88BA202E2EC100B67DFF /* MultiKeyboardMachine.hpp */, ); path = Implementation; sourceTree = ""; From e1cab52c8437d8a985943faeb117da3b7da764b2 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 10 Feb 2018 19:38:26 -0500 Subject: [PATCH 20/37] Ensures thread safety of access to machines array. --- .../Implementation/MultiCRTMachine.cpp | 31 ++++++++++++------- .../Implementation/MultiCRTMachine.hpp | 4 ++- .../MultiConfigurationTarget.cpp | 15 ++++----- .../MultiConfigurationTarget.hpp | 4 +-- .../Dynamic/MultiMachine/MultiMachine.cpp | 4 ++- .../Dynamic/MultiMachine/MultiMachine.hpp | 2 ++ .../xcschemes/Clock Signal.xcscheme | 1 + 7 files changed, 39 insertions(+), 22 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index a735b5a76..a18c39c13 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -13,25 +13,29 @@ using namespace Analyser::Dynamic; -MultiCRTMachine::MultiCRTMachine(const std::vector> &machines) : - machines_(machines), queues_(machines.size()) {} +MultiCRTMachine::MultiCRTMachine(const std::vector> &machines, std::mutex &machines_mutex) : + machines_(machines), machines_mutex_(machines_mutex), queues_(machines.size()) {} void MultiCRTMachine::perform_parallel(const std::function &function) { // Apply a blunt force parallelisation of the machines; each run_for is dispatched // to a separate queue and this queue will block until all are done. + volatile std::size_t outstanding_machines; std::condition_variable condition; std::mutex mutex; - std::size_t outstanding_machines = machines_.size(); + { + std::lock_guard machines_lock(machines_mutex_); + outstanding_machines = machines_.size(); - for(std::size_t index = 0; index < machines_.size(); ++index) { - queues_[index].enqueue([&mutex, &condition, this, index, function, &outstanding_machines]() { - CRTMachine::Machine *crt_machine = machines_[index]->crt_machine(); - if(crt_machine) function(crt_machine); + for(std::size_t index = 0; index < machines_.size(); ++index) { + queues_[index].enqueue([&mutex, &condition, this, index, function, &outstanding_machines]() { + CRTMachine::Machine *crt_machine = machines_[index]->crt_machine(); + if(crt_machine) function(crt_machine); - std::unique_lock lock(mutex); - outstanding_machines--; - condition.notify_all(); - }); + std::unique_lock lock(mutex); + outstanding_machines--; + condition.notify_all(); + }); + } } while(true) { @@ -42,6 +46,7 @@ void MultiCRTMachine::perform_parallel(const std::function &function) { + std::lock_guard machines_lock(machines_mutex_); for(const auto &machine: machines_) { CRTMachine::Machine *crt_machine = machine->crt_machine(); if(crt_machine) function(crt_machine); @@ -61,11 +66,13 @@ void MultiCRTMachine::close_output() { } Outputs::CRT::CRT *MultiCRTMachine::get_crt() { + std::lock_guard machines_lock(machines_mutex_); CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); return crt_machine ? crt_machine->get_crt() : nullptr; } Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() { + std::lock_guard machines_lock(machines_mutex_); CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); return crt_machine ? crt_machine->get_speaker() : nullptr; } @@ -80,11 +87,13 @@ void MultiCRTMachine::run_for(const Cycles cycles) { double MultiCRTMachine::get_clock_rate() { // TODO: something smarter than this? Not all clock rates will necessarily be the same. + std::lock_guard machines_lock(machines_mutex_); CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); return crt_machine ? crt_machine->get_clock_rate() : 0.0; } bool MultiCRTMachine::get_clock_is_unlimited() { + std::lock_guard machines_lock(machines_mutex_); CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); return crt_machine ? crt_machine->get_clock_is_unlimited() : false; } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp index 1152483d9..5a2fe112f 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp @@ -14,6 +14,7 @@ #include "../../../../Machines/DynamicMachine.hpp" #include +#include #include namespace Analyser { @@ -21,7 +22,7 @@ namespace Dynamic { class MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machine::Delegate { public: - MultiCRTMachine(const std::vector> &machines); + MultiCRTMachine(const std::vector> &machines, std::mutex &machines_mutex); void setup_output(float aspect_ratio) override; void close_output() override; @@ -46,6 +47,7 @@ class MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machin private: const std::vector> &machines_; + std::mutex &machines_mutex_; std::vector queues_; Delegate *delegate_ = nullptr; diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp index da13ca227..22ae0e6ee 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp @@ -10,19 +10,20 @@ using namespace Analyser::Dynamic; -MultiConfigurationTarget::MultiConfigurationTarget(const std::vector> &machines) : - machines_(machines) {} +MultiConfigurationTarget::MultiConfigurationTarget(const std::vector> &machines) { + for(const auto &machine: machines) { + ConfigurationTarget::Machine *configuration_target = machine->configuration_target(); + if(configuration_target) targets_.push_back(configuration_target); + } +} void MultiConfigurationTarget::configure_as_target(const Analyser::Static::Target &target) { } bool MultiConfigurationTarget::insert_media(const Analyser::Static::Media &media) { bool inserted = false; - for(const auto &machine : machines_) { - ConfigurationTarget::Machine *configuration_target = machine->configuration_target(); - if(configuration_target) { - inserted |= configuration_target->insert_media(media); - } + for(const auto &target : targets_) { + inserted |= target->insert_media(media); } return inserted; } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp index f8790ce9d..886b6db40 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp @@ -18,7 +18,7 @@ namespace Analyser { namespace Dynamic { -struct MultiConfigurationTarget: public ::ConfigurationTarget::Machine { +struct MultiConfigurationTarget: public ConfigurationTarget::Machine { public: MultiConfigurationTarget(const std::vector> &machines); @@ -26,7 +26,7 @@ struct MultiConfigurationTarget: public ::ConfigurationTarget::Machine { bool insert_media(const Analyser::Static::Media &media) override; private: - const std::vector> &machines_; + std::vector targets_; }; } diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index daceb8a7a..ad721ded7 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -14,7 +14,7 @@ MultiMachine::MultiMachine(std::vector> &&machin machines_(std::move(machines)), configurable_(machines_), configuration_target_(machines_), - crt_machine_(machines_), + crt_machine_(machines_, machines_mutex_), joystick_machine_(machines), keyboard_machine_(machines_) { crt_machine_.set_delegate(this); @@ -41,6 +41,7 @@ Configurable::Device *MultiMachine::configurable_device() { } void MultiMachine::multi_crt_did_run_machines() { + std::lock_guard machines_lock(machines_mutex_); DynamicMachine *front = machines_.front().get(); // for(const auto &machine: machines_) { // CRTMachine::Machine *crt = machine->crt_machine(); @@ -49,6 +50,7 @@ void MultiMachine::multi_crt_did_run_machines() { // printf("; "); // } // printf("\n"); + std::stable_sort(machines_.begin(), machines_.end(), [] (const auto &lhs, const auto &rhs){ CRTMachine::Machine *lhs_crt = lhs->crt_machine(); CRTMachine::Machine *rhs_crt = rhs->crt_machine(); diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index 6afa5bd22..66b267eff 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -18,6 +18,7 @@ #include "Implementation/MultiKeyboardMachine.hpp" #include +#include #include namespace Analyser { @@ -49,6 +50,7 @@ class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::De private: std::vector> machines_; + std::mutex machines_mutex_; MultiConfigurable configurable_; MultiConfigurationTarget configuration_target_; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme index 46dd90eea..ebe496fa1 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme +++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme @@ -79,6 +79,7 @@ useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" + stopOnEveryThreadSanitizerIssue = "YES" stopOnEveryUBSanitizerIssue = "YES" debugServiceExtension = "internal" allowLocationSimulation = "NO"> From 8eea55b51c4d9be16c1b99a7c8806fb7fc195cdb Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 10 Feb 2018 23:39:30 -0500 Subject: [PATCH 21/37] Simplifies `perform_parallel` slightly. --- .../Implementation/MultiCRTMachine.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index a18c39c13..d7f33104d 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -24,25 +24,25 @@ void MultiCRTMachine::perform_parallel(const std::function machines_lock(machines_mutex_); + std::lock_guard lock(mutex); outstanding_machines = machines_.size(); for(std::size_t index = 0; index < machines_.size(); ++index) { - queues_[index].enqueue([&mutex, &condition, this, index, function, &outstanding_machines]() { - CRTMachine::Machine *crt_machine = machines_[index]->crt_machine(); + CRTMachine::Machine *crt_machine = machines_[index]->crt_machine(); + queues_[index].enqueue([&mutex, &condition, crt_machine, function, &outstanding_machines]() { if(crt_machine) function(crt_machine); - std::unique_lock lock(mutex); - outstanding_machines--; + { + std::lock_guard lock(mutex); + outstanding_machines--; + } condition.notify_all(); }); } } - while(true) { - std::unique_lock lock(mutex); - condition.wait(lock); - if(!outstanding_machines) break; - } + std::unique_lock lock(mutex); + condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; }); } void MultiCRTMachine::perform_serial(const std::function &function) { From 9960121b08d40d79d94914b4fe9fd65ef75153f5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 11 Feb 2018 20:24:08 -0500 Subject: [PATCH 22/37] Introduces an exit condition for the multi machine. --- .../Dynamic/MultiMachine/MultiMachine.cpp | 55 +++++++++++++++---- .../Dynamic/MultiMachine/MultiMachine.hpp | 3 + 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index ad721ded7..f6c6e78a1 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -21,35 +21,55 @@ MultiMachine::MultiMachine(std::vector> &&machin } ConfigurationTarget::Machine *MultiMachine::configuration_target() { - return &configuration_target_; + if(has_picked_) { + return machines_.front()->configuration_target(); + } else { + return &configuration_target_; + } } CRTMachine::Machine *MultiMachine::crt_machine() { - return &crt_machine_; + if(has_picked_) { + return machines_.front()->crt_machine(); + } else { + return &crt_machine_; + } } JoystickMachine::Machine *MultiMachine::joystick_machine() { - return &joystick_machine_; + if(has_picked_) { + return machines_.front()->joystick_machine(); + } else { + return &joystick_machine_; + } } KeyboardMachine::Machine *MultiMachine::keyboard_machine() { - return &keyboard_machine_; + if(has_picked_) { + return machines_.front()->keyboard_machine(); + } else { + return &keyboard_machine_; + } } Configurable::Device *MultiMachine::configurable_device() { - return &configurable_; + if(has_picked_) { + return machines_.front()->configurable_device(); + } else { + return &configurable_; + } } void MultiMachine::multi_crt_did_run_machines() { std::lock_guard machines_lock(machines_mutex_); DynamicMachine *front = machines_.front().get(); -// for(const auto &machine: machines_) { -// CRTMachine::Machine *crt = machine->crt_machine(); -// printf("%0.2f ", crt->get_confidence()); -// crt->print_type(); -// printf("; "); -// } -// printf("\n"); + for(const auto &machine: machines_) { + CRTMachine::Machine *crt = machine->crt_machine(); + printf("%0.2f ", crt->get_confidence()); + crt->print_type(); + printf("; "); + } + printf("\n"); std::stable_sort(machines_.begin(), machines_.end(), [] (const auto &lhs, const auto &rhs){ CRTMachine::Machine *lhs_crt = lhs->crt_machine(); @@ -60,4 +80,15 @@ void MultiMachine::multi_crt_did_run_machines() { if(machines_.front().get() != front) { crt_machine_.did_change_machine_order(); } + + if(machines_.front()->crt_machine()->get_confidence() > 0.9) { + pick_first(); + } +} + +void MultiMachine::pick_first() { + has_picked_ = true; +// machines_.erase(machines_.begin() + 1, machines_.end()); + // TODO: this isn't quite correct, because it may leak OpenGL/etc resources through failure to + // request a close_output while the context is active. } diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index 66b267eff..1b67b6dce 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -57,6 +57,9 @@ class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::De MultiCRTMachine crt_machine_; MultiJoystickMachine joystick_machine_; MultiKeyboardMachine keyboard_machine_; + + void pick_first(); + bool has_picked_ = false; }; } From dcf313a83322ec17ba32b6730898c71290f74684 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 11 Feb 2018 20:32:21 -0500 Subject: [PATCH 23/37] Changes equivocal semantics. --- Analyser/Dynamic/ConfidenceCounter.cpp | 6 ++++-- Analyser/Dynamic/ConfidenceCounter.hpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Analyser/Dynamic/ConfidenceCounter.cpp b/Analyser/Dynamic/ConfidenceCounter.cpp index c2ce5bbc4..16e1f3075 100644 --- a/Analyser/Dynamic/ConfidenceCounter.cpp +++ b/Analyser/Dynamic/ConfidenceCounter.cpp @@ -23,6 +23,8 @@ void ConfidenceCounter::add_miss() { } void ConfidenceCounter::add_equivocal() { - hits_++; - misses_++; + if(hits_ > misses_) { + hits_++; + misses_++; + } } diff --git a/Analyser/Dynamic/ConfidenceCounter.hpp b/Analyser/Dynamic/ConfidenceCounter.hpp index 9d424c0c5..8494e4b04 100644 --- a/Analyser/Dynamic/ConfidenceCounter.hpp +++ b/Analyser/Dynamic/ConfidenceCounter.hpp @@ -31,8 +31,8 @@ class ConfidenceCounter: public ConfidenceSource { void add_miss(); /*! - Records an event that provides no strong evidence either way — one that - could be a hit but could be a miss — pushes probability up or down towards 0.5. + Records an event that could be correct but isn't necessarily so; which can push probability + down towards 0.5, but will never push it upwards. */ void add_equivocal(); From f02989649c62af0bc9cff449f6117679158bcd50 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 11 Feb 2018 20:32:45 -0500 Subject: [PATCH 24/37] Corrects effect of pc_is_outside_bios. --- Machines/MSX/Cartridges/ASCII16kb.hpp | 8 ++++++-- Machines/MSX/Cartridges/ASCII8kb.hpp | 16 ++++++++++++---- Machines/MSX/Cartridges/Konami.hpp | 14 ++++++++++---- Machines/MSX/Cartridges/KonamiWithSCC.hpp | 16 ++++++++++++---- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index 3b34f86a0..493894754 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -26,11 +26,15 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { confidence_counter_.add_miss(); break; case 0xc: - if(pc_is_outside_bios && address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x4000, 0x4000, 0x4000); break; case 0xe: - if(pc_is_outside_bios && (address == 0x7000 || address == 0x77ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x7000 || address == 0x77ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x4000, 0x8000, 0x4000); break; } diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index dab987e98..ab214e59a 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -26,19 +26,27 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { confidence_counter_.add_miss(); break; case 0xc: - if(pc_is_outside_bios && (address == 0x6000 || address == 0x60ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x6000 || address == 0x60ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0x4000, 0x2000); break; case 0xd: - if(pc_is_outside_bios && (address == 0x6800 || address == 0x68ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x6800 || address == 0x68ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 0xe: - if(pc_is_outside_bios && (address == 0x7000 || address == 0x70ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x7000 || address == 0x70ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0x8000, 0x2000); break; case 0xf: - if(pc_is_outside_bios && (address == 0x7800 || address == 0x78ff)) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x7800 || address == 0x78ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } diff --git a/Machines/MSX/Cartridges/Konami.hpp b/Machines/MSX/Cartridges/Konami.hpp index 5d15d38ce..f61217eaa 100644 --- a/Machines/MSX/Cartridges/Konami.hpp +++ b/Machines/MSX/Cartridges/Konami.hpp @@ -20,21 +20,27 @@ class KonamiROMSlotHandler: public ROMSlotHandler { map_(map), slot_(slot) {} void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) override { -// printf("K %04x[%c] ", address, pc_is_outside_bios ? '.' : '+'); +// printf("K %04x[%c]\n", address, pc_is_outside_bios ? '.' : '+'); switch(address >> 13) { default: if(pc_is_outside_bios) confidence_counter_.add_miss(); break; case 3: - if(pc_is_outside_bios && address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 4: - if(pc_is_outside_bios && address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0x8000, 0x2000); break; case 5: - if(pc_is_outside_bios && address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } diff --git a/Machines/MSX/Cartridges/KonamiWithSCC.hpp b/Machines/MSX/Cartridges/KonamiWithSCC.hpp index b7327d0df..9e6d03e9b 100644 --- a/Machines/MSX/Cartridges/KonamiWithSCC.hpp +++ b/Machines/MSX/Cartridges/KonamiWithSCC.hpp @@ -27,15 +27,21 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { if(pc_is_outside_bios) confidence_counter_.add_miss(); break; case 0x0a: - if(pc_is_outside_bios && address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0x4000, 0x2000); break; case 0x0e: - if(pc_is_outside_bios && address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0x6000, 0x2000); break; case 0x12: - if(pc_is_outside_bios && address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } if((value&0x3f) == 0x3f) { scc_is_visible_ = true; map_.unmap(slot_, 0x8000, 0x2000); @@ -53,7 +59,9 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler { } break; case 0x16: - if(pc_is_outside_bios && address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + if(pc_is_outside_bios) { + if(address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal(); + } map_.map(slot_, value * 0x2000, 0xa000, 0x2000); break; } From d751b7e2cb245c1b6f242c0ebb00fbd01cb7c8e8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 11 Feb 2018 20:32:59 -0500 Subject: [PATCH 25/37] Marginally reformats for current style. --- .../Mac/Clock Signal/Audio/CSAudioQueue.m | 54 +++++++------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/OSBindings/Mac/Clock Signal/Audio/CSAudioQueue.m b/OSBindings/Mac/Clock Signal/Audio/CSAudioQueue.m index 9b968fbca..28cc2d607 100644 --- a/OSBindings/Mac/Clock Signal/Audio/CSAudioQueue.m +++ b/OSBindings/Mac/Clock Signal/Audio/CSAudioQueue.m @@ -25,8 +25,7 @@ static NSLock *CSAudioQueueDeallocLock; @implementation CSWeakAudioQueuePointer @end -@implementation CSAudioQueue -{ +@implementation CSAudioQueue { AudioQueueRef _audioQueue; AudioQueueBufferRef _storedBuffers[NumberOfStoredAudioQueueBuffer]; NSLock *_storedBuffersLock; @@ -38,13 +37,10 @@ static NSLock *CSAudioQueueDeallocLock; /*! @returns @c YES if the queue is running dry; @c NO otherwise. */ -- (BOOL)audioQueue:(AudioQueueRef)theAudioQueue didCallbackWithBuffer:(AudioQueueBufferRef)buffer -{ +- (BOOL)audioQueue:(AudioQueueRef)theAudioQueue didCallbackWithBuffer:(AudioQueueBufferRef)buffer { [_storedBuffersLock lock]; - for(int c = 0; c < NumberOfStoredAudioQueueBuffer; c++) - { - if(!_storedBuffers[c] || buffer->mAudioDataBytesCapacity > _storedBuffers[c]->mAudioDataBytesCapacity) - { + for(int c = 0; c < NumberOfStoredAudioQueueBuffer; c++) { + if(!_storedBuffers[c] || buffer->mAudioDataBytesCapacity > _storedBuffers[c]->mAudioDataBytesCapacity) { if(_storedBuffers[c]) AudioQueueFreeBuffer(_audioQueue, _storedBuffers[c]); _storedBuffers[c] = buffer; [_storedBuffersLock unlock]; @@ -59,12 +55,10 @@ static NSLock *CSAudioQueueDeallocLock; static void audioOutputCallback( void *inUserData, AudioQueueRef inAQ, - AudioQueueBufferRef inBuffer) -{ + AudioQueueBufferRef inBuffer) { // Pull the delegate call for audio queue running dry outside of the locked region, to allow non-deadlocking // lifecycle -dealloc events to result from it. - if([CSAudioQueueDeallocLock tryLock]) - { + if([CSAudioQueueDeallocLock tryLock]) { CSAudioQueue *queue = ((__bridge CSWeakAudioQueuePointer *)inUserData).queue; BOOL isRunningDry = NO; isRunningDry = [queue audioQueue:inAQ didCallbackWithBuffer:inBuffer]; @@ -76,14 +70,11 @@ static void audioOutputCallback( #pragma mark - Standard object lifecycle -- (instancetype)initWithSamplingRate:(Float64)samplingRate -{ +- (instancetype)initWithSamplingRate:(Float64)samplingRate { self = [super init]; - if(self) - { - if(!CSAudioQueueDeallocLock) - { + if(self) { + if(!CSAudioQueueDeallocLock) { CSAudioQueueDeallocLock = [[NSLock alloc] init]; } _storedBuffersLock = [[NSLock alloc] init]; @@ -122,8 +113,7 @@ static void audioOutputCallback( NULL, kCFRunLoopCommonModes, 0, - &_audioQueue)) - { + &_audioQueue)) { AudioQueueStart(_audioQueue, NULL); } } @@ -131,16 +121,13 @@ static void audioOutputCallback( return self; } -- (instancetype)init -{ +- (instancetype)init { return [self initWithSamplingRate:[[self class] preferredSamplingRate]]; } -- (void)dealloc -{ +- (void)dealloc { [CSAudioQueueDeallocLock lock]; - if(_audioQueue) - { + if(_audioQueue) { AudioQueueDispose(_audioQueue, true); _audioQueue = NULL; } @@ -167,15 +154,12 @@ static void audioOutputCallback( #pragma mark - Audio enqueuer -- (void)enqueueAudioBuffer:(const int16_t *)buffer numberOfSamples:(size_t)lengthInSamples -{ +- (void)enqueueAudioBuffer:(const int16_t *)buffer numberOfSamples:(size_t)lengthInSamples { size_t bufferBytes = lengthInSamples * sizeof(int16_t); [_storedBuffersLock lock]; - for(int c = 0; c < NumberOfStoredAudioQueueBuffer; c++) - { - if(_storedBuffers[c] && _storedBuffers[c]->mAudioDataBytesCapacity >= bufferBytes) - { + for(int c = 0; c < NumberOfStoredAudioQueueBuffer; c++) { + if(_storedBuffers[c] && _storedBuffers[c]->mAudioDataBytesCapacity >= bufferBytes) { memcpy(_storedBuffers[c]->mAudioData, buffer, bufferBytes); _storedBuffers[c]->mAudioDataByteSize = (UInt32)bufferBytes; @@ -197,8 +181,7 @@ static void audioOutputCallback( #pragma mark - Sampling Rate getters -+ (AudioDeviceID)defaultOutputDevice -{ ++ (AudioDeviceID)defaultOutputDevice { AudioObjectPropertyAddress address; address.mSelector = kAudioHardwarePropertyDefaultOutputDevice; address.mScope = kAudioObjectPropertyScopeGlobal; @@ -209,8 +192,7 @@ static void audioOutputCallback( return AudioObjectGetPropertyData(kAudioObjectSystemObject, &address, sizeof(AudioObjectPropertyAddress), NULL, &size, &deviceID) ? 0 : deviceID; } -+ (Float64)preferredSamplingRate -{ ++ (Float64)preferredSamplingRate { AudioObjectPropertyAddress address; address.mSelector = kAudioDevicePropertyNominalSampleRate; address.mScope = kAudioObjectPropertyScopeGlobal; From 23105956d6eaa3169361c135b2a52adf921e7d60 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 11 Feb 2018 20:51:39 -0500 Subject: [PATCH 26/37] Fixes spurious unrecognised miss detection for the ASCII mappers. --- Machines/MSX/Cartridges/ASCII16kb.hpp | 2 +- Machines/MSX/Cartridges/ASCII8kb.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Machines/MSX/Cartridges/ASCII16kb.hpp b/Machines/MSX/Cartridges/ASCII16kb.hpp index 493894754..2b03ccbc3 100644 --- a/Machines/MSX/Cartridges/ASCII16kb.hpp +++ b/Machines/MSX/Cartridges/ASCII16kb.hpp @@ -23,7 +23,7 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler { // printf("A16 %04x ", address); switch(address >> 11) { default: - confidence_counter_.add_miss(); + if(pc_is_outside_bios) confidence_counter_.add_miss(); break; case 0xc: if(pc_is_outside_bios) { diff --git a/Machines/MSX/Cartridges/ASCII8kb.hpp b/Machines/MSX/Cartridges/ASCII8kb.hpp index ab214e59a..b9b9d5542 100644 --- a/Machines/MSX/Cartridges/ASCII8kb.hpp +++ b/Machines/MSX/Cartridges/ASCII8kb.hpp @@ -23,7 +23,7 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler { // printf("A8 %04x ", address); switch(address >> 11) { default: - confidence_counter_.add_miss(); + if(pc_is_outside_bios) confidence_counter_.add_miss(); break; case 0xc: if(pc_is_outside_bios) { From 6b8c2238048d99c3617ca90dbced057da7906048 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 11 Feb 2018 21:05:59 -0500 Subject: [PATCH 27/37] Adds an extra termination condition for the multimachine. --- Analyser/Dynamic/MultiMachine/MultiMachine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index f6c6e78a1..648b822ba 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -81,7 +81,10 @@ void MultiMachine::multi_crt_did_run_machines() { crt_machine_.did_change_machine_order(); } - if(machines_.front()->crt_machine()->get_confidence() > 0.9) { + if( + (machines_.front()->crt_machine()->get_confidence() > 0.9f) || + (machines_.front()->crt_machine()->get_confidence() >= 2.0f * machines_[1]->crt_machine()->get_confidence()) + ) { pick_first(); } } From 7ea4ca00dcdbd38925ed473f16b76c2e2a538eda Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 11 Feb 2018 21:06:51 -0500 Subject: [PATCH 28/37] Ensures `perform_parallel` doesn't lock up if all machines complete prior to reaching `condition.wait`. --- .../Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index d7f33104d..1d24ac088 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -42,7 +42,7 @@ void MultiCRTMachine::perform_parallel(const std::function lock(mutex); - condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; }); + if(outstanding_machines) condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; }); } void MultiCRTMachine::perform_serial(const std::function &function) { From ddf1bf3cbf208bdfd56d70a23c706f585797872d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 12 Feb 2018 21:46:21 -0500 Subject: [PATCH 29/37] Reintroduces options selection for the Mac. For everything except the Vic-20, anyway. That has a somewhat outdated notion of what an options panel should be, corresponding to the work yet to do on its analyser. --- .../Dynamic/MultiMachine/MultiMachine.cpp | 4 ++ .../Dynamic/MultiMachine/MultiMachine.hpp | 2 + Machines/DynamicMachine.hpp | 12 +++++ Machines/Utility/TypedDynamicMachine.hpp | 4 ++ .../Clock Signal.xcodeproj/project.pbxproj | 22 +++----- .../Documents/Atari2600OptionsPanel.swift | 2 +- .../Documents/MachineDocument.swift | 10 ++-- .../Documents/ZX8081OptionsPanel.swift | 6 +-- .../Machine/CSMachine+Subclassing.h | 16 ------ .../Mac/Clock Signal/Machine/CSMachine.h | 8 +++ .../Mac/Clock Signal/Machine/CSMachine.mm | 11 +++- .../StaticAnalyser/CSStaticAnalyser.mm | 3 +- .../Machine/Wrappers/CSAtari2600.h | 10 ++-- .../Machine/Wrappers/CSAtari2600.mm | 53 ++++++++----------- .../Clock Signal/Machine/Wrappers/CSZX8081.h | 6 ++- .../Clock Signal/Machine/Wrappers/CSZX8081.mm | 20 +++---- 16 files changed, 99 insertions(+), 90 deletions(-) delete mode 100644 OSBindings/Mac/Clock Signal/Machine/CSMachine+Subclassing.h diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index 648b822ba..608730e75 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -95,3 +95,7 @@ void MultiMachine::pick_first() { // TODO: this isn't quite correct, because it may leak OpenGL/etc resources through failure to // request a close_output while the context is active. } + +void *MultiMachine::raw_pointer() { + return nullptr; +} diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index 1b67b6dce..81feebef2 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -45,9 +45,11 @@ class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::De JoystickMachine::Machine *joystick_machine() override; KeyboardMachine::Machine *keyboard_machine() override; Configurable::Device *configurable_device() override; + void *raw_pointer() override; void multi_crt_did_run_machines() override; + private: std::vector> machines_; std::mutex machines_mutex_; diff --git a/Machines/DynamicMachine.hpp b/Machines/DynamicMachine.hpp index 96839410d..6d261b6da 100644 --- a/Machines/DynamicMachine.hpp +++ b/Machines/DynamicMachine.hpp @@ -29,6 +29,18 @@ struct DynamicMachine { virtual JoystickMachine::Machine *joystick_machine() = 0; virtual KeyboardMachine::Machine *keyboard_machine() = 0; virtual Configurable::Device *configurable_device() = 0; + + /*! + Provides a raw pointer to the underlying machine if and only if this dynamic machine really is + only a single machine. + + Very unsafe. Very temporary. + + TODO: eliminate in favour of introspection for machine-specific inputs. This is here temporarily + only to permit continuity of certain features in the Mac port that have not yet made their way + to the SDL/console port. + */ + virtual void *raw_pointer() = 0; }; } diff --git a/Machines/Utility/TypedDynamicMachine.hpp b/Machines/Utility/TypedDynamicMachine.hpp index 83b3f7087..d0ecc70c8 100644 --- a/Machines/Utility/TypedDynamicMachine.hpp +++ b/Machines/Utility/TypedDynamicMachine.hpp @@ -45,6 +45,10 @@ template class TypedDynamicMachine: public ::Machine::DynamicMachine return get(); } + void *raw_pointer() override { + return get(); + } + private: template Class *get() { return dynamic_cast(machine_.get()); diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 617d6fc15..7e51ddef7 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -127,7 +127,6 @@ 4B1414601B58885000E04248 /* WolfgangLorenzTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14145F1B58885000E04248 /* WolfgangLorenzTests.swift */; }; 4B1414621B58888700E04248 /* KlausDormannTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1414611B58888700E04248 /* KlausDormannTests.swift */; }; 4B1497881EE4A1DA00CE2596 /* ZX80O81P.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1497861EE4A1DA00CE2596 /* ZX80O81P.cpp */; }; - 4B14978F1EE4B4D200CE2596 /* CSZX8081.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B14978E1EE4B4D200CE2596 /* CSZX8081.mm */; }; 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 */; }; @@ -144,8 +143,6 @@ 4B2A332D1DB86821002876E3 /* OricOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B2A332B1DB86821002876E3 /* OricOptions.xib */; }; 4B2A539F1D117D36003C6002 /* CSAudioQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A53911D117D36003C6002 /* CSAudioQueue.m */; }; 4B2A53A01D117D36003C6002 /* CSMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A53961D117D36003C6002 /* CSMachine.mm */; }; - 4B2A53A11D117D36003C6002 /* CSAtari2600.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */; }; - 4B2A53A31D117D36003C6002 /* CSVic20.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539E1D117D36003C6002 /* CSVic20.mm */; }; 4B2AF8691E513FC20027EE29 /* TIATests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2AF8681E513FC20027EE29 /* TIATests.mm */; }; 4B2B3A4B1F9B8FA70062DABF /* Typer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2B3A471F9B8FA70062DABF /* Typer.cpp */; }; 4B2B3A4C1F9B8FA70062DABF /* MemoryFuzzer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2B3A481F9B8FA70062DABF /* MemoryFuzzer.cpp */; }; @@ -282,21 +279,20 @@ 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; }; 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */; }; 4B8FE21E1DA19D5F0090D3CE /* Vic20Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2191DA19D5F0090D3CE /* Vic20Options.xib */; }; - 4B8FE2201DA19D7C0090D3CE /* Atari2600OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE21F1DA19D7C0090D3CE /* Atari2600OptionsPanel.swift */; }; 4B8FE2221DA19FB20090D3CE /* MachinePanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE2211DA19FB20090D3CE /* MachinePanel.swift */; }; 4B8FE2271DA1DE2D0090D3CE /* NSBundle+DataResource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE2261DA1DE2D0090D3CE /* NSBundle+DataResource.m */; }; 4B924E991E74D22700B76AF1 /* AtariStaticAnalyserTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B924E981E74D22700B76AF1 /* AtariStaticAnalyserTests.mm */; }; 4B9252CE1E74D28200B76AF1 /* Atari ROMs in Resources */ = {isa = PBXBuildFile; fileRef = 4B9252CD1E74D28200B76AF1 /* Atari ROMs */; }; 4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */; }; - 4B95FA9D1F11893B0008E395 /* ZX8081OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B95FA9C1F11893B0008E395 /* ZX8081OptionsPanel.swift */; }; 4B98A05E1FFAD3F600ADF63B /* CSROMFetcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A05D1FFAD3F600ADF63B /* CSROMFetcher.mm */; }; 4B98A05F1FFAD62400ADF63B /* CSROMFetcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A05D1FFAD3F600ADF63B /* CSROMFetcher.mm */; }; 4B98A0611FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A0601FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm */; }; 4B98A1CE1FFADEC500ADF63B /* MSX ROMs in Resources */ = {isa = PBXBuildFile; fileRef = 4B98A1CD1FFADEC400ADF63B /* MSX ROMs */; }; - 4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */; }; 4BA0F68E1EEA0E8400E9489E /* ZX8081.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA0F68C1EEA0E8400E9489E /* ZX8081.cpp */; }; 4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */; }; 4BAD13441FF709C700FD114A /* MSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E61051FF34737002A9DBD /* MSX.cpp */; }; + 4BAE49582032881E004BE78E /* CSZX8081.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B14978E1EE4B4D200CE2596 /* CSZX8081.mm */; }; + 4BAE495920328897004BE78E /* ZX8081OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B95FA9C1F11893B0008E395 /* ZX8081OptionsPanel.swift */; }; 4BAF2B4E2004580C00480230 /* DMK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAF2B4C2004580C00480230 /* DMK.cpp */; }; 4BAF2B4F2004580C00480230 /* DMK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAF2B4C2004580C00480230 /* DMK.cpp */; }; 4BB17D4E1ED7909F00ABD1E1 /* tests.expected.json in Resources */ = {isa = PBXBuildFile; fileRef = 4BB17D4C1ED7909F00ABD1E1 /* tests.expected.json */; }; @@ -601,6 +597,8 @@ 4BD468F71D8DF41D0084958B /* 1770.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD468F51D8DF41D0084958B /* 1770.cpp */; }; 4BD4A8D01E077FD20020D856 /* PCMTrackTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4A8CF1E077FD20020D856 /* PCMTrackTests.mm */; }; 4BD5F1951D13528900631CD1 /* CSBestEffortUpdater.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BD5F1941D13528900631CD1 /* CSBestEffortUpdater.mm */; }; + 4BDB61EB2032806E0048AF91 /* CSAtari2600.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */; }; + 4BDB61EC203285AE0048AF91 /* Atari2600OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE21F1DA19D7C0090D3CE /* Atari2600OptionsPanel.swift */; }; 4BDDBA991EF3451200347E61 /* Z80MachineCycleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */; }; 4BE7C9181E3D397100A5496D /* TIA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE7C9161E3D397100A5496D /* TIA.cpp */; }; 4BE9A6B11EDE293000CBCB47 /* zexdoc.com in Resources */ = {isa = PBXBuildFile; fileRef = 4BE9A6B01EDE293000CBCB47 /* zexdoc.com */; }; @@ -712,7 +710,6 @@ 4B2A332C1DB86821002876E3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/OricOptions.xib"; sourceTree = SOURCE_ROOT; }; 4B2A53901D117D36003C6002 /* CSAudioQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSAudioQueue.h; sourceTree = ""; }; 4B2A53911D117D36003C6002 /* CSAudioQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSAudioQueue.m; sourceTree = ""; }; - 4B2A53941D117D36003C6002 /* CSMachine+Subclassing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CSMachine+Subclassing.h"; sourceTree = ""; }; 4B2A53951D117D36003C6002 /* CSMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMachine.h; sourceTree = ""; }; 4B2A53961D117D36003C6002 /* CSMachine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CSMachine.mm; sourceTree = ""; }; 4B2A53971D117D36003C6002 /* KeyCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyCodes.h; sourceTree = ""; }; @@ -1542,7 +1539,6 @@ children = ( 4BBC34241D2208B100FFC9DF /* CSFastLoading.h */, 4B2A53951D117D36003C6002 /* CSMachine.h */, - 4B2A53941D117D36003C6002 /* CSMachine+Subclassing.h */, 4B643F3C1D77AE5C00D431D6 /* CSMachine+Target.h */, 4B98A05C1FFAD3F600ADF63B /* CSROMFetcher.hpp */, 4B2A53971D117D36003C6002 /* KeyCodes.h */, @@ -3530,7 +3526,6 @@ 4B0E61071FF34737002A9DBD /* MSX.cpp in Sources */, 4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */, 4B4518A01F75FD1C00926311 /* CPCDSK.cpp in Sources */, - 4B95FA9D1F11893B0008E395 /* ZX8081OptionsPanel.swift in Sources */, 4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */, 4B322E041F5A2E3C004EB04C /* Z80Base.cpp in Sources */, 4B894530201967B4007DE474 /* StaticAnalyser.cpp in Sources */, @@ -3553,6 +3548,7 @@ 4B2BFDB21DAEF5FF001A68B8 /* Video.cpp in Sources */, 4B4DC82B1D2C27A4003C5BF8 /* SerialBus.cpp in Sources */, 4BBFFEE61F7B27F1005F3FEB /* TrackSerialiser.cpp in Sources */, + 4BAE49582032881E004BE78E /* CSZX8081.mm in Sources */, 4BC3B74F1CD194CC00F86E85 /* Shader.cpp in Sources */, 4B894518201967B4007DE474 /* ConfidenceCounter.cpp in Sources */, 4B89452E201967B4007DE474 /* StaticAnalyser.cpp in Sources */, @@ -3563,6 +3559,7 @@ 4B4B1A3C200198CA00A0F866 /* KonamiSCC.cpp in Sources */, 4BD5F1951D13528900631CD1 /* CSBestEffortUpdater.mm in Sources */, 4B894532201967B4007DE474 /* 6502.cpp in Sources */, + 4BDB61EC203285AE0048AF91 /* Atari2600OptionsPanel.swift in Sources */, 4B4518811F75E91A00926311 /* PCMPatchedTrack.cpp in Sources */, 4BBB70A8202014E2002FE009 /* MultiCRTMachine.cpp in Sources */, 4B8805F71DCFF6C9003085B1 /* Commodore.cpp in Sources */, @@ -3575,7 +3572,6 @@ 4B7913CC1DFCD80E00175A82 /* Video.cpp in Sources */, 4B4518831F75E91A00926311 /* PCMTrack.cpp in Sources */, 4B45189F1F75FD1C00926311 /* AcornADF.cpp in Sources */, - 4B2A53A11D117D36003C6002 /* CSAtari2600.mm in Sources */, 4B7136911F789C93008B8ED9 /* SegmentParser.cpp in Sources */, 4B4518A21F75FD1C00926311 /* G64.cpp in Sources */, 4B89452C201967B4007DE474 /* Tape.cpp in Sources */, @@ -3583,6 +3579,7 @@ 4BEBFB512002DB30000708CC /* DiskROM.cpp in Sources */, 4B89451C201967B4007DE474 /* Disk.cpp in Sources */, 4BEA52631DF339D7007E74F2 /* SoundGenerator.cpp in Sources */, + 4BAE495920328897004BE78E /* ZX8081OptionsPanel.swift in Sources */, 4B89451A201967B4007DE474 /* ConfidenceSummary.cpp in Sources */, 4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */, 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */, @@ -3623,13 +3620,10 @@ 4B4A76301DB1A3FA007AAE2E /* AY38910.cpp in Sources */, 4B6A4C991F58F09E00E3F787 /* 6502Base.cpp in Sources */, 4B4518871F75E91A00926311 /* DigitalPhaseLockedLoop.cpp in Sources */, - 4B2A53A31D117D36003C6002 /* CSVic20.mm in Sources */, 4B98A05E1FFAD3F600ADF63B /* CSROMFetcher.mm in Sources */, - 4B8FE2201DA19D7C0090D3CE /* Atari2600OptionsPanel.swift in Sources */, 4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */, 4B3FCC40201EC24200960631 /* MultiMachine.cpp in Sources */, 4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */, - 4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */, 4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */, 4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */, 4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */, @@ -3642,6 +3636,7 @@ 4B83348A1F5DB94B0097E338 /* IRQDelegatePortHandler.cpp in Sources */, 4B894524201967B4007DE474 /* Tape.cpp in Sources */, 4B7136891F78725F008B8ED9 /* Shifter.cpp in Sources */, + 4BDB61EB2032806E0048AF91 /* CSAtari2600.mm in Sources */, 4BFDD78C1F7F2DB4008579B9 /* ImplicitSectors.cpp in Sources */, 4BC3B7521CD1956900F86E85 /* OutputShader.cpp in Sources */, 4B5073071DDD3B9400C48FBD /* ArrayBuilder.cpp in Sources */, @@ -3656,7 +3651,6 @@ 4B8334861F5DA3780097E338 /* 6502Storage.cpp in Sources */, 4B8FE2271DA1DE2D0090D3CE /* NSBundle+DataResource.m in Sources */, 4B2A53A01D117D36003C6002 /* CSMachine.mm in Sources */, - 4B14978F1EE4B4D200CE2596 /* CSZX8081.mm in Sources */, 4BC91B831D1F160E00884B76 /* CommodoreTAP.cpp in Sources */, 4B2A539F1D117D36003C6002 /* CSAudioQueue.m in Sources */, 4B89453E201967B4007DE474 /* StaticAnalyser.cpp in Sources */, diff --git a/OSBindings/Mac/Clock Signal/Documents/Atari2600OptionsPanel.swift b/OSBindings/Mac/Clock Signal/Documents/Atari2600OptionsPanel.swift index e00c7ba0a..b4129b5a3 100644 --- a/OSBindings/Mac/Clock Signal/Documents/Atari2600OptionsPanel.swift +++ b/OSBindings/Mac/Clock Signal/Documents/Atari2600OptionsPanel.swift @@ -9,7 +9,7 @@ class Atari2600OptionsPanel: MachinePanel { var atari2600: CSAtari2600! { get { - return self.machine as! CSAtari2600 + return self.machine.atari2600 } } diff --git a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift index 1763eddec..8fbdad7fc 100644 --- a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift @@ -118,11 +118,11 @@ class MachineDocument: self.machine = machine } -// if let optionsPanelNibName = analysis.optionsPanelNibName { -// Bundle.main.loadNibNamed(NSNib.Name(rawValue: optionsPanelNibName), owner: self, topLevelObjects: nil) -// self.optionsPanel.machine = self.machine -// showOptions(self) -// } + if let optionsPanelNibName = analysis.optionsPanelNibName { + Bundle.main.loadNibNamed(NSNib.Name(rawValue: optionsPanelNibName), owner: self, topLevelObjects: nil) + self.optionsPanel.machine = self.machine + showOptions(self) + } } override func read(from url: URL, ofType typeName: String) throws { diff --git a/OSBindings/Mac/Clock Signal/Documents/ZX8081OptionsPanel.swift b/OSBindings/Mac/Clock Signal/Documents/ZX8081OptionsPanel.swift index a3b754c9a..9de95ff72 100644 --- a/OSBindings/Mac/Clock Signal/Documents/ZX8081OptionsPanel.swift +++ b/OSBindings/Mac/Clock Signal/Documents/ZX8081OptionsPanel.swift @@ -9,7 +9,7 @@ class ZX8081OptionsPanel: MachinePanel { var zx8081: CSZX8081! { get { - return self.machine as! CSZX8081 + return self.machine.zx8081 } } @@ -21,7 +21,7 @@ class ZX8081OptionsPanel: MachinePanel { let isEnabled = sender.state == .on UserDefaults.standard.set(isEnabled, forKey: self.automaticTapeMotorControlDefaultsKey) self.playOrPauseTapeButton.isEnabled = !isEnabled - self.zx8081.useAutomaticTapeMotorControl = isEnabled + self.machine.useAutomaticTapeMotorControl = isEnabled } @IBOutlet var playOrPauseTapeButton: NSButton! @@ -44,6 +44,6 @@ class ZX8081OptionsPanel: MachinePanel { let automaticTapeMotorControlIsEnabled = standardUserDefaults.bool(forKey: self.automaticTapeMotorControlDefaultsKey) self.automaticTapeMotorControlButton.state = automaticTapeMotorControlIsEnabled ? .on : .off self.playOrPauseTapeButton.isEnabled = !automaticTapeMotorControlIsEnabled - self.zx8081.useAutomaticTapeMotorControl = automaticTapeMotorControlIsEnabled + self.machine.useAutomaticTapeMotorControl = automaticTapeMotorControlIsEnabled } } diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine+Subclassing.h b/OSBindings/Mac/Clock Signal/Machine/CSMachine+Subclassing.h deleted file mode 100644 index 453f5aeaf..000000000 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine+Subclassing.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// CSMachine+Subclassing.h -// Clock Signal -// -// Created by Thomas Harte on 04/01/2016. -// Copyright © 2016 Thomas Harte. All rights reserved. -// - -#import "CSMachine.h" -#include "CRTMachine.hpp" - -@interface CSMachine (Subclassing) - -- (void)setupOutputWithAspectRatio:(float)aspectRatio; - -@end diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.h b/OSBindings/Mac/Clock Signal/Machine/CSMachine.h index 0315a623a..5ac636f0a 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.h +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.h @@ -18,6 +18,10 @@ - (void)machineDidChangeClockIsUnlimited:(CSMachine *)machine; @end +// Deliberately low; to ensure CSMachine has been declared as an @class already. +#import "CSAtari2600.h" +#import "CSZX8081.h" + @interface CSMachine : NSObject - (instancetype)init NS_UNAVAILABLE; @@ -54,4 +58,8 @@ @property (nonatomic, assign) BOOL useCompositeOutput; @property (nonatomic, assign) BOOL useAutomaticTapeMotorControl; +// Special-case accessors; undefined behaviour if accessed for a machine not of the corresponding type. +@property (nonatomic, readonly) CSAtari2600 *atari2600; +@property (nonatomic, readonly) CSZX8081 *zx8081; + @end diff --git a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm index b0fe69d5d..8d4a5c75e 100644 --- a/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm +++ b/OSBindings/Mac/Clock Signal/Machine/CSMachine.mm @@ -7,7 +7,6 @@ // #import "CSMachine.h" -#import "CSMachine+Subclassing.h" #import "CSMachine+Target.h" #include "CSROMFetcher.hpp" @@ -342,4 +341,14 @@ struct MachineDelegate: CRTMachine::Machine::Delegate, public LockProtectedDeleg return [[NSString stringWithUTF8String:name.c_str()] lowercaseString]; } +#pragma mark - Special machines + +- (CSAtari2600 *)atari2600 { + return [[CSAtari2600 alloc] initWithAtari2600:_machine->raw_pointer() owner:self]; +} + +- (CSZX8081 *)zx8081 { + return [[CSZX8081 alloc] initWithZX8081:_machine->raw_pointer() owner:self]; +} + @end diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index da59b2b01..71638ba99 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -10,7 +10,6 @@ #import "CSMachine.h" #import "CSMachine+Target.h" -#import "CSMachine+Subclassing.h" #include "StaticAnalyser.hpp" @@ -40,7 +39,7 @@ case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions"; case Analyser::Machine::MSX: return @"QuickLoadCompositeOptions"; case Analyser::Machine::Oric: return @"OricOptions"; - case Analyser::Machine::Vic20: return @"Vic20Options"; + case Analyser::Machine::Vic20: nil; //return @"Vic20Options"; case Analyser::Machine::ZX8081: return @"ZX8081Options"; default: return nil; } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.h index c06a072f7..66984889d 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.h +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.h @@ -6,14 +6,12 @@ // Copyright © 2015 Thomas Harte. All rights reserved. // -#include "CSMachine.h" -#include "Atari2600Inputs.h" +@class CSAtari2600; +#import "CSMachine.h" -@interface CSAtari2600 : CSMachine +@interface CSAtari2600 : NSObject -- (instancetype)init; - -- (void)setResetLineEnabled:(BOOL)enabled; +- (instancetype)initWithAtari2600:(void *)atari2600 owner:(CSMachine *)machine; @property (nonatomic, assign) BOOL colourButton; @property (nonatomic, assign) BOOL leftPlayerDifficultyButton; diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm index 07d16c923..5f9420719 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm @@ -9,60 +9,53 @@ #import "CSAtari2600.h" #include "Atari2600.hpp" -#include "TypedDynamicMachine.hpp" -#import "CSMachine+Subclassing.h" @implementation CSAtari2600 { - Machine::TypedDynamicMachine _atari2600; + Atari2600::Machine *_atari2600; + __weak CSMachine *_machine; } -- (instancetype)init { - _atari2600 = Machine::TypedDynamicMachine(Atari2600::Machine::Atari2600()); - return nil;//[super initWithMachine:&_atari2600]; -} - -- (void)setResetLineEnabled:(BOOL)enabled { - @synchronized(self) { - _atari2600.get()->set_reset_switch(enabled ? true : false); +- (instancetype)initWithAtari2600:(void *)atari2600 owner:(CSMachine *)machine { + self = [super init]; + if(self) { + _atari2600 = (Atari2600::Machine *)atari2600; + _machine = machine; } + return self; } -- (void)setupOutputWithAspectRatio:(float)aspectRatio { - @synchronized(self) { - [super setupOutputWithAspectRatio:aspectRatio]; - } -} - -#pragma mark - Switches - - (void)setColourButton:(BOOL)colourButton { _colourButton = colourButton; - @synchronized(self) { - _atari2600.get()->set_switch_is_enabled(Atari2600SwitchColour, colourButton); + + @synchronized(_machine) { + _atari2600->set_switch_is_enabled(Atari2600SwitchColour, colourButton); } } - (void)setLeftPlayerDifficultyButton:(BOOL)leftPlayerDifficultyButton { _leftPlayerDifficultyButton = leftPlayerDifficultyButton; - @synchronized(self) { - _atari2600.get()->set_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty, leftPlayerDifficultyButton); + + @synchronized(_machine) { + _atari2600->set_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty, leftPlayerDifficultyButton); } } - (void)setRightPlayerDifficultyButton:(BOOL)rightPlayerDifficultyButton { _rightPlayerDifficultyButton = rightPlayerDifficultyButton; - @synchronized(self) { - _atari2600.get()->set_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty, rightPlayerDifficultyButton); + + @synchronized(_machine) { + _atari2600->set_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty, rightPlayerDifficultyButton); } } - (void)toggleSwitch:(Atari2600Switch)toggleSwitch { - @synchronized(self) { - _atari2600.get()->set_switch_is_enabled(toggleSwitch, true); + @synchronized(_machine) { + _atari2600->set_switch_is_enabled(toggleSwitch, true); } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - @synchronized(self) { - _atari2600.get()->set_switch_is_enabled(toggleSwitch, false); + @synchronized(_machine) { + _atari2600->set_switch_is_enabled(toggleSwitch, false); } }); } @@ -75,6 +68,4 @@ [self toggleSwitch:Atari2600SwitchSelect]; } -- (NSString *)userDefaultsPrefix { return @"atari2600"; } - @end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h index 7d0fe7889..3133dca67 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h @@ -6,10 +6,12 @@ // Copyright © 2017 Thomas Harte. All rights reserved. // +@class CSZX8081; #import "CSMachine.h" -#import "CSFastLoading.h" -@interface CSZX8081 : CSMachine +@interface CSZX8081 : NSObject + +- (instancetype)initWithZX8081:(void *)zx8081 owner:(CSMachine *)machine; @property (nonatomic, assign) BOOL tapeIsPlaying; diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm index 86b1adf5b..8067655b4 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm @@ -9,25 +9,27 @@ #import "CSZX8081.h" #include "ZX8081.hpp" -#include "TypedDynamicMachine.hpp" @implementation CSZX8081 { - Machine::TypedDynamicMachine _zx8081; + ZX8081::Machine *_zx8081; + __weak CSMachine *_machine; } -- (instancetype)initWithIntendedTarget:(const Analyser::Static::Target &)target { - _zx8081 = Machine::TypedDynamicMachine(ZX8081::Machine::ZX8081(target)); - return nil;//[super initWithMachine:&_zx8081]; +- (instancetype)initWithZX8081:(void *)zx8081 owner:(CSMachine *)machine { + self = [super init]; + if(self) { + _zx8081 = (ZX8081::Machine *)zx8081; + _machine = machine; + } + return self; } -- (NSString *)userDefaultsPrefix { return @"zx8081"; } - #pragma mark - Options - (void)setTapeIsPlaying:(BOOL)tapeIsPlaying { - @synchronized(self) { + @synchronized(_machine) { _tapeIsPlaying = tapeIsPlaying; - _zx8081.get()->set_tape_is_playing(tapeIsPlaying ? true : false); + _zx8081->set_tape_is_playing(tapeIsPlaying ? true : false); } } From 7b420d56e3b0c232092fecc2a2545baa01f95007 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 14 Feb 2018 21:46:50 -0500 Subject: [PATCH 30/37] Removed state mirroring in the machine-specific Mac UI classes. --- Machines/Atari2600/Atari2600.cpp | 12 ++++++++++ Machines/Atari2600/Atari2600.hpp | 3 +++ Machines/ZX8081/ZX8081.cpp | 5 ++++ Machines/ZX8081/ZX8081.hpp | 1 + .../Machine/Wrappers/CSAtari2600.mm | 24 ++++++++++++++----- .../Clock Signal/Machine/Wrappers/CSZX8081.mm | 7 +++++- 6 files changed, 45 insertions(+), 7 deletions(-) diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index 109b1e7a1..255d99b45 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -130,6 +130,18 @@ class ConcreteMachine: } } + bool get_switch_is_enabled(Atari2600Switch input) override { + uint8_t port_input = bus_->mos6532_.get_port_input(1); + switch(input) { + case Atari2600SwitchReset: return !!(port_input & 0x01); + case Atari2600SwitchSelect: return !!(port_input & 0x02); + case Atari2600SwitchColour: return !!(port_input & 0x08); + case Atari2600SwitchLeftPlayerDifficulty: return !!(port_input & 0x40); + case Atari2600SwitchRightPlayerDifficulty: return !!(port_input & 0x80); + default: return false; + } + } + void set_reset_switch(bool state) override { bus_->set_reset_line(state); } diff --git a/Machines/Atari2600/Atari2600.hpp b/Machines/Atari2600/Atari2600.hpp index c4c2d5282..856409fd4 100644 --- a/Machines/Atari2600/Atari2600.hpp +++ b/Machines/Atari2600/Atari2600.hpp @@ -33,6 +33,9 @@ class Machine: /// Sets the switch @c input to @c state. virtual void set_switch_is_enabled(Atari2600Switch input, bool state) = 0; + /// Gets the state of switch @c input. + virtual bool get_switch_is_enabled(Atari2600Switch input) = 0; + // Presses or releases the reset button. virtual void set_reset_switch(bool state) = 0; }; diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index a5e044c53..7e8c8a507 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -341,10 +341,15 @@ template class ConcreteMachine: tape_player_.set_motor_control(false); } } + void set_tape_is_playing(bool is_playing) override final { tape_player_.set_motor_control(is_playing); } + bool get_tape_is_playing() override final { + return tape_player_.get_motor_control(); + } + // MARK: - Typer timing HalfCycles get_typer_delay() override final { return Cycles(7000000); } HalfCycles get_typer_frequency() override final { return Cycles(390000); } diff --git a/Machines/ZX8081/ZX8081.hpp b/Machines/ZX8081/ZX8081.hpp index 14993c44e..351e62aa1 100644 --- a/Machines/ZX8081/ZX8081.hpp +++ b/Machines/ZX8081/ZX8081.hpp @@ -30,6 +30,7 @@ class Machine: static Machine *ZX8081(const Analyser::Static::Target &target_hint); virtual void set_tape_is_playing(bool is_playing) = 0; + virtual bool get_tape_is_playing() = 0; }; } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm index 5f9420719..5b596cb7d 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSAtari2600.mm @@ -25,29 +25,41 @@ } - (void)setColourButton:(BOOL)colourButton { - _colourButton = colourButton; - @synchronized(_machine) { _atari2600->set_switch_is_enabled(Atari2600SwitchColour, colourButton); } } -- (void)setLeftPlayerDifficultyButton:(BOOL)leftPlayerDifficultyButton { - _leftPlayerDifficultyButton = leftPlayerDifficultyButton; +- (BOOL)colourButton { + @synchronized(_machine) { + return _atari2600->get_switch_is_enabled(Atari2600SwitchColour); + } +} +- (void)setLeftPlayerDifficultyButton:(BOOL)leftPlayerDifficultyButton { @synchronized(_machine) { _atari2600->set_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty, leftPlayerDifficultyButton); } } -- (void)setRightPlayerDifficultyButton:(BOOL)rightPlayerDifficultyButton { - _rightPlayerDifficultyButton = rightPlayerDifficultyButton; +- (BOOL)leftPlayerDifficultyButton { + @synchronized(_machine) { + return _atari2600->get_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty); + } +} +- (void)setRightPlayerDifficultyButton:(BOOL)rightPlayerDifficultyButton { @synchronized(_machine) { _atari2600->set_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty, rightPlayerDifficultyButton); } } +- (BOOL)rightPlayerDifficultyButton { + @synchronized(_machine) { + return _atari2600->get_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty); + } +} + - (void)toggleSwitch:(Atari2600Switch)toggleSwitch { @synchronized(_machine) { _atari2600->set_switch_is_enabled(toggleSwitch, true); diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm index 8067655b4..0143bb3bb 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm @@ -28,9 +28,14 @@ - (void)setTapeIsPlaying:(BOOL)tapeIsPlaying { @synchronized(_machine) { - _tapeIsPlaying = tapeIsPlaying; _zx8081->set_tape_is_playing(tapeIsPlaying ? true : false); } } +- (BOOL)tapeIsPlaying { + @synchronized(_machine) { + return _zx8081->get_tape_is_playing(); + } +} + @end From c8a4432c6394e7b3f76f4d37f2d6e1151f435857 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 18 Feb 2018 15:23:15 -0500 Subject: [PATCH 31/37] Makes an attempt to transfer audio outputs during dynamic analysis. --- .../Implementation/MultiCRTMachine.cpp | 13 +++-- .../Implementation/MultiCRTMachine.hpp | 3 + .../Implementation/MultiSpeaker.cpp | 58 +++++++++++++++++++ .../Implementation/MultiSpeaker.hpp | 42 ++++++++++++++ .../Clock Signal.xcodeproj/project.pbxproj | 8 +++ Outputs/Speaker/Speaker.hpp | 2 +- 6 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp create mode 100644 Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index 1d24ac088..1da426514 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -14,7 +14,9 @@ using namespace Analyser::Dynamic; MultiCRTMachine::MultiCRTMachine(const std::vector> &machines, std::mutex &machines_mutex) : - machines_(machines), machines_mutex_(machines_mutex), queues_(machines.size()) {} + machines_(machines), machines_mutex_(machines_mutex), queues_(machines.size()) { + speaker_ = MultiSpeaker::create(machines); +} void MultiCRTMachine::perform_parallel(const std::function &function) { // Apply a blunt force parallelisation of the machines; each run_for is dispatched @@ -72,9 +74,7 @@ Outputs::CRT::CRT *MultiCRTMachine::get_crt() { } Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() { - std::lock_guard machines_lock(machines_mutex_); - CRTMachine::Machine *crt_machine = machines_.front()->crt_machine(); - return crt_machine ? crt_machine->get_speaker() : nullptr; + return speaker_; } void MultiCRTMachine::run_for(const Cycles cycles) { @@ -99,7 +99,10 @@ bool MultiCRTMachine::get_clock_is_unlimited() { } void MultiCRTMachine::did_change_machine_order() { - // TODO: shuffle delegates and announce potential output rate changes. + if(speaker_) { + std::lock_guard machines_lock(machines_mutex_); + speaker_->set_new_front_machine(machines_.front().get()); + } } void MultiCRTMachine::set_delegate(::CRTMachine::Machine::Delegate *delegate) { diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp index 5a2fe112f..b82e1db53 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp @@ -13,6 +13,8 @@ #include "../../../../Machines/CRTMachine.hpp" #include "../../../../Machines/DynamicMachine.hpp" +#include "MultiSpeaker.hpp" + #include #include #include @@ -49,6 +51,7 @@ class MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machin const std::vector> &machines_; std::mutex &machines_mutex_; std::vector queues_; + MultiSpeaker *speaker_ = nullptr; Delegate *delegate_ = nullptr; /*! diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp new file mode 100644 index 000000000..1d1b741dd --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp @@ -0,0 +1,58 @@ +// +// MultiSpeaker.cpp +// Clock Signal +// +// Created by Thomas Harte on 18/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#include "MultiSpeaker.hpp" + +using namespace Analyser::Dynamic; + +MultiSpeaker *MultiSpeaker::create(const std::vector> &machines) { + std::vector speakers; + for(const auto &machine: machines) { + Outputs::Speaker::Speaker *speaker = machine->crt_machine()->get_speaker(); + if(speaker) speakers.push_back(speaker); + } + if(speakers.empty()) return nullptr; + + return new MultiSpeaker(speakers); +} + +MultiSpeaker::MultiSpeaker(const std::vector &speakers) : + speakers_(speakers), front_speaker_(speakers.front()) { + for(const auto &speaker: speakers_) { + speaker->set_delegate(this); + } +} + +float MultiSpeaker::get_ideal_clock_rate_in_range(float minimum, float maximum) { + float ideal = 0.0f; + for(const auto &speaker: speakers_) { + ideal += speaker->get_ideal_clock_rate_in_range(minimum, maximum); + } + + return ideal / static_cast(speakers_.size()); +} + +void MultiSpeaker::set_output_rate(float cycles_per_second, int buffer_size) { + for(const auto &speaker: speakers_) { + speaker->set_output_rate(cycles_per_second, buffer_size); + } +} + +void MultiSpeaker::set_delegate(Outputs::Speaker::Speaker::Delegate *delegate) { + delegate_ = delegate; +} + +void MultiSpeaker::speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer) { + if(delegate_ && speaker == front_speaker_) { + delegate_->speaker_did_complete_samples(this, buffer); + } +} + +void MultiSpeaker::set_new_front_machine(::Machine::DynamicMachine *machine) { + front_speaker_ = machine->crt_machine()->get_speaker(); +} diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp new file mode 100644 index 000000000..b5e9a28e9 --- /dev/null +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp @@ -0,0 +1,42 @@ +// +// MultiSpeaker.hpp +// Clock Signal +// +// Created by Thomas Harte on 18/02/2018. +// Copyright © 2018 Thomas Harte. All rights reserved. +// + +#ifndef MultiSpeaker_hpp +#define MultiSpeaker_hpp + +#include "../../../../Machines/DynamicMachine.hpp" +#include "../../../../Outputs/Speaker/Speaker.hpp" + +#include +#include + +namespace Analyser { +namespace Dynamic { + +class MultiSpeaker: public Outputs::Speaker::Speaker, Outputs::Speaker::Speaker::Delegate { + public: + static MultiSpeaker *create(const std::vector> &machines); + MultiSpeaker(const std::vector &speakers); + + void set_new_front_machine(::Machine::DynamicMachine *machine); + + float get_ideal_clock_rate_in_range(float minimum, float maximum); + void set_output_rate(float cycles_per_second, int buffer_size); + void set_delegate(Outputs::Speaker::Speaker::Delegate *delegate); + void speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer); + + private: + std::vector speakers_; + Outputs::Speaker::Speaker *front_speaker_ = nullptr; + Outputs::Speaker::Speaker::Delegate *delegate_ = nullptr; +}; + +} +} + +#endif /* MultiSpeaker_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 7e51ddef7..5176aaf6b 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -288,6 +288,8 @@ 4B98A05F1FFAD62400ADF63B /* CSROMFetcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A05D1FFAD3F600ADF63B /* CSROMFetcher.mm */; }; 4B98A0611FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B98A0601FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm */; }; 4B98A1CE1FFADEC500ADF63B /* MSX ROMs in Resources */ = {isa = PBXBuildFile; fileRef = 4B98A1CD1FFADEC400ADF63B /* MSX ROMs */; }; + 4B9BE400203A0C0600FFAE60 /* MultiSpeaker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9BE3FE203A0C0600FFAE60 /* MultiSpeaker.cpp */; }; + 4B9BE401203A0C0600FFAE60 /* MultiSpeaker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9BE3FE203A0C0600FFAE60 /* MultiSpeaker.cpp */; }; 4BA0F68E1EEA0E8400E9489E /* ZX8081.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA0F68C1EEA0E8400E9489E /* ZX8081.cpp */; }; 4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */; }; 4BAD13441FF709C700FD114A /* MSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E61051FF34737002A9DBD /* MSX.cpp */; }; @@ -963,6 +965,8 @@ 4B98A05D1FFAD3F600ADF63B /* CSROMFetcher.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CSROMFetcher.mm; sourceTree = ""; }; 4B98A0601FFADCDE00ADF63B /* MSXStaticAnalyserTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MSXStaticAnalyserTests.mm; sourceTree = ""; }; 4B98A1CD1FFADEC400ADF63B /* MSX ROMs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "MSX ROMs"; sourceTree = ""; }; + 4B9BE3FE203A0C0600FFAE60 /* MultiSpeaker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MultiSpeaker.cpp; sourceTree = ""; }; + 4B9BE3FF203A0C0600FFAE60 /* MultiSpeaker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MultiSpeaker.hpp; sourceTree = ""; }; 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vic20OptionsPanel.swift; sourceTree = ""; }; 4BA0F68C1EEA0E8400E9489E /* ZX8081.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ZX8081.cpp; path = Data/ZX8081.cpp; sourceTree = ""; }; 4BA0F68D1EEA0E8400E9489E /* ZX8081.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ZX8081.hpp; path = Data/ZX8081.hpp; sourceTree = ""; }; @@ -2675,11 +2679,13 @@ 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */, 4B1B88C6202E469300B67DFF /* MultiJoystickMachine.cpp */, 4B1B88B9202E2EC100B67DFF /* MultiKeyboardMachine.cpp */, + 4B9BE3FE203A0C0600FFAE60 /* MultiSpeaker.cpp */, 4B1B88BF202E3DB200B67DFF /* MultiConfigurable.hpp */, 4BBB70A2202011C2002FE009 /* MultiConfigurationTarget.hpp */, 4BBB70A7202014E2002FE009 /* MultiCRTMachine.hpp */, 4B1B88C7202E469300B67DFF /* MultiJoystickMachine.hpp */, 4B1B88BA202E2EC100B67DFF /* MultiKeyboardMachine.hpp */, + 4B9BE3FF203A0C0600FFAE60 /* MultiSpeaker.hpp */, ); path = Implementation; sourceTree = ""; @@ -3440,6 +3446,7 @@ 4B055A9C1FAE85DA0060FFFF /* CPCDSK.cpp in Sources */, 4B055AE41FAE9B6F0060FFFF /* TextureTarget.cpp in Sources */, 4B055ABA1FAE86170060FFFF /* Commodore.cpp in Sources */, + 4B9BE401203A0C0600FFAE60 /* MultiSpeaker.cpp in Sources */, 4B055AA61FAE85EF0060FFFF /* Parser.cpp in Sources */, 4B055AE91FAE9B990060FFFF /* 6502Base.cpp in Sources */, 4B055AEF1FAE9BF00060FFFF /* Typer.cpp in Sources */, @@ -3534,6 +3541,7 @@ 4B4518A11F75FD1C00926311 /* D64.cpp in Sources */, 4B1558C01F844ECD006E9A97 /* BitReverse.cpp in Sources */, 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */, + 4B9BE400203A0C0600FFAE60 /* MultiSpeaker.cpp in Sources */, 4B894538201967B4007DE474 /* Tape.cpp in Sources */, 4B54C0CB1F8D92590050900F /* Keyboard.cpp in Sources */, 4BEA525E1DF33323007E74F2 /* Tape.cpp in Sources */, diff --git a/Outputs/Speaker/Speaker.hpp b/Outputs/Speaker/Speaker.hpp index b5a334b25..209667076 100644 --- a/Outputs/Speaker/Speaker.hpp +++ b/Outputs/Speaker/Speaker.hpp @@ -29,7 +29,7 @@ class Speaker { struct Delegate { virtual void speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer) = 0; }; - void set_delegate(Delegate *delegate) { + virtual void set_delegate(Delegate *delegate) { delegate_ = delegate; } From a005dabbe319ba644ff9d71ef4974e7d475dae28 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 18 Feb 2018 16:37:07 -0500 Subject: [PATCH 32/37] Corrects some minor outstanding data races. --- .../MultiMachine/Implementation/MultiCRTMachine.cpp | 9 +++------ .../Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp | 2 ++ .../Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp | 2 ++ Analyser/Dynamic/MultiMachine/MultiMachine.cpp | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp index 1da426514..b20a2c94e 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.cpp @@ -34,17 +34,15 @@ void MultiCRTMachine::perform_parallel(const std::function lock(mutex); - outstanding_machines--; - } + std::lock_guard lock(mutex); + outstanding_machines--; condition.notify_all(); }); } } std::unique_lock lock(mutex); - if(outstanding_machines) condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; }); + condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; }); } void MultiCRTMachine::perform_serial(const std::function &function) { @@ -100,7 +98,6 @@ bool MultiCRTMachine::get_clock_is_unlimited() { void MultiCRTMachine::did_change_machine_order() { if(speaker_) { - std::lock_guard machines_lock(machines_mutex_); speaker_->set_new_front_machine(machines_.front().get()); } } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp index 1d1b741dd..47f92e305 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp @@ -48,11 +48,13 @@ void MultiSpeaker::set_delegate(Outputs::Speaker::Speaker::Delegate *delegate) { } void MultiSpeaker::speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer) { + std::lock_guard lock_guard(front_speaker_mutex_); if(delegate_ && speaker == front_speaker_) { delegate_->speaker_did_complete_samples(this, buffer); } } void MultiSpeaker::set_new_front_machine(::Machine::DynamicMachine *machine) { + std::lock_guard lock_guard(front_speaker_mutex_); front_speaker_ = machine->crt_machine()->get_speaker(); } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp index b5e9a28e9..84d2c910a 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp @@ -13,6 +13,7 @@ #include "../../../../Outputs/Speaker/Speaker.hpp" #include +#include #include namespace Analyser { @@ -34,6 +35,7 @@ class MultiSpeaker: public Outputs::Speaker::Speaker, Outputs::Speaker::Speaker: std::vector speakers_; Outputs::Speaker::Speaker *front_speaker_ = nullptr; Outputs::Speaker::Speaker::Delegate *delegate_ = nullptr; + std::mutex front_speaker_mutex_; }; } diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index 608730e75..4927af57a 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -62,7 +62,6 @@ Configurable::Device *MultiMachine::configurable_device() { void MultiMachine::multi_crt_did_run_machines() { std::lock_guard machines_lock(machines_mutex_); - DynamicMachine *front = machines_.front().get(); for(const auto &machine: machines_) { CRTMachine::Machine *crt = machine->crt_machine(); printf("%0.2f ", crt->get_confidence()); @@ -71,6 +70,7 @@ void MultiMachine::multi_crt_did_run_machines() { } printf("\n"); + DynamicMachine *front = machines_.front().get(); std::stable_sort(machines_.begin(), machines_.end(), [] (const auto &lhs, const auto &rhs){ CRTMachine::Machine *lhs_crt = lhs->crt_machine(); CRTMachine::Machine *rhs_crt = rhs->crt_machine(); From 7d75e864b1e566f78b53c63f21ac9f296b65d17d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 18 Feb 2018 22:09:03 -0500 Subject: [PATCH 33/37] Ensures thread safety of usages of `bestEffortLock`. --- .../Documents/MachineDocument.swift | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift index 8fbdad7fc..34ea26be3 100644 --- a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift @@ -18,8 +18,10 @@ class MachineDocument: CSBestEffortUpdaterDelegate, CSAudioQueueDelegate { - lazy var actionLock = NSLock() - lazy var drawLock = NSLock() + fileprivate let actionLock = NSLock() + fileprivate let drawLock = NSLock() + fileprivate let bestEffortLock = NSLock() + var machine: CSMachine! var name: String! { get { @@ -77,7 +79,9 @@ class MachineDocument: } func machineDidChangeClockIsUnlimited(_ machine: CSMachine!) { + bestEffortLock.lock() self.bestEffortUpdater?.runAsUnlimited = machine.clockIsUnlimited + bestEffortLock.unlock() } fileprivate func setupClockRate() { @@ -91,20 +95,24 @@ class MachineDocument: self.machine.setAudioSamplingRate(selectedSamplingRate, bufferSize:audioQueue.preferredBufferSize) } + bestEffortLock.lock() self.bestEffortUpdater?.clockRate = self.machine.clockRate + bestEffortLock.unlock() } override func close() { optionsPanel?.setIsVisible(false) optionsPanel = nil - openGLView.delegate = nil + bestEffortLock.lock() bestEffortUpdater!.delegate = nil bestEffortUpdater = nil + bestEffortLock.unlock() actionLock.lock() drawLock.lock() machine = nil + openGLView.delegate = nil openGLView.invalidate() actionLock.unlock() drawLock.unlock() @@ -148,6 +156,7 @@ class MachineDocument: } func runForNumberOfCycles(_ numberOfCycles: Int32) { + bestEffortLock.lock() if let bestEffortUpdater = bestEffortUpdater { let cyclesToRunFor = min(numberOfCycles, Int32(bestEffortUpdater.clockRate / 10)) if actionLock.try() { @@ -155,15 +164,19 @@ class MachineDocument: actionLock.unlock() } } + bestEffortLock.unlock() } // MARK: CSAudioQueueDelegate final func audioQueueIsRunningDry(_ audioQueue: CSAudioQueue) { + bestEffortLock.lock() bestEffortUpdater?.update() + bestEffortLock.unlock() } // MARK: CSOpenGLViewDelegate final func openGLView(_ view: CSOpenGLView, drawViewOnlyIfDirty onlyIfDirty: Bool) { + bestEffortLock.lock() if let bestEffortUpdater = bestEffortUpdater { bestEffortUpdater.update() if drawLock.try() { @@ -171,6 +184,7 @@ class MachineDocument: drawLock.unlock() } } + bestEffortLock.unlock() } final func openGLView(_ view: CSOpenGLView, didReceiveFileAt URL: URL) { From fc9e84c72ec0dc9e021b8e9f89da12526b31ef27 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 18 Feb 2018 22:09:27 -0500 Subject: [PATCH 34/37] Eliminates unsafe optimisation. Also likely to be unhelpful as and when multiple machines are in play. --- Outputs/CRT/Internals/Shaders/Shader.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Outputs/CRT/Internals/Shaders/Shader.cpp b/Outputs/CRT/Internals/Shaders/Shader.cpp index 482107576..72fa3b086 100644 --- a/Outputs/CRT/Internals/Shaders/Shader.cpp +++ b/Outputs/CRT/Internals/Shaders/Shader.cpp @@ -14,7 +14,9 @@ using namespace OpenGL; namespace { - Shader *bound_shader = nullptr; + // The below is disabled because it isn't context/thread-specific. Which makes it + // fairly 'unuseful'. +// Shader *bound_shader = nullptr; } GLuint Shader::compile_shader(const std::string &source, GLenum type) { @@ -75,20 +77,20 @@ Shader::Shader(const std::string &vertex_shader, const std::string &fragment_sha } Shader::~Shader() { - if(bound_shader == this) Shader::unbind(); +// if(bound_shader == this) Shader::unbind(); glDeleteProgram(shader_program_); } void Shader::bind() { - if(bound_shader != this) { +// if(bound_shader != this) { glUseProgram(shader_program_); - bound_shader = this; - } +// bound_shader = this; +// } flush_functions(); } void Shader::unbind() { - bound_shader = nullptr; +// bound_shader = nullptr; glUseProgram(0); } From 9728bea0a78d03972903b541d78ed670a93a6839 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 19 Feb 2018 05:13:41 -0800 Subject: [PATCH 35/37] Updates scons file and corrects missing headers; backports to C++11. --- .../Implementation/MultiConfigurable.cpp | 2 ++ .../Dynamic/MultiMachine/MultiMachine.cpp | 13 ++++++---- Analyser/Static/StaticAnalyser.cpp | 8 ++++--- OSBindings/SDL/SConstruct | 24 +++++++++++-------- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp index 8d288cfb1..2aab3e028 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp @@ -8,6 +8,8 @@ #include "MultiConfigurable.hpp" +#include + using namespace Analyser::Dynamic; MultiConfigurable::MultiConfigurable(const std::vector> &machines) { diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp index 4927af57a..fc018abd7 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.cpp @@ -8,6 +8,8 @@ #include "MultiMachine.hpp" +#include + using namespace Analyser::Dynamic; MultiMachine::MultiMachine(std::vector> &&machines) : @@ -71,11 +73,12 @@ void MultiMachine::multi_crt_did_run_machines() { printf("\n"); DynamicMachine *front = machines_.front().get(); - std::stable_sort(machines_.begin(), machines_.end(), [] (const auto &lhs, const auto &rhs){ - CRTMachine::Machine *lhs_crt = lhs->crt_machine(); - CRTMachine::Machine *rhs_crt = rhs->crt_machine(); - return lhs_crt->get_confidence() > rhs_crt->get_confidence(); - }); + std::stable_sort(machines_.begin(), machines_.end(), + [] (const std::unique_ptr &lhs, const std::unique_ptr &rhs){ + CRTMachine::Machine *lhs_crt = lhs->crt_machine(); + CRTMachine::Machine *rhs_crt = rhs->crt_machine(); + return lhs_crt->get_confidence() > rhs_crt->get_confidence(); + }); if(machines_.front().get() != front) { crt_machine_.did_change_machine_order(); diff --git a/Analyser/Static/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp index dab1e7705..c773d07d3 100644 --- a/Analyser/Static/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -8,6 +8,7 @@ #include "StaticAnalyser.hpp" +#include #include #include @@ -166,9 +167,10 @@ std::vector> Analyser::Static::GetTargets(const char *fi // Sort by initial confidence. Use a stable sort in case any of the machine-specific analysers // picked their insertion order carefully. - std::stable_sort(targets.begin(), targets.end(), [](auto &a, auto &b) { - return a->confidence > b->confidence; - }); + std::stable_sort(targets.begin(), targets.end(), + [] (const std::unique_ptr &a, const std::unique_ptr &b) { + return a->confidence > b->confidence; + }); return targets; } diff --git a/OSBindings/SDL/SConstruct b/OSBindings/SDL/SConstruct index 3219db008..e2559b148 100644 --- a/OSBindings/SDL/SConstruct +++ b/OSBindings/SDL/SConstruct @@ -10,6 +10,20 @@ env.ParseConfig('sdl2-config --libs') # gather a list of source files SOURCES = glob.glob('*.cpp') +SOURCES += glob.glob('../../Analyser/Dynamic/*.cpp') +SOURCES += glob.glob('../../Analyser/Dynamic/MultiMachine/*.cpp') +SOURCES += glob.glob('../../Analyser/Dynamic/MultiMachine/Implementation/*.cpp') + +SOURCES += glob.glob('../../Analyser/Static/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/Acorn/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/AmstradCPC/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/Atari/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/Commodore/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/Disassembler/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/MSX/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/Oric/*.cpp') +SOURCES += glob.glob('../../Analyser/Static/ZX8081/*.cpp') + SOURCES += glob.glob('../../Components/1770/*.cpp') SOURCES += glob.glob('../../Components/6522/Implementation/*.cpp') SOURCES += glob.glob('../../Components/6560/*.cpp') @@ -46,16 +60,6 @@ SOURCES += glob.glob('../../Processors/Z80/Implementation/*.cpp') SOURCES += glob.glob('../../SignalProcessing/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/Acorn/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/AmstradCPC/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/Atari/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/Commodore/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/Disassembler/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/MSX/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/Oric/*.cpp') -SOURCES += glob.glob('../../StaticAnalyser/ZX8081/*.cpp') - SOURCES += glob.glob('../../Storage/*.cpp') SOURCES += glob.glob('../../Storage/Cartridge/*.cpp') SOURCES += glob.glob('../../Storage/Cartridge/Encodings/*.cpp') From 8265f289bd4944ea1c794b95b30c34312876bfae Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 19 Feb 2018 16:03:17 -0500 Subject: [PATCH 36/37] Improves documentation within the new parts. --- .../Implementation/MultiCRTMachine.hpp | 41 ++++++++++++++----- .../Implementation/MultiConfigurable.hpp | 7 ++++ .../MultiConfigurationTarget.hpp | 7 ++++ .../Implementation/MultiJoystickMachine.hpp | 8 +++- .../Implementation/MultiKeyboardMachine.hpp | 9 +++- .../Implementation/MultiSpeaker.hpp | 18 +++++++- .../Dynamic/MultiMachine/MultiMachine.hpp | 9 ++-- 7 files changed, 80 insertions(+), 19 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp index b82e1db53..b57583884 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiCRTMachine.hpp @@ -22,10 +22,37 @@ namespace Analyser { namespace Dynamic { -class MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machine::Delegate { +/*! + Provides a class that multiplexes the CRT machine interface to multiple machines. + + Keeps a reference to the original vector of machines; will access it only after + acquiring a supplied mutex. The owner should also call did_change_machine_order() + if the order of machines changes. +*/ +class MultiCRTMachine: public CRTMachine::Machine, public CRTMachine::Machine::Delegate { public: MultiCRTMachine(const std::vector> &machines, std::mutex &machines_mutex); + /*! + Informs the MultiCRTMachine that the order of machines has changed; the MultiCRTMachine + uses this as an opportunity to synthesis any CRTMachine::Machine::Delegate messages that + are necessary to bridge the gap between one machine and the next. + */ + void did_change_machine_order(); + + /*! + Provides a mechanism by which a delegate can be informed each time a call to run_for has + been received. + */ + struct Delegate { + virtual void multi_crt_did_run_machines() = 0; + }; + /// Sets @c delegate as the receiver of delegate messages. + void set_delegate(Delegate *delegate) { + delegate_ = delegate; + } + + // Below is the standard CRTMachine::Machine interface; see there for documentation. void setup_output(float aspect_ratio) override; void close_output() override; Outputs::CRT::CRT *get_crt() override; @@ -35,19 +62,11 @@ class MultiCRTMachine: public ::CRTMachine::Machine, public ::CRTMachine::Machin bool get_clock_is_unlimited() override; void set_delegate(::CRTMachine::Machine::Delegate *delegate) override; + private: + // CRTMachine::Machine::Delegate void machine_did_change_clock_rate(Machine *machine) override; void machine_did_change_clock_is_unlimited(Machine *machine) override; - void did_change_machine_order(); - - struct Delegate { - virtual void multi_crt_did_run_machines() = 0; - }; - void set_delegate(Delegate *delegate) { - delegate_ = delegate; - } - - private: const std::vector> &machines_; std::mutex &machines_mutex_; std::vector queues_; diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp index 8f00057e8..79695f5ad 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.hpp @@ -17,10 +17,17 @@ namespace Analyser { namespace Dynamic { +/*! + Provides a class that multiplexes the configurable interface to multiple machines. + + Makes a static internal copy of the list of machines; makes no guarantees about the + order of delivered messages. +*/ class MultiConfigurable: public Configurable::Device { public: MultiConfigurable(const std::vector> &machines); + // Below is the standard Configurable::Device interface; see there for documentation. std::vector> get_options() override; void set_selections(const Configurable::SelectionSet &selection_by_option) override; Configurable::SelectionSet get_accurate_selections() override; diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp index 886b6db40..374057333 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.hpp @@ -18,10 +18,17 @@ namespace Analyser { namespace Dynamic { +/*! + Provides a class that multiplexes the configuration target interface to multiple machines. + + Makes a static internal copy of the list of machines; makes no guarantees about the + order of delivered messages. +*/ struct MultiConfigurationTarget: public ConfigurationTarget::Machine { public: MultiConfigurationTarget(const std::vector> &machines); + // Below is the standard ConfigurationTarget::Machine interface; see there for documentation. void configure_as_target(const Analyser::Static::Target &target) override; bool insert_media(const Analyser::Static::Media &media) override; diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp index dad324354..137c96e95 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.hpp @@ -17,16 +17,22 @@ namespace Analyser { namespace Dynamic { +/*! + Provides a class that multiplexes the joystick machine interface to multiple machines. + + Makes a static internal copy of the list of machines; makes no guarantees about the + order of delivered messages. +*/ class MultiJoystickMachine: public JoystickMachine::Machine { public: MultiJoystickMachine(const std::vector> &machines); + // Below is the standard JoystickMachine::Machine interface; see there for documentation. std::vector> &get_joysticks() override; private: std::vector machines_; std::vector> joysticks_; - }; } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp index 47df189a0..535fac6d1 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp @@ -18,10 +18,17 @@ namespace Analyser { namespace Dynamic { -class MultiKeyboardMachine: public ::KeyboardMachine::Machine { +/*! + Provides a class that multiplexes the keyboard machine interface to multiple machines. + + Makes a static internal copy of the list of machines; makes no guarantees about the + order of delivered messages. +*/ +class MultiKeyboardMachine: public KeyboardMachine::Machine { public: MultiKeyboardMachine(const std::vector> &machines); + // Below is the standard KeyboardMachine::Machine interface; see there for documentation. void clear_all_keys() override; void set_key_state(uint16_t key, bool is_pressed) override; void type_string(const std::string &) override; diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp index 84d2c910a..cba1acca0 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp @@ -19,19 +19,33 @@ namespace Analyser { namespace Dynamic { +/*! + Provides a class that multiplexes calls to and from Outputs::Speaker::Speaker in order + transparently to connect a single caller to multiple destinations. + + Makes a static internal copy of the list of machines; expects the owner to keep it + abreast of the current frontmost machine. +*/ class MultiSpeaker: public Outputs::Speaker::Speaker, Outputs::Speaker::Speaker::Delegate { public: + /*! + Provides a construction mechanism that may return nullptr, in the case that all included + machines return nullptr as their speaker. + */ static MultiSpeaker *create(const std::vector> &machines); - MultiSpeaker(const std::vector &speakers); + /// This class requires the caller to nominate changes in the frontmost machine. void set_new_front_machine(::Machine::DynamicMachine *machine); + // Below is the standard Outputs::Speaker::Speaker interface; see there for documentation. float get_ideal_clock_rate_in_range(float minimum, float maximum); void set_output_rate(float cycles_per_second, int buffer_size); void set_delegate(Outputs::Speaker::Speaker::Delegate *delegate); - void speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer); private: + void speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer); + MultiSpeaker(const std::vector &speakers); + std::vector speakers_; Outputs::Speaker::Speaker *front_speaker_ = nullptr; Outputs::Speaker::Speaker::Delegate *delegate_ = nullptr; diff --git a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp index 81feebef2..cf4711422 100644 --- a/Analyser/Dynamic/MultiMachine/MultiMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/MultiMachine.hpp @@ -28,13 +28,15 @@ namespace Dynamic { Provides the same interface as to a single machine, while multiplexing all underlying calls to an array of real dynamic machines. - Calls to crt_machine->get_crt will return that for the first machine. + Calls to crt_machine->get_crt will return that for the frontmost machine; + anything installed as the speaker's delegate will similarly receive + feedback only from that machine. Following each crt_machine->run_for, reorders the supplied machines by confidence. If confidence for any machine becomes disproportionately low compared to - the others in the set, that machine is removed from the array. + the others in the set, that machine stops running. */ class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::Delegate { public: @@ -47,10 +49,9 @@ class MultiMachine: public ::Machine::DynamicMachine, public MultiCRTMachine::De Configurable::Device *configurable_device() override; void *raw_pointer() override; + private: void multi_crt_did_run_machines() override; - - private: std::vector> machines_; std::mutex machines_mutex_; From 2439f5aee58fd33808d6ea0b5a7f6f4708295303 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 19 Feb 2018 16:06:46 -0500 Subject: [PATCH 37/37] Corrects some whitespace errors. --- .../Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp | 2 +- .../MultiMachine/Implementation/MultiConfigurationTarget.cpp | 2 +- .../MultiMachine/Implementation/MultiJoystickMachine.cpp | 2 +- .../MultiMachine/Implementation/MultiKeyboardMachine.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp index 2aab3e028..ad56d34ff 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurable.cpp @@ -15,7 +15,7 @@ using namespace Analyser::Dynamic; MultiConfigurable::MultiConfigurable(const std::vector> &machines) { for(const auto &machine: machines) { Configurable::Device *device = machine->configurable_device(); - if(device) devices_.push_back(device); + if(device) devices_.push_back(device); } } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp index 22ae0e6ee..b4d8a7192 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiConfigurationTarget.cpp @@ -13,7 +13,7 @@ using namespace Analyser::Dynamic; MultiConfigurationTarget::MultiConfigurationTarget(const std::vector> &machines) { for(const auto &machine: machines) { ConfigurationTarget::Machine *configuration_target = machine->configuration_target(); - if(configuration_target) targets_.push_back(configuration_target); + if(configuration_target) targets_.push_back(configuration_target); } } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp index d899b9e36..3959090bc 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiJoystickMachine.cpp @@ -13,7 +13,7 @@ using namespace Analyser::Dynamic; MultiJoystickMachine::MultiJoystickMachine(const std::vector> &machines) { for(const auto &machine: machines) { JoystickMachine::Machine *joystick_machine = machine->joystick_machine(); - if(joystick_machine) machines_.push_back(joystick_machine); + if(joystick_machine) machines_.push_back(joystick_machine); } } diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp index 2806801a7..743091270 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp @@ -13,7 +13,7 @@ using namespace Analyser::Dynamic; MultiKeyboardMachine::MultiKeyboardMachine(const std::vector> &machines) { for(const auto &machine: machines) { KeyboardMachine::Machine *keyboard_machine = machine->keyboard_machine(); - if(keyboard_machine) machines_.push_back(keyboard_machine); + if(keyboard_machine) machines_.push_back(keyboard_machine); } }