remove GetCurrentModule() functions in HLE Services

This commit is contained in:
B3n30
2018-10-11 11:12:07 +02:00
parent 4ee914c7a8
commit 9d53136f20
14 changed files with 99 additions and 69 deletions

View File

@@ -114,14 +114,6 @@ static const std::vector<u8> cfg_system_savedata_id = {
0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x01, 0x00,
};
static std::weak_ptr<Module> current_cfg;
std::shared_ptr<Module> GetCurrentModule() {
auto cfg = current_cfg.lock();
ASSERT_MSG(cfg, "No CFG module running!");
return cfg;
}
Module::Interface::Interface(std::shared_ptr<Module> cfg, const char* name, u32 max_session)
: ServiceFramework(name, max_session), cfg(std::move(cfg)) {}
@@ -145,6 +137,10 @@ void Module::Interface::GetCountryCodeString(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(country_codes[country_code_id]);
}
std::shared_ptr<Module> Module::Interface::GetModule() const {
return cfg;
}
void Module::Interface::GetCountryCodeID(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0A, 1, 0);
u16 country_code = rp.Pop<u16>();
@@ -729,7 +725,6 @@ void InstallInterfaces(Core::System& system) {
std::make_shared<CFG_S>(cfg)->InstallAsService(service_manager);
std::make_shared<CFG_U>(cfg)->InstallAsService(service_manager);
std::make_shared<CFG_NOR>()->InstallAsService(service_manager);
current_cfg = cfg;
}
} // namespace Service::CFG

View File

@@ -97,6 +97,8 @@ public:
Interface(std::shared_ptr<Module> cfg, const char* name, u32 max_session);
~Interface();
std::shared_ptr<Module> GetModule() const;
/**
* CFG::GetCountryCodeString service function
* Inputs:
@@ -117,8 +119,6 @@ public:
*/
void GetCountryCodeID(Kernel::HLERequestContext& ctx);
u32 GetRegionValue();
/**
* CFG::SecureInfoGetRegion service function
* Inputs:
@@ -412,6 +412,5 @@ private:
};
void InstallInterfaces(Core::System& system);
std::shared_ptr<Module> GetCurrentModule();
} // namespace Service::CFG