Service/PCTL: convert to module, add services, stub

PCTL::CreateServiceWithoutInitialize and IParentalControlService::Initialize, required by Kirby Star Allies
This commit is contained in:
mailwl 2018-04-24 18:08:23 +03:00
parent ea3151f475
commit 2ba4e2263c
7 changed files with 71 additions and 39 deletions

View File

@ -181,10 +181,10 @@ add_library(core STATIC
hle/service/nvflinger/buffer_queue.h hle/service/nvflinger/buffer_queue.h
hle/service/nvflinger/nvflinger.cpp hle/service/nvflinger/nvflinger.cpp
hle/service/nvflinger/nvflinger.h hle/service/nvflinger/nvflinger.h
hle/service/pctl/module.cpp
hle/service/pctl/module.h
hle/service/pctl/pctl.cpp hle/service/pctl/pctl.cpp
hle/service/pctl/pctl.h hle/service/pctl/pctl.h
hle/service/pctl/pctl_a.cpp
hle/service/pctl/pctl_a.h
hle/service/service.cpp hle/service/service.cpp
hle/service/service.h hle/service/service.h
hle/service/set/set.cpp hle/service/set/set.cpp

View File

@ -4,7 +4,8 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/service/pctl/pctl_a.h" #include "core/hle/service/pctl/module.h"
#include "core/hle/service/pctl/pctl.h"
namespace Service::PCTL { namespace Service::PCTL {
@ -12,7 +13,7 @@ class IParentalControlService final : public ServiceFramework<IParentalControlSe
public: public:
IParentalControlService() : ServiceFramework("IParentalControlService") { IParentalControlService() : ServiceFramework("IParentalControlService") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{1, nullptr, "Initialize"}, {1, &IParentalControlService::Initialize, "Initialize"},
{1001, nullptr, "CheckFreeCommunicationPermission"}, {1001, nullptr, "CheckFreeCommunicationPermission"},
{1002, nullptr, "ConfirmLaunchApplicationPermission"}, {1002, nullptr, "ConfirmLaunchApplicationPermission"},
{1003, nullptr, "ConfirmResumeApplicationPermission"}, {1003, nullptr, "ConfirmResumeApplicationPermission"},
@ -108,20 +109,38 @@ public:
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }
private:
void Initialize(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_PCTL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 0};
rb.Push(RESULT_SUCCESS);
}
}; };
void PCTL_A::CreateService(Kernel::HLERequestContext& ctx) {
void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IParentalControlService>(); rb.PushIpcInterface<IParentalControlService>();
NGLOG_DEBUG(Service_PCTL, "called"); NGLOG_DEBUG(Service_PCTL, "called");
} }
PCTL_A::PCTL_A() : ServiceFramework("pctl:a") { void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) {
static const FunctionInfo functions[] = { IPC::ResponseBuilder rb{ctx, 2, 0, 1};
{0, &PCTL_A::CreateService, "CreateService"}, rb.Push(RESULT_SUCCESS);
{1, nullptr, "CreateServiceWithoutInitialize"}, rb.PushIpcInterface<IParentalControlService>();
}; NGLOG_DEBUG(Service_PCTL, "called");
RegisterHandlers(functions); }
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
: ServiceFramework(name), module(std::move(module)) {}
void InstallInterfaces(SM::ServiceManager& service_manager) {
auto module = std::make_shared<Module>();
std::make_shared<PCTL>(module, "pctl")->InstallAsService(service_manager);
std::make_shared<PCTL>(module, "pctl:a")->InstallAsService(service_manager);
std::make_shared<PCTL>(module, "pctl:r")->InstallAsService(service_manager);
std::make_shared<PCTL>(module, "pctl:s")->InstallAsService(service_manager);
} }
} // namespace Service::PCTL } // namespace Service::PCTL

View File

@ -0,0 +1,28 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/hle/service/service.h"
namespace Service::PCTL {
class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
Interface(std::shared_ptr<Module> module, const char* name);
void CreateService(Kernel::HLERequestContext& ctx);
void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx);
protected:
std::shared_ptr<Module> module;
};
};
/// Registers all PCTL services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace Service::PCTL

View File

@ -3,12 +3,15 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/hle/service/pctl/pctl.h" #include "core/hle/service/pctl/pctl.h"
#include "core/hle/service/pctl/pctl_a.h"
namespace Service::PCTL { namespace Service::PCTL {
void InstallInterfaces(SM::ServiceManager& service_manager) { PCTL::PCTL(std::shared_ptr<Module> module, const char* name)
std::make_shared<PCTL_A>()->InstallAsService(service_manager); : Module::Interface(std::move(module), name) {
static const FunctionInfo functions[] = {
{0, &PCTL::CreateService, "CreateService"},
{1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},
};
RegisterHandlers(functions);
} }
} // namespace Service::PCTL } // namespace Service::PCTL

View File

@ -4,11 +4,13 @@
#pragma once #pragma once
#include "core/hle/service/service.h" #include "core/hle/service/pctl/module.h"
namespace Service::PCTL { namespace Service::PCTL {
/// Registers all PCTL services with the specified service manager. class PCTL final : public Module::Interface {
void InstallInterfaces(SM::ServiceManager& service_manager); public:
explicit PCTL(std::shared_ptr<Module> module, const char* name);
};
} // namespace Service::PCTL } // namespace Service::PCTL

View File

@ -1,20 +0,0 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/hle/service/service.h"
namespace Service::PCTL {
class PCTL_A final : public ServiceFramework<PCTL_A> {
public:
PCTL_A();
~PCTL_A() = default;
private:
void CreateService(Kernel::HLERequestContext& ctx);
};
} // namespace Service::PCTL

View File

@ -29,7 +29,7 @@
#include "core/hle/service/nifm/nifm.h" #include "core/hle/service/nifm/nifm.h"
#include "core/hle/service/ns/ns.h" #include "core/hle/service/ns/ns.h"
#include "core/hle/service/nvdrv/nvdrv.h" #include "core/hle/service/nvdrv/nvdrv.h"
#include "core/hle/service/pctl/pctl.h" #include "core/hle/service/pctl/module.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/hle/service/set/settings.h" #include "core/hle/service/set/settings.h"
#include "core/hle/service/sm/controller.h" #include "core/hle/service/sm/controller.h"