1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-24 17:32:55 +00:00

Restores Vic-20 runtime options.

This commit is contained in:
Thomas Harte 2020-03-18 20:23:55 -04:00
parent ffc1b0ff29
commit b2a381d401
4 changed files with 33 additions and 44 deletions

View File

@ -49,15 +49,6 @@ enum ROMSlot {
Drive
};
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::DisplaySVideo | Configurable::DisplayCompositeColour | Configurable::QuickLoadTape)
// );
//}
enum JoystickInput {
Up = 0x04,
Down = 0x08,
@ -656,6 +647,10 @@ class ConcreteMachine:
mos6560_.set_display_type(display_type);
}
Outputs::Display::DisplayType get_display_type() final {
return mos6560_.get_display_type();
}
Outputs::Speaker::Speaker *get_speaker() final {
return mos6560_.get_speaker();
}
@ -683,41 +678,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();
}
// std::vector<std::unique_ptr<Configurable::Option>> get_options() final {
// return Commodore::Vic20::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();
// }
//
// 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::SVideo);
// return selection_set;
// }
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) final {
tape_is_sleeping_ = clocking == ClockingHint::Preference::None;

View File

@ -9,7 +9,8 @@
#ifndef Vic20_hpp
#define Vic20_hpp
#include "../../../Reflection/Struct.h"
#include "../../../Configurable/Configurable.hpp"
#include "../../../Configurable/StandardOptions.hpp"
#include "../../../Analyser/Static/StaticAnalyser.hpp"
#include "../../ROMMachine.hpp"
@ -27,6 +28,21 @@ class Machine {
/// Creates and returns a Vic-20.
static Machine *Vic20(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
class Options: public Reflection::StructImpl<Options>, public Configurable::DisplayOption<Options>, public Configurable::QuickloadOption<Options> {
friend Configurable::DisplayOption<Options>;
friend Configurable::QuickloadOption<Options>;
public:
Options(Configurable::OptionsType type) :
Configurable::DisplayOption<Options>(type == Configurable::OptionsType::UserFriendly ? Configurable::Display::SVideo : Configurable::Display::CompositeColour),
Configurable::QuickloadOption<Options>(type == Configurable::OptionsType::UserFriendly) {
if(needs_declare()) {
declare_display_option();
declare_quickload_option();
limit_enum(&output, Configurable::Display::SVideo, Configurable::Display::CompositeColour, -1);
}
}
};
};
}

View File

@ -42,7 +42,7 @@ class Machine {
if(needs_declare()) {
declare_display_option();
declare_quickload_option();
limit_enum(&output, Configurable::Display::RGB, Configurable::Display::CompositeColour, -1);
limit_enum(&output, Configurable::Display::RGB, Configurable::Display::CompositeColour, Configurable::Display::CompositeMonochrome, -1);
}
}
};

View File

@ -177,7 +177,6 @@ std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsBy
std::map<std::string, std::unique_ptr<Reflection::Struct>> options;
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Macintosh), Apple::Macintosh::get_options()));
// options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::Vic20), Commodore::Vic20::get_options()));
#define Emplace(machine, class) \
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::machine), std::make_unique<class::Options>(Configurable::OptionsType::UserFriendly)));
@ -190,6 +189,7 @@ std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsBy
Emplace(MasterSystem, Sega::MasterSystem::Machine);
Emplace(MSX, MSX::Machine);
Emplace(Oric, Oric::Machine);
Emplace(Vic20, Commodore::Vic20::Machine);
Emplace(ZX8081, ZX8081::Machine);
#undef Emplace