summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Morph2021-10-14 14:21:15 -0400
committerGravatar Morph2021-10-15 17:34:48 -0400
commitb6719094e69bba468ecbc275fd892c4d412b92a3 (patch)
tree633d5621300ec64c6ed2a2e7cfdff587d5462c0a /src/core
parentMerge pull request #7183 from FearlessTobi/translation-ci (diff)
downloadyuzu-b6719094e69bba468ecbc275fd892c4d412b92a3.tar.gz
yuzu-b6719094e69bba468ecbc275fd892c4d412b92a3.tar.xz
yuzu-b6719094e69bba468ecbc275fd892c4d412b92a3.zip
core: Remove static system instance
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.cpp15
-rw-r--r--src/core/core.h18
2 files changed, 5 insertions, 28 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index bb268a319..ae1d56b27 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -428,21 +428,8 @@ struct System::Impl {
428}; 428};
429 429
430System::System() : impl{std::make_unique<Impl>(*this)} {} 430System::System() : impl{std::make_unique<Impl>(*this)} {}
431System::~System() = default;
432
433System& System::GetInstance() {
434 if (!s_instance) {
435 throw std::runtime_error("Using System instance before its initialization");
436 }
437 return *s_instance;
438}
439 431
440void System::InitializeGlobalInstance() { 432System::~System() = default;
441 if (s_instance) {
442 throw std::runtime_error("Reinitializing Global System instance.");
443 }
444 s_instance = std::unique_ptr<System>(new System);
445}
446 433
447CpuManager& System::GetCpuManager() { 434CpuManager& System::GetCpuManager() {
448 return impl->cpu_manager; 435 return impl->cpu_manager;
diff --git a/src/core/core.h b/src/core/core.h
index a796472b2..cae578c69 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -108,22 +108,16 @@ class System {
108public: 108public:
109 using CurrentBuildProcessID = std::array<u8, 0x20>; 109 using CurrentBuildProcessID = std::array<u8, 0x20>;
110 110
111 explicit System();
112
113 ~System();
114
111 System(const System&) = delete; 115 System(const System&) = delete;
112 System& operator=(const System&) = delete; 116 System& operator=(const System&) = delete;
113 117
114 System(System&&) = delete; 118 System(System&&) = delete;
115 System& operator=(System&&) = delete; 119 System& operator=(System&&) = delete;
116 120
117 ~System();
118
119 /**
120 * Gets the instance of the System singleton class.
121 * @returns Reference to the instance of the System singleton class.
122 */
123 [[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
124
125 static void InitializeGlobalInstance();
126
127 /// Enumeration representing the return values of the System Initialize and Load process. 121 /// Enumeration representing the return values of the System Initialize and Load process.
128 enum class ResultStatus : u32 { 122 enum class ResultStatus : u32 {
129 Success, ///< Succeeded 123 Success, ///< Succeeded
@@ -403,12 +397,8 @@ public:
403 void ApplySettings(); 397 void ApplySettings();
404 398
405private: 399private:
406 System();
407
408 struct Impl; 400 struct Impl;
409 std::unique_ptr<Impl> impl; 401 std::unique_ptr<Impl> impl;
410
411 inline static std::unique_ptr<System> s_instance{};
412}; 402};
413 403
414} // namespace Core 404} // namespace Core