Refactored out the horrible static var in CoreTiming
This commit is contained in:
parent
917d651a3c
commit
4aab38f133
6 changed files with 15 additions and 11 deletions
|
@ -61,6 +61,11 @@ Kernel::KernelSystem& Global() {
|
|||
return System::GetInstance().Kernel();
|
||||
}
|
||||
|
||||
template <>
|
||||
Core::Timing& Global() {
|
||||
return System::GetInstance().CoreTiming();
|
||||
}
|
||||
|
||||
System::~System() = default;
|
||||
|
||||
System::ResultStatus System::RunLoop(bool tight_loop) {
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
Timing* Timing::deserializing = nullptr;
|
||||
|
||||
// Sort by time, unless the times are the same, in which case sort by the order added to the queue
|
||||
bool Timing::Event::operator>(const Timing::Event& right) const {
|
||||
return std::tie(time, fifo_order) > std::tie(right.time, right.fifo_order);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/threadsafe_queue.h"
|
||||
#include "core/global.h"
|
||||
|
||||
// The timing we get from the assembly is 268,111,855.956 Hz
|
||||
// It is possible that this number isn't just an integer because the compiler could have
|
||||
|
@ -135,8 +136,6 @@ struct TimingEventType {
|
|||
};
|
||||
|
||||
class Timing {
|
||||
private:
|
||||
static Timing* deserializing;
|
||||
|
||||
public:
|
||||
struct Event {
|
||||
|
@ -165,7 +164,7 @@ public:
|
|||
ar& userdata;
|
||||
std::string name;
|
||||
ar >> name;
|
||||
type = Timing::deserializing->RegisterEvent(name, nullptr);
|
||||
type = Global<Timing>().RegisterEvent(name, nullptr);
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
|
||||
|
@ -291,11 +290,9 @@ private:
|
|||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
// event_types set during initialization of other things
|
||||
deserializing = this;
|
||||
ar& global_timer;
|
||||
ar& timers;
|
||||
ar& current_timer;
|
||||
deserializing = nullptr;
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
|
|
@ -196,7 +196,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
std::unique_ptr<DelayGenerator> delay_generator; // TODO: Replace with virtual GetOpenDelayNs
|
||||
std::unique_ptr<DelayGenerator> delay_generator;
|
||||
|
||||
private:
|
||||
template <class Archive>
|
||||
|
|
|
@ -68,8 +68,8 @@ protected:
|
|||
Service::FS::MediaType media_type;
|
||||
|
||||
private:
|
||||
NCCHArchive() = default; // NOTE: If the public ctor has behaviour, need to replace this with
|
||||
// *_construct_data
|
||||
NCCHArchive() = default;
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& boost::serialization::base_object<ArchiveBackend>(*this);
|
||||
|
|
|
@ -9,9 +9,13 @@ namespace Core {
|
|||
template <class T>
|
||||
T& Global();
|
||||
|
||||
// Declare explicit specialisation to prevent im
|
||||
// Declare explicit specialisation to prevent automatic instantiation
|
||||
class System;
|
||||
template <>
|
||||
System& Global();
|
||||
|
||||
class Timing;
|
||||
template <>
|
||||
Timing& Global();
|
||||
|
||||
} // namespace Core
|
||||
|
|
Loading…
Reference in a new issue