ArmInterface: return ref instead of copy for GetTimer (#5227)

* ArmInterface: return ref instead of copy for GetTimer

* ArmInterface: add const ref GetTimer

* ArmInterface: return raw pointer instead of shared_ptr in GetTimer

* remove more unnecessary shared_ptr usage

* Fix save states

* fix unit tests
This commit is contained in:
Ben 2020-04-22 07:44:58 +02:00 committed by GitHub
parent 38c3c9c74b
commit 39463f1f6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 32 deletions

View file

@ -281,20 +281,28 @@ private:
std::unordered_map<std::string, TimingEventType> event_types = {};
std::vector<std::shared_ptr<Timer>> timers;
std::shared_ptr<Timer> current_timer;
Timer* current_timer = nullptr;
// Stores a scaling for the internal clockspeed. Changing this number results in
// under/overclocking the guest cpu
double cpu_clock_scale = 1.0;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
void serialize(Archive& ar, const unsigned int file_version) {
// event_types set during initialization of other things
ar& global_timer;
ar& timers;
ar& current_timer;
if (file_version == 0) {
std::shared_ptr<Timer> x;
ar& x;
current_timer = x.get();
} else {
ar& current_timer;
}
}
friend class boost::serialization::access;
};
} // namespace Core
BOOST_CLASS_VERSION(Core::Timing, 1)