diff --git a/Analyser/Static/MSX/Tape.cpp b/Analyser/Static/MSX/Tape.cpp index dd6220f89..7af73ae29 100644 --- a/Analyser/Static/MSX/Tape.cpp +++ b/Analyser/Static/MSX/Tape.cpp @@ -29,7 +29,7 @@ std::vector Analyser::Static::MSX::GetFiles(const std::shared_ptrset_tape(media.tapes[0]); + tape_player_->set_tape(media.tapes[0], TargetPlatform::Plus4); } if(!media.disks.empty() && c1541_) { diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index add0e5468..9ca259c98 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -439,7 +439,7 @@ public: bool insert_media(const Analyser::Static::Media &media) final { if(!media.tapes.empty()) { - tape_->set_tape(media.tapes.front()); + tape_->set_tape(media.tapes.front(), TargetPlatform::Vic20); } if(!media.disks.empty() && c1540_) { diff --git a/Machines/MSX/MSX.cpp b/Machines/MSX/MSX.cpp index 4d9950191..bc5535390 100644 --- a/Machines/MSX/MSX.cpp +++ b/Machines/MSX/MSX.cpp @@ -431,7 +431,7 @@ class ConcreteMachine: } if(!media.tapes.empty()) { - tape_player_.set_tape(media.tapes.front()); + tape_player_.set_tape(media.tapes.front(), TargetPlatform::MSX); } if(!media.disks.empty()) { diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index e1bb570e7..9d4aa63af 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -440,7 +440,7 @@ template class ConcreteMachine: bool insert_media(const Analyser::Static::Media &media) final { if(!media.tapes.empty()) { - tape_player_.set_tape(media.tapes.front()); + tape_player_.set_tape(media.tapes.front(), is_zx81 ? TargetPlatform::ZX81 : TargetPlatform::ZX80); } set_use_fast_tape(); diff --git a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp index f0a855262..a17cdf659 100644 --- a/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp +++ b/Machines/Sinclair/ZXSpectrum/ZXSpectrum.cpp @@ -681,7 +681,7 @@ template class ConcreteMachine: bool insert_media(const Analyser::Static::Media &media) override { // If there are any tapes supplied, use the first of them. if(!media.tapes.empty()) { - tape_player_.set_tape(media.tapes.front()); + tape_player_.set_tape(media.tapes.front(), TargetPlatform::ZXSpectrum); set_use_fast_tape(); } diff --git a/Storage/Tape/Tape.cpp b/Storage/Tape/Tape.cpp index 8028a244a..b332c9e99 100644 --- a/Storage/Tape/Tape.cpp +++ b/Storage/Tape/Tape.cpp @@ -78,9 +78,13 @@ ClockingHint::Preference TapePlayer::preferred_clocking() const { return (!tape_ || serialiser_->is_at_end()) ? ClockingHint::Preference::None : ClockingHint::Preference::JustInTime; } -void TapePlayer::set_tape(std::shared_ptr tape) { +void TapePlayer::set_tape(std::shared_ptr tape, TargetPlatform::Type platform) { tape_ = tape; serialiser_ = tape->serialiser(); + if(auto recipient = dynamic_cast(serialiser_.get()); recipient) { + recipient->set_target_platforms(platform); + } + reset_timer(); next_pulse(); update_clocking_observer(); diff --git a/Storage/Tape/Tape.hpp b/Storage/Tape/Tape.hpp index a9d349abb..bf49dcd67 100644 --- a/Storage/Tape/Tape.hpp +++ b/Storage/Tape/Tape.hpp @@ -115,7 +115,7 @@ public: TapePlayer(int input_clock_rate); virtual ~TapePlayer() = default; - void set_tape(std::shared_ptr); + void set_tape(std::shared_ptr, TargetPlatform::Type platform); bool has_tape() const; bool is_at_end() const; TapeSerialiser *serialiser();