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

In all these instances, final => override. So no need to repeat myself.

This commit is contained in:
Thomas Harte 2020-01-23 22:35:39 -05:00
parent 2103e1b470
commit ba516387ba
7 changed files with 48 additions and 48 deletions

View File

@ -170,11 +170,11 @@ class ConcreteJoystick: public Joystick {
}
}
std::vector<Input> &get_inputs() override final {
std::vector<Input> &get_inputs() final {
return inputs_;
}
void set_input(const Input &input, bool is_active) override final {
void set_input(const Input &input, bool is_active) final {
// If this is a digital setting to a digital property, just pass it along.
if(input.is_button() || stick_types_[input.info.control.index] == StickType::Digital) {
did_set_input(input, is_active);
@ -193,7 +193,7 @@ class ConcreteJoystick: public Joystick {
}
}
void set_input(const Input &input, float value) override final {
void set_input(const Input &input, float value) final {
// If this is an analogue setting to an analogue property, just pass it along.
if(!input.is_button() && stick_types_[input.info.control.index] == StickType::Analogue) {
did_set_input(input, value);

View File

@ -1007,7 +1007,7 @@ template <bool has_fdc> class ConcreteMachine:
}
/// A CRTMachine function; sets the destination for video.
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override final {
void set_scan_target(Outputs::Display::ScanTarget *scan_target) final {
crtc_bus_handler_.set_scan_target(scan_target);
}
@ -1017,21 +1017,21 @@ template <bool has_fdc> class ConcreteMachine:
}
/// A CRTMachine function; sets the output display type.
void set_display_type(Outputs::Display::DisplayType display_type) override final {
void set_display_type(Outputs::Display::DisplayType display_type) final {
crtc_bus_handler_.set_display_type(display_type);
}
/// @returns the speaker in use.
Outputs::Speaker::Speaker *get_speaker() override final {
Outputs::Speaker::Speaker *get_speaker() final {
return ay_.get_speaker();
}
/// Wires virtual-dispatched CRTMachine run_for requests to the static Z80 method.
void run_for(const Cycles cycles) override final {
void run_for(const Cycles cycles) final {
z80_.run_for(cycles);
}
bool insert_media(const Analyser::Static::Media &media) override final {
bool insert_media(const Analyser::Static::Media &media) final {
// If there are any tapes supplied, use the first of them.
if(!media.tapes.empty()) {
tape_player_.set_tape(media.tapes.front());
@ -1048,32 +1048,32 @@ template <bool has_fdc> class ConcreteMachine:
return !media.tapes.empty() || (!media.disks.empty() && has_fdc);
}
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) override final {
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) final {
fdc_is_sleeping_ = fdc_.preferred_clocking() == ClockingHint::Preference::None;
tape_player_is_sleeping_ = tape_player_.preferred_clocking() == ClockingHint::Preference::None;
}
// MARK: - Keyboard
void type_string(const std::string &string) override final {
void type_string(const std::string &string) final {
std::unique_ptr<CharacterMapper> mapper(new CharacterMapper());
Utility::TypeRecipient::add_typer(string, std::move(mapper));
}
HalfCycles get_typer_delay() override final {
HalfCycles get_typer_delay() final {
return Cycles(4000000); // Wait 1 second before typing.
}
HalfCycles get_typer_frequency() override final {
HalfCycles get_typer_frequency() final {
return Cycles(160000); // Type one character per frame.
}
// See header; sets a key as either pressed or released.
void set_key_state(uint16_t key, bool isPressed) override final {
void set_key_state(uint16_t key, bool isPressed) final {
key_state_.set_is_pressed(isPressed, key >> 4, key & 7);
}
// See header; sets all keys to released.
void clear_all_keys() override final {
void clear_all_keys() final {
key_state_.clear_all_keys();
}

View File

@ -453,7 +453,7 @@ class ConcreteMachine:
}
}
bool insert_media(const Analyser::Static::Media &media) override final {
bool insert_media(const Analyser::Static::Media &media) final {
if(!media.tapes.empty()) {
tape_->set_tape(media.tapes.front());
}
@ -477,14 +477,14 @@ class ConcreteMachine:
return !media.tapes.empty() || (!media.disks.empty() && c1540_ != nullptr) || !media.cartridges.empty();
}
void set_key_state(uint16_t key, bool is_pressed) override final {
void set_key_state(uint16_t key, bool is_pressed) final {
if(key != KeyRestore)
keyboard_via_port_handler_->set_key_state(key, is_pressed);
else
user_port_via_.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !is_pressed);
}
void clear_all_keys() override final {
void clear_all_keys() final {
keyboard_via_port_handler_->clear_all_keys();
}
@ -618,11 +618,11 @@ class ConcreteMachine:
mos6560_.flush();
}
void run_for(const Cycles cycles) override final {
void run_for(const Cycles cycles) final {
m6502_.run_for(cycles);
}
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override final {
void set_scan_target(Outputs::Display::ScanTarget *scan_target) final {
mos6560_.set_scan_target(scan_target);
}
@ -630,24 +630,24 @@ class ConcreteMachine:
return mos6560_.get_scaled_scan_status();
}
void set_display_type(Outputs::Display::DisplayType display_type) override final {
void set_display_type(Outputs::Display::DisplayType display_type) final {
mos6560_.set_display_type(display_type);
}
Outputs::Speaker::Speaker *get_speaker() override final {
Outputs::Speaker::Speaker *get_speaker() final {
return mos6560_.get_speaker();
}
void mos6522_did_change_interrupt_status(void *mos6522) override final {
void mos6522_did_change_interrupt_status(void *mos6522) final {
m6502_.set_nmi_line(user_port_via_.get_interrupt_line());
m6502_.set_irq_line(keyboard_via_.get_interrupt_line());
}
void type_string(const std::string &string) override final {
void type_string(const std::string &string) final {
Utility::TypeRecipient::add_typer(string, std::make_unique<CharacterMapper>());
}
void tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape) override final {
void tape_did_change_input(Storage::Tape::BinaryTapePlayer *tape) final {
keyboard_via_.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !tape->get_input());
}

View File

@ -114,7 +114,7 @@ class ConcreteMachine:
audio_queue_.flush();
}
void set_key_state(uint16_t key, bool isPressed) override final {
void set_key_state(uint16_t key, bool isPressed) final {
if(key == KeyBreak) {
m6502_.set_reset_line(isPressed);
} else {
@ -125,12 +125,12 @@ class ConcreteMachine:
}
}
void clear_all_keys() override final {
void clear_all_keys() final {
memset(key_states_, 0, sizeof(key_states_));
if(is_holding_shift_) set_key_state(KeyShift, true);
}
bool insert_media(const Analyser::Static::Media &media) override final {
bool insert_media(const Analyser::Static::Media &media) final {
if(!media.tapes.empty()) {
tape_.set_tape(media.tapes.front());
}
@ -379,7 +379,7 @@ class ConcreteMachine:
audio_queue_.perform();
}
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override final {
void set_scan_target(Outputs::Display::ScanTarget *scan_target) final {
video_output_.set_scan_target(scan_target);
}
@ -391,28 +391,28 @@ class ConcreteMachine:
video_output_.set_display_type(display_type);
}
Outputs::Speaker::Speaker *get_speaker() override final {
Outputs::Speaker::Speaker *get_speaker() final {
return &speaker_;
}
void run_for(const Cycles cycles) override final {
void run_for(const Cycles cycles) final {
m6502_.run_for(cycles);
}
void tape_did_change_interrupt_status(Tape *tape) override final {
void tape_did_change_interrupt_status(Tape *tape) final {
interrupt_status_ = (interrupt_status_ & ~(Interrupt::TransmitDataEmpty | Interrupt::ReceiveDataFull | Interrupt::HighToneDetect)) | tape_.get_interrupt_status();
evaluate_interrupts();
}
HalfCycles get_typer_delay() override final {
HalfCycles get_typer_delay() final {
return m6502_.get_is_resetting() ? Cycles(625*25*128) : Cycles(0); // wait one second if resetting
}
HalfCycles get_typer_frequency() override final {
HalfCycles get_typer_frequency() final {
return Cycles(625*128*2); // accept a new character every two frames
}
void type_string(const std::string &string) override final {
void type_string(const std::string &string) final {
Utility::TypeRecipient::add_typer(string, std::make_unique<CharacterMapper>());
}

View File

@ -360,7 +360,7 @@ class ConcreteMachine:
return true;
}
void type_string(const std::string &string) override final {
void type_string(const std::string &string) final {
std::transform(
string.begin(),
string.end(),

View File

@ -608,7 +608,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
}
// WD::WD1770::Delegate
void wd1770_did_change_output(WD::WD1770 *wd1770) override final {
void wd1770_did_change_output(WD::WD1770 *wd1770) final {
set_interrupt_line();
}
@ -665,7 +665,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
}
}
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference preference) override final {
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference preference) final {
diskii_clocking_preference_ = diskii_.preferred_clocking();
}

View File

@ -314,7 +314,7 @@ template<bool is_zx81> class ConcreteMachine:
}
}
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override final {
void set_scan_target(Outputs::Display::ScanTarget *scan_target) final {
video_.set_scan_target(scan_target);
}
@ -322,15 +322,15 @@ template<bool is_zx81> class ConcreteMachine:
return video_.get_scaled_scan_status();
}
Outputs::Speaker::Speaker *get_speaker() override final {
Outputs::Speaker::Speaker *get_speaker() final {
return is_zx81 ? &speaker_ : nullptr;
}
void run_for(const Cycles cycles) override final {
void run_for(const Cycles cycles) final {
z80_.run_for(cycles);
}
bool insert_media(const Analyser::Static::Media &media) override final {
bool insert_media(const Analyser::Static::Media &media) final {
if(!media.tapes.empty()) {
tape_player_.set_tape(media.tapes.front());
}
@ -339,19 +339,19 @@ template<bool is_zx81> class ConcreteMachine:
return !media.tapes.empty();
}
void type_string(const std::string &string) override final {
void type_string(const std::string &string) final {
Utility::TypeRecipient::add_typer(string, std::make_unique<CharacterMapper>(is_zx81));
}
// MARK: - Keyboard
void set_key_state(uint16_t key, bool is_pressed) override final {
void set_key_state(uint16_t key, bool is_pressed) final {
if(is_pressed)
key_states_[key >> 8] &= static_cast<uint8_t>(~key);
else
key_states_[key >> 8] |= static_cast<uint8_t>(key);
}
void clear_all_keys() override final {
void clear_all_keys() final {
memset(key_states_, 0xff, 8);
}
@ -364,17 +364,17 @@ template<bool is_zx81> class ConcreteMachine:
}
}
void set_tape_is_playing(bool is_playing) override final {
void set_tape_is_playing(bool is_playing) final {
tape_player_.set_motor_control(is_playing);
}
bool get_tape_is_playing() override final {
bool get_tape_is_playing() final {
return tape_player_.get_motor_control();
}
// MARK: - Typer timing
HalfCycles get_typer_delay() override final { return Cycles(7000000); }
HalfCycles get_typer_frequency() override final { return Cycles(390000); }
HalfCycles get_typer_delay() final { return Cycles(7000000); }
HalfCycles get_typer_frequency() final { return Cycles(390000); }
KeyboardMapper *get_keyboard_mapper() override {
return &keyboard_mapper_;