diff options
author | Liam <byteslice@airmail.cc> | 2022-10-16 07:53:56 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-10-31 22:44:06 +0100 |
commit | 983f2b70741f17f30fe2321451f10cabecc013d2 (patch) | |
tree | c1ac3c1033fdeefaabe76590ca204c4c1b2a98cd /src/core/hle/kernel/kernel.cpp | |
parent | Merge pull request #9159 from liamwhite/kbork (diff) | |
download | yuzu-983f2b70741f17f30fe2321451f10cabecc013d2.tar yuzu-983f2b70741f17f30fe2321451f10cabecc013d2.tar.gz yuzu-983f2b70741f17f30fe2321451f10cabecc013d2.tar.bz2 yuzu-983f2b70741f17f30fe2321451f10cabecc013d2.tar.lz yuzu-983f2b70741f17f30fe2321451f10cabecc013d2.tar.xz yuzu-983f2b70741f17f30fe2321451f10cabecc013d2.tar.zst yuzu-983f2b70741f17f30fe2321451f10cabecc013d2.zip |
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index fdc774e30..29e122dfd 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -60,7 +60,6 @@ struct KernelCore::Impl { global_scheduler_context = std::make_unique<Kernel::GlobalSchedulerContext>(kernel); global_handle_table = std::make_unique<Kernel::KHandleTable>(kernel); global_handle_table->Initialize(KHandleTable::MaxTableSize); - default_service_thread = CreateServiceThread(kernel, "DefaultServiceThread"); is_phantom_mode_for_singlecore = false; @@ -86,6 +85,8 @@ struct KernelCore::Impl { } RegisterHostThread(); + + default_service_thread = CreateServiceThread(kernel, "DefaultServiceThread"); } void InitializeCores() { @@ -703,6 +704,15 @@ struct KernelCore::Impl { return port; } + void RegisterNamedServiceHandler(std::string name, KServerPort* server_port) { + auto search = service_interface_handlers.find(name); + if (search == service_interface_handlers.end()) { + return; + } + + search->second(system.ServiceManager(), server_port); + } + void RegisterServerObject(KAutoObject* server_object) { std::scoped_lock lk(server_objects_lock); server_objects.insert(server_object); @@ -715,7 +725,7 @@ struct KernelCore::Impl { std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel, const std::string& name) { - auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, 1, name); + auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, name); service_threads_manager.QueueWork( [this, service_thread]() { service_threads.emplace(service_thread); }); @@ -774,6 +784,7 @@ struct KernelCore::Impl { /// Map of named ports managed by the kernel, which can be retrieved using /// the ConnectToPort SVC. std::unordered_map<std::string, ServiceInterfaceFactory> service_interface_factory; + std::unordered_map<std::string, ServiceInterfaceHandlerFn> service_interface_handlers; NamedPortTable named_ports; std::unordered_set<KAutoObject*> server_objects; std::unordered_set<KAutoObject*> registered_objects; @@ -981,10 +992,19 @@ void KernelCore::RegisterNamedService(std::string name, ServiceInterfaceFactory& impl->service_interface_factory.emplace(std::move(name), factory); } +void KernelCore::RegisterInterfaceForNamedService(std::string name, + ServiceInterfaceHandlerFn&& handler) { + impl->service_interface_handlers.emplace(std::move(name), handler); +} + KClientPort* KernelCore::CreateNamedServicePort(std::string name) { return impl->CreateNamedServicePort(std::move(name)); } +void KernelCore::RegisterNamedServiceHandler(std::string name, KServerPort* server_port) { + impl->RegisterNamedServiceHandler(std::move(name), server_port); +} + void KernelCore::RegisterServerObject(KAutoObject* server_object) { impl->RegisterServerObject(server_object); } |