diff --git a/stratosphere/loader/source/ldr_meta.cpp b/stratosphere/loader/source/ldr_meta.cpp index cd2b57d70..fb46f49d6 100644 --- a/stratosphere/loader/source/ldr_meta.cpp +++ b/stratosphere/loader/source/ldr_meta.cpp @@ -198,6 +198,8 @@ namespace ams::ldr { if (status.IsHbl()) { if (R_SUCCEEDED(fs::OpenFile(std::addressof(file), SdOrBaseMetaPath, fs::OpenMode_Read))) { ON_SCOPE_EXIT { fs::CloseFile(file); }; + + if (R_SUCCEEDED(LoadMetaFromFile(file, &g_original_meta_cache))) { Meta *o_meta = &g_original_meta_cache.meta; @@ -212,6 +214,15 @@ namespace ams::ldr { caps::SetProgramInfoFlags(program_info_flags, meta->aci_kac, meta->aci->kac_size); } } + + /* When hbl is applet, adjust main thread priority. */ + if ((caps::GetProgramInfoFlags(meta->aci_kac, meta->aci->kac_size) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Applet) { + constexpr auto HblMainThreadPriorityApplication = 44; + constexpr auto HblMainThreadPriorityApplet = 40; + if (meta->npdm->main_thread_priority == HblMainThreadPriorityApplication) { + meta->npdm->main_thread_priority = HblMainThreadPriorityApplet; + } + } } else if (hos::GetVersion() >= hos::Version_10_0_0) { /* If storage id is none, there is no base code filesystem, and thus it is impossible for us to validate. */ /* However, if we're an application, we are guaranteed a base code filesystem. */