diff options
| author | 2024-02-21 21:10:49 -0500 | |
|---|---|---|
| committer | 2024-02-21 23:00:01 -0500 | |
| commit | 5ab49c833d26b870ee250ef008e4aa1087b46f98 (patch) | |
| tree | 98f0339353403f8df0fcd7ace6900d8a5f53c40f /src/core/hle/service | |
| parent | pctl: move IParentalControlServiceFactory (diff) | |
| download | yuzu-5ab49c833d26b870ee250ef008e4aa1087b46f98.tar.gz yuzu-5ab49c833d26b870ee250ef008e4aa1087b46f98.tar.xz yuzu-5ab49c833d26b870ee250ef008e4aa1087b46f98.zip | |
pctl: rewrite IParentalControlServiceFactory
Diffstat (limited to 'src/core/hle/service')
| -rw-r--r-- | src/core/hle/service/pctl/parental_control_service_factory.cpp | 33 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/parental_control_service_factory.h | 13 |
2 files changed, 26 insertions, 20 deletions
diff --git a/src/core/hle/service/pctl/parental_control_service_factory.cpp b/src/core/hle/service/pctl/parental_control_service_factory.cpp index 1427f5a96..7d8f361e9 100644 --- a/src/core/hle/service/pctl/parental_control_service_factory.cpp +++ b/src/core/hle/service/pctl/parental_control_service_factory.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2024 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/ipc_helpers.h" | 4 | #include "core/hle/service/cmif_serialization.h" |
| 5 | #include "core/hle/service/pctl/parental_control_service.h" | 5 | #include "core/hle/service/pctl/parental_control_service.h" |
| 6 | #include "core/hle/service/pctl/parental_control_service_factory.h" | 6 | #include "core/hle/service/pctl/parental_control_service_factory.h" |
| 7 | 7 | ||
| @@ -10,26 +10,31 @@ namespace Service::PCTL { | |||
| 10 | IParentalControlServiceFactory::IParentalControlServiceFactory(Core::System& system_, | 10 | IParentalControlServiceFactory::IParentalControlServiceFactory(Core::System& system_, |
| 11 | const char* name_, | 11 | const char* name_, |
| 12 | Capability capability_) | 12 | Capability capability_) |
| 13 | : ServiceFramework{system_, name_}, capability{capability_} {} | 13 | : ServiceFramework{system_, name_}, capability{capability_} { |
| 14 | static const FunctionInfo functions[] = { | ||
| 15 | {0, D<&IParentalControlServiceFactory::CreateService>, "CreateService"}, | ||
| 16 | {1, D<&IParentalControlServiceFactory::CreateServiceWithoutInitialize>, | ||
| 17 | "CreateServiceWithoutInitialize"}, | ||
| 18 | }; | ||
| 19 | RegisterHandlers(functions); | ||
| 20 | } | ||
| 14 | 21 | ||
| 15 | IParentalControlServiceFactory::~IParentalControlServiceFactory() = default; | 22 | IParentalControlServiceFactory::~IParentalControlServiceFactory() = default; |
| 16 | 23 | ||
| 17 | void IParentalControlServiceFactory::CreateService(HLERequestContext& ctx) { | 24 | Result IParentalControlServiceFactory::CreateService( |
| 25 | Out<SharedPointer<IParentalControlService>> out_service, ClientProcessId process_id) { | ||
| 18 | LOG_DEBUG(Service_PCTL, "called"); | 26 | LOG_DEBUG(Service_PCTL, "called"); |
| 19 | 27 | // TODO(ogniK): Get application id from process | |
| 20 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 28 | *out_service = std::make_shared<IParentalControlService>(system, capability); |
| 21 | rb.Push(ResultSuccess); | 29 | R_SUCCEED(); |
| 22 | // TODO(ogniK): Get TID from process | ||
| 23 | |||
| 24 | rb.PushIpcInterface<IParentalControlService>(system, capability); | ||
| 25 | } | 30 | } |
| 26 | 31 | ||
| 27 | void IParentalControlServiceFactory::CreateServiceWithoutInitialize(HLERequestContext& ctx) { | 32 | Result IParentalControlServiceFactory::CreateServiceWithoutInitialize( |
| 33 | Out<SharedPointer<IParentalControlService>> out_service, ClientProcessId process_id) { | ||
| 28 | LOG_DEBUG(Service_PCTL, "called"); | 34 | LOG_DEBUG(Service_PCTL, "called"); |
| 29 | 35 | // TODO(ogniK): Get application id from process | |
| 30 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 36 | *out_service = std::make_shared<IParentalControlService>(system, capability); |
| 31 | rb.Push(ResultSuccess); | 37 | R_SUCCEED(); |
| 32 | rb.PushIpcInterface<IParentalControlService>(system, capability); | ||
| 33 | } | 38 | } |
| 34 | 39 | ||
| 35 | } // namespace Service::PCTL | 40 | } // 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 index 19195aa38..362988add 100644 --- a/src/core/hle/service/pctl/parental_control_service_factory.h +++ b/src/core/hle/service/pctl/parental_control_service_factory.h | |||
| @@ -3,23 +3,24 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 6 | #include "core/hle/service/pctl/pctl_types.h" | 7 | #include "core/hle/service/pctl/pctl_types.h" |
| 7 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 8 | 9 | ||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 13 | namespace Service::PCTL { | 10 | namespace Service::PCTL { |
| 14 | 11 | ||
| 12 | class IParentalControlService; | ||
| 13 | |||
| 15 | class IParentalControlServiceFactory : public ServiceFramework<IParentalControlServiceFactory> { | 14 | class IParentalControlServiceFactory : public ServiceFramework<IParentalControlServiceFactory> { |
| 16 | public: | 15 | public: |
| 17 | explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, | 16 | explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, |
| 18 | Capability capability_); | 17 | Capability capability_); |
| 19 | ~IParentalControlServiceFactory() override; | 18 | ~IParentalControlServiceFactory() override; |
| 20 | 19 | ||
| 21 | void CreateService(HLERequestContext& ctx); | 20 | Result CreateService(Out<SharedPointer<IParentalControlService>> out_service, |
| 22 | void CreateServiceWithoutInitialize(HLERequestContext& ctx); | 21 | ClientProcessId process_id); |
| 22 | Result CreateServiceWithoutInitialize(Out<SharedPointer<IParentalControlService>> out_service, | ||
| 23 | ClientProcessId process_id); | ||
| 23 | 24 | ||
| 24 | private: | 25 | private: |
| 25 | Capability capability{}; | 26 | Capability capability{}; |