From ffc1b0ff29566d0894378b1a4ff2bc7f893acf96 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 18 Mar 2020 18:31:31 -0400 Subject: [PATCH] Reintroduces Oric runtime options. --- Machines/Oric/Oric.cpp | 57 ++++++--------------------- Machines/Oric/Oric.hpp | 17 +++++++- Machines/Oric/Video.cpp | 4 ++ Machines/Oric/Video.hpp | 1 + Machines/Utility/MachineForTarget.cpp | 2 +- 5 files changed, 34 insertions(+), 47 deletions(-) diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 8931be836..74d92136f 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -50,20 +50,6 @@ enum ROM { BASIC10 = 0, BASIC11, Microdisc, Colour }; -//std::vector> get_options() { -// return Configurable::standard_options( -// static_cast( -// Configurable::DisplayRGB | -// Configurable::DisplayCompositeColour | -// Configurable::DisplayCompositeMonochrome | -// Configurable::QuickLoadTape) -// ); -//} - -std::unique_ptr get_options() { - return nullptr; -} - /*! Models the Oric's keyboard: eight key rows, containing a bitfield of keys set. @@ -569,6 +555,10 @@ template class Co video_output_.set_display_type(display_type); } + Outputs::Display::DisplayType get_display_type() final { + return video_output_.get_display_type(); + } + Outputs::Speaker::Speaker *get_speaker() final { return &speaker_; } @@ -628,40 +618,17 @@ template class Co // MARK: - Configuration options. std::unique_ptr get_options() final { - return nullptr; + auto options = std::make_unique(Configurable::OptionsType::UserFriendly); + options->output = get_video_signal_configurable(); + options->quickload = use_fast_tape_hack_; + return options; } - void set_options(const std::unique_ptr &options) final { + void set_options(const std::unique_ptr &str) final { + const auto options = dynamic_cast(str.get()); + set_video_signal_configurable(options->output); + set_use_fast_tape_hack(options->quickload); } -// std::vector> get_options() final { -// return Oric::get_options(); -// } -// -// void set_selections(const Configurable::SelectionSet &selections_by_option) final { -// bool quickload; -// if(Configurable::get_quick_load_tape(selections_by_option, quickload)) { -// set_use_fast_tape_hack(quickload); -// } -// -// Configurable::Display display; -// if(Configurable::get_display(selections_by_option, display)) { -// set_video_signal_configurable(display); -// } -// } -// -// Configurable::SelectionSet get_accurate_selections() final { -// Configurable::SelectionSet selection_set; -// Configurable::append_quick_load_tape_selection(selection_set, false); -// Configurable::append_display_selection(selection_set, Configurable::Display::CompositeColour); -// return selection_set; -// } -// -// Configurable::SelectionSet get_user_friendly_selections() final { -// Configurable::SelectionSet selection_set; -// Configurable::append_quick_load_tape_selection(selection_set, true); -// Configurable::append_display_selection(selection_set, Configurable::Display::RGB); -// return selection_set; -// } void set_activity_observer(Activity::Observer *observer) final { switch(disk_interface) { diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 57c6fdba3..d9f8540b1 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -9,7 +9,8 @@ #ifndef Oric_hpp #define Oric_hpp -#include "../../Reflection/Struct.h" +#include "../../Configurable/Configurable.hpp" +#include "../../Configurable/StandardOptions.hpp" #include "../../Analyser/Static/StaticAnalyser.hpp" #include "../ROMMachine.hpp" @@ -29,6 +30,20 @@ class Machine { /// Creates and returns an Oric. static Machine *Oric(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher); + + class Options: public Reflection::StructImpl, public Configurable::DisplayOption, public Configurable::QuickloadOption { + friend Configurable::DisplayOption; + friend Configurable::QuickloadOption; + public: + Options(Configurable::OptionsType type) : + Configurable::DisplayOption(type == Configurable::OptionsType::UserFriendly ? Configurable::Display::RGB : Configurable::Display::CompositeColour), + Configurable::QuickloadOption(type == Configurable::OptionsType::UserFriendly) { + if(needs_declare()) { + declare_display_option(); + declare_quickload_option(); + } + } + }; }; } diff --git a/Machines/Oric/Video.cpp b/Machines/Oric/Video.cpp index 7e228c38e..8fb8926a0 100644 --- a/Machines/Oric/Video.cpp +++ b/Machines/Oric/Video.cpp @@ -67,6 +67,10 @@ void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) { } } +Outputs::Display::DisplayType VideoOutput::get_display_type() { + return crt_.get_display_type(); +} + void VideoOutput::set_scan_target(Outputs::Display::ScanTarget *scan_target) { crt_.set_scan_target(scan_target); } diff --git a/Machines/Oric/Video.hpp b/Machines/Oric/Video.hpp index 9d066a808..fe3001efe 100644 --- a/Machines/Oric/Video.hpp +++ b/Machines/Oric/Video.hpp @@ -27,6 +27,7 @@ class VideoOutput { void set_scan_target(Outputs::Display::ScanTarget *scan_target); void set_display_type(Outputs::Display::DisplayType display_type); + Outputs::Display::DisplayType get_display_type(); Outputs::Display::ScanStatus get_scaled_scan_status() const; void register_crt_frequency_mismatch(); diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index bc45e42ce..316ef8211 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -177,7 +177,6 @@ std::map> Machine::AllOptionsBy std::map> options; // options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Macintosh), Apple::Macintosh::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())); #define Emplace(machine, class) \ @@ -190,6 +189,7 @@ std::map> Machine::AllOptionsBy Emplace(Electron, Electron::Machine); Emplace(MasterSystem, Sega::MasterSystem::Machine); Emplace(MSX, MSX::Machine); + Emplace(Oric, Oric::Machine); Emplace(ZX8081, ZX8081::Machine); #undef Emplace