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

@@ -162,17 +162,17 @@ std::vector<ARM_Interface::BacktraceEntry> ARM_Interface::GetBacktraceFromContex
} }
std::map<std::string, Symbols> symbols; std::map<std::string, Symbols> symbols;
for (const auto& module : modules) { for (const auto& mod : modules) {
symbols.insert_or_assign(module.second, GetSymbols(module.first, memory)); symbols.insert_or_assign(mod.second, GetSymbols(mod.first, memory));
} }
for (auto& entry : out) { for (auto& entry : out) {
VAddr base = 0; VAddr base = 0;
for (auto iter = modules.rbegin(); iter != modules.rend(); ++iter) { for (auto iter = modules.rbegin(); iter != modules.rend(); ++iter) {
const auto& module{*iter}; const auto& mod{*iter};
if (entry.original_address >= module.first) { if (entry.original_address >= mod.first) {
entry.module = module.second; entry.mod = mod.second;
base = module.first; base = mod.first;
break; break;
} }
} }
@@ -180,10 +180,10 @@ std::vector<ARM_Interface::BacktraceEntry> ARM_Interface::GetBacktraceFromContex
entry.offset = entry.original_address - base; entry.offset = entry.original_address - base;
entry.address = SEGMENT_BASE + entry.offset; entry.address = SEGMENT_BASE + entry.offset;
if (entry.module.empty()) if (entry.mod.empty())
entry.module = "unknown"; entry.mod = "unknown";
const auto symbol_set = symbols.find(entry.module); const auto symbol_set = symbols.find(entry.mod);
if (symbol_set != symbols.end()) { if (symbol_set != symbols.end()) {
const auto symbol = GetSymbolName(symbol_set->second, entry.offset); const auto symbol = GetSymbolName(symbol_set->second, entry.offset);
if (symbol.has_value()) { if (symbol.has_value()) {
@@ -218,17 +218,17 @@ std::vector<ARM_Interface::BacktraceEntry> ARM_Interface::GetBacktrace() const {
} }
std::map<std::string, Symbols> symbols; std::map<std::string, Symbols> symbols;
for (const auto& module : modules) { for (const auto& mod : modules) {
symbols.insert_or_assign(module.second, GetSymbols(module.first, memory)); symbols.insert_or_assign(mod.second, GetSymbols(mod.first, memory));
} }
for (auto& entry : out) { for (auto& entry : out) {
VAddr base = 0; VAddr base = 0;
for (auto iter = modules.rbegin(); iter != modules.rend(); ++iter) { for (auto iter = modules.rbegin(); iter != modules.rend(); ++iter) {
const auto& module{*iter}; const auto& mod{*iter};
if (entry.original_address >= module.first) { if (entry.original_address >= mod.first) {
entry.module = module.second; entry.mod = mod.second;
base = module.first; base = mod.first;
break; break;
} }
} }
@@ -236,10 +236,10 @@ std::vector<ARM_Interface::BacktraceEntry> ARM_Interface::GetBacktrace() const {
entry.offset = entry.original_address - base; entry.offset = entry.original_address - base;
entry.address = SEGMENT_BASE + entry.offset; entry.address = SEGMENT_BASE + entry.offset;
if (entry.module.empty()) if (entry.mod.empty())
entry.module = "unknown"; entry.mod = "unknown";
const auto symbol_set = symbols.find(entry.module); const auto symbol_set = symbols.find(entry.mod);
if (symbol_set != symbols.end()) { if (symbol_set != symbols.end()) {
const auto symbol = GetSymbolName(symbol_set->second, entry.offset); const auto symbol = GetSymbolName(symbol_set->second, entry.offset);
if (symbol.has_value()) { if (symbol.has_value()) {
@@ -262,7 +262,7 @@ void ARM_Interface::LogBacktrace() const {
const auto backtrace = GetBacktrace(); const auto backtrace = GetBacktrace();
for (const auto& entry : backtrace) { for (const auto& entry : backtrace) {
LOG_ERROR(Core_ARM, "{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address, LOG_ERROR(Core_ARM, "{:20}{:016X} {:016X} {:016X} {}", entry.mod, entry.address,
entry.original_address, entry.offset, entry.name); entry.original_address, entry.offset, entry.name);
} }
} }

View File

@@ -162,7 +162,7 @@ public:
virtual void PrepareReschedule() = 0; virtual void PrepareReschedule() = 0;
struct BacktraceEntry { struct BacktraceEntry {
std::string module; std::string mod;
u64 address; u64 address;
u64 original_address; u64 original_address;
u64 offset; u64 offset;

View File

@@ -10,7 +10,8 @@ ErrorApplet::~ErrorApplet() = default;
void DefaultErrorApplet::ShowError(ResultCode error, std::function<void()> finished) const { void DefaultErrorApplet::ShowError(ResultCode error, std::function<void()> finished) const {
LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})",
static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); static_cast<u32>(error.error_module.Value()), error.description.Value(),
error.raw);
} }
void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
@@ -18,7 +19,8 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::s
LOG_CRITICAL( LOG_CRITICAL(
Service_Fatal, Service_Fatal,
"Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}",
static_cast<u32>(error.module.Value()), error.description.Value(), error.raw, time.count()); static_cast<u32>(error.error_module.Value()), error.description.Value(), error.raw,
time.count());
} }
void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text, void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text,
@@ -26,7 +28,8 @@ void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_
std::function<void()> finished) const { std::function<void()> finished) const {
LOG_CRITICAL(Service_Fatal, LOG_CRITICAL(Service_Fatal,
"Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})",
static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); static_cast<u32>(error.error_module.Value()), error.description.Value(),
error.raw);
LOG_CRITICAL(Service_Fatal, " Main Text: {}", main_text); LOG_CRITICAL(Service_Fatal, " Main Text: {}", main_text);
LOG_CRITICAL(Service_Fatal, " Detail Text: {}", detail_text); LOG_CRITICAL(Service_Fatal, " Detail Text: {}", detail_text);
} }

View File

@@ -189,16 +189,16 @@ std::vector<Module> modules;
} // Anonymous namespace } // Anonymous namespace
void RegisterModule(std::string name, VAddr beg, VAddr end, bool add_elf_ext) { void RegisterModule(std::string name, VAddr beg, VAddr end, bool add_elf_ext) {
Module module; Module mod;
if (add_elf_ext) { if (add_elf_ext) {
Common::SplitPath(name, nullptr, &module.name, nullptr); Common::SplitPath(name, nullptr, &mod.name, nullptr);
module.name += ".elf"; mod.name += ".elf";
} else { } else {
module.name = std::move(name); mod.name = std::move(name);
} }
module.beg = beg; mod.beg = beg;
module.end = end; mod.end = end;
modules.push_back(std::move(module)); modules.push_back(std::move(mod));
} }
static Kernel::Thread* FindThreadById(s64 id) { static Kernel::Thread* FindThreadById(s64 id) {
@@ -671,10 +671,10 @@ static void HandleQuery() {
std::string buffer; std::string buffer;
buffer += "l<?xml version=\"1.0\"?>"; buffer += "l<?xml version=\"1.0\"?>";
buffer += "<library-list>"; buffer += "<library-list>";
for (const auto& module : modules) { for (const auto& mod : modules) {
buffer += buffer +=
fmt::format(R"*("<library name = "{}"><segment address = "0x{:x}"/></library>)*", fmt::format(R"*("<library name = "{}"><segment address = "0x{:x}"/></library>)*",
module.name, module.beg); mod.name, mod.beg);
} }
buffer += "</library-list>"; buffer += "</library-list>";
SendReply(buffer.c_str()); SendReply(buffer.c_str());

View File

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

View File

@@ -807,25 +807,25 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid); 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, std::shared_ptr<ProfileManager> profile_manager, Core::System& system,
const char* name) 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) {} profile_manager(std::move(profile_manager)), system(system) {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;
void InstallInterfaces(Core::System& system) { 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>(); 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()); ->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()); ->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()); ->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()); ->InstallAsService(system.ServiceManager());
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -14,7 +14,7 @@ namespace Service::BCAT {
class BCAT final : public Module::Interface { class BCAT final : public Module::Interface {
public: 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); FileSystem::FileSystemController& fsc, const char* name);
~BCAT() override; ~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)); 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) 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_, backend{CreateBackendFromSettings(system_,
[&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })}, [&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })},
system{system_} {} system{system_} {}
@@ -589,14 +589,14 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;
void InstallInterfaces(Core::System& system) { void InstallInterfaces(Core::System& system) {
auto module = std::make_shared<Module>(); auto interface_module = std::make_shared<Module>();
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:a") std::make_shared<BCAT>(system, interface_module, system.GetFileSystemController(), "bcat:a")
->InstallAsService(system.ServiceManager()); ->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()); ->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()); ->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()); ->InstallAsService(system.ServiceManager());
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ namespace Service::Fatal {
class Fatal_P final : public Module::Interface { class Fatal_P final : public Module::Interface {
public: 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; ~Fatal_P() override;
}; };

View File

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

View File

@@ -10,7 +10,7 @@ namespace Service::Fatal {
class Fatal_U final : public Module::Interface { class Fatal_U final : public Module::Interface {
public: 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; ~Fatal_U() override;
}; };

View File

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

View File

@@ -16,14 +16,15 @@ class Module final {
public: public:
class Interface : public ServiceFramework<Interface> { class Interface : public ServiceFramework<Interface> {
public: 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; ~Interface() override;
void CreateFriendService(Kernel::HLERequestContext& ctx); void CreateFriendService(Kernel::HLERequestContext& ctx);
void CreateNotificationService(Kernel::HLERequestContext& ctx); void CreateNotificationService(Kernel::HLERequestContext& ctx);
protected: protected:
std::shared_ptr<Module> module; std::shared_ptr<Module> interface_module;
Core::System& system; Core::System& system;
}; };
}; };

View File

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

View File

@@ -10,7 +10,8 @@ namespace Service::Friend {
class Friend final : public Module::Interface { class Friend final : public Module::Interface {
public: 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; ~Friend() override;
}; };

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ namespace Service::NFP {
class NFP_User final : public Module::Interface { class NFP_User final : public Module::Interface {
public: 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; ~NFP_User() override;
}; };

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,8 @@
namespace Service::SPL { 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[] = { static const FunctionInfo functions[] = {
{0, &CSRNG::GetRandomBytes, "GetRandomBytes"}, {0, &CSRNG::GetRandomBytes, "GetRandomBytes"},
}; };

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,8 @@
namespace Service::SPL { 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[] = { static const FunctionInfo functions[] = {
{0, nullptr, "GetConfig"}, {0, nullptr, "GetConfig"},
{1, nullptr, "ModularExponentiate"}, {1, nullptr, "ModularExponentiate"},

View File

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

View File

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

View File

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

View File

@@ -135,13 +135,13 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
// Use the NSO module loader to figure out the code layout // Use the NSO module loader to figure out the code layout
std::size_t code_size{}; std::size_t code_size{};
for (const auto& module : static_modules) { for (const auto& mod : static_modules) {
const FileSys::VirtualFile module_file{dir->GetFile(module)}; const FileSys::VirtualFile module_file{dir->GetFile(mod)};
if (!module_file) { if (!module_file) {
continue; continue;
} }
const bool should_pass_arguments = std::strcmp(module, "rtld") == 0; const bool should_pass_arguments = std::strcmp(mod, "rtld") == 0;
const auto tentative_next_load_addr = AppLoader_NSO::LoadModule( const auto tentative_next_load_addr = AppLoader_NSO::LoadModule(
process, system, *module_file, code_size, should_pass_arguments, false); process, system, *module_file, code_size, should_pass_arguments, false);
if (!tentative_next_load_addr) { if (!tentative_next_load_addr) {
@@ -161,14 +161,14 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
const VAddr base_address{process.PageTable().GetCodeRegionStart()}; const VAddr base_address{process.PageTable().GetCodeRegionStart()};
VAddr next_load_addr{base_address}; VAddr next_load_addr{base_address};
const FileSys::PatchManager pm{metadata.GetTitleID()}; const FileSys::PatchManager pm{metadata.GetTitleID()};
for (const auto& module : static_modules) { for (const auto& mod : static_modules) {
const FileSys::VirtualFile module_file{dir->GetFile(module)}; const FileSys::VirtualFile module_file{dir->GetFile(mod)};
if (!module_file) { if (!module_file) {
continue; continue;
} }
const VAddr load_addr{next_load_addr}; const VAddr load_addr{next_load_addr};
const bool should_pass_arguments = std::strcmp(module, "rtld") == 0; const bool should_pass_arguments = std::strcmp(mod, "rtld") == 0;
const auto tentative_next_load_addr = AppLoader_NSO::LoadModule( const auto tentative_next_load_addr = AppLoader_NSO::LoadModule(
process, system, *module_file, load_addr, should_pass_arguments, true, pm); process, system, *module_file, load_addr, should_pass_arguments, true, pm);
if (!tentative_next_load_addr) { if (!tentative_next_load_addr) {
@@ -176,10 +176,10 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
} }
next_load_addr = *tentative_next_load_addr; next_load_addr = *tentative_next_load_addr;
modules.insert_or_assign(load_addr, module); modules.insert_or_assign(load_addr, mod);
LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr); LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", mod, load_addr);
// Register module with GDBStub // Register module with GDBStub
GDBStub::RegisterModule(module, load_addr, next_load_addr - 1, false); GDBStub::RegisterModule(mod, load_addr, next_load_addr - 1, false);
} }
// Find the RomFS by searching for a ".romfs" file in this directory // Find the RomFS by searching for a ".romfs" file in this directory

View File

@@ -69,7 +69,7 @@ json GetReportCommonData(u64 title_id, ResultCode result, const std::string& tim
auto out = json{ auto out = json{
{"title_id", fmt::format("{:016X}", title_id)}, {"title_id", fmt::format("{:016X}", title_id)},
{"result_raw", fmt::format("{:08X}", result.raw)}, {"result_raw", fmt::format("{:08X}", result.raw)},
{"result_module", fmt::format("{:08X}", static_cast<u32>(result.module.Value()))}, {"result_module", fmt::format("{:08X}", static_cast<u32>(result.error_module.Value()))},
{"result_description", fmt::format("{:08X}", result.description.Value())}, {"result_description", fmt::format("{:08X}", result.description.Value())},
{"timestamp", timestamp}, {"timestamp", timestamp},
}; };
@@ -127,7 +127,7 @@ json GetBacktraceData(Core::System& system) {
const auto& backtrace{system.CurrentArmInterface().GetBacktrace()}; const auto& backtrace{system.CurrentArmInterface().GetBacktrace()};
for (const auto& entry : backtrace) { for (const auto& entry : backtrace) {
out.push_back({ out.push_back({
{"module", entry.module}, {"module", entry.mod},
{"address", fmt::format("{:016X}", entry.address)}, {"address", fmt::format("{:016X}", entry.address)},
{"original_address", fmt::format("{:016X}", entry.original_address)}, {"original_address", fmt::format("{:016X}", entry.original_address)},
{"offset", fmt::format("{:016X}", entry.offset)}, {"offset", fmt::format("{:016X}", entry.offset)},

View File

@@ -529,7 +529,7 @@ void VKBlitScreen::CreateGraphicsPipeline() {
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.stage = VK_SHADER_STAGE_VERTEX_BIT, .stage = VK_SHADER_STAGE_VERTEX_BIT,
.module = *vertex_shader, .shader_module = *vertex_shader,
.pName = "main", .pName = "main",
.pSpecializationInfo = nullptr, .pSpecializationInfo = nullptr,
}, },
@@ -538,7 +538,7 @@ void VKBlitScreen::CreateGraphicsPipeline() {
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.stage = VK_SHADER_STAGE_FRAGMENT_BIT, .stage = VK_SHADER_STAGE_FRAGMENT_BIT,
.module = *fragment_shader, .shader_module = *fragment_shader,
.pName = "main", .pName = "main",
.pSpecializationInfo = nullptr, .pSpecializationInfo = nullptr,
}, },

View File

@@ -418,7 +418,7 @@ VKComputePass::VKComputePass(const VKDevice& device, VKDescriptorPool& descripto
auto code_copy = std::make_unique<u32[]>(code_size / sizeof(u32) + 1); auto code_copy = std::make_unique<u32[]>(code_size / sizeof(u32) + 1);
std::memcpy(code_copy.get(), code, code_size); std::memcpy(code_copy.get(), code, code_size);
module = device.GetLogical().CreateShaderModule({ shader_module = device.GetLogical().CreateShaderModule({
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
@@ -436,7 +436,7 @@ VKComputePass::VKComputePass(const VKDevice& device, VKDescriptorPool& descripto
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.stage = VK_SHADER_STAGE_COMPUTE_BIT, .stage = VK_SHADER_STAGE_COMPUTE_BIT,
.module = *module, .shader_module = *shader_module,
.pName = "main", .pName = "main",
.pSpecializationInfo = nullptr, .pSpecializationInfo = nullptr,
}, },

View File

@@ -40,7 +40,7 @@ protected:
private: private:
vk::DescriptorSetLayout descriptor_set_layout; vk::DescriptorSetLayout descriptor_set_layout;
std::optional<DescriptorAllocator> descriptor_allocator; std::optional<DescriptorAllocator> descriptor_allocator;
vk::ShaderModule module; vk::ShaderModule shader_module;
}; };
class QuadArrayPass final : public VKComputePass { class QuadArrayPass final : public VKComputePass {

View File

@@ -128,7 +128,7 @@ vk::Pipeline VKComputePipeline::CreatePipeline() const {
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.stage = VK_SHADER_STAGE_COMPUTE_BIT, .stage = VK_SHADER_STAGE_COMPUTE_BIT,
.module = *shader_module, .shader_module = *shader_module,
.pName = "main", .pName = "main",
.pSpecializationInfo = nullptr, .pSpecializationInfo = nullptr,
}, },

View File

@@ -438,7 +438,7 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa
stage_ci.pNext = nullptr; stage_ci.pNext = nullptr;
stage_ci.flags = 0; stage_ci.flags = 0;
stage_ci.stage = MaxwellToVK::ShaderStage(static_cast<Tegra::Engines::ShaderType>(stage)); stage_ci.stage = MaxwellToVK::ShaderStage(static_cast<Tegra::Engines::ShaderType>(stage));
stage_ci.module = *modules[module_index++]; stage_ci.shader_module = *modules[module_index++];
stage_ci.pName = "main"; stage_ci.pName = "main";
stage_ci.pSpecializationInfo = nullptr; stage_ci.pSpecializationInfo = nullptr;

View File

@@ -21,7 +21,7 @@ void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished)
emit MainWindowDisplayError( emit MainWindowDisplayError(
tr("An error has occured.\nPlease try again or contact the developer of the " tr("An error has occured.\nPlease try again or contact the developer of the "
"software.\n\nError Code: %1-%2 (0x%3)") "software.\n\nError Code: %1-%2 (0x%3)")
.arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) .arg(static_cast<u32>(error.error_module.Value()) + 2000, 4, 10, QChar::fromLatin1('0'))
.arg(error.description, 4, 10, QChar::fromLatin1('0')) .arg(error.description, 4, 10, QChar::fromLatin1('0'))
.arg(error.raw, 8, 16, QChar::fromLatin1('0'))); .arg(error.raw, 8, 16, QChar::fromLatin1('0')));
} }
@@ -36,7 +36,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::secon
"developer of the software.\n\nError Code: %3-%4 (0x%5)") "developer of the software.\n\nError Code: %3-%4 (0x%5)")
.arg(date_time.toString(QStringLiteral("dddd, MMMM d, yyyy"))) .arg(date_time.toString(QStringLiteral("dddd, MMMM d, yyyy")))
.arg(date_time.toString(QStringLiteral("h:mm:ss A"))) .arg(date_time.toString(QStringLiteral("h:mm:ss A")))
.arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) .arg(static_cast<u32>(error.error_module.Value()) + 2000, 4, 10, QChar::fromLatin1('0'))
.arg(error.description, 4, 10, QChar::fromLatin1('0')) .arg(error.description, 4, 10, QChar::fromLatin1('0'))
.arg(error.raw, 8, 16, QChar::fromLatin1('0'))); .arg(error.raw, 8, 16, QChar::fromLatin1('0')));
} }
@@ -47,7 +47,7 @@ void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_te
this->callback = std::move(finished); this->callback = std::move(finished);
emit MainWindowDisplayError( emit MainWindowDisplayError(
tr("An error has occured.\nError Code: %1-%2 (0x%3)\n\n%4\n\n%5") tr("An error has occured.\nError Code: %1-%2 (0x%3)\n\n%4\n\n%5")
.arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) .arg(static_cast<u32>(error.error_module.Value()) + 2000, 4, 10, QChar::fromLatin1('0'))
.arg(error.description, 4, 10, QChar::fromLatin1('0')) .arg(error.description, 4, 10, QChar::fromLatin1('0'))
.arg(error.raw, 8, 16, QChar::fromLatin1('0')) .arg(error.raw, 8, 16, QChar::fromLatin1('0'))
.arg(QString::fromStdString(dialog_text)) .arg(QString::fromStdString(dialog_text))

View File

@@ -162,7 +162,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
thread.GetContext64()); thread.GetContext64());
for (auto& entry : backtrace) { for (auto& entry : backtrace) {
std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address, std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.mod, entry.address,
entry.original_address, entry.offset, entry.name); entry.original_address, entry.offset, entry.name);
list.push_back(std::make_unique<WaitTreeText>(QString::fromStdString(s))); list.push_back(std::make_unique<WaitTreeText>(QString::fromStdString(s)));
} }