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

Reintroduces Apple II runtime options.

This commit is contained in:
Thomas Harte 2020-03-17 21:53:26 -04:00
parent f9ca443667
commit b6e81242e7
6 changed files with 36 additions and 37 deletions

View File

@ -28,7 +28,7 @@ class Machine {
/// Creates and returns an Amstrad CPC.
static Machine *AmstradCPC(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
/// Defines the runtime options available for a ZX80/81.
/// Defines the runtime options available for an Amstrad CPC.
class Options: public Reflection::StructImpl<Options> {
public:
Configurable::Display output = Configurable::Display::RGB;

View File

@ -37,15 +37,6 @@
namespace Apple {
namespace II {
std::unique_ptr<Reflection::Struct> get_options() {
return nullptr;
}
//std::vector<std::unique_ptr<Configurable::Option>> get_options() {
// return Configurable::standard_options(
// static_cast<Configurable::StandardOptions>(Configurable::DisplayCompositeMonochrome | Configurable::DisplayCompositeColour)
// );
//}
#define is_iie() ((model == Analyser::Static::AppleII::Target::Model::IIe) || (model == Analyser::Static::AppleII::Target::Model::EnhancedIIe))
template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
@ -433,6 +424,10 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
video_.set_display_type(display_type);
}
Outputs::Display::DisplayType get_display_type() final {
return video_.get_display_type();
}
Outputs::Speaker::Speaker *get_speaker() final {
return &speaker_;
}
@ -870,31 +865,15 @@ template <Analyser::Static::AppleII::Target::Model model> 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();
return options;
}
void set_options(const std::unique_ptr<Reflection::Struct> &options) final {
void set_options(const std::unique_ptr<Reflection::Struct> &str) {
const auto options = dynamic_cast<Options *>(str.get());
set_video_signal_configurable(options->output);
}
// std::vector<std::unique_ptr<Configurable::Option>> get_options() final {
// return Apple::II::get_options();
// }
//
// void set_selections(const Configurable::SelectionSet &selections_by_option) final {
// 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_display_selection(selection_set, Configurable::Display::CompositeColour);
// return selection_set;
// }
//
// Configurable::SelectionSet get_user_friendly_selections() final {
// return get_accurate_selections();
// }
// MARK: MediaTarget
bool insert_media(const Analyser::Static::Media &media) final {

View File

@ -9,7 +9,8 @@
#ifndef AppleII_hpp
#define AppleII_hpp
#include "../../../Reflection/Struct.h"
#include "../../../Configurable/Configurable.hpp"
#include "../../../Configurable/StandardOptions.hpp"
#include "../../../Analyser/Static/StaticAnalyser.hpp"
#include "../../ROMMachine.hpp"
@ -18,15 +19,27 @@
namespace Apple {
namespace II {
/// @returns The options available for an Apple II.
std::unique_ptr<Reflection::Struct> get_options();
class Machine {
public:
virtual ~Machine();
/// Creates and returns an AppleII.
static Machine *AppleII(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
/// Defines the runtime options available for an Apple II.
class Options: public Reflection::StructImpl<Options> {
public:
Configurable::Display output = Configurable::Display::CompositeColour;
Options(Configurable::OptionsType type) {
// Declare fields if necessary.
if(needs_declare()) {
DeclareField(output);
AnnounceEnumNS(Configurable, Display);
limit_enum(&output, Configurable::Display::CompositeMonochrome, Configurable::Display::CompositeColour, -1);
}
}
};
};
}

View File

@ -55,6 +55,10 @@ void VideoBase::set_display_type(Outputs::Display::DisplayType display_type) {
crt_.set_display_type(display_type);
}
Outputs::Display::DisplayType VideoBase::get_display_type() {
return crt_.get_display_type();
}
/*
Rote setters and getters.
*/

View File

@ -46,6 +46,9 @@ class VideoBase {
/// Sets the type of output.
void set_display_type(Outputs::Display::DisplayType);
/// Gets the type of output.
Outputs::Display::DisplayType get_display_type();
/*
Descriptions for the setters below are taken verbatim from
the Apple IIe Technical Reference. Addresses are the conventional

View File

@ -176,7 +176,6 @@ std::vector<std::string> Machine::AllMachines(bool meaningful_without_media_only
std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsByMachineName() {
std::map<std::string, std::unique_ptr<Reflection::Struct>> options;
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::AppleII), Apple::II::get_options()));
// 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()));
@ -190,6 +189,7 @@ std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsBy
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::machine), std::make_unique<class::Options>(Configurable::OptionsType::UserFriendly)));
Emplace(AmstradCPC, AmstradCPC::Machine);
Emplace(AppleII, Apple::II::Machine);
Emplace(ZX8081, ZX8081::Machine);
#undef Emplace