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

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/core.h"
#include "core/hle/service/nwm/nwm.h"
#include "core/hle/service/nwm/nwm_cec.h"
#include "core/hle/service/nwm/nwm_ext.h"
@ -13,14 +14,15 @@
namespace Service::NWM {
void InstallInterfaces(SM::ServiceManager& service_manager) {
void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager();
std::make_shared<NWM_CEC>()->InstallAsService(service_manager);
std::make_shared<NWM_EXT>()->InstallAsService(service_manager);
std::make_shared<NWM_INF>()->InstallAsService(service_manager);
std::make_shared<NWM_SAP>()->InstallAsService(service_manager);
std::make_shared<NWM_SOC>()->InstallAsService(service_manager);
std::make_shared<NWM_TST>()->InstallAsService(service_manager);
std::make_shared<NWM_UDS>()->InstallAsService(service_manager);
std::make_shared<NWM_UDS>(system)->InstallAsService(service_manager);
}
} // namespace Service::NWM

View file

@ -6,9 +6,13 @@
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::NWM {
/// Initialize all NWM services
void InstallInterfaces(SM::ServiceManager& service_manager);
void InstallInterfaces(Core::System& system);
} // namespace Service::NWM

View file

@ -1283,7 +1283,7 @@ static void BeaconBroadcastCallback(u64 userdata, s64 cycles_late) {
beacon_broadcast_event, 0);
}
NWM_UDS::NWM_UDS() : ServiceFramework("nwm::UDS") {
NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS") {
static const FunctionInfo functions[] = {
{0x000102C2, nullptr, "Initialize (deprecated)"},
{0x00020000, nullptr, "Scrap"},
@ -1334,9 +1334,8 @@ NWM_UDS::NWM_UDS() : ServiceFramework("nwm::UDS") {
}
}
Core::System::GetInstance().GetSharedPageHandler()->SetMacAddress(mac);
Core::System::GetInstance().GetSharedPageHandler()->SetWifiLinkLevel(
SharedPage::WifiLinkLevel::BEST);
system.GetSharedPageHandler()->SetMacAddress(mac);
system.GetSharedPageHandler()->SetWifiLinkLevel(SharedPage::WifiLinkLevel::BEST);
}
NWM_UDS::~NWM_UDS() {

View file

@ -11,6 +11,10 @@
#include "common/swap.h"
#include "core/hle/service/service.h"
namespace Core {
class System;
}
// Local-WLAN service
namespace Service::NWM {
@ -98,7 +102,7 @@ enum class TagId : u8 {
class NWM_UDS final : public ServiceFramework<NWM_UDS> {
public:
NWM_UDS();
explicit NWM_UDS(Core::System& system);
~NWM_UDS();
private: