diff --git a/ClockReceiver/JustInTime.hpp b/ClockReceiver/JustInTime.hpp index e5f9a5ef6..eff555061 100644 --- a/ClockReceiver/JustInTime.hpp +++ b/ClockReceiver/JustInTime.hpp @@ -38,6 +38,11 @@ template return &object_; } + /// Returns a pointer to the included object without flushing time. + inline T *last_valid() { + return &object_; + } + /// Flushes all accumulated time. inline void flush() { if(!is_flushed_) object_.run_for(time_since_update_.template flush()); @@ -80,6 +85,11 @@ template return &object_; } + /// Returns a pointer to the included object without flushing time. + inline T *last_valid() { + return &object_; + } + /// Flushes all accumulated time. inline void flush() { if(!is_flushed_) { diff --git a/Machines/MasterSystem/MasterSystem.cpp b/Machines/MasterSystem/MasterSystem.cpp index 63468faa2..7aff87195 100644 --- a/Machines/MasterSystem/MasterSystem.cpp +++ b/Machines/MasterSystem/MasterSystem.cpp @@ -237,7 +237,7 @@ class ConcreteMachine: *cycle.value = vdp_->get_current_line(); break; case 0x41: - *cycle.value = vdp_->get_latched_horizontal_counter(); + *cycle.value = vdp_.last_valid()->get_latched_horizontal_counter(); break; case 0x80: case 0x81: *cycle.value = vdp_->get_register(address);