Add GetModule() helper functions, for HID, CAM, and CFG

This commit is contained in:
B3n30
2018-10-12 11:50:50 +02:00
parent 1b1de23a98
commit eb3af0f16a
12 changed files with 49 additions and 51 deletions

View File

@@ -465,11 +465,9 @@ ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_i
ErrorLevel::Status);
}
auto cfg = system.ServiceManager().GetService<Service::CFG::Module::Interface>("cfg:u");
ASSERT_MSG(cfg, "cfg:u not started!");
auto cfg_module = cfg->GetModule();
ASSERT_MSG(cfg_module, "CFG Module missing!");
u32 region_value = cfg_module->GetRegionValue();
auto cfg = Service::CFG::GetModule(system);
ASSERT_MSG(cfg, "CFG Module missing!");
u32 region_value = cfg->GetRegionValue();
return MakeResult<AppletInfo>({GetTitleIdForApplet(app_id, region_value),
Service::FS::MediaType::NAND, slot->registered, slot->loaded,
slot->attributes.raw});
@@ -554,11 +552,9 @@ void AppletManager::EnsureHomeMenuLoaded() {
return;
}
auto cfg = system.ServiceManager().GetService<Service::CFG::Module::Interface>("cfg:u");
ASSERT_MSG(cfg, "cfg:u not started!");
auto cfg_module = cfg->GetModule();
ASSERT_MSG(cfg_module, "CFG Module missing!");
u32 region_value = cfg_module->GetRegionValue();
auto cfg = Service::CFG::GetModule(system);
ASSERT_MSG(cfg, "CFG Module missing!");
u32 region_value = cfg->GetRegionValue();
u64 menu_title_id = GetTitleIdForApplet(AppletId::HomeMenu, region_value);
auto process = NS::LaunchTitle(FS::MediaType::NAND, menu_title_id);
if (!process) {

View File

@@ -103,13 +103,9 @@ static u32 DecompressLZ11(const u8* in, u8* out) {
bool Module::LoadSharedFont() {
u8 font_region_code;
auto cfg =
Core::System::GetInstance().ServiceManager().GetService<Service::CFG::Module::Interface>(
"cfg:u");
ASSERT_MSG(cfg, "cfg:u not started!");
auto cfg_module = cfg->GetModule();
ASSERT_MSG(cfg_module, "CFG Module missing!");
switch (cfg_module->GetRegionValue()) {
auto cfg = Service::CFG::GetModule(Core::System::GetInstance());
ASSERT_MSG(cfg, "CFG Module missing!");
switch (cfg->GetRegionValue()) {
case 4: // CHN
font_region_code = 2;
break;