diff options
author | Liam <[email protected]> | 2024-02-21 21:10:49 -0500 |
---|---|---|
committer | Liam <[email protected]> | 2024-02-21 23:00:01 -0500 |
commit | 5ab49c833d26b870ee250ef008e4aa1087b46f98 (patch) | |
tree | 98f0339353403f8df0fcd7ace6900d8a5f53c40f /src | |
parent | 0e74204aadb1753e402b333692d36b1bc7221463 (diff) | |
download | yuzu-android-5ab49c833d26b870ee250ef008e4aa1087b46f98.tar.gz yuzu-android-5ab49c833d26b870ee250ef008e4aa1087b46f98.zip |
pctl: rewrite IParentalControlServiceFactory
Diffstat (limited to 'src')
-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 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/cmif_serialization.h" #include "core/hle/service/pctl/parental_control_service.h" #include "core/hle/service/pctl/parental_control_service_factory.h" @@ -10,26 +10,31 @@ namespace Service::PCTL { IParentalControlServiceFactory::IParentalControlServiceFactory(Core::System& system_, const char* name_, Capability capability_) - : ServiceFramework{system_, name_}, capability{capability_} {} + : ServiceFramework{system_, name_}, capability{capability_} { + static const FunctionInfo functions[] = { + {0, D<&IParentalControlServiceFactory::CreateService>, "CreateService"}, + {1, D<&IParentalControlServiceFactory::CreateServiceWithoutInitialize>, + "CreateServiceWithoutInitialize"}, + }; + RegisterHandlers(functions); +} IParentalControlServiceFactory::~IParentalControlServiceFactory() = default; -void IParentalControlServiceFactory::CreateService(HLERequestContext& ctx) { +Result IParentalControlServiceFactory::CreateService( + Out<SharedPointer<IParentalControlService>> out_service, ClientProcessId process_id) { LOG_DEBUG(Service_PCTL, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - // TODO(ogniK): Get TID from process - - rb.PushIpcInterface<IParentalControlService>(system, capability); + // TODO(ogniK): Get application id from process + *out_service = std::make_shared<IParentalControlService>(system, capability); + R_SUCCEED(); } -void IParentalControlServiceFactory::CreateServiceWithoutInitialize(HLERequestContext& ctx) { +Result IParentalControlServiceFactory::CreateServiceWithoutInitialize( + Out<SharedPointer<IParentalControlService>> out_service, ClientProcessId process_id) { LOG_DEBUG(Service_PCTL, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface<IParentalControlService>(system, capability); + // TODO(ogniK): Get application id from process + *out_service = std::make_shared<IParentalControlService>(system, capability); + R_SUCCEED(); } } // 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 @@ #pragma once +#include "core/hle/service/cmif_types.h" #include "core/hle/service/pctl/pctl_types.h" #include "core/hle/service/service.h" -namespace Core { -class System; -} - namespace Service::PCTL { +class IParentalControlService; + class IParentalControlServiceFactory : public ServiceFramework<IParentalControlServiceFactory> { public: explicit IParentalControlServiceFactory(Core::System& system_, const char* name_, Capability capability_); ~IParentalControlServiceFactory() override; - void CreateService(HLERequestContext& ctx); - void CreateServiceWithoutInitialize(HLERequestContext& ctx); + Result CreateService(Out<SharedPointer<IParentalControlService>> out_service, + ClientProcessId process_id); + Result CreateServiceWithoutInitialize(Out<SharedPointer<IParentalControlService>> out_service, + ClientProcessId process_id); private: Capability capability{}; |