From de9db724a72e8701f296c71ecd3a03dfc4f3bb7b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 17 Nov 2017 23:02:00 -0500 Subject: [PATCH 1/6] Introduces `Configurable::Device` and implements it for the Electron. Configurable::Device covers devices that have user-facing configuration options, listing them and accepting them. --- Configurable/Configurable.hpp | 76 +++++++++++++++++++ Machines/ConfigurationTarget.hpp | 3 + Machines/Electron/Electron.cpp | 29 +++++++ Machines/Electron/Electron.hpp | 4 +- Machines/Utility/MachineForTarget.cpp | 23 ++++-- Machines/Utility/MachineForTarget.hpp | 2 + .../Clock Signal.xcodeproj/project.pbxproj | 11 +++ OSBindings/SDL/main.cpp | 6 ++ 8 files changed, 145 insertions(+), 9 deletions(-) create mode 100644 Configurable/Configurable.hpp diff --git a/Configurable/Configurable.hpp b/Configurable/Configurable.hpp new file mode 100644 index 000000000..b5ccf7406 --- /dev/null +++ b/Configurable/Configurable.hpp @@ -0,0 +1,76 @@ +// +// Configurable.h +// Clock Signal +// +// Created by Thomas Harte on 17/11/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#ifndef Configurable_h +#define Configurable_h + +#include +#include +#include + +namespace Configurable { + +/*! + The Option class hierarchy provides a way for components, machines, etc, to provide a named + list of typed options to which they can respond. +*/ +struct Option { + std::string long_name; + std::string short_name; + virtual ~Option() {} + + Option(const std::string &long_name, const std::string &short_name) : long_name(long_name), short_name(short_name) {} +}; + +struct BooleanOption: public Option { + BooleanOption(const std::string &long_name, const std::string &short_name) : Option(long_name, short_name) {} +}; + +struct ListOption: public Option { + std::vector options; + ListOption(const std::string &long_name, const std::string &short_name, const std::vector &options) : Option(long_name, short_name), options(options) {} +}; + +/*! + Selections are responses to Options. +*/ +struct Selection { + virtual ~Selection() {} +}; + +struct BooleanSelection: public Selection { + bool value; + BooleanSelection(bool value) : value(value) {} +}; + +struct ListSelection: public Selection { + std::string value; + ListSelection(const std::string value) : value(value) {} +}; + +using SelectionSet = std::map>; + +/*! + A Configuratble provides the options that it responds to and allows selections to be set. +*/ +struct Device { + virtual std::vector> get_options() = 0; + virtual void set_selections(const SelectionSet &selection_by_option) = 0; + virtual SelectionSet get_accurate_selections() = 0; + virtual SelectionSet get_user_friendly_selections() = 0; +}; + +template T *selection(const Configurable::SelectionSet &selections_by_option, const std::string &name) { + auto selection = selections_by_option.find(name); + if(selection == selections_by_option.end()) return nullptr; + return dynamic_cast(selection->second.get()); +} + +} + +#endif /* Configurable_h */ diff --git a/Machines/ConfigurationTarget.hpp b/Machines/ConfigurationTarget.hpp index 1a658db78..1dd5f54ec 100644 --- a/Machines/ConfigurationTarget.hpp +++ b/Machines/ConfigurationTarget.hpp @@ -10,6 +10,9 @@ #define ConfigurationTarget_hpp #include "../StaticAnalyser/StaticAnalyser.hpp" +#include "../Configurable/Configurable.hpp" + +#include namespace ConfigurationTarget { diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 20a9661c3..9300b71dc 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -416,6 +416,35 @@ class ConcreteMachine: return keyboard_mapper_; } + std::vector> get_options() override { + std::vector> options; + options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); + options.emplace_back(new Configurable::ListOption("Display", "display", {"composite", "rgb"})); + return options; + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + auto quickload = Configurable::selection(selections_by_option, "quickload"); + if(quickload) set_use_fast_tape_hack(quickload->value); + + auto display = Configurable::selection(selections_by_option, "display"); + if(display) get_crt()->set_output_device((display->value == "rgb") ? Outputs::CRT::OutputDevice::Monitor : Outputs::CRT::OutputDevice::Television); + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + selection_set["display"] = std::unique_ptr(new Configurable::ListSelection("composite")); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + selection_set["display"] = std::unique_ptr(new Configurable::ListSelection("rgb")); + return selection_set; + } + private: inline void update_display() { if(cycles_since_display_update_ > 0) { diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index 5d39b9386..53f05bd15 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -9,6 +9,7 @@ #ifndef Electron_hpp #define Electron_hpp +#include "../../Configurable/Configurable.hpp" #include "../ConfigurationTarget.hpp" #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" @@ -41,7 +42,8 @@ enum ROMSlot: uint8_t { class Machine: public CRTMachine::Machine, public ConfigurationTarget::Machine, - public KeyboardMachine::Machine { + public KeyboardMachine::Machine, + public Configurable::Device { public: virtual ~Machine(); diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 869a203a4..c03431fb7 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -21,23 +21,30 @@ template class TypedDynamicMachine: public ::Machine::DynamicMachine public: TypedDynamicMachine(T *machine) : machine_(machine) {} - ConfigurationTarget::Machine *configuration_target() { - return dynamic_cast(machine_.get()); + ConfigurationTarget::Machine *configuration_target() override { + return get(); } - CRTMachine::Machine *crt_machine() { - return dynamic_cast(machine_.get()); + CRTMachine::Machine *crt_machine() override { + return get(); } - JoystickMachine::Machine *joystick_machine() { - return dynamic_cast(machine_.get()); + JoystickMachine::Machine *joystick_machine() override { + return get(); } - KeyboardMachine::Machine *keyboard_machine() { - return dynamic_cast(machine_.get()); + KeyboardMachine::Machine *keyboard_machine() override { + return get(); + } + + Configurable::Device *configurable_device() override { + return get(); } private: + template Class *get() { + return dynamic_cast(machine_.get()); + } std::unique_ptr machine_; }; diff --git a/Machines/Utility/MachineForTarget.hpp b/Machines/Utility/MachineForTarget.hpp index 14adcecf7..fbfb05466 100644 --- a/Machines/Utility/MachineForTarget.hpp +++ b/Machines/Utility/MachineForTarget.hpp @@ -11,6 +11,7 @@ #include "../../StaticAnalyser/StaticAnalyser.hpp" +#include "../../Configurable/Configurable.hpp" #include "../ConfigurationTarget.hpp" #include "../CRTMachine.hpp" #include "../JoystickMachine.hpp" @@ -29,6 +30,7 @@ struct DynamicMachine { virtual CRTMachine::Machine *crt_machine() = 0; virtual JoystickMachine::Machine *joystick_machine() = 0; virtual KeyboardMachine::Machine *keyboard_machine() = 0; + virtual Configurable::Device *configurable_device() = 0; }; /*! diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 3a31a6a60..7cca3f355 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -680,6 +680,7 @@ 4B30512C1D989E2200B4FED8 /* Drive.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Drive.hpp; sourceTree = ""; }; 4B30512E1D98ACC600B4FED8 /* Plus3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Plus3.cpp; path = Electron/Plus3.cpp; sourceTree = ""; }; 4B30512F1D98ACC600B4FED8 /* Plus3.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Plus3.hpp; path = Electron/Plus3.hpp; sourceTree = ""; }; + 4B31B88F1FBFBCD800C140D5 /* Configurable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Configurable.hpp; sourceTree = ""; }; 4B322DF31F5A26BF004EB04C /* 6502Implementation.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = 6502Implementation.hpp; sourceTree = ""; }; 4B322DF41F5A2714004EB04C /* 6502Storage.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = 6502Storage.hpp; sourceTree = ""; }; 4B322DFD1F5A2981004EB04C /* Z80AllRAM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Z80AllRAM.cpp; sourceTree = ""; }; @@ -1509,6 +1510,15 @@ name = Electron; sourceTree = ""; }; + 4B31B88E1FBFBCD800C140D5 /* Configurable */ = { + isa = PBXGroup; + children = ( + 4B31B88F1FBFBCD800C140D5 /* Configurable.hpp */, + ); + name = Configurable; + path = ../../Configurable; + sourceTree = ""; + }; 4B322DFC1F5A2981004EB04C /* AllRAM */ = { isa = PBXGroup; children = ( @@ -2259,6 +2269,7 @@ 4BF660691F281573002CB053 /* ClockReceiver */, 4BC9DF4A1D04691600F44158 /* Components */, 4B3940E81DA83C8700427841 /* Concurrency */, + 4B31B88E1FBFBCD800C140D5 /* Configurable */, 4B055A761FAE78210060FFFF /* Frameworks */, 4B86E2581F8C628F006FAA45 /* Inputs */, 4BB73EDC1B587CA500552FC2 /* Machines */, diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index 217025698..3d025f2a2 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -252,6 +252,12 @@ int main(int argc, char *argv[]) { SDL_GetWindowSize(window, &window_width, &window_height); std::cout << "Window size is " << window_width << ", " << window_height << std::endl; + // Establish user-friendly options by default. + Configurable::Device *configurable_device = machine->configurable_device(); + if(configurable_device) { + configurable_device->set_selections(configurable_device->get_user_friendly_selections()); + } + // Run the main event loop until the OS tells us to quit. bool should_quit = false; while(!should_quit) { From 27b123549b1a340ba86349b17804935fa7521cbc Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 17 Nov 2017 23:15:37 -0500 Subject: [PATCH 2/6] Adds missing #include. --- Configurable/Configurable.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Configurable/Configurable.hpp b/Configurable/Configurable.hpp index b5ccf7406..0748331d7 100644 --- a/Configurable/Configurable.hpp +++ b/Configurable/Configurable.hpp @@ -10,6 +10,7 @@ #define Configurable_h #include +#include #include #include From 073e439518e731501f7136427bba4f31c3ffb474 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 18 Nov 2017 19:34:38 -0500 Subject: [PATCH 3/6] Adds a basic argument parser, allowing machine options to be set. --- OSBindings/SDL/main.cpp | 53 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index 3d025f2a2..cffc76833 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -6,9 +6,9 @@ // Copyright © 2017 Thomas Harte. All rights reserved. // +#include #include #include -#include #include @@ -117,19 +117,63 @@ bool KeyboardKeyForSDLScancode(SDL_Keycode scancode, Inputs::Keyboard::Key &key) } +struct ParsedArguments { + std::string file_name; + Configurable::SelectionSet selections; +}; + +/*! Parses an argc/argv pair to discern program arguments. */ +ParsedArguments parse_arguments(int argc, char *argv[]) { + ParsedArguments arguments; + + for(int index = 1; index < argc; ++index) { + char *arg = argv[index]; + + // Accepted format is: + // + // --flag sets a Boolean option to true. + // --flag=value sets the value for a list option. + // name sets the file name to load. + + // Anything starting with a dash always makes a selection; otherwise it's a file name. + if(arg[0] == '-') { + while(*arg == '-') arg++; + + // Check for an equals sign, to discern a Boolean selection from a list selection. + std::string argument = arg; + std::size_t split_index = argument.find("="); + + if(split_index == std::string::npos) { + arguments.selections[argument] = std::unique_ptr(new Configurable::BooleanSelection(true)); + } else { + std::string name = argument.substr(0, split_index); + std::string value = argument.substr(split_index+1, std::string::npos); + arguments.selections[name] = std::unique_ptr(new Configurable::ListSelection(value)); + } + } else { + arguments.file_name = arg; + } + } + + return arguments; +} + int main(int argc, char *argv[]) { SDL_Window *window = nullptr; + // Attempt to parse arguments. + ParsedArguments arguments = parse_arguments(argc, argv); + // Perform a sanity check on arguments. - if(argc < 2) { + if(arguments.file_name.empty()) { std::cerr << "Usage: " << argv[0] << " [file]" << std::endl; return -1; } // Determine the machine for the supplied file. - std::list targets = StaticAnalyser::GetTargets(argv[1]); + std::list targets = StaticAnalyser::GetTargets(arguments.file_name.c_str()); if(targets.empty()) { - std::cerr << "Cannot open " << argv[1] << std::endl; + std::cerr << "Cannot open " << arguments.file_name << std::endl; return -1; } @@ -256,6 +300,7 @@ int main(int argc, char *argv[]) { Configurable::Device *configurable_device = machine->configurable_device(); if(configurable_device) { configurable_device->set_selections(configurable_device->get_user_friendly_selections()); + configurable_device->set_selections(arguments.selections); } // Run the main event loop until the OS tells us to quit. From 82ad0354c4e7dbd5849f9b5bd4b519e6fffd7e09 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 18 Nov 2017 19:48:10 -0500 Subject: [PATCH 4/6] Adds configuration options to the Vic-20, Oric and ZX80/81. --- Machines/Commodore/Vic-20/Vic20.cpp | 24 +++++++++++++++++ Machines/Commodore/Vic-20/Vic20.hpp | 4 ++- Machines/Electron/Electron.cpp | 2 ++ Machines/Oric/Oric.cpp | 30 +++++++++++++++++++++ Machines/Oric/Oric.hpp | 4 ++- Machines/ZX8081/ZX8081.cpp | 42 +++++++++++++++++++++++------ Machines/ZX8081/ZX8081.hpp | 4 ++- 7 files changed, 99 insertions(+), 11 deletions(-) diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 33c12acca..edf231b0f 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -636,6 +636,30 @@ class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. + std::vector> get_options() override { + std::vector> options; + options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); + return options; + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + auto quickload = Configurable::selection(selections_by_option, "quickload"); + if(quickload) set_use_fast_tape_hack(quickload->value); + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + return selection_set; + } + private: CPU::MOS6502::Processor m6502_; diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index e99c34c73..a7e4f5e4b 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -9,6 +9,7 @@ #ifndef Vic20_hpp #define Vic20_hpp +#include "../../../Configurable/Configurable.hpp" #include "../../ConfigurationTarget.hpp" #include "../../CRTMachine.hpp" #include "../../KeyboardMachine.hpp" @@ -44,7 +45,8 @@ class Machine: public CRTMachine::Machine, public ConfigurationTarget::Machine, public KeyboardMachine::Machine, - public JoystickMachine::Machine { + public JoystickMachine::Machine, + public Configurable::Device { public: virtual ~Machine(); diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index 9300b71dc..8e00ed376 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -416,6 +416,7 @@ class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. std::vector> get_options() override { std::vector> options; options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); @@ -446,6 +447,7 @@ class ConcreteMachine: } private: + // MARK: - Work deferral updates. inline void update_display() { if(cycles_since_display_update_ > 0) { video_output_->run_for(cycles_since_display_update_.flush()); diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index 1a67c4014..985faef52 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -427,6 +427,36 @@ class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. + std::vector> get_options() override { + std::vector> options; + options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); + options.emplace_back(new Configurable::ListOption("Display", "display", {"composite", "rgb"})); + return options; + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + auto quickload = Configurable::selection(selections_by_option, "quickload"); + if(quickload) set_use_fast_tape_hack(quickload->value); + + auto display = Configurable::selection(selections_by_option, "display"); + if(display) get_crt()->set_output_device((display->value == "rgb") ? Outputs::CRT::OutputDevice::Monitor : Outputs::CRT::OutputDevice::Television); + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + selection_set["display"] = std::unique_ptr(new Configurable::ListSelection("composite")); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + selection_set["display"] = std::unique_ptr(new Configurable::ListSelection("rgb")); + return selection_set; + } + private: CPU::MOS6502::Processor m6502_; diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 4e4a8c418..2aa05f46e 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -9,6 +9,7 @@ #ifndef Oric_hpp #define Oric_hpp +#include "../../Configurable/Configurable.hpp" #include "../ConfigurationTarget.hpp" #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" @@ -28,7 +29,8 @@ enum ROM { class Machine: public CRTMachine::Machine, public ConfigurationTarget::Machine, - public KeyboardMachine::Machine { + public KeyboardMachine::Machine, + public Configurable::Device { public: virtual ~Machine(); diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index ddbb34058..97b410d02 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -308,8 +308,7 @@ template class ConcreteMachine: return true; } -// MARK: - Keyboard - + // MARK: - Keyboard void set_key_state(uint16_t key, bool isPressed) override final { if(isPressed) key_states_[key >> 8] &= static_cast(~key); @@ -321,8 +320,7 @@ template class ConcreteMachine: memset(key_states_, 0xff, 8); } -// MARK: - Tape control - + // MARK: - Tape control void set_use_fast_tape_hack(bool activate) override final { use_fast_tape_hack_ = activate; } @@ -337,8 +335,7 @@ template class ConcreteMachine: tape_player_.set_motor_control(is_playing); } -// MARK: - Typer timing - + // MARK: - Typer timing HalfCycles get_typer_delay() override final { return Cycles(7000000); } HalfCycles get_typer_frequency() override final { return Cycles(390000); } @@ -346,6 +343,36 @@ template class ConcreteMachine: return keyboard_mapper_; } + // MARK: - Configuration options. + std::vector> get_options() override { + std::vector> options; + options.emplace_back(new Configurable::BooleanOption("Load Tapes Quickly", "quickload")); + options.emplace_back(new Configurable::BooleanOption("Automatic Tape Motor Control", "autotapemotor")); + return options; + } + + void set_selections(const Configurable::SelectionSet &selections_by_option) override { + auto quickload = Configurable::selection(selections_by_option, "quickload"); + if(quickload) set_use_fast_tape_hack(quickload->value); + + auto autotapemotor = Configurable::selection(selections_by_option, "autotapemotor"); + if(autotapemotor) set_use_automatic_tape_motor_control(autotapemotor->value); + } + + Configurable::SelectionSet get_accurate_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + selection_set["autotapemotor"] = std::unique_ptr(new Configurable::BooleanSelection(false)); + return selection_set; + } + + Configurable::SelectionSet get_user_friendly_selections() override { + Configurable::SelectionSet selection_set; + selection_set["quickload"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + selection_set["autotapemotor"] = std::unique_ptr(new Configurable::BooleanSelection(true)); + return selection_set; + } + private: CPU::Z80::Processor z80_; @@ -383,8 +410,7 @@ template class ConcreteMachine: bool use_automatic_tape_motor_control_; HalfCycles tape_advance_delay_ = 0; -// MARK: - Video - + // MARK: - Video inline void set_vsync(bool sync) { vsync_ = sync; update_sync(); diff --git a/Machines/ZX8081/ZX8081.hpp b/Machines/ZX8081/ZX8081.hpp index ce797fbf8..3297c85ea 100644 --- a/Machines/ZX8081/ZX8081.hpp +++ b/Machines/ZX8081/ZX8081.hpp @@ -9,6 +9,7 @@ #ifndef ZX8081_hpp #define ZX8081_hpp +#include "../../Configurable/Configurable.hpp" #include "../ConfigurationTarget.hpp" #include "../CRTMachine.hpp" #include "../KeyboardMachine.hpp" @@ -25,7 +26,8 @@ enum ROMType: uint8_t { class Machine: public CRTMachine::Machine, public ConfigurationTarget::Machine, - public KeyboardMachine::Machine { + public KeyboardMachine::Machine, + public Configurable::Device { public: static Machine *ZX8081(const StaticAnalyser::Target &target_hint); virtual ~Machine(); From d3e68914dd666d628585370c09224d6687e2a8e0 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 18 Nov 2017 20:00:40 -0500 Subject: [PATCH 5/6] Removes uninteresting logging. --- OSBindings/SDL/main.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index cffc76833..02d3ec42b 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -222,7 +222,6 @@ int main(int argc, char *argv[]) { GLint target_framebuffer = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &target_framebuffer); - std::cout << "Target framebuffer has ID " << target_framebuffer << std::endl; // For vanilla SDL purposes, assume system ROMs can be found in one of: // @@ -294,7 +293,6 @@ int main(int argc, char *argv[]) { int window_width, window_height; SDL_GetWindowSize(window, &window_width, &window_height); - std::cout << "Window size is " << window_width << ", " << window_height << std::endl; // Establish user-friendly options by default. Configurable::Device *configurable_device = machine->configurable_device(); @@ -319,8 +317,6 @@ int main(int argc, char *argv[]) { glGetIntegerv(GL_FRAMEBUFFER_BINDING, &target_framebuffer); machine->crt_machine()->get_crt()->set_target_framebuffer(target_framebuffer); SDL_GetWindowSize(window, &window_width, &window_height); - - std::cout << "Resized; framebuffer is " << target_framebuffer << ", and window size is " << window_width << ", " << window_height << std::endl; } break; default: break; From 90d33949f9083862798a67f372af55f3e1e38059 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 18 Nov 2017 20:02:04 -0500 Subject: [PATCH 6/6] Adds a mapping of backspace for the Electron. --- Machines/Electron/Keyboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Machines/Electron/Keyboard.cpp b/Machines/Electron/Keyboard.cpp index 381e07b40..12da6d50c 100644 --- a/Machines/Electron/Keyboard.cpp +++ b/Machines/Electron/Keyboard.cpp @@ -42,7 +42,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) { BIND(LeftShift, KeyShift); BIND(RightShift, KeyShift); BIND(Hyphen, KeyMinus); - BIND(Delete, KeyDelete); + BIND(Delete, KeyDelete); BIND(BackSpace, KeyDelete); BIND(Enter, KeyReturn); BIND(KeyPadEnter, KeyReturn); BIND(KeyPad0, Key0); BIND(KeyPad1, Key1); BIND(KeyPad2, Key2); BIND(KeyPad3, Key3); BIND(KeyPad4, Key4);