From d45f1a793d84325b0e0c24ce7fff59ba9ec370b1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 21 Jun 2018 20:00:49 -0400 Subject: [PATCH] Introduces composite/RGB selection for the Amstrad CPC. --- Machines/AmstradCPC/AmstradCPC.cpp | 33 ++++++++++- Machines/AmstradCPC/AmstradCPC.hpp | 9 +++ Machines/Utility/MachineForTarget.cpp | 1 + .../Clock Signal.xcodeproj/project.pbxproj | 12 ++++ .../Base.lproj/CompositeOptions.xib | 56 +++++++++++++++++++ .../StaticAnalyser/CSStaticAnalyser.mm | 1 + 6 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 OSBindings/Mac/Clock Signal/Base.lproj/CompositeOptions.xib diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 25bc3cf24..a31ca7568 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -37,6 +37,12 @@ namespace AmstradCPC { +std::vector> get_options() { + return Configurable::standard_options( + static_cast(Configurable::DisplayRGB | Configurable::DisplayComposite) + ); +} + enum ROMType: int { OS464 = 0, BASIC464, OS664, BASIC664, @@ -717,6 +723,7 @@ class ConcreteMachine: public Utility::TypeRecipient, public CPU::Z80::BusHandler, public ClockingHint::Observer, + public Configurable::Device, public Machine, public Activity::Source { public: @@ -995,8 +1002,7 @@ class ConcreteMachine: tape_player_is_sleeping_ = tape_player_.preferred_clocking() == ClockingHint::Preference::None; } -// MARK: - Keyboard - + // MARK: - Keyboard void type_string(const std::string &string) override final { std::unique_ptr mapper(new CharacterMapper()); Utility::TypeRecipient::add_typer(string, std::move(mapper)); @@ -1029,6 +1035,29 @@ class ConcreteMachine: if(has_fdc_) fdc_.set_activity_observer(observer); } + // MARK: - Configuration options. + std::vector> get_options() override { + return AmstradCPC::get_options(); + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + Configurable::Display display; + if(Configurable::get_display(selections_by_option, display)) { + set_video_signal_configurable(display); + } + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + Configurable::append_display_selection(selection_set, Configurable::Display::RGB); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + Configurable::append_display_selection(selection_set, Configurable::Display::RGB); + return selection_set; + } private: inline void write_to_gate_array(uint8_t value) { diff --git a/Machines/AmstradCPC/AmstradCPC.hpp b/Machines/AmstradCPC/AmstradCPC.hpp index 6b8729fec..55dce79fa 100644 --- a/Machines/AmstradCPC/AmstradCPC.hpp +++ b/Machines/AmstradCPC/AmstradCPC.hpp @@ -9,8 +9,17 @@ #ifndef AmstradCPC_hpp #define AmstradCPC_hpp +#include "../../Configurable/Configurable.hpp" + +#include +#include +#include + namespace AmstradCPC { +/// @returns The options available for an Amstrad CPC. +std::vector> get_options(); + /*! Models an Amstrad CPC. */ diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 639fb04df..ea67873aa 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -129,6 +129,7 @@ std::string Machine::LongNameForTargetMachine(Analyser::Machine machine) { std::map>> Machine::AllOptionsByMachineName() { std::map>> options; + options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::AmstradCPC), AmstradCPC::get_options())); options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::AppleII), AppleII::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())); diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 06bbc3832..1019bd13c 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -646,6 +646,7 @@ 4BEBFB522002DB30000708CC /* DiskROM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBFB4F2002DB30000708CC /* DiskROM.cpp */; }; 4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6A1D72496600532C7B /* Cartridge.cpp */; }; 4BEE0A701D72496600532C7B /* PRG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEE0A6D1D72496600532C7B /* PRG.cpp */; }; + 4BEEE6BD20DC72EB003723BF /* CompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BEEE6BB20DC72EA003723BF /* CompositeOptions.xib */; }; 4BEF6AAA1D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */; }; 4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */; }; 4BF437EE209D0F7E008CBD6B /* SegmentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF437EC209D0F7E008CBD6B /* SegmentParser.cpp */; }; @@ -1430,6 +1431,7 @@ 4BEE0A6B1D72496600532C7B /* Cartridge.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Cartridge.hpp; sourceTree = ""; }; 4BEE0A6D1D72496600532C7B /* PRG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PRG.cpp; sourceTree = ""; }; 4BEE0A6E1D72496600532C7B /* PRG.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PRG.hpp; sourceTree = ""; }; + 4BEEE6BC20DC72EA003723BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/CompositeOptions.xib"; sourceTree = SOURCE_ROOT; }; 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 = ""; }; @@ -1995,6 +1997,7 @@ 4B08A56720D72BEF0016CE5A /* Activity.xib */, 4BC5FC2E20CDDDEE00410AA0 /* AppleIIOptions.xib */, 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */, + 4BEEE6BB20DC72EA003723BF /* CompositeOptions.xib */, 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */, 4B2A332B1DB86821002876E3 /* OricOptions.xib */, 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */, @@ -3298,6 +3301,7 @@ 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */, 4B79E4461E3AF38600141F11 /* floppy525.png in Resources */, 4BC9DF451D044FCA00F44158 /* ROMImages in Resources */, + 4BEEE6BD20DC72EB003723BF /* CompositeOptions.xib in Resources */, 4B1497981EE4B97F00CE2596 /* ZX8081Options.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4070,6 +4074,14 @@ name = QuickLoadOptions.xib; sourceTree = ""; }; + 4BEEE6BB20DC72EA003723BF /* CompositeOptions.xib */ = { + isa = PBXVariantGroup; + children = ( + 4BEEE6BC20DC72EA003723BF /* Base */, + ); + name = CompositeOptions.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ diff --git a/OSBindings/Mac/Clock Signal/Base.lproj/CompositeOptions.xib b/OSBindings/Mac/Clock Signal/Base.lproj/CompositeOptions.xib new file mode 100644 index 000000000..1bc85891b --- /dev/null +++ b/OSBindings/Mac/Clock Signal/Base.lproj/CompositeOptions.xib @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index 787161d97..fee228e7e 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -183,6 +183,7 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K - (NSString *)optionsPanelNibName { switch(_targets.front()->machine) { + case Analyser::Machine::AmstradCPC: return @"CompositeOptions"; case Analyser::Machine::AppleII: return @"AppleIIOptions"; case Analyser::Machine::Atari2600: return @"Atari2600Options"; case Analyser::Machine::Electron: return @"QuickLoadCompositeOptions";