diff options
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/service.cpp | 52 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.h | 6 |
4 files changed, 32 insertions, 32 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index c5490c1ae..08ce29677 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -145,7 +145,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co | |||
| 145 | return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead); | 145 | return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead); |
| 146 | } | 146 | } |
| 147 | case IPC::CommandType::Control: { | 147 | case IPC::CommandType::Control: { |
| 148 | SM::g_service_manager->InvokeControlRequest(context); | 148 | Core::System::GetInstance().ServiceManager().InvokeControlRequest(context); |
| 149 | break; | 149 | break; |
| 150 | } | 150 | } |
| 151 | case IPC::CommandType::Request: { | 151 | case IPC::CommandType::Request: { |
| @@ -170,42 +170,40 @@ void AddNamedPort(std::string name, SharedPtr<ClientPort> port) { | |||
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | /// Initialize ServiceManager | 172 | /// Initialize ServiceManager |
| 173 | void Init() { | 173 | void Init(std::shared_ptr<SM::ServiceManager>& sm) { |
| 174 | // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it | 174 | // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it |
| 175 | // here and pass it into the respective InstallInterfaces functions. | 175 | // here and pass it into the respective InstallInterfaces functions. |
| 176 | auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>(); | 176 | auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>(); |
| 177 | 177 | ||
| 178 | SM::g_service_manager = std::make_shared<SM::ServiceManager>(); | 178 | SM::ServiceManager::InstallInterfaces(sm); |
| 179 | SM::ServiceManager::InstallInterfaces(SM::g_service_manager); | 179 | |
| 180 | 180 | Account::InstallInterfaces(*sm); | |
| 181 | Account::InstallInterfaces(*SM::g_service_manager); | 181 | AM::InstallInterfaces(*sm, nv_flinger); |
| 182 | AM::InstallInterfaces(*SM::g_service_manager, nv_flinger); | 182 | AOC::InstallInterfaces(*sm); |
| 183 | AOC::InstallInterfaces(*SM::g_service_manager); | 183 | APM::InstallInterfaces(*sm); |
| 184 | APM::InstallInterfaces(*SM::g_service_manager); | 184 | Audio::InstallInterfaces(*sm); |
| 185 | Audio::InstallInterfaces(*SM::g_service_manager); | 185 | Fatal::InstallInterfaces(*sm); |
| 186 | Fatal::InstallInterfaces(*SM::g_service_manager); | 186 | FileSystem::InstallInterfaces(*sm); |
| 187 | FileSystem::InstallInterfaces(*SM::g_service_manager); | 187 | Friend::InstallInterfaces(*sm); |
| 188 | Friend::InstallInterfaces(*SM::g_service_manager); | 188 | HID::InstallInterfaces(*sm); |
| 189 | HID::InstallInterfaces(*SM::g_service_manager); | 189 | LM::InstallInterfaces(*sm); |
| 190 | LM::InstallInterfaces(*SM::g_service_manager); | 190 | NFP::InstallInterfaces(*sm); |
| 191 | NFP::InstallInterfaces(*SM::g_service_manager); | 191 | NIFM::InstallInterfaces(*sm); |
| 192 | NIFM::InstallInterfaces(*SM::g_service_manager); | 192 | NS::InstallInterfaces(*sm); |
| 193 | NS::InstallInterfaces(*SM::g_service_manager); | 193 | Nvidia::InstallInterfaces(*sm); |
| 194 | Nvidia::InstallInterfaces(*SM::g_service_manager); | 194 | PCTL::InstallInterfaces(*sm); |
| 195 | PCTL::InstallInterfaces(*SM::g_service_manager); | 195 | Sockets::InstallInterfaces(*sm); |
| 196 | Sockets::InstallInterfaces(*SM::g_service_manager); | 196 | SPL::InstallInterfaces(*sm); |
| 197 | SPL::InstallInterfaces(*SM::g_service_manager); | 197 | SSL::InstallInterfaces(*sm); |
| 198 | SSL::InstallInterfaces(*SM::g_service_manager); | 198 | Time::InstallInterfaces(*sm); |
| 199 | Time::InstallInterfaces(*SM::g_service_manager); | 199 | VI::InstallInterfaces(*sm, nv_flinger); |
| 200 | VI::InstallInterfaces(*SM::g_service_manager, nv_flinger); | 200 | Set::InstallInterfaces(*sm); |
| 201 | Set::InstallInterfaces(*SM::g_service_manager); | ||
| 202 | 201 | ||
| 203 | LOG_DEBUG(Service, "initialized OK"); | 202 | LOG_DEBUG(Service, "initialized OK"); |
| 204 | } | 203 | } |
| 205 | 204 | ||
| 206 | /// Shutdown ServiceManager | 205 | /// Shutdown ServiceManager |
| 207 | void Shutdown() { | 206 | void Shutdown() { |
| 208 | SM::g_service_manager = nullptr; | ||
| 209 | g_kernel_named_ports.clear(); | 207 | g_kernel_named_ports.clear(); |
| 210 | LOG_DEBUG(Service, "shutdown OK"); | 208 | LOG_DEBUG(Service, "shutdown OK"); |
| 211 | } | 209 | } |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 9c2e826da..fee841d46 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -178,7 +178,7 @@ private: | |||
| 178 | }; | 178 | }; |
| 179 | 179 | ||
| 180 | /// Initialize ServiceManager | 180 | /// Initialize ServiceManager |
| 181 | void Init(); | 181 | void Init(std::shared_ptr<SM::ServiceManager>& sm); |
| 182 | 182 | ||
| 183 | /// Shutdown ServiceManager | 183 | /// Shutdown ServiceManager |
| 184 | void Shutdown(); | 184 | void Shutdown(); |
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 297a4f2c6..4578fc05f 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | namespace Service::SM { | 15 | namespace Service::SM { |
| 16 | 16 | ||
| 17 | ServiceManager::~ServiceManager() = default; | ||
| 18 | |||
| 17 | void ServiceManager::InvokeControlRequest(Kernel::HLERequestContext& context) { | 19 | void ServiceManager::InvokeControlRequest(Kernel::HLERequestContext& context) { |
| 18 | controller_interface->InvokeRequest(context); | 20 | controller_interface->InvokeRequest(context); |
| 19 | } | 21 | } |
| @@ -72,7 +74,7 @@ ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ServiceManager::ConnectToSer | |||
| 72 | return client_port->Connect(); | 74 | return client_port->Connect(); |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | std::shared_ptr<ServiceManager> g_service_manager; | 77 | SM::~SM() = default; |
| 76 | 78 | ||
| 77 | /** | 79 | /** |
| 78 | * SM::Initialize service function | 80 | * SM::Initialize service function |
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 40421cfd5..13f5c4c28 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h | |||
| @@ -23,7 +23,7 @@ namespace Service::SM { | |||
| 23 | class SM final : public ServiceFramework<SM> { | 23 | class SM final : public ServiceFramework<SM> { |
| 24 | public: | 24 | public: |
| 25 | SM(std::shared_ptr<ServiceManager> service_manager); | 25 | SM(std::shared_ptr<ServiceManager> service_manager); |
| 26 | ~SM() = default; | 26 | ~SM() override; |
| 27 | 27 | ||
| 28 | private: | 28 | private: |
| 29 | void Initialize(Kernel::HLERequestContext& ctx); | 29 | void Initialize(Kernel::HLERequestContext& ctx); |
| @@ -44,6 +44,8 @@ class ServiceManager { | |||
| 44 | public: | 44 | public: |
| 45 | static void InstallInterfaces(std::shared_ptr<ServiceManager> self); | 45 | static void InstallInterfaces(std::shared_ptr<ServiceManager> self); |
| 46 | 46 | ||
| 47 | ~ServiceManager(); | ||
| 48 | |||
| 47 | ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> RegisterService(std::string name, | 49 | ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> RegisterService(std::string name, |
| 48 | unsigned int max_sessions); | 50 | unsigned int max_sessions); |
| 49 | ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> GetServicePort(const std::string& name); | 51 | ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> GetServicePort(const std::string& name); |
| @@ -59,6 +61,4 @@ private: | |||
| 59 | std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> registered_services; | 61 | std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> registered_services; |
| 60 | }; | 62 | }; |
| 61 | 63 | ||
| 62 | extern std::shared_ptr<ServiceManager> g_service_manager; | ||
| 63 | |||
| 64 | } // namespace Service::SM | 64 | } // namespace Service::SM |