From 36e0cb29c06ad319872536ca237f4b4580a60a16 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 4 Apr 2018 19:14:42 -0400 Subject: [PATCH] Ensures proper propagation of video choice through the Oric. --- Machines/CRTMachine.hpp | 13 ++++++++++++- Machines/Oric/Oric.cpp | 10 +++++----- Machines/Oric/Video.cpp | 12 ++++++------ Machines/Oric/Video.hpp | 4 ++-- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Machines/CRTMachine.hpp b/Machines/CRTMachine.hpp index 56a8e7e8a..538c3da88 100644 --- a/Machines/CRTMachine.hpp +++ b/Machines/CRTMachine.hpp @@ -67,6 +67,10 @@ class Machine: public ROMMachine::Machine { return clock_rate_; } + /*! + Maps from Configurable::Display to Outputs::CRT::VideoSignal and calls + @c set_video_signal with the result. + */ void set_video_signal_configurable(Configurable::Display type) { Outputs::CRT::VideoSignal signal; switch(type) { @@ -81,7 +85,14 @@ class Machine: public ROMMachine::Machine { signal = Outputs::CRT::VideoSignal::Composite; break; } - get_crt()->set_video_signal(signal); + set_video_signal(signal); + } + + /*! + Forwards the video signal to the CRT returned by get_crt(). + */ + virtual void set_video_signal(Outputs::CRT::VideoSignal video_signal) { + get_crt()->set_video_signal(video_signal); } private: diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 5215badf4..d65531d8b 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -263,10 +263,6 @@ class ConcreteMachine: use_fast_tape_hack_ = activate; } - void set_output_device(Outputs::CRT::VideoSignal output_device) { - video_output_->set_output_device(output_device); - } - // to satisfy ConfigurationTarget::Machine void configure_as_target(const Analyser::Static::Target *target) override final { auto *const oric_target = dynamic_cast(target); @@ -392,7 +388,7 @@ class ConcreteMachine: video_output_.reset(new VideoOutput(ram_)); if(!colour_rom_.empty()) video_output_->set_colour_rom(colour_rom_); - set_output_device(Outputs::CRT::VideoSignal::RGB); + set_video_signal(Outputs::CRT::VideoSignal::RGB); } void close_output() override final { @@ -469,6 +465,10 @@ class ConcreteMachine: } } + void set_video_signal(Outputs::CRT::VideoSignal video_signal) override { + video_output_->set_video_signal(video_signal); + } + Configurable::SelectionSet get_accurate_selections() override { Configurable::SelectionSet selection_set; Configurable::append_quick_load_tape_selection(selection_set, false); diff --git a/Machines/Oric/Video.cpp b/Machines/Oric/Video.cpp index fd8b34851..efb8fbfa2 100644 --- a/Machines/Oric/Video.cpp +++ b/Machines/Oric/Video.cpp @@ -41,13 +41,13 @@ VideoOutput::VideoOutput(uint8_t *memory) : ); crt_->set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 0.0f); - set_output_device(Outputs::CRT::VideoSignal::Composite); + set_video_signal(Outputs::CRT::VideoSignal::Composite); crt_->set_visible_area(crt_->get_rect_for_area(53, 224, 16 * 6, 40 * 6, 4.0f / 3.0f)); } -void VideoOutput::set_output_device(Outputs::CRT::VideoSignal output_device) { - output_device_ = output_device; - crt_->set_video_signal(output_device); +void VideoOutput::set_video_signal(Outputs::CRT::VideoSignal video_signal) { + video_signal_ = video_signal; + crt_->set_video_signal(video_signal); } void VideoOutput::set_colour_rom(const std::vector &rom) { @@ -129,7 +129,7 @@ void VideoOutput::run_for(const Cycles cycles) { if(control_byte & 0x60) { if(pixel_target_) { uint16_t colours[2]; - if(output_device_ == Outputs::CRT::VideoSignal::RGB) { + if(video_signal_ == Outputs::CRT::VideoSignal::RGB) { colours[0] = static_cast(paper_ ^ inverse_mask); colours[1] = static_cast(ink_ ^ inverse_mask); } else { @@ -183,7 +183,7 @@ void VideoOutput::run_for(const Cycles cycles) { pixel_target_[0] = pixel_target_[1] = pixel_target_[2] = pixel_target_[3] = pixel_target_[4] = pixel_target_[5] = - (output_device_ == Outputs::CRT::VideoSignal::RGB) ? paper_ ^ inverse_mask : colour_forms_[paper_ ^ inverse_mask]; + (video_signal_ == Outputs::CRT::VideoSignal::RGB) ? paper_ ^ inverse_mask : colour_forms_[paper_ ^ inverse_mask]; } } if(pixel_target_) pixel_target_ += 6; diff --git a/Machines/Oric/Video.hpp b/Machines/Oric/Video.hpp index c3b58436e..9de5a85d7 100644 --- a/Machines/Oric/Video.hpp +++ b/Machines/Oric/Video.hpp @@ -20,7 +20,7 @@ class VideoOutput { Outputs::CRT::CRT *get_crt(); void run_for(const Cycles cycles); void set_colour_rom(const std::vector &rom); - void set_output_device(Outputs::CRT::VideoSignal output_device); + void set_video_signal(Outputs::CRT::VideoSignal output_device); private: uint8_t *ram_; @@ -33,7 +33,7 @@ class VideoOutput { // Output target and device uint16_t *pixel_target_; uint16_t colour_forms_[8]; - Outputs::CRT::VideoSignal output_device_; + Outputs::CRT::VideoSignal video_signal_; // Registers uint8_t ink_, paper_;