mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-17 08:34:23 -04:00
LogManager: implement system module, client api, logging api (#1617)
Some notes: * Unless `atmosphere!enable_log_manager` is true, Nintendo's log manager will be used instead. * This prevents paying memory costs for LM when not enabling logging. * To facilitate this, Atmosphere's log manager has a different program id from Nintendo's. * `atmosphere!enable_htc` implies `atmosphere!enable_log_manager`. * LogManager logs to tma, and the SD card (if `lm!enable_sd_card_logging` is true, which it is by default). * Binary logs are saved to `lm!sd_card_log_output_directory`, which is `atmosphere/binlogs` by default.
This commit is contained in:
parent
a1fb8a91c8
commit
e9849c74cf
94 changed files with 5595 additions and 45 deletions
|
@ -40,7 +40,7 @@ namespace ams::boot2 {
|
|||
ncm::SystemProgramId::Vi, /* vi */
|
||||
ncm::SystemProgramId::Pgl, /* pgl */
|
||||
ncm::SystemProgramId::Ns, /* ns */
|
||||
ncm::SystemProgramId::LogManager, /* lm */
|
||||
//ncm::SystemProgramId::LogManager, /* lm */
|
||||
ncm::SystemProgramId::Ppc, /* ppc */
|
||||
ncm::SystemProgramId::Ptm, /* ptm */
|
||||
ncm::SystemProgramId::Hid, /* hid */
|
||||
|
@ -83,7 +83,7 @@ namespace ams::boot2 {
|
|||
ncm::SystemProgramId::Vi, /* vi */
|
||||
ncm::SystemProgramId::Pgl, /* pgl */
|
||||
ncm::SystemProgramId::Ns, /* ns */
|
||||
ncm::SystemProgramId::LogManager, /* lm */
|
||||
//ncm::SystemProgramId::LogManager, /* lm */
|
||||
ncm::SystemProgramId::Ppc, /* ppc */
|
||||
ncm::SystemProgramId::Ptm, /* ptm */
|
||||
ncm::SystemProgramId::Hid, /* hid */
|
||||
|
@ -183,11 +183,22 @@ namespace ams::boot2 {
|
|||
}
|
||||
|
||||
bool IsHtcEnabled() {
|
||||
u8 enable_htc = 1;
|
||||
u8 enable_htc = 0;
|
||||
settings::fwdbg::GetSettingsItemValue(&enable_htc, sizeof(enable_htc), "atmosphere", "enable_htc");
|
||||
return enable_htc != 0;
|
||||
}
|
||||
|
||||
bool IsAtmosphereLogManagerEnabled() {
|
||||
/* If htc is enabled, ams log manager is enabled. */
|
||||
if (IsHtcEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 enable_ams_lm = 0;
|
||||
settings::fwdbg::GetSettingsItemValue(&enable_ams_lm, sizeof(enable_ams_lm), "atmosphere", "enable_log_manager");
|
||||
return enable_ams_lm != 0;
|
||||
}
|
||||
|
||||
bool IsMaintenanceMode() {
|
||||
/* Contact set:sys, retrieve boot!force_maintenance. */
|
||||
if (IsForceMaintenance()) {
|
||||
|
@ -390,7 +401,7 @@ namespace ams::boot2 {
|
|||
/* Check for and forward declare non-atmosphere mitm modules. */
|
||||
DetectAndDeclareFutureMitms();
|
||||
|
||||
/* Device whether to launch tma or htc. */
|
||||
/* Decide whether to launch tma or htc. */
|
||||
if (IsHtcEnabled()) {
|
||||
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Htc, ncm::StorageId::None), 0);
|
||||
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Cs, ncm::StorageId::None), 0);
|
||||
|
@ -398,6 +409,13 @@ namespace ams::boot2 {
|
|||
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Tma, ncm::StorageId::BuiltInSystem), 0);
|
||||
}
|
||||
|
||||
/* Decide whether to launch atmosphere or nintendo's log manager. */
|
||||
if (IsAtmosphereLogManagerEnabled()) {
|
||||
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::AtmosphereProgramId::AtmosphereLogManager, ncm::StorageId::None), 0);
|
||||
} else {
|
||||
LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::LogManager, ncm::StorageId::None), 0);
|
||||
}
|
||||
|
||||
/* Launch additional programs. */
|
||||
if (maintenance) {
|
||||
LaunchList(AdditionalMaintenanceLaunchPrograms, NumAdditionalMaintenanceLaunchPrograms);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue