diff options
| -rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/parental_control_service_factory.cpp | 35 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/parental_control_service_factory.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl_module.cpp | 56 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/pctl_module.h | 36 | ||||
| -rw-r--r-- | src/core/hle/service/services.cpp | 2 |
8 files changed, 87 insertions, 112 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d0fdae8db..45b4b203d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -893,12 +893,12 @@ add_library(core STATIC | |||
| 893 | hle/service/os/mutex.h | 893 | hle/service/os/mutex.h |
| 894 | hle/service/pcie/pcie.cpp | 894 | hle/service/pcie/pcie.cpp |
| 895 | hle/service/pcie/pcie.h | 895 | hle/service/pcie/pcie.h |
| 896 | hle/service/pctl/parental_control_service_factory.cpp | ||
| 897 | hle/service/pctl/parental_control_service_factory.h | ||
| 896 | hle/service/pctl/parental_control_service.cpp | 898 | hle/service/pctl/parental_control_service.cpp |
| 897 | hle/service/pctl/parental_control_service.h | 899 | hle/service/pctl/parental_control_service.h |
| 898 | hle/service/pctl/pctl.cpp | 900 | hle/service/pctl/pctl.cpp |
| 899 | hle/service/pctl/pctl.h | 901 | hle/service/pctl/pctl.h |
| 900 | hle/service/pctl/pctl_module.cpp | ||
| 901 | hle/service/pctl/pctl_module.h | ||
| 902 | hle/service/pctl/pctl_results.h | 902 | hle/service/pctl/pctl_results.h |
| 903 | hle/service/pctl/pctl_types.h | 903 | hle/service/pctl/pctl_types.h |
| 904 | hle/service/pcv/pcv.cpp | 904 | hle/service/pcv/pcv.cpp |
diff --git a/src/core/hle/service/pctl/parental_control_service_factory.cpp b/src/core/hle/service/pctl/parental_control_service_factory.cpp new file mode 100644 index 000000000..1427f5a96 --- /dev/null +++ b/src/core/hle/service/pctl/parental_control_service_factory.cpp | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/hle/service/ipc_helpers.h" | ||
| 5 | #include "core/hle/service/pctl/parental_control_service.h" | ||
| 6 | #include "core/hle/service/pctl/parental_control_service_factory.h" | ||
| 7 | |||
| 8 | namespace Service::PCTL { | ||
| 9 | |||
| 10 | IParentalControlServiceFactory::IParentalControlServiceFactory(Core::System& system_, | ||
| 11 | const char* name_, | ||
| 12 | Capability capability_) | ||
| 13 | : ServiceFramework{system_, name_}, capability{capability_} {} | ||
| 14 | |||
| 15 | IParentalControlServiceFactory::~IParentalControlServiceFactory() = default; | ||
| 16 | |||
| 17 | void IParentalControlServiceFactory::CreateService(HLERequestContext& ctx) { | ||
| 18 | LOG_DEBUG(Service_PCTL, "called"); | ||
| 19 | |||
| 20 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 21 | rb.Push(ResultSuccess); | ||
| 22 | // TODO(ogniK): Get TID from process | ||
| 23 | |||
| 24 | rb.PushIpcInterface<IParentalControlService>(system, capability); | ||
| 25 | } | ||
| 26 | |||
| 27 | void IParentalControlServiceFactory::CreateServiceWithoutInitialize(HLERequestContext& ctx) { | ||
| 28 | LOG_DEBUG(Service_PCTL, "called"); | ||
| 29 | |||
| 30 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 31 | rb.Push(ResultSuccess); | ||
| 32 | rb.PushIpcInterface<IParentalControlService>(system, capability); | ||
| 33 | } | ||
| 34 | |||
| 35 | } // namespace Service::PCTL | ||
diff --git a/src/core/hle/service/pctl/parental_control_service_factory.h b/src/core/hle/service/pctl/parental_control_service_factory.h new file mode 100644 index 000000000..19195aa38 --- /dev/null +++ b/src/core/hle/service/pctl/parental_control_service_factory.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/pctl/pctl_types.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Service::PCTL { | ||
| 14 | |||
| 15 | class IParentalControlServiceFactory : public ServiceFramework<IParentalControlServiceFactory> { | ||
| 16 | public: | ||
| 17 | explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, | ||
| 18 | Capability capability_); | ||
| 19 | ~IParentalControlServiceFactory() override; | ||
| 20 | |||
| 21 | void CreateService(HLERequestContext& ctx); | ||
| 22 | void CreateServiceWithoutInitialize(HLERequestContext& ctx); | ||
| 23 | |||
| 24 | private: | ||
| 25 | Capability capability{}; | ||
| 26 | }; | ||
| 27 | |||
| 28 | void LoopProcess(Core::System& system); | ||
| 29 | |||
| 30 | } // namespace Service::PCTL | ||
diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp index 3f47bf094..d92dbe216 100644 --- a/src/core/hle/service/pctl/pctl.cpp +++ b/src/core/hle/service/pctl/pctl.cpp | |||
| @@ -1,19 +1,28 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/pctl/parental_control_service_factory.h" | ||
| 4 | #include "core/hle/service/pctl/pctl.h" | 5 | #include "core/hle/service/pctl/pctl.h" |
| 6 | #include "core/hle/service/server_manager.h" | ||
| 5 | 7 | ||
| 6 | namespace Service::PCTL { | 8 | namespace Service::PCTL { |
| 7 | 9 | ||
| 8 | PCTL::PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name, | 10 | void LoopProcess(Core::System& system) { |
| 9 | Capability capability_) | 11 | auto server_manager = std::make_unique<ServerManager>(system); |
| 10 | : Interface{system_, std::move(module_), name, capability_} { | 12 | |
| 11 | static const FunctionInfo functions[] = { | 13 | server_manager->RegisterNamedService("pctl", |
| 12 | {0, &PCTL::CreateService, "CreateService"}, | 14 | std::make_shared<IParentalControlServiceFactory>( |
| 13 | {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"}, | 15 | system, "pctl", |
| 14 | }; | 16 | Capability::Application | Capability::SnsPost | |
| 15 | RegisterHandlers(functions); | 17 | Capability::Status | Capability::StereoVision)); |
| 18 | // TODO(ogniK): Implement remaining capabilities | ||
| 19 | server_manager->RegisterNamedService("pctl:a", std::make_shared<IParentalControlServiceFactory>( | ||
| 20 | system, "pctl:a", Capability::None)); | ||
| 21 | server_manager->RegisterNamedService("pctl:r", std::make_shared<IParentalControlServiceFactory>( | ||
| 22 | system, "pctl:r", Capability::None)); | ||
| 23 | server_manager->RegisterNamedService("pctl:s", std::make_shared<IParentalControlServiceFactory>( | ||
| 24 | system, "pctl:s", Capability::None)); | ||
| 25 | ServerManager::RunServer(std::move(server_manager)); | ||
| 16 | } | 26 | } |
| 17 | 27 | ||
| 18 | PCTL::~PCTL() = default; | ||
| 19 | } // namespace Service::PCTL | 28 | } // namespace Service::PCTL |
diff --git a/src/core/hle/service/pctl/pctl.h b/src/core/hle/service/pctl/pctl.h index 87f93161e..5f9d03d4d 100644 --- a/src/core/hle/service/pctl/pctl.h +++ b/src/core/hle/service/pctl/pctl.h | |||
| @@ -3,19 +3,12 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "core/hle/service/pctl/pctl_module.h" | ||
| 7 | |||
| 8 | namespace Core { | 6 | namespace Core { |
| 9 | class System; | 7 | class System; |
| 10 | } | 8 | } |
| 11 | 9 | ||
| 12 | namespace Service::PCTL { | 10 | namespace Service::PCTL { |
| 13 | 11 | ||
| 14 | class PCTL final : public Module::Interface { | 12 | void LoopProcess(Core::System& system); |
| 15 | public: | ||
| 16 | explicit PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name, | ||
| 17 | Capability capability_); | ||
| 18 | ~PCTL() override; | ||
| 19 | }; | ||
| 20 | 13 | ||
| 21 | } // namespace Service::PCTL | 14 | } // namespace Service::PCTL |
diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp deleted file mode 100644 index 118856574..000000000 --- a/src/core/hle/service/pctl/pctl_module.cpp +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "common/logging/log.h" | ||
| 5 | #include "core/hle/service/ipc_helpers.h" | ||
| 6 | #include "core/hle/service/kernel_helpers.h" | ||
| 7 | #include "core/hle/service/pctl/parental_control_service.h" | ||
| 8 | #include "core/hle/service/pctl/pctl.h" | ||
| 9 | #include "core/hle/service/pctl/pctl_module.h" | ||
| 10 | #include "core/hle/service/server_manager.h" | ||
| 11 | |||
| 12 | namespace Service::PCTL { | ||
| 13 | |||
| 14 | void Module::Interface::CreateService(HLERequestContext& ctx) { | ||
| 15 | LOG_DEBUG(Service_PCTL, "called"); | ||
| 16 | |||
| 17 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 18 | rb.Push(ResultSuccess); | ||
| 19 | // TODO(ogniK): Get TID from process | ||
| 20 | |||
| 21 | rb.PushIpcInterface<IParentalControlService>(system, capability); | ||
| 22 | } | ||
| 23 | |||
| 24 | void Module::Interface::CreateServiceWithoutInitialize(HLERequestContext& ctx) { | ||
| 25 | LOG_DEBUG(Service_PCTL, "called"); | ||
| 26 | |||
| 27 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 28 | rb.Push(ResultSuccess); | ||
| 29 | rb.PushIpcInterface<IParentalControlService>(system, capability); | ||
| 30 | } | ||
| 31 | |||
| 32 | Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, | ||
| 33 | const char* name_, Capability capability_) | ||
| 34 | : ServiceFramework{system_, name_}, module{std::move(module_)}, capability{capability_} {} | ||
| 35 | |||
| 36 | Module::Interface::~Interface() = default; | ||
| 37 | |||
| 38 | void LoopProcess(Core::System& system) { | ||
| 39 | auto server_manager = std::make_unique<ServerManager>(system); | ||
| 40 | |||
| 41 | auto module = std::make_shared<Module>(); | ||
| 42 | server_manager->RegisterNamedService( | ||
| 43 | "pctl", std::make_shared<PCTL>(system, module, "pctl", | ||
| 44 | Capability::Application | Capability::SnsPost | | ||
| 45 | Capability::Status | Capability::StereoVision)); | ||
| 46 | // TODO(ogniK): Implement remaining capabilities | ||
| 47 | server_manager->RegisterNamedService( | ||
| 48 | "pctl:a", std::make_shared<PCTL>(system, module, "pctl:a", Capability::None)); | ||
| 49 | server_manager->RegisterNamedService( | ||
| 50 | "pctl:r", std::make_shared<PCTL>(system, module, "pctl:r", Capability::None)); | ||
| 51 | server_manager->RegisterNamedService( | ||
| 52 | "pctl:s", std::make_shared<PCTL>(system, module, "pctl:s", Capability::None)); | ||
| 53 | ServerManager::RunServer(std::move(server_manager)); | ||
| 54 | } | ||
| 55 | |||
| 56 | } // namespace Service::PCTL | ||
diff --git a/src/core/hle/service/pctl/pctl_module.h b/src/core/hle/service/pctl/pctl_module.h deleted file mode 100644 index 715c05b20..000000000 --- a/src/core/hle/service/pctl/pctl_module.h +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/pctl/pctl_types.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Service::PCTL { | ||
| 14 | |||
| 15 | class Module final { | ||
| 16 | public: | ||
| 17 | class Interface : public ServiceFramework<Interface> { | ||
| 18 | public: | ||
| 19 | explicit Interface(Core::System& system_, std::shared_ptr<Module> module_, | ||
| 20 | const char* name_, Capability capability_); | ||
| 21 | ~Interface() override; | ||
| 22 | |||
| 23 | void CreateService(HLERequestContext& ctx); | ||
| 24 | void CreateServiceWithoutInitialize(HLERequestContext& ctx); | ||
| 25 | |||
| 26 | protected: | ||
| 27 | std::shared_ptr<Module> module; | ||
| 28 | |||
| 29 | private: | ||
| 30 | Capability capability{}; | ||
| 31 | }; | ||
| 32 | }; | ||
| 33 | |||
| 34 | void LoopProcess(Core::System& system); | ||
| 35 | |||
| 36 | } // namespace Service::PCTL | ||
diff --git a/src/core/hle/service/services.cpp b/src/core/hle/service/services.cpp index d6c6eff50..1aa85ea54 100644 --- a/src/core/hle/service/services.cpp +++ b/src/core/hle/service/services.cpp | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | #include "core/hle/service/olsc/olsc.h" | 46 | #include "core/hle/service/olsc/olsc.h" |
| 47 | #include "core/hle/service/omm/omm.h" | 47 | #include "core/hle/service/omm/omm.h" |
| 48 | #include "core/hle/service/pcie/pcie.h" | 48 | #include "core/hle/service/pcie/pcie.h" |
| 49 | #include "core/hle/service/pctl/pctl_module.h" | 49 | #include "core/hle/service/pctl/pctl.h" |
| 50 | #include "core/hle/service/pcv/pcv.h" | 50 | #include "core/hle/service/pcv/pcv.h" |
| 51 | #include "core/hle/service/pm/pm.h" | 51 | #include "core/hle/service/pm/pm.h" |
| 52 | #include "core/hle/service/prepo/prepo.h" | 52 | #include "core/hle/service/prepo/prepo.h" |