aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorLiam <[email protected]>2024-02-21 21:05:30 -0500
committerLiam <[email protected]>2024-02-21 23:00:01 -0500
commit0e74204aadb1753e402b333692d36b1bc7221463 (patch)
treeea3791615ffedad6d6c9d52f6519309a04b575d9 /src
parenta37bd0b9a706f63cf1eb4503549171c232bf4238 (diff)
downloadyuzu-mainline-0e74204aadb1753e402b333692d36b1bc7221463.tar.gz
yuzu-mainline-0e74204aadb1753e402b333692d36b1bc7221463.zip
pctl: move IParentalControlServiceFactory
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/hle/service/pctl/parental_control_service_factory.cpp35
-rw-r--r--src/core/hle/service/pctl/parental_control_service_factory.h30
-rw-r--r--src/core/hle/service/pctl/pctl.cpp27
-rw-r--r--src/core/hle/service/pctl/pctl.h9
-rw-r--r--src/core/hle/service/pctl/pctl_module.cpp56
-rw-r--r--src/core/hle/service/pctl/pctl_module.h36
-rw-r--r--src/core/hle/service/services.cpp2
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
hle/service/os/mutex.h
hle/service/pcie/pcie.cpp
hle/service/pcie/pcie.h
+ hle/service/pctl/parental_control_service_factory.cpp
+ hle/service/pctl/parental_control_service_factory.h
hle/service/pctl/parental_control_service.cpp
hle/service/pctl/parental_control_service.h
hle/service/pctl/pctl.cpp
hle/service/pctl/pctl.h
- hle/service/pctl/pctl_module.cpp
- hle/service/pctl/pctl_module.h
hle/service/pctl/pctl_results.h
hle/service/pctl/pctl_types.h
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 @@
+// 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/pctl/parental_control_service.h"
+#include "core/hle/service/pctl/parental_control_service_factory.h"
+
+namespace Service::PCTL {
+
+IParentalControlServiceFactory::IParentalControlServiceFactory(Core::System& system_,
+ const char* name_,
+ Capability capability_)
+ : ServiceFramework{system_, name_}, capability{capability_} {}
+
+IParentalControlServiceFactory::~IParentalControlServiceFactory() = default;
+
+void IParentalControlServiceFactory::CreateService(HLERequestContext& ctx) {
+ 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);
+}
+
+void IParentalControlServiceFactory::CreateServiceWithoutInitialize(HLERequestContext& ctx) {
+ LOG_DEBUG(Service_PCTL, "called");
+
+ IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+ rb.Push(ResultSuccess);
+ rb.PushIpcInterface<IParentalControlService>(system, capability);
+}
+
+} // 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 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/pctl/pctl_types.h"
+#include "core/hle/service/service.h"
+
+namespace Core {
+class System;
+}
+
+namespace Service::PCTL {
+
+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);
+
+private:
+ Capability capability{};
+};
+
+void LoopProcess(Core::System& system);
+
+} // 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 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "core/hle/service/pctl/parental_control_service_factory.h"
#include "core/hle/service/pctl/pctl.h"
+#include "core/hle/service/server_manager.h"
namespace Service::PCTL {
-PCTL::PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
- Capability capability_)
- : Interface{system_, std::move(module_), name, capability_} {
- static const FunctionInfo functions[] = {
- {0, &PCTL::CreateService, "CreateService"},
- {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},
- };
- RegisterHandlers(functions);
+void LoopProcess(Core::System& system) {
+ auto server_manager = std::make_unique<ServerManager>(system);
+
+ server_manager->RegisterNamedService("pctl",
+ std::make_shared<IParentalControlServiceFactory>(
+ system, "pctl",
+ Capability::Application | Capability::SnsPost |
+ Capability::Status | Capability::StereoVision));
+ // TODO(ogniK): Implement remaining capabilities
+ server_manager->RegisterNamedService("pctl:a", std::make_shared<IParentalControlServiceFactory>(
+ system, "pctl:a", Capability::None));
+ server_manager->RegisterNamedService("pctl:r", std::make_shared<IParentalControlServiceFactory>(
+ system, "pctl:r", Capability::None));
+ server_manager->RegisterNamedService("pctl:s", std::make_shared<IParentalControlServiceFactory>(
+ system, "pctl:s", Capability::None));
+ ServerManager::RunServer(std::move(server_manager));
}
-PCTL::~PCTL() = default;
} // 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 @@
#pragma once
-#include "core/hle/service/pctl/pctl_module.h"
-
namespace Core {
class System;
}
namespace Service::PCTL {
-class PCTL final : public Module::Interface {
-public:
- explicit PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
- Capability capability_);
- ~PCTL() override;
-};
+void LoopProcess(Core::System& system);
} // 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 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "common/logging/log.h"
-#include "core/hle/service/ipc_helpers.h"
-#include "core/hle/service/kernel_helpers.h"
-#include "core/hle/service/pctl/parental_control_service.h"
-#include "core/hle/service/pctl/pctl.h"
-#include "core/hle/service/pctl/pctl_module.h"
-#include "core/hle/service/server_manager.h"
-
-namespace Service::PCTL {
-
-void Module::Interface::CreateService(HLERequestContext& ctx) {
- 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);
-}
-
-void Module::Interface::CreateServiceWithoutInitialize(HLERequestContext& ctx) {
- LOG_DEBUG(Service_PCTL, "called");
-
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<IParentalControlService>(system, capability);
-}
-
-Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
- const char* name_, Capability capability_)
- : ServiceFramework{system_, name_}, module{std::move(module_)}, capability{capability_} {}
-
-Module::Interface::~Interface() = default;
-
-void LoopProcess(Core::System& system) {
- auto server_manager = std::make_unique<ServerManager>(system);
-
- auto module = std::make_shared<Module>();
- server_manager->RegisterNamedService(
- "pctl", std::make_shared<PCTL>(system, module, "pctl",
- Capability::Application | Capability::SnsPost |
- Capability::Status | Capability::StereoVision));
- // TODO(ogniK): Implement remaining capabilities
- server_manager->RegisterNamedService(
- "pctl:a", std::make_shared<PCTL>(system, module, "pctl:a", Capability::None));
- server_manager->RegisterNamedService(
- "pctl:r", std::make_shared<PCTL>(system, module, "pctl:r", Capability::None));
- server_manager->RegisterNamedService(
- "pctl:s", std::make_shared<PCTL>(system, module, "pctl:s", Capability::None));
- ServerManager::RunServer(std::move(server_manager));
-}
-
-} // 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 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/pctl/pctl_types.h"
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::PCTL {
-
-class Module final {
-public:
- class Interface : public ServiceFramework<Interface> {
- public:
- explicit Interface(Core::System& system_, std::shared_ptr<Module> module_,
- const char* name_, Capability capability_);
- ~Interface() override;
-
- void CreateService(HLERequestContext& ctx);
- void CreateServiceWithoutInitialize(HLERequestContext& ctx);
-
- protected:
- std::shared_ptr<Module> module;
-
- private:
- Capability capability{};
- };
-};
-
-void LoopProcess(Core::System& system);
-
-} // 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 @@
#include "core/hle/service/olsc/olsc.h"
#include "core/hle/service/omm/omm.h"
#include "core/hle/service/pcie/pcie.h"
-#include "core/hle/service/pctl/pctl_module.h"
+#include "core/hle/service/pctl/pctl.h"
#include "core/hle/service/pcv/pcv.h"
#include "core/hle/service/pm/pm.h"
#include "core/hle/service/prepo/prepo.h"