1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Restores runtime options for the Acorn Electron.

This commit is contained in:
Thomas Harte 2020-03-17 22:06:20 -04:00
parent b6e81242e7
commit 8c6ca89da2
6 changed files with 43 additions and 38 deletions

View File

@ -20,7 +20,6 @@ ReflectableEnum(Display,
CompositeMonochrome
);
}
#endif /* StandardOptions_hpp */

View File

@ -420,6 +420,10 @@ class ConcreteMachine:
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_;
}
@ -455,41 +459,19 @@ class ConcreteMachine:
// MARK: - Configuration options.
std::unique_ptr<Reflection::Struct> get_options() final {
return nullptr;
auto options = std::make_unique<Options>(Configurable::OptionsType::UserFriendly);
options->output = get_video_signal_configurable();
options->quickload = allow_fast_tape_hack_;
return options;
}
void set_options(const std::unique_ptr<Reflection::Struct> &options) final {
void set_options(const std::unique_ptr<Reflection::Struct> &str) final {
const auto options = dynamic_cast<Options *>(str.get());
set_video_signal_configurable(options->output);
allow_fast_tape_hack_ = options->quickload;
set_use_fast_tape_hack();
}
// std::vector<std::unique_ptr<Configurable::Option>> get_options() final {
// return Electron::get_options();
// }
//
// void set_selections(const Configurable::SelectionSet &selections_by_option) final {
// bool quickload;
// if(Configurable::get_quick_load_tape(selections_by_option, quickload)) {
// allow_fast_tape_hack_ = quickload;
// set_use_fast_tape_hack();
// }
//
// 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;
// }
// MARK: - Activity Source
void set_activity_observer(Activity::Observer *observer) final {

View File

@ -9,7 +9,8 @@
#ifndef Electron_hpp
#define Electron_hpp
#include "../../Reflection/Struct.h"
#include "../../Configurable/Configurable.hpp"
#include "../../Configurable/StandardOptions.hpp"
#include "../../Analyser/Static/StaticAnalyser.hpp"
#include "../ROMMachine.hpp"
@ -17,9 +18,6 @@
namespace Electron {
/// @returns The options available for an Electron.
std::unique_ptr<Reflection::Struct> get_options();
/*!
@abstract Represents an Acorn Electron.
@ -32,6 +30,25 @@ class Machine {
/// Creates and returns an Electron.
static Machine *Electron(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
/// Defines the runtime options available for an Electron.
class Options: public Reflection::StructImpl<Options> {
public:
Configurable::Display output;
bool quickload;
Options(Configurable::OptionsType type) :
output(type == Configurable::OptionsType::UserFriendly ? Configurable::Display::RGB : Configurable::Display::CompositeColour),
quickload(type == Configurable::OptionsType::UserFriendly) {
if(needs_declare()) {
DeclareField(output);
DeclareField(quickload);
AnnounceEnumNS(Configurable, Display);
limit_enum(&output, Configurable::Display::RGB, Configurable::Display::CompositeColour, -1);
}
}
};
};
}

View File

@ -64,6 +64,10 @@ void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) {
crt_.set_display_type(display_type);
}
Outputs::Display::DisplayType VideoOutput::get_display_type() {
return crt_.get_display_type();
}
// MARK: - Display update methods
void VideoOutput::start_pixel_line() {

View File

@ -45,6 +45,9 @@ class VideoOutput {
/// Sets the type of output.
void set_display_type(Outputs::Display::DisplayType);
/// Gets the type of output.
Outputs::Display::DisplayType get_display_type();
/*!
Writes @c value to the register at @c address. May mutate the results of @c get_next_interrupt,
@c get_cycles_until_next_ram_availability and @c get_memory_access_range.

View File

@ -178,7 +178,6 @@ std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsBy
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::AtariST), Atari::ST::get_options()));
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::ColecoVision), Coleco::Vision::get_options()));
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Electron), Electron::get_options()));
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Macintosh), Apple::Macintosh::get_options()));
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::MasterSystem), Sega::MasterSystem::get_options()));
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::MSX), MSX::get_options()));
@ -190,6 +189,7 @@ std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsBy
Emplace(AmstradCPC, AmstradCPC::Machine);
Emplace(AppleII, Apple::II::Machine);
Emplace(Electron, Electron::Machine);
Emplace(ZX8081, ZX8081::Machine);
#undef Emplace