Core: pass down Core::System reference to all services (#4272)

* Core: pass down Core::System reference to all services

This has to be done at once due to unified interface used by HLE/LLE switcher

* apt: eliminate Core::System::GetInstance

* gpu_gsp: eliminate Core::System::GetInstance in service

* hid: eliminate Core::System::GetInstance

* nwm: eliminate Core::System::GetInstance

* err_f: eliminate Core::System::GetInstance
This commit is contained in:
Weiyi Wang 2018-10-05 10:59:43 -04:00 committed by GitHub
parent 008242c5f3
commit b163502744
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 329 additions and 111 deletions

View file

@ -69,15 +69,15 @@ const std::array<ServiceModuleInfo, 40> service_module_map{
{"LDR", 0x00040130'00003702, LDR::InstallInterfaces},
{"PXI", 0x00040130'00001402, PXI::InstallInterfaces},
{"ERR", 0x00040030'00008A02, [](SM::ServiceManager& sm) { ERR::InstallInterfaces(); }},
{"ERR", 0x00040030'00008A02, ERR::InstallInterfaces},
{"AC", 0x00040130'00002402, AC::InstallInterfaces},
{"ACT", 0x00040130'00003802, ACT::InstallInterfaces},
{"AM", 0x00040130'00001502, AM::InstallInterfaces},
{"BOSS", 0x00040130'00003402, BOSS::InstallInterfaces},
{"CAM", 0x00040130'00001602,
[](SM::ServiceManager& sm) {
CAM::InstallInterfaces(sm);
Y2R::InstallInterfaces(sm);
[](Core::System& system) {
CAM::InstallInterfaces(system);
Y2R::InstallInterfaces(system);
}},
{"CECD", 0x00040130'00002602, CECD::InstallInterfaces},
{"CFG", 0x00040130'00001702, CFG::InstallInterfaces},
@ -94,9 +94,9 @@ const std::array<ServiceModuleInfo, 40> service_module_map{
{"NFC", 0x00040130'00004002, NFC::InstallInterfaces},
{"NIM", 0x00040130'00002C02, NIM::InstallInterfaces},
{"NS", 0x00040130'00008002,
[](SM::ServiceManager& sm) {
NS::InstallInterfaces(sm);
APT::InstallInterfaces(sm);
[](Core::System& system) {
NS::InstallInterfaces(system);
APT::InstallInterfaces(system);
}},
{"NWM", 0x00040130'00002D02, NWM::InstallInterfaces},
{"PTM", 0x00040130'00002202, PTM::InstallInterfaces},
@ -235,13 +235,13 @@ static bool AttemptLLE(const ServiceModuleInfo& service_module) {
}
/// Initialize ServiceManager
void Init(std::shared_ptr<SM::ServiceManager>& sm) {
void Init(Core::System& core, std::shared_ptr<SM::ServiceManager>& sm) {
FS::ArchiveInit();
SM::ServiceManager::InstallInterfaces(sm);
for (const auto& service_module : service_module_map) {
if (!AttemptLLE(service_module) && service_module.init_function != nullptr)
service_module.init_function(*sm);
service_module.init_function(core);
}
LOG_DEBUG(Service, "initialized OK");
}