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 Service {
namespace ACT { namespace ACT {
void Init() { Module::Interface::Interface(std::shared_ptr<Module> act, const char* name)
AddService(new ACT_A); : ServiceFramework(name, 1 /* Placeholder */), act(std::move(act)) {}
AddService(new ACT_U);
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 } // namespace ACT

View file

@ -4,11 +4,25 @@
#pragma once #pragma once
#include "core/hle/service/service.h"
namespace Service { namespace Service {
namespace ACT { namespace ACT {
/// Initializes all ACT services /// 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 ACT
} // namespace Service } // namespace Service

View file

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

View file

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

View file

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

View file

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

View file

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