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,28 +2,26 @@
// 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") {
// act:u shared commands const FunctionInfo functions[] = {
{0x00010084, nullptr, "Initialize"}, // act:u shared commands
{0x00020040, nullptr, "GetErrorCode"}, {0x00010084, nullptr, "Initialize"},
{0x000600C2, nullptr, "GetAccountDataBlock"}, {0x00020040, nullptr, "GetErrorCode"},
{0x000B0042, nullptr, "AcquireEulaList"}, {0x000600C2, nullptr, "GetAccountDataBlock"},
{0x000D0040, nullptr, "GenerateUuid"}, {0x000B0042, nullptr, "AcquireEulaList"},
// act:a {0x000D0040, nullptr, "GenerateUuid"},
{0x041300C2, nullptr, "UpdateMiiImage"}, // act:a
{0x041B0142, nullptr, "AgreeEula"}, {0x041300C2, nullptr, "UpdateMiiImage"},
{0x04210042, nullptr, "UploadMii"}, {0x041B0142, nullptr, "AgreeEula"},
{0x04230082, nullptr, "ValidateMailAddress"}, {0x04210042, nullptr, "UploadMii"},
}; {0x04230082, nullptr, "ValidateMailAddress"},
};
ACT_A::ACT_A() { RegisterHandlers(functions);
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,24 +2,22 @@
// 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") {
// clang-format off static const FunctionInfo functions[] = {
{0x00010084, nullptr, "Initialize"}, // clang-format off
{0x00020040, nullptr, "GetErrorCode"}, {0x00010084, nullptr, "Initialize"},
{0x000600C2, nullptr, "GetAccountDataBlock"}, {0x00020040, nullptr, "GetErrorCode"},
{0x000B0042, nullptr, "AcquireEulaList"}, {0x000600C2, nullptr, "GetAccountDataBlock"},
{0x000D0040, nullptr, "GenerateUuid"}, {0x000B0042, nullptr, "AcquireEulaList"},
// clang-format on {0x000D0040, nullptr, "GenerateUuid"},
}; // clang-format on
};
ACT_U::ACT_U() { RegisterHandlers(functions);
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();