diff options
| author | 2018-04-20 19:29:04 -0400 | |
|---|---|---|
| committer | 2018-04-20 19:44:32 -0400 | |
| commit | 659a612368c98002037d904d511473d8da8e69e4 (patch) | |
| tree | eb3a8d9007462f1864174ea4ffe9e5a80d56c9d5 /src/core/core.cpp | |
| parent | Merge pull request #340 from mailwl/vi-update (diff) | |
| download | yuzu-659a612368c98002037d904d511473d8da8e69e4.tar.gz yuzu-659a612368c98002037d904d511473d8da8e69e4.tar.xz yuzu-659a612368c98002037d904d511473d8da8e69e4.zip | |
core: Relocate g_service_manager to the System class
Converts the service manager from a global into an instance-based
variable.
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 9f5507a65..ee4af4dcc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -12,10 +12,13 @@ | |||
| 12 | #include "core/core.h" | 12 | #include "core/core.h" |
| 13 | #include "core/core_timing.h" | 13 | #include "core/core_timing.h" |
| 14 | #include "core/gdbstub/gdbstub.h" | 14 | #include "core/gdbstub/gdbstub.h" |
| 15 | #include "core/hle/kernel/client_port.h" | ||
| 15 | #include "core/hle/kernel/kernel.h" | 16 | #include "core/hle/kernel/kernel.h" |
| 16 | #include "core/hle/kernel/process.h" | 17 | #include "core/hle/kernel/process.h" |
| 17 | #include "core/hle/kernel/thread.h" | 18 | #include "core/hle/kernel/thread.h" |
| 18 | #include "core/hle/service/service.h" | 19 | #include "core/hle/service/service.h" |
| 20 | #include "core/hle/service/sm/controller.h" | ||
| 21 | #include "core/hle/service/sm/sm.h" | ||
| 19 | #include "core/hw/hw.h" | 22 | #include "core/hw/hw.h" |
| 20 | #include "core/loader/loader.h" | 23 | #include "core/loader/loader.h" |
| 21 | #include "core/memory_setup.h" | 24 | #include "core/memory_setup.h" |
| @@ -26,6 +29,8 @@ namespace Core { | |||
| 26 | 29 | ||
| 27 | /*static*/ System System::s_instance; | 30 | /*static*/ System System::s_instance; |
| 28 | 31 | ||
| 32 | System::~System() = default; | ||
| 33 | |||
| 29 | System::ResultStatus System::RunLoop(bool tight_loop) { | 34 | System::ResultStatus System::RunLoop(bool tight_loop) { |
| 30 | status = ResultStatus::Success; | 35 | status = ResultStatus::Success; |
| 31 | if (!cpu_core) { | 36 | if (!cpu_core) { |
| @@ -167,10 +172,12 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { | |||
| 167 | 172 | ||
| 168 | telemetry_session = std::make_unique<Core::TelemetrySession>(); | 173 | telemetry_session = std::make_unique<Core::TelemetrySession>(); |
| 169 | 174 | ||
| 175 | service_manager = std::make_shared<Service::SM::ServiceManager>(); | ||
| 176 | |||
| 170 | HW::Init(); | 177 | HW::Init(); |
| 171 | Kernel::Init(system_mode); | 178 | Kernel::Init(system_mode); |
| 172 | scheduler = std::make_unique<Kernel::Scheduler>(cpu_core.get()); | 179 | scheduler = std::make_unique<Kernel::Scheduler>(cpu_core.get()); |
| 173 | Service::Init(); | 180 | Service::Init(service_manager); |
| 174 | GDBStub::Init(); | 181 | GDBStub::Init(); |
| 175 | 182 | ||
| 176 | if (!VideoCore::Init(emu_window)) { | 183 | if (!VideoCore::Init(emu_window)) { |
| @@ -200,17 +207,26 @@ void System::Shutdown() { | |||
| 200 | VideoCore::Shutdown(); | 207 | VideoCore::Shutdown(); |
| 201 | GDBStub::Shutdown(); | 208 | GDBStub::Shutdown(); |
| 202 | Service::Shutdown(); | 209 | Service::Shutdown(); |
| 203 | scheduler = nullptr; | 210 | scheduler.reset(); |
| 204 | Kernel::Shutdown(); | 211 | Kernel::Shutdown(); |
| 205 | HW::Shutdown(); | 212 | HW::Shutdown(); |
| 206 | telemetry_session = nullptr; | 213 | service_manager.reset(); |
| 207 | gpu_core = nullptr; | 214 | telemetry_session.reset(); |
| 208 | cpu_core = nullptr; | 215 | gpu_core.reset(); |
| 216 | cpu_core.reset(); | ||
| 209 | CoreTiming::Shutdown(); | 217 | CoreTiming::Shutdown(); |
| 210 | 218 | ||
| 211 | app_loader = nullptr; | 219 | app_loader.reset(); |
| 212 | 220 | ||
| 213 | LOG_DEBUG(Core, "Shutdown OK"); | 221 | LOG_DEBUG(Core, "Shutdown OK"); |
| 214 | } | 222 | } |
| 215 | 223 | ||
| 224 | Service::SM::ServiceManager& System::ServiceManager() { | ||
| 225 | return *service_manager; | ||
| 226 | } | ||
| 227 | |||
| 228 | const Service::SM::ServiceManager& System::ServiceManager() const { | ||
| 229 | return *service_manager; | ||
| 230 | } | ||
| 231 | |||
| 216 | } // namespace Core | 232 | } // namespace Core |