mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	pctl: move IParentalControlServiceFactory
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
							
								
								
									
										30
									
								
								src/core/hle/service/pctl/parental_control_service_factory.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/core/hle/service/pctl/parental_control_service_factory.h
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user