mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-05 04:37:41 +00:00
Provides s-video as a command-line option.
This commit is contained in:
parent
7b381a8b6b
commit
33084899d0
@ -33,7 +33,13 @@ bool get_bool(const Configurable::SelectionSet &selections_by_option, const std:
|
||||
std::vector<std::unique_ptr<Configurable::Option>> Configurable::standard_options(Configurable::StandardOptions mask) {
|
||||
std::vector<std::unique_ptr<Configurable::Option>> options;
|
||||
if(mask & QuickLoadTape) options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload"));
|
||||
if(mask & DisplayRGBComposite) options.emplace_back(new Configurable::ListOption("Display", "display", {"composite", "rgb"}));
|
||||
if(mask & (DisplayRGB | DisplayComposite | DisplaySVideo)) {
|
||||
std::vector<std::string> display_options;
|
||||
if(mask & DisplayComposite) display_options.emplace_back("composite");
|
||||
if(mask & DisplaySVideo) display_options.emplace_back("svideo");
|
||||
if(mask & DisplayRGB) display_options.emplace_back("rgb");
|
||||
options.emplace_back(new Configurable::ListOption("Display", "display", display_options));
|
||||
}
|
||||
if(mask & AutomaticTapeMotorControl) options.emplace_back(new Configurable::BooleanOption("Automatic Tape Motor Control", "autotapemotor"));
|
||||
return options;
|
||||
}
|
||||
@ -48,7 +54,14 @@ void Configurable::append_automatic_tape_motor_control_selection(SelectionSet &s
|
||||
}
|
||||
|
||||
void Configurable::append_display_selection(Configurable::SelectionSet &selection_set, Display selection) {
|
||||
selection_set["display"] = std::unique_ptr<Configurable::Selection>(new Configurable::ListSelection((selection == Display::RGB) ? "rgb" : "composite"));
|
||||
std::string string_selection;
|
||||
switch(selection) {
|
||||
default:
|
||||
case Display::RGB: string_selection = "rgb"; break;
|
||||
case Display::SVideo: string_selection = "svideo"; break;
|
||||
case Display::Composite: string_selection = "composite"; break;
|
||||
}
|
||||
selection_set["display"] = std::unique_ptr<Configurable::Selection>(new Configurable::ListSelection(string_selection));
|
||||
}
|
||||
|
||||
// MARK: - Selection parsers
|
||||
@ -67,6 +80,10 @@ bool Configurable::get_display(const Configurable::SelectionSet &selections_by_o
|
||||
result = Configurable::Display::RGB;
|
||||
return true;
|
||||
}
|
||||
if(display->value == "svideo") {
|
||||
result = Configurable::Display::SVideo;
|
||||
return true;
|
||||
}
|
||||
if(display->value == "composite") {
|
||||
result = Configurable::Display::Composite;
|
||||
return true;
|
||||
|
@ -14,13 +14,16 @@
|
||||
namespace Configurable {
|
||||
|
||||
enum StandardOptions {
|
||||
DisplayRGBComposite = (1 << 0),
|
||||
QuickLoadTape = (1 << 1),
|
||||
AutomaticTapeMotorControl = (1 << 2)
|
||||
DisplayRGB = (1 << 0),
|
||||
DisplaySVideo = (1 << 1),
|
||||
DisplayComposite = (1 << 2),
|
||||
QuickLoadTape = (1 << 3),
|
||||
AutomaticTapeMotorControl = (1 << 4)
|
||||
};
|
||||
|
||||
enum class Display {
|
||||
RGB,
|
||||
SVideo,
|
||||
Composite
|
||||
};
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "../ClockReceiver/TimeTypes.hpp"
|
||||
#include "ROMMachine.hpp"
|
||||
|
||||
#include "../Configurable/StandardOptions.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace CRTMachine {
|
||||
@ -65,6 +67,23 @@ class Machine: public ROMMachine::Machine {
|
||||
return clock_rate_;
|
||||
}
|
||||
|
||||
void set_video_signal_configurable(Configurable::Display type) {
|
||||
Outputs::CRT::VideoSignal signal;
|
||||
switch(type) {
|
||||
default:
|
||||
case Configurable::Display::RGB:
|
||||
signal = Outputs::CRT::VideoSignal::RGB;
|
||||
break;
|
||||
case Configurable::Display::SVideo:
|
||||
signal = Outputs::CRT::VideoSignal::SVideo;
|
||||
break;
|
||||
case Configurable::Display::Composite:
|
||||
signal = Outputs::CRT::VideoSignal::Composite;
|
||||
break;
|
||||
}
|
||||
get_crt()->set_video_signal(signal);
|
||||
}
|
||||
|
||||
private:
|
||||
double clock_rate_ = 1.0;
|
||||
double clock_conversion_error_ = 0.0;
|
||||
|
@ -47,7 +47,9 @@ enum ROMSlot {
|
||||
};
|
||||
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
|
||||
return Configurable::standard_options(Configurable::QuickLoadTape);
|
||||
return Configurable::standard_options(
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplaySVideo | Configurable::DisplayComposite | Configurable::QuickLoadTape)
|
||||
);
|
||||
}
|
||||
|
||||
enum JoystickInput {
|
||||
@ -709,17 +711,24 @@ class ConcreteMachine:
|
||||
allow_fast_tape_hack_ = quickload;
|
||||
set_use_fast_tape();
|
||||
}
|
||||
|
||||
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_quick_load_tape_selection(selection_set, false);
|
||||
Configurable::append_display_selection(selection_set, Configurable::Display::Composite);
|
||||
return selection_set;
|
||||
}
|
||||
|
||||
Configurable::SelectionSet get_user_friendly_selections() override {
|
||||
Configurable::SelectionSet selection_set;
|
||||
Configurable::append_quick_load_tape_selection(selection_set, true);
|
||||
Configurable::append_display_selection(selection_set, Configurable::Display::SVideo);
|
||||
return selection_set;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace Electron {
|
||||
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
|
||||
return Configurable::standard_options(
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplayRGBComposite | Configurable::QuickLoadTape)
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplayRGB | Configurable::DisplayComposite | Configurable::QuickLoadTape)
|
||||
);
|
||||
}
|
||||
|
||||
@ -454,7 +454,7 @@ class ConcreteMachine:
|
||||
|
||||
Configurable::Display display;
|
||||
if(Configurable::get_display(selections_by_option, display)) {
|
||||
get_crt()->set_video_signal((display == Configurable::Display::RGB) ? Outputs::CRT::VideoSignal::RGB : Outputs::CRT::VideoSignal::Composite);
|
||||
set_video_signal_configurable(display);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace MSX {
|
||||
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
|
||||
return Configurable::standard_options(
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplayRGBComposite | Configurable::QuickLoadTape)
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplayRGB | Configurable::DisplaySVideo | Configurable::DisplayComposite | Configurable::QuickLoadTape)
|
||||
);
|
||||
}
|
||||
|
||||
@ -562,7 +562,7 @@ class ConcreteMachine:
|
||||
|
||||
Configurable::Display display;
|
||||
if(Configurable::get_display(selections_by_option, display)) {
|
||||
get_crt()->set_video_signal((display == Configurable::Display::RGB) ? Outputs::CRT::VideoSignal::RGB : Outputs::CRT::VideoSignal::Composite);
|
||||
set_video_signal_configurable(display);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ enum ROM {
|
||||
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
|
||||
return Configurable::standard_options(
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplayRGBComposite | Configurable::QuickLoadTape)
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplayRGB | Configurable::DisplayComposite | Configurable::QuickLoadTape)
|
||||
);
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ class ConcreteMachine:
|
||||
|
||||
Configurable::Display display;
|
||||
if(Configurable::get_display(selections_by_option, display)) {
|
||||
set_output_device((display == Configurable::Display::RGB) ? Outputs::CRT::VideoSignal::RGB : Outputs::CRT::VideoSignal::Composite);
|
||||
set_video_signal_configurable(display);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user