1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 16:55:59 +00:00

Restores ColecoVision runtime options.

This commit is contained in:
Thomas Harte 2020-03-18 00:06:52 -04:00
parent ec6664f590
commit a7e1920597
6 changed files with 33 additions and 35 deletions

View File

@ -129,6 +129,10 @@ void TMS9918::set_display_type(Outputs::Display::DisplayType display_type) {
crt_.set_display_type(display_type); crt_.set_display_type(display_type);
} }
Outputs::Display::DisplayType TMS9918::get_display_type() {
return crt_.get_display_type();
}
void Base::LineBuffer::reset_sprite_collection() { void Base::LineBuffer::reset_sprite_collection() {
sprites_stopped = false; sprites_stopped = false;
active_sprite_slot = 0; active_sprite_slot = 0;

View File

@ -50,6 +50,9 @@ class TMS9918: public Base {
/*! Sets the type of display the CRT will request. */ /*! Sets the type of display the CRT will request. */
void set_display_type(Outputs::Display::DisplayType); void set_display_type(Outputs::Display::DisplayType);
/*! Gets the type of display the CRT will request. */
Outputs::Display::DisplayType get_display_type();
/*! /*!
Runs the VCP for the number of cycles indicate; it is an implicit assumption of the code Runs the VCP for the number of cycles indicate; it is an implicit assumption of the code
that the input clock rate is 3579545 Hz, the NTSC colour clock rate. that the input clock rate is 3579545 Hz, the NTSC colour clock rate.

View File

@ -34,12 +34,6 @@ constexpr int sn76489_divider = 2;
namespace Coleco { namespace Coleco {
namespace Vision { namespace Vision {
//std::vector<std::unique_ptr<Configurable::Option>> get_options() {
// return Configurable::standard_options(
// static_cast<Configurable::StandardOptions>(Configurable::DisplaySVideo | Configurable::DisplayCompositeColour)
// );
//}
std::unique_ptr<Reflection::Struct> get_options() { std::unique_ptr<Reflection::Struct> get_options() {
return nullptr; return nullptr;
} }
@ -198,6 +192,10 @@ class ConcreteMachine:
vdp_->set_display_type(display_type); vdp_->set_display_type(display_type);
} }
Outputs::Display::DisplayType get_display_type() final {
return vdp_->get_display_type();
}
Outputs::Speaker::Speaker *get_speaker() final { Outputs::Speaker::Speaker *get_speaker() final {
return &speaker_; return &speaker_;
} }
@ -374,33 +372,15 @@ class ConcreteMachine:
// MARK: - Configuration options. // MARK: - Configuration options.
std::unique_ptr<Reflection::Struct> get_options() final { 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) final {
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 Coleco::Vision::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 {
// Configurable::SelectionSet selection_set;
// Configurable::append_display_selection(selection_set, Configurable::Display::SVideo);
// return selection_set;
// }
private: private:
inline void page_megacart(uint16_t address) { inline void page_megacart(uint16_t address) {

View File

@ -9,7 +9,8 @@
#ifndef ColecoVision_hpp #ifndef ColecoVision_hpp
#define ColecoVision_hpp #define ColecoVision_hpp
#include "../../Reflection/Struct.h" #include "../../Configurable/Configurable.hpp"
#include "../../Configurable/StandardOptions.hpp"
#include "../../Analyser/Static/StaticAnalyser.hpp" #include "../../Analyser/Static/StaticAnalyser.hpp"
#include "../ROMMachine.hpp" #include "../ROMMachine.hpp"
@ -18,12 +19,22 @@
namespace Coleco { namespace Coleco {
namespace Vision { namespace Vision {
std::unique_ptr<Reflection::Struct> get_options();
class Machine { class Machine {
public: public:
virtual ~Machine(); virtual ~Machine();
static Machine *ColecoVision(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher); static Machine *ColecoVision(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
class Options: public Reflection::StructImpl<Options>, public Configurable::DisplayOption<Options> {
friend Configurable::DisplayOption<Options>;
public:
Options(Configurable::OptionsType type) :
Configurable::DisplayOption<Options>(type == Configurable::OptionsType::UserFriendly ? Configurable::Display::SVideo : Configurable::Display::CompositeColour) {
if(needs_declare()) {
declare_display_option();
limit_enum(&output, Configurable::Display::SVideo, Configurable::Display::CompositeColour, -1);
}
}
};
}; };
} }

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

View File

@ -528,7 +528,7 @@ int main(int argc, char *argv[]) {
std::cout << '\t' << "--" << option; std::cout << '\t' << "--" << option;
auto source = target_reflectable; auto source = target_reflectable;
auto type = target_reflectable->type_of(option); auto type = target_reflectable ? target_reflectable->type_of(option) : nullptr;
if(!type) { if(!type) {
source = options_reflectable; source = options_reflectable;
type = options_reflectable->type_of(option); type = options_reflectable->type_of(option);