htc: configure usage via system setting

This commit is contained in:
Michael Scire 2021-02-23 04:10:20 -08:00 committed by SciresM
parent 0ec54ed492
commit ce149f996c
4 changed files with 21 additions and 4 deletions

View file

@ -34,7 +34,6 @@ namespace ams::boot2 {
constexpr size_t NumPreSdCardLaunchPrograms = util::size(PreSdCardLaunchPrograms);
constexpr ncm::SystemProgramId AdditionalLaunchPrograms[] = {
ncm::SystemProgramId::Htc, /* htc */ /* TODO: should we do boot!use_htc_gen2, with default to on in custom settings? */
ncm::SystemProgramId::Am, /* am */
ncm::SystemProgramId::NvServices, /* nvservices */
ncm::SystemProgramId::NvnFlinger, /* nvnflinger */
@ -80,7 +79,6 @@ namespace ams::boot2 {
constexpr size_t NumAdditionalLaunchPrograms = util::size(AdditionalLaunchPrograms);
constexpr ncm::SystemProgramId AdditionalMaintenanceLaunchPrograms[] = {
ncm::SystemProgramId::Htc, /* htc */
ncm::SystemProgramId::Am, /* am */
ncm::SystemProgramId::NvServices, /* nvservices */
ncm::SystemProgramId::NvnFlinger, /* nvnflinger */
@ -188,6 +186,12 @@ namespace ams::boot2 {
return force_maintenance != 0;
}
bool IsHtcEnabled() {
u8 enable_htc = 1;
settings::fwdbg::GetSettingsItemValue(&enable_htc, sizeof(enable_htc), "atmosphere", "enable_htc");
return enable_htc != 0;
}
bool IsMaintenanceMode() {
/* Contact set:sys, retrieve boot!force_maintenance. */
if (IsForceMaintenance()) {
@ -379,6 +383,13 @@ namespace ams::boot2 {
/* Check for and forward declare non-atmosphere mitm modules. */
DetectAndDeclareFutureMitms();
/* Device whether to launch tma or htc. */
if (IsHtcEnabled()) {
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Htc, ncm::StorageId::None), 0);
} else {
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Tma, ncm::StorageId::None), 0);
}
/* Launch additional programs. */
if (maintenance) {
LaunchList(AdditionalMaintenanceLaunchPrograms, NumAdditionalMaintenanceLaunchPrograms);