1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 01:32:55 +00:00

Restores Macintosh 'runtime' options.

Also cleans up some leftover parts elsewhere.
This commit is contained in:
Thomas Harte 2020-03-18 21:50:02 -04:00
parent b2a381d401
commit 311458f41f
8 changed files with 44 additions and 68 deletions

View File

@ -49,6 +49,17 @@ template <typename Owner> class QuickloadOption {
}
};
template <typename Owner> class QuickbootOption {
public:
bool quickboot;
QuickbootOption(bool quickboot) : quickboot(quickboot) {}
protected:
void declare_quickboot_option() {
static_cast<Owner *>(this)->declare(&quickboot, "quickboot");
}
};
}
#endif /* StandardOptions_hpp */

View File

@ -57,16 +57,6 @@ constexpr int CLOCK_RATE = 7833600;
namespace Apple {
namespace Macintosh {
//std::vector<std::unique_ptr<Configurable::Option>> get_options() {
// return Configurable::standard_options(
// static_cast<Configurable::StandardOptions>(Configurable::QuickBoot)
// );
//}
std::unique_ptr<Reflection::Struct> get_options() {
return nullptr;
}
template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachine:
public Machine,
public CRTMachine::Machine,
@ -528,42 +518,30 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
// MARK: - Configuration options.
std::unique_ptr<Reflection::Struct> get_options() final {
return nullptr;
auto options = std::make_unique<Options>(Configurable::OptionsType::UserFriendly);
options->quickboot = quickboot_;
return options;
}
void set_options(const std::unique_ptr<Reflection::Struct> &options) final {
void set_options(const std::unique_ptr<Reflection::Struct> &str) final {
// TODO: should this really be a runtime option?
// It should probably be a construction option.
const auto options = dynamic_cast<Options *>(str.get());
quickboot_ = options->quickboot;
if(quickboot_) {
// Cf. Big Mess o' Wires' disassembly of the Mac Plus ROM, and the
// test at $E00. TODO: adapt as(/if?) necessary for other Macs.
ram_[0x02ae] = 0x40;
ram_[0x02af] = 0x00;
ram_[0x02b0] = 0x00;
ram_[0x02b1] = 0x00;
}
}
// std::vector<std::unique_ptr<Configurable::Option>> get_options() final {
// return Apple::Macintosh::get_options();
// }
//
// void set_selections(const Configurable::SelectionSet &selections_by_option) final {
// bool quick_boot;
// if(Configurable::get_quick_boot(selections_by_option, quick_boot)) {
// if(quick_boot) {
// // Cf. Big Mess o' Wires' disassembly of the Mac Plus ROM, and the
// // test at $E00. TODO: adapt as(/if?) necessary for other Macs.
// ram_[0x02ae] = 0x40;
// ram_[0x02af] = 0x00;
// ram_[0x02b0] = 0x00;
// ram_[0x02b1] = 0x00;
// }
// }
// }
//
// Configurable::SelectionSet get_accurate_selections() final {
// Configurable::SelectionSet selection_set;
// Configurable::append_quick_boot_selection(selection_set, false);
// return selection_set;
// }
//
// Configurable::SelectionSet get_user_friendly_selections() final {
// Configurable::SelectionSet selection_set;
// Configurable::append_quick_boot_selection(selection_set, true);
// return selection_set;
// }
private:
bool quickboot_ = false;
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) final {
scsi_bus_is_clocked_ = scsi_bus_.preferred_clocking() != ClockingHint::Preference::None;
}

View File

@ -9,23 +9,31 @@
#ifndef Macintosh_hpp
#define Macintosh_hpp
#include "../../../Reflection/Struct.h"
#include "../../../Configurable/Configurable.hpp"
#include "../../../Configurable/StandardOptions.hpp"
#include "../../../Analyser/Static/StaticAnalyser.hpp"
#include "../../ROMMachine.hpp"
#include <memory>
namespace Apple {
namespace Macintosh {
std::unique_ptr<Reflection::Struct> get_options();
class Machine {
public:
virtual ~Machine();
/// Creates and returns a Macintosh.
static Machine *Macintosh(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
class Options: public Reflection::StructImpl<Options>, public Configurable::QuickbootOption<Options> {
friend Configurable::QuickbootOption<Options>;
public:
Options(Configurable::OptionsType type) :
Configurable::QuickbootOption<Options>(type == Configurable::OptionsType::UserFriendly) {
if(needs_declare()) {
declare_quickboot_option();
}
}
};
};

View File

@ -34,10 +34,6 @@ constexpr int sn76489_divider = 2;
namespace Coleco {
namespace Vision {
std::unique_ptr<Reflection::Struct> get_options() {
return nullptr;
}
class Joystick: public Inputs::ConcreteJoystick {
public:
Joystick() :

View File

@ -14,8 +14,6 @@
#include "../../Analyser/Static/StaticAnalyser.hpp"
#include "../ROMMachine.hpp"
#include <memory>
namespace Coleco {
namespace Vision {

View File

@ -33,17 +33,6 @@
namespace Electron {
//std::vector<std::unique_ptr<Configurable::Option>> get_options() {
// return Configurable::standard_options(
// static_cast<Configurable::StandardOptions>(Configurable::DisplayRGB | Configurable::DisplayCompositeColour | Configurable::QuickLoadTape)
// );
//}
std::unique_ptr<Reflection::Struct> get_options() {
return nullptr;
}
class ConcreteMachine:
public Machine,
public CRTMachine::Machine,

View File

@ -18,9 +18,6 @@
namespace Oric {
/// @returns The options available for an Oric.
std::unique_ptr<Reflection::Struct> get_options();
/*!
Models an Oric 1/Atmos with or without a Microdisc.
*/

View File

@ -176,8 +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::Macintosh), Apple::Macintosh::get_options()));
#define Emplace(machine, class) \
options.emplace(std::make_pair(LongNameForTargetMachine(Analyser::Machine::machine), std::make_unique<class::Options>(Configurable::OptionsType::UserFriendly)));
@ -186,6 +184,7 @@ std::map<std::string, std::unique_ptr<Reflection::Struct>> Machine::AllOptionsBy
Emplace(AtariST, Atari::ST::Machine);
Emplace(ColecoVision, Coleco::Vision::Machine);
Emplace(Electron, Electron::Machine);
Emplace(Macintosh, Apple::Macintosh::Machine);
Emplace(MasterSystem, Sega::MasterSystem::Machine);
Emplace(MSX, MSX::Machine);
Emplace(Oric, Oric::Machine);