mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-18 00:54: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
|
@ -34,11 +34,10 @@ namespace ams::time {
|
|||
InitializeMode_SystemUser,
|
||||
};
|
||||
|
||||
u32 g_initialize_count = 0;
|
||||
InitializeMode g_initialize_mode = InitializeMode_None;
|
||||
constinit u32 g_initialize_count = 0;
|
||||
constinit InitializeMode g_initialize_mode = InitializeMode_None;
|
||||
|
||||
/* TODO: os::SdkMutex */
|
||||
os::Mutex g_initialize_mutex(false);
|
||||
constinit os::SdkMutex g_initialize_mutex;
|
||||
|
||||
Result InitializeImpl(InitializeMode mode) {
|
||||
std::scoped_lock lk(g_initialize_mutex);
|
||||
|
@ -76,7 +75,11 @@ namespace ams::time {
|
|||
}
|
||||
|
||||
Result InitializeForSystemUser() {
|
||||
return InitializeImpl(InitializeMode_System);
|
||||
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
||||
return InitializeImpl(InitializeMode_SystemUser);
|
||||
} else {
|
||||
return InitializeImpl(InitializeMode_Normal);
|
||||
}
|
||||
}
|
||||
|
||||
Result Finalize() {
|
||||
|
@ -98,6 +101,10 @@ namespace ams::time {
|
|||
return g_initialize_count > 0;
|
||||
}
|
||||
|
||||
bool IsValidDate(int year, int month, int day) {
|
||||
return impl::util::IsValidDate(year, month, day);
|
||||
}
|
||||
|
||||
Result GetElapsedSecondsBetween(s64 *out, const SteadyClockTimePoint &from, const SteadyClockTimePoint &to) {
|
||||
return impl::util::GetSpanBetween(out, from, to);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue