core: Remove static system instance
This commit is contained in:
parent
2a5014b193
commit
b6719094e6
|
@ -428,22 +428,9 @@ struct System::Impl {
|
||||||
};
|
};
|
||||||
|
|
||||||
System::System() : impl{std::make_unique<Impl>(*this)} {}
|
System::System() : impl{std::make_unique<Impl>(*this)} {}
|
||||||
|
|
||||||
System::~System() = default;
|
System::~System() = default;
|
||||||
|
|
||||||
System& System::GetInstance() {
|
|
||||||
if (!s_instance) {
|
|
||||||
throw std::runtime_error("Using System instance before its initialization");
|
|
||||||
}
|
|
||||||
return *s_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void System::InitializeGlobalInstance() {
|
|
||||||
if (s_instance) {
|
|
||||||
throw std::runtime_error("Reinitializing Global System instance.");
|
|
||||||
}
|
|
||||||
s_instance = std::unique_ptr<System>(new System);
|
|
||||||
}
|
|
||||||
|
|
||||||
CpuManager& System::GetCpuManager() {
|
CpuManager& System::GetCpuManager() {
|
||||||
return impl->cpu_manager;
|
return impl->cpu_manager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,22 +108,16 @@ class System {
|
||||||
public:
|
public:
|
||||||
using CurrentBuildProcessID = std::array<u8, 0x20>;
|
using CurrentBuildProcessID = std::array<u8, 0x20>;
|
||||||
|
|
||||||
|
explicit System();
|
||||||
|
|
||||||
|
~System();
|
||||||
|
|
||||||
System(const System&) = delete;
|
System(const System&) = delete;
|
||||||
System& operator=(const System&) = delete;
|
System& operator=(const System&) = delete;
|
||||||
|
|
||||||
System(System&&) = delete;
|
System(System&&) = delete;
|
||||||
System& operator=(System&&) = delete;
|
System& operator=(System&&) = delete;
|
||||||
|
|
||||||
~System();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the instance of the System singleton class.
|
|
||||||
* @returns Reference to the instance of the System singleton class.
|
|
||||||
*/
|
|
||||||
[[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
|
|
||||||
|
|
||||||
static void InitializeGlobalInstance();
|
|
||||||
|
|
||||||
/// Enumeration representing the return values of the System Initialize and Load process.
|
/// Enumeration representing the return values of the System Initialize and Load process.
|
||||||
enum class ResultStatus : u32 {
|
enum class ResultStatus : u32 {
|
||||||
Success, ///< Succeeded
|
Success, ///< Succeeded
|
||||||
|
@ -403,12 +397,8 @@ public:
|
||||||
void ApplySettings();
|
void ApplySettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
System();
|
|
||||||
|
|
||||||
struct Impl;
|
struct Impl;
|
||||||
std::unique_ptr<Impl> impl;
|
std::unique_ptr<Impl> impl;
|
||||||
|
|
||||||
inline static std::unique_ptr<System> s_instance{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
Loading…
Reference in a new issue