8 changed files with 87 additions and 112 deletions
-
4src/core/CMakeLists.txt
-
35src/core/hle/service/pctl/parental_control_service_factory.cpp
-
30src/core/hle/service/pctl/parental_control_service_factory.h
-
27src/core/hle/service/pctl/pctl.cpp
-
9src/core/hle/service/pctl/pctl.h
-
56src/core/hle/service/pctl/pctl_module.cpp
-
36src/core/hle/service/pctl/pctl_module.h
-
2src/core/hle/service/services.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
|
||||
@ -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-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// 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/pctl/pctl.h"
|
||||
|
#include "core/hle/service/server_manager.h"
|
||||
|
|
||||
namespace Service::PCTL { |
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
|
} // 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 |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue