style: C++20 module keyword fixup

With C++20, "module" is now considered a keyword, this PR removes mentions of the word "module".
This commit is contained in:
David Marcec
2020-09-20 16:33:47 +10:00
parent 8a85a562ed
commit 35795a042c
55 changed files with 209 additions and 185 deletions

View File

@@ -116,13 +116,13 @@ enum class ErrorModule : u32 {
union ResultCode {
u32 raw;
BitField<0, 9, ErrorModule> module;
BitField<0, 9, ErrorModule> error_module;
BitField<9, 13, u32> description;
constexpr explicit ResultCode(u32 raw) : raw(raw) {}
constexpr ResultCode(ErrorModule module_, u32 description_)
: raw(module.FormatValue(module_) | description.FormatValue(description_)) {}
: raw(error_module.FormatValue(module_) | description.FormatValue(description_)) {}
constexpr bool IsSuccess() const {
return raw == 0;

View File

@@ -807,25 +807,25 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid);
}
Module::Interface::Interface(std::shared_ptr<Module> module,
Module::Interface::Interface(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system,
const char* name)
: ServiceFramework(name), module(std::move(module)),
: ServiceFramework(name), interface_module(std::move(interface_module)),
profile_manager(std::move(profile_manager)), system(system) {}
Module::Interface::~Interface() = default;
void InstallInterfaces(Core::System& system) {
auto module = std::make_shared<Module>();
auto interface_module = std::make_shared<Module>();
auto profile_manager = std::make_shared<ProfileManager>();
std::make_shared<ACC_AA>(module, profile_manager, system)
std::make_shared<ACC_AA>(interface_module, profile_manager, system)
->InstallAsService(system.ServiceManager());
std::make_shared<ACC_SU>(module, profile_manager, system)
std::make_shared<ACC_SU>(interface_module, profile_manager, system)
->InstallAsService(system.ServiceManager());
std::make_shared<ACC_U0>(module, profile_manager, system)
std::make_shared<ACC_U0>(interface_module, profile_manager, system)
->InstallAsService(system.ServiceManager());
std::make_shared<ACC_U1>(module, profile_manager, system)
std::make_shared<ACC_U1>(interface_module, profile_manager, system)
->InstallAsService(system.ServiceManager());
}

View File

@@ -15,7 +15,7 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module,
explicit Interface(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system,
const char* name);
~Interface() override;
@@ -57,7 +57,7 @@ public:
ApplicationInfo application_info{};
protected:
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
std::shared_ptr<ProfileManager> profile_manager;
Core::System& system;
};

View File

@@ -6,9 +6,9 @@
namespace Service::Account {
ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:aa") {
ACC_AA::ACC_AA(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system)
: Module::Interface(std::move(interface_module), std::move(profile_manager), system, "acc:aa") {
static const FunctionInfo functions[] = {
{0, nullptr, "EnsureCacheAsync"},
{1, nullptr, "LoadCache"},

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_AA final : public Module::Interface {
public:
explicit ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_AA(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system);
~ACC_AA() override;
};

View File

@@ -6,9 +6,9 @@
namespace Service::Account {
ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:su") {
ACC_SU::ACC_SU(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system)
: Module::Interface(std::move(interface_module), std::move(profile_manager), system, "acc:su") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ACC_SU::GetUserCount, "GetUserCount"},

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_SU final : public Module::Interface {
public:
explicit ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_SU(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system);
~ACC_SU() override;
};

View File

@@ -6,9 +6,9 @@
namespace Service::Account {
ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u0") {
ACC_U0::ACC_U0(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system)
: Module::Interface(std::move(interface_module), std::move(profile_manager), system, "acc:u0") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ACC_U0::GetUserCount, "GetUserCount"},

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_U0 final : public Module::Interface {
public:
explicit ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_U0(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system);
~ACC_U0() override;
};

View File

@@ -6,9 +6,9 @@
namespace Service::Account {
ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u1") {
ACC_U1::ACC_U1(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system)
: Module::Interface(std::move(interface_module), std::move(profile_manager), system, "acc:u1") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ACC_U1::GetUserCount, "GetUserCount"},

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_U1 final : public Module::Interface {
public:
explicit ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_U1(std::shared_ptr<Module> interface_module,
std::shared_ptr<ProfileManager> profile_manager, Core::System& system);
~ACC_U1() override;
};

View File

@@ -77,11 +77,11 @@ void CopyArgumentData(const std::vector<u8>& data, T& variable) {
ResultCode Decode64BitError(u64 error) {
const auto description = (error >> 32) & 0x1FFF;
auto module = error & 0x3FF;
if (module >= 2000)
module -= 2000;
module &= 0x1FF;
return {static_cast<ErrorModule>(module), static_cast<u32>(description)};
auto error_module = error & 0x3FF;
if (error_module >= 2000)
error_module -= 2000;
error_module &= 0x1FF;
return {static_cast<ErrorModule>(error_module), static_cast<u32>(description)};
}
} // Anonymous namespace

View File

@@ -6,9 +6,9 @@
namespace Service::BCAT {
BCAT::BCAT(Core::System& system, std::shared_ptr<Module> module,
BCAT::BCAT(Core::System& system, std::shared_ptr<Module> interface_module,
FileSystem::FileSystemController& fsc, const char* name)
: Interface(system, std::move(module), fsc, name) {
: Interface(system, std::move(interface_module), fsc, name) {
// clang-format off
static const FunctionInfo functions[] = {
{0, &BCAT::CreateBcatService, "CreateBcatService"},

View File

@@ -14,7 +14,7 @@ namespace Service::BCAT {
class BCAT final : public Module::Interface {
public:
explicit BCAT(Core::System& system, std::shared_ptr<Module> module,
explicit BCAT(Core::System& system, std::shared_ptr<Module> interface_module,
FileSystem::FileSystemController& fsc, const char* name);
~BCAT() override;
};

View File

@@ -579,9 +579,9 @@ std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System
return std::make_unique<NullBackend>(std::move(getter));
}
Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> interface_module,
FileSystem::FileSystemController& fsc_, const char* name)
: ServiceFramework(name), fsc{fsc_}, module{std::move(module_)},
: ServiceFramework(name), fsc{fsc_}, interface_module{std::move(interface_module)},
backend{CreateBackendFromSettings(system_,
[&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })},
system{system_} {}
@@ -589,14 +589,14 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu
Module::Interface::~Interface() = default;
void InstallInterfaces(Core::System& system) {
auto module = std::make_shared<Module>();
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:a")
auto interface_module = std::make_shared<Module>();
std::make_shared<BCAT>(system, interface_module, system.GetFileSystemController(), "bcat:a")
->InstallAsService(system.ServiceManager());
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:m")
std::make_shared<BCAT>(system, interface_module, system.GetFileSystemController(), "bcat:m")
->InstallAsService(system.ServiceManager());
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:u")
std::make_shared<BCAT>(system, interface_module, system.GetFileSystemController(), "bcat:u")
->InstallAsService(system.ServiceManager());
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:s")
std::make_shared<BCAT>(system, interface_module, system.GetFileSystemController(), "bcat:s")
->InstallAsService(system.ServiceManager());
}

View File

@@ -24,7 +24,7 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(Core::System& system_, std::shared_ptr<Module> module_,
explicit Interface(Core::System& system_, std::shared_ptr<Module> interface_module,
FileSystem::FileSystemController& fsc_, const char* name);
~Interface() override;
@@ -35,7 +35,7 @@ public:
protected:
FileSystem::FileSystemController& fsc;
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
std::unique_ptr<Backend> backend;
private:

View File

@@ -20,8 +20,9 @@
namespace Service::Fatal {
Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name)
: ServiceFramework(name), module(std::move(module)), system(system) {}
Module::Interface::Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name)
: ServiceFramework(name), interface_module(std::move(interface_module)), system(system) {}
Module::Interface::~Interface() = default;
@@ -75,7 +76,7 @@ static void GenerateErrorReport(Core::System& system, ResultCode error_code,
"Program entry point: 0x{:16X}\n"
"\n",
Common::g_scm_branch, Common::g_scm_desc, title_id, error_code.raw,
2000 + static_cast<u32>(error_code.module.Value()),
2000 + static_cast<u32>(error_code.error_module.Value()),
static_cast<u32>(error_code.description.Value()), info.set_flags, info.program_entry_point);
if (info.backtrace_size != 0x0) {
crash_report += "Registers:\n";
@@ -166,9 +167,9 @@ void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx)
}
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
auto module = std::make_shared<Module>();
std::make_shared<Fatal_P>(module, system)->InstallAsService(service_manager);
std::make_shared<Fatal_U>(module, system)->InstallAsService(service_manager);
auto interface_module = std::make_shared<Module>();
std::make_shared<Fatal_P>(interface_module, system)->InstallAsService(service_manager);
std::make_shared<Fatal_U>(interface_module, system)->InstallAsService(service_manager);
}
} // namespace Service::Fatal

View File

@@ -16,7 +16,8 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name);
explicit Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name);
~Interface() override;
void ThrowFatal(Kernel::HLERequestContext& ctx);
@@ -24,7 +25,7 @@ public:
void ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx);
protected:
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
Core::System& system;
};
};

View File

@@ -6,8 +6,8 @@
namespace Service::Fatal {
Fatal_P::Fatal_P(std::shared_ptr<Module> module, Core::System& system)
: Module::Interface(std::move(module), system, "fatal:p") {}
Fatal_P::Fatal_P(std::shared_ptr<Module> interface_module, Core::System& system)
: Module::Interface(std::move(interface_module), system, "fatal:p") {}
Fatal_P::~Fatal_P() = default;

View File

@@ -10,7 +10,7 @@ namespace Service::Fatal {
class Fatal_P final : public Module::Interface {
public:
explicit Fatal_P(std::shared_ptr<Module> module, Core::System& system);
explicit Fatal_P(std::shared_ptr<Module> interface_module, Core::System& system);
~Fatal_P() override;
};

View File

@@ -6,8 +6,8 @@
namespace Service::Fatal {
Fatal_U::Fatal_U(std::shared_ptr<Module> module, Core::System& system)
: Module::Interface(std::move(module), system, "fatal:u") {
Fatal_U::Fatal_U(std::shared_ptr<Module> interface_module, Core::System& system)
: Module::Interface(std::move(interface_module), system, "fatal:u") {
static const FunctionInfo functions[] = {
{0, &Fatal_U::ThrowFatal, "ThrowFatal"},
{1, &Fatal_U::ThrowFatalWithPolicy, "ThrowFatalWithPolicy"},

View File

@@ -10,7 +10,7 @@ namespace Service::Fatal {
class Fatal_U final : public Module::Interface {
public:
explicit Fatal_U(std::shared_ptr<Module> module, Core::System& system);
explicit Fatal_U(std::shared_ptr<Module> interface_module, Core::System& system);
~Fatal_U() override;
};

View File

@@ -281,18 +281,24 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx
rb.PushIpcInterface<INotificationService>(uuid, system);
}
Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name)
: ServiceFramework(name), module(std::move(module)), system(system) {}
Module::Interface::Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name)
: ServiceFramework(name), interface_module(std::move(interface_module)), system(system) {}
Module::Interface::~Interface() = default;
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
auto module = std::make_shared<Module>();
std::make_shared<Friend>(module, system, "friend:a")->InstallAsService(service_manager);
std::make_shared<Friend>(module, system, "friend:m")->InstallAsService(service_manager);
std::make_shared<Friend>(module, system, "friend:s")->InstallAsService(service_manager);
std::make_shared<Friend>(module, system, "friend:u")->InstallAsService(service_manager);
std::make_shared<Friend>(module, system, "friend:v")->InstallAsService(service_manager);
auto interface_module = std::make_shared<Module>();
std::make_shared<Friend>(interface_module, system, "friend:a")
->InstallAsService(service_manager);
std::make_shared<Friend>(interface_module, system, "friend:m")
->InstallAsService(service_manager);
std::make_shared<Friend>(interface_module, system, "friend:s")
->InstallAsService(service_manager);
std::make_shared<Friend>(interface_module, system, "friend:u")
->InstallAsService(service_manager);
std::make_shared<Friend>(interface_module, system, "friend:v")
->InstallAsService(service_manager);
}
} // namespace Service::Friend

View File

@@ -16,14 +16,15 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name);
explicit Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name);
~Interface() override;
void CreateFriendService(Kernel::HLERequestContext& ctx);
void CreateNotificationService(Kernel::HLERequestContext& ctx);
protected:
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
Core::System& system;
};
};

View File

@@ -6,8 +6,8 @@
namespace Service::Friend {
Friend::Friend(std::shared_ptr<Module> module, Core::System& system, const char* name)
: Interface(std::move(module), system, name) {
Friend::Friend(std::shared_ptr<Module> interface_module, Core::System& system, const char* name)
: Interface(std::move(interface_module), system, name) {
static const FunctionInfo functions[] = {
{0, &Friend::CreateFriendService, "CreateFriendService"},
{1, &Friend::CreateNotificationService, "CreateNotificationService"},

View File

@@ -10,7 +10,8 @@ namespace Service::Friend {
class Friend final : public Module::Interface {
public:
explicit Friend(std::shared_ptr<Module> module, Core::System& system, const char* name);
explicit Friend(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name);
~Friend() override;
};

View File

@@ -21,8 +21,9 @@ namespace ErrCodes {
constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152);
} // namespace ErrCodes
Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name)
: ServiceFramework(name), module(std::move(module)), system(system) {
Module::Interface::Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name)
: ServiceFramework(name), interface_module(std::move(interface_module)), system(system) {
auto& kernel = system.Kernel();
nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, "IUser:NFCTagDetected");
}
@@ -354,8 +355,8 @@ const Module::Interface::AmiiboFile& Module::Interface::GetAmiiboBuffer() const
}
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
auto module = std::make_shared<Module>();
std::make_shared<NFP_User>(module, system)->InstallAsService(service_manager);
auto interface_module = std::make_shared<Module>();
std::make_shared<NFP_User>(interface_module, system)->InstallAsService(service_manager);
}
} // namespace Service::NFP

View File

@@ -16,7 +16,8 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name);
explicit Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name);
~Interface() override;
struct ModelInfo {
@@ -42,7 +43,7 @@ public:
AmiiboFile amiibo{};
protected:
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
Core::System& system;
};
};

View File

@@ -6,8 +6,8 @@
namespace Service::NFP {
NFP_User::NFP_User(std::shared_ptr<Module> module, Core::System& system)
: Module::Interface(std::move(module), system, "nfp:user") {
NFP_User::NFP_User(std::shared_ptr<Module> interface_module, Core::System& system)
: Module::Interface(std::move(interface_module), system, "nfp:user") {
static const FunctionInfo functions[] = {
{0, &NFP_User::CreateUserInterface, "CreateUserInterface"},
};

View File

@@ -10,7 +10,7 @@ namespace Service::NFP {
class NFP_User final : public Module::Interface {
public:
explicit NFP_User(std::shared_ptr<Module> module, Core::System& system);
explicit NFP_User(std::shared_ptr<Module> interface_module, Core::System& system);
~NFP_User() override;
};

View File

@@ -148,17 +148,17 @@ void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext
rb.PushIpcInterface<IParentalControlService>();
}
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
: ServiceFramework(name), module(std::move(module)) {}
Module::Interface::Interface(std::shared_ptr<Module> interface_module, const char* name)
: ServiceFramework(name), interface_module(std::move(interface_module)) {}
Module::Interface::~Interface() = default;
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);
auto interface_module = std::make_shared<Module>();
std::make_shared<PCTL>(interface_module, "pctl")->InstallAsService(service_manager);
std::make_shared<PCTL>(interface_module, "pctl:a")->InstallAsService(service_manager);
std::make_shared<PCTL>(interface_module, "pctl:r")->InstallAsService(service_manager);
std::make_shared<PCTL>(interface_module, "pctl:s")->InstallAsService(service_manager);
}
} // namespace Service::PCTL

