Convert ACT to the new service framework (#3521)

* Convert ACT to the new service framework

* Fix clang-format

* le updates to fix stuff

* Fixed one last thing.

* Well, I fucked up.

* Quick hotfix
This commit is contained in:
Starlet 2018-03-16 05:36:35 -04:00 committed by Weiyi Wang
parent a0f70912e1
commit 935bcdbd20
7 changed files with 57 additions and 49 deletions

View File

@ -9,9 +9,15 @@
namespace Service {
namespace ACT {
void Init() {
AddService(new ACT_A);
AddService(new ACT_U);
Module::Interface::Interface(std::shared_ptr<Module> act, const char* name)
: ServiceFramework(name, 1 /* Placeholder */), act(std::move(act)) {}
Module::Interface::~Interface() = default;
void InstallInterfaces(SM::ServiceManager& service_manager) {
auto act = std::make_shared<Module>();
std::make_shared<ACT_A>(act)->InstallAsService(service_manager);
std::make_shared<ACT_U>(act)->InstallAsService(service_manager);
}
} // namespace ACT

View File

@ -4,11 +4,25 @@
#pragma once
#include "core/hle/service/service.h"
namespace Service {
namespace ACT {
/// Initializes all ACT services
void Init();
class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
Interface(std::shared_ptr<Module> act, const char* name);
~Interface();
private:
std::shared_ptr<Module> act;
};
};
void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace ACT
} // namespace Service

View File

@ -2,28 +2,26 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/act/act.h"
#include "core/hle/service/act/act_a.h"
namespace Service {
namespace ACT {
const Interface::FunctionInfo FunctionTable[] = {
// act:u shared commands
{0x00010084, nullptr, "Initialize"},
{0x00020040, nullptr, "GetErrorCode"},
{0x000600C2, nullptr, "GetAccountDataBlock"},
{0x000B0042, nullptr, "AcquireEulaList"},
{0x000D0040, nullptr, "GenerateUuid"},
// act:a
{0x041300C2, nullptr, "UpdateMiiImage"},
{0x041B0142, nullptr, "AgreeEula"},
{0x04210042, nullptr, "UploadMii"},
{0x04230082, nullptr, "ValidateMailAddress"},
};
ACT_A::ACT_A() {
Register(FunctionTable);
ACT_A::ACT_A(std::shared_ptr<Module> act) : Module::Interface(std::move(act), "act:a") {
const FunctionInfo functions[] = {
// act:u shared commands
{0x00010084, nullptr, "Initialize"},
{0x00020040, nullptr, "GetErrorCode"},
{0x000600C2, nullptr, "GetAccountDataBlock"},
{0x000B0042, nullptr, "AcquireEulaList"},
{0x000D0040, nullptr, "GenerateUuid"},
// act:a
{0x041300C2, nullptr, "UpdateMiiImage"},
{0x041B0142, nullptr, "AgreeEula"},
{0x04210042, nullptr, "UploadMii"},
{0x04230082, nullptr, "ValidateMailAddress"},
};
RegisterHandlers(functions);
}
} // namespace ACT

View File

@ -4,18 +4,14 @@
#pragma once
#include "core/hle/service/service.h"
#include "core/hle/service/act/act.h"
namespace Service {
namespace ACT {
class ACT_A final : public Service::Interface {
class ACT_A final : public Module::Interface {
public:
ACT_A();
std::string GetPortName() const override {
return "act:a";
}
explicit ACT_A(std::shared_ptr<Module> act);
};
} // namespace ACT

View File

@ -2,24 +2,22 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/act/act.h"
#include "core/hle/service/act/act_u.h"
namespace Service {
namespace ACT {
const Interface::FunctionInfo FunctionTable[] = {
// clang-format off
{0x00010084, nullptr, "Initialize"},
{0x00020040, nullptr, "GetErrorCode"},
{0x000600C2, nullptr, "GetAccountDataBlock"},
{0x000B0042, nullptr, "AcquireEulaList"},
{0x000D0040, nullptr, "GenerateUuid"},
// clang-format on
};
ACT_U::ACT_U() {
Register(FunctionTable);
ACT_U::ACT_U(std::shared_ptr<Module> act) : Module::Interface(std::move(act), "act:u") {
static const FunctionInfo functions[] = {
// clang-format off
{0x00010084, nullptr, "Initialize"},
{0x00020040, nullptr, "GetErrorCode"},
{0x000600C2, nullptr, "GetAccountDataBlock"},
{0x000B0042, nullptr, "AcquireEulaList"},
{0x000D0040, nullptr, "GenerateUuid"},
// clang-format on
};
RegisterHandlers(functions);
}
} // namespace ACT

View File

@ -4,18 +4,14 @@
#pragma once
#include "core/hle/service/service.h"
#include "core/hle/service/act/act.h"
namespace Service {
namespace ACT {
class ACT_U final : public Interface {
class ACT_U final : public Module::Interface {
public:
ACT_U();
std::string GetPortName() const override {
return "act:u";
}
explicit ACT_U(std::shared_ptr<Module> act);
};
} // namespace ACT

View File

@ -236,7 +236,7 @@ void Init() {
FS::InstallInterfaces(*SM::g_service_manager);
FS::ArchiveInit();
ACT::Init();
ACT::InstallInterfaces(*SM::g_service_manager);
AM::InstallInterfaces(*SM::g_service_manager);
APT::InstallInterfaces(*SM::g_service_manager);
BOSS::Init();