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