View File

@@ -12,14 +12,14 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, const char* name);
explicit Interface(std::shared_ptr<Module> interface_module, const char* name);
~Interface() override;
void CreateService(Kernel::HLERequestContext& ctx);
void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx);
protected:
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
};
};

View File

@@ -6,8 +6,8 @@
namespace Service::PCTL {
PCTL::PCTL(std::shared_ptr<Module> module, const char* name)
: Module::Interface(std::move(module), name) {
PCTL::PCTL(std::shared_ptr<Module> interface_module, const char* name)
: Module::Interface(std::move(interface_module), name) {
static const FunctionInfo functions[] = {
{0, &PCTL::CreateService, "CreateService"},
{1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},

View File

@@ -10,7 +10,7 @@ namespace Service::PCTL {
class PCTL final : public Module::Interface {
public:
explicit PCTL(std::shared_ptr<Module> module, const char* name);
explicit PCTL(std::shared_ptr<Module> interface_module, const char* name);
~PCTL() override;
};

View File

@@ -6,7 +6,8 @@
namespace Service::SPL {
CSRNG::CSRNG(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "csrng") {
CSRNG::CSRNG(std::shared_ptr<Module> interface_module)
: Module::Interface(std::move(interface_module), "csrng") {
static const FunctionInfo functions[] = {
{0, &CSRNG::GetRandomBytes, "GetRandomBytes"},
};

View File

@@ -10,7 +10,7 @@ namespace Service::SPL {
class CSRNG final : public Module::Interface {
public:
explicit CSRNG(std::shared_ptr<Module> module);
explicit CSRNG(std::shared_ptr<Module> interface_module);
~CSRNG() override;
};

View File

@@ -17,8 +17,8 @@
namespace Service::SPL {
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
: ServiceFramework(name), module(std::move(module)),
Module::Interface::Interface(std::shared_ptr<Module> interface_module, const char* name)
: ServiceFramework(name), interface_module(std::move(interface_module)),
rng(Settings::values.rng_seed.GetValue().value_or(std::time(nullptr))) {}
Module::Interface::~Interface() = default;
@@ -39,9 +39,9 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
}
void InstallInterfaces(SM::ServiceManager& service_manager) {
auto module = std::make_shared<Module>();
std::make_shared<CSRNG>(module)->InstallAsService(service_manager);
std::make_shared<SPL>(module)->InstallAsService(service_manager);
auto interface_module = std::make_shared<Module>();
std::make_shared<CSRNG>(interface_module)->InstallAsService(service_manager);
std::make_shared<SPL>(interface_module)->InstallAsService(service_manager);
}
} // namespace Service::SPL

View File

@@ -13,13 +13,13 @@ class Module final {
public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, const char* name);
explicit Interface(std::shared_ptr<Module> interface_module, const char* name);
~Interface() override;
void GetRandomBytes(Kernel::HLERequestContext& ctx);
protected:
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
private:
std::mt19937 rng;

View File

@@ -6,7 +6,8 @@
namespace Service::SPL {
SPL::SPL(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "spl:") {
SPL::SPL(std::shared_ptr<Module> interface_module)
: Module::Interface(std::move(interface_module), "spl:") {
static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"},

View File

@@ -6,8 +6,8 @@
namespace Service::Time {
Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* name)
: Module::Interface(std::move(module), system, name) {
Time::Time(std::shared_ptr<Module> interface_module, Core::System& system, const char* name)
: Module::Interface(std::move(interface_module), system, name) {
// clang-format off
static const FunctionInfo functions[] = {
{0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"},

View File

@@ -125,7 +125,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
Kernel::Thread* thread, Clock::SystemClockContext user_context,
Clock::SystemClockContext network_context, u8 type, Clock::ClockSnapshot& clock_snapshot) {
auto& time_manager{module->GetTimeManager()};
auto& time_manager{interface_module->GetTimeManager()};
clock_snapshot.is_automatic_correction_enabled =
time_manager.GetStandardUserSystemClockCore().IsAutomaticCorrectionEnabled();
@@ -182,45 +182,46 @@ void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ct
LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemClock>(module->GetTimeManager().GetStandardUserSystemClockCore(),
system);
rb.PushIpcInterface<ISystemClock>(
interface_module->GetTimeManager().GetStandardUserSystemClockCore(), system);
}
void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemClock>(module->GetTimeManager().GetStandardNetworkSystemClockCore(),
system);
rb.PushIpcInterface<ISystemClock>(
interface_module->GetTimeManager().GetStandardNetworkSystemClockCore(), system);
}
void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISteadyClock>(module->GetTimeManager().GetStandardSteadyClockCore(),
system);
rb.PushIpcInterface<ISteadyClock>(
interface_module->GetTimeManager().GetStandardSteadyClockCore(), system);
}
void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ITimeZoneService>(module->GetTimeManager().GetTimeZoneContentManager());
rb.PushIpcInterface<ITimeZoneService>(
interface_module->GetTimeManager().GetTimeZoneContentManager());
}
void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemClock>(module->GetTimeManager().GetStandardLocalSystemClockCore(),
system);
rb.PushIpcInterface<ISystemClock>(
interface_module->GetTimeManager().GetStandardLocalSystemClockCore(), system);
}
void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient(
Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called");
auto& clock_core{module->GetTimeManager().GetStandardNetworkSystemClockCore()};
auto& clock_core{interface_module->GetTimeManager().GetStandardNetworkSystemClockCore()};
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(clock_core.IsStandardNetworkSystemClockAccuracySufficient(system));
@@ -229,7 +230,7 @@ void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient(
void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called");
auto& steady_clock_core{module->GetTimeManager().GetStandardSteadyClockCore()};
auto& steady_clock_core{interface_module->GetTimeManager().GetStandardSteadyClockCore()};
if (!steady_clock_core.IsInitialized()) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERROR_UNINITIALIZED_CLOCK);
@@ -262,7 +263,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
Clock::SystemClockContext user_context{};
if (const ResultCode result{
module->GetTimeManager().GetStandardUserSystemClockCore().GetClockContext(
interface_module->GetTimeManager().GetStandardUserSystemClockCore().GetClockContext(
system, user_context)};
result.IsError()) {
IPC::ResponseBuilder rb{ctx, 2};
@@ -271,7 +272,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
}
Clock::SystemClockContext network_context{};
if (const ResultCode result{
module->GetTimeManager().GetStandardNetworkSystemClockCore().GetClockContext(
interface_module->GetTimeManager().GetStandardNetworkSystemClockCore().GetClockContext(
system, network_context)};
result.IsError()) {
IPC::ResponseBuilder rb{ctx, 2};
@@ -372,19 +373,24 @@ void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& c
LOG_DEBUG(Service_Time, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(module->GetTimeManager().GetSharedMemory().GetSharedMemoryHolder());
rb.PushCopyObjects(
interface_module->GetTimeManager().GetSharedMemory().GetSharedMemoryHolder());
}
Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name)
: ServiceFramework(name), module{std::move(module)}, system{system} {}
Module::Interface::Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name)
: ServiceFramework(name), interface_module{std::move(interface_module)}, system{system} {}
Module::Interface::~Interface() = default;
void InstallInterfaces(Core::System& system) {
auto module{std::make_shared<Module>(system)};
std::make_shared<Time>(module, system, "time:a")->InstallAsService(system.ServiceManager());
std::make_shared<Time>(module, system, "time:s")->InstallAsService(system.ServiceManager());
std::make_shared<Time>(module, system, "time:u")->InstallAsService(system.ServiceManager());
auto interface_module{std::make_shared<Module>(system)};
std::make_shared<Time>(interface_module, system, "time:a")
->InstallAsService(system.ServiceManager());
std::make_shared<Time>(interface_module, system, "time:s")
->InstallAsService(system.ServiceManager());
std::make_shared<Time>(interface_module, system, "time:u")
->InstallAsService(system.ServiceManager());
}
} // namespace Service::Time

View File

@@ -20,7 +20,8 @@ public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name);
explicit Interface(std::shared_ptr<Module> interface_module, Core::System& system,
const char* name);
~Interface() override;
void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
@@ -43,7 +44,7 @@ public:
Clock::ClockSnapshot& cloc_snapshot);
protected:
std::shared_ptr<Module> module;
std::shared_ptr<Module> interface_module;
Core::System& system;
};