mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-23 03:06:52 -04:00
fatal: refactor into sts namespace
This commit is contained in:
parent
442ebff829
commit
39d041466d
38 changed files with 2176 additions and 1926 deletions
|
@ -18,22 +18,79 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
struct FatalConfig {
|
||||
char serial_number[0x18];
|
||||
SetSysFirmwareVersion firmware_version;
|
||||
u64 language_code;
|
||||
u64 quest_reboot_interval_second;
|
||||
bool transition_to_fatal;
|
||||
bool show_extra_info;
|
||||
bool quest_flag;
|
||||
const char *error_msg;
|
||||
const char *error_desc;
|
||||
const char *quest_desc;
|
||||
u64 fatal_auto_reboot_interval;
|
||||
bool is_auto_reboot_enabled;
|
||||
};
|
||||
namespace sts::fatal::srv {
|
||||
|
||||
IEvent *GetFatalSettingsEvent();
|
||||
FatalConfig *GetFatalConfig();
|
||||
class FatalConfig {
|
||||
private:
|
||||
char serial_number[0x18];
|
||||
SetSysFirmwareVersion firmware_version;
|
||||
u64 language_code;
|
||||
u64 quest_reboot_interval_second;
|
||||
bool transition_to_fatal;
|
||||
bool show_extra_info;
|
||||
bool quest_flag;
|
||||
const char *error_msg;
|
||||
const char *error_desc;
|
||||
const char *quest_desc;
|
||||
u64 fatal_auto_reboot_interval;
|
||||
bool fatal_auto_reboot_enabled;
|
||||
public:
|
||||
FatalConfig();
|
||||
|
||||
void InitializeFatalConfig();
|
||||
const char *GetSerialNumber() const {
|
||||
return this->serial_number;
|
||||
}
|
||||
|
||||
const SetSysFirmwareVersion &GetFirmwareVersion() const {
|
||||
return this->firmware_version;
|
||||
}
|
||||
|
||||
void UpdateLanguageCode() {
|
||||
setGetLanguageCode(&this->language_code);
|
||||
}
|
||||
|
||||
u64 GetLanguageCode() const {
|
||||
return this->language_code;
|
||||
}
|
||||
|
||||
bool ShouldTransitionToFatal() const {
|
||||
return this->transition_to_fatal;
|
||||
}
|
||||
|
||||
bool ShouldShowExtraInfo() const {
|
||||
return this->show_extra_info;
|
||||
}
|
||||
|
||||
bool IsQuest() const {
|
||||
return this->quest_flag;
|
||||
}
|
||||
|
||||
bool IsFatalRebootEnabled() const {
|
||||
return this->fatal_auto_reboot_enabled;
|
||||
}
|
||||
|
||||
u64 GetQuestRebootTimeoutInterval() const {
|
||||
return this->quest_reboot_interval_second * 1'000'000'000ul;
|
||||
}
|
||||
|
||||
u64 GetFatalRebootTimeoutInterval() const {
|
||||
return this->fatal_auto_reboot_interval * 1'000'000ul;
|
||||
}
|
||||
|
||||
const char *GetErrorMessage() const {
|
||||
return this->error_msg;
|
||||
}
|
||||
|
||||
const char *GetErrorDescription() const {
|
||||
if (this->IsQuest()) {
|
||||
return this->quest_desc;
|
||||
} else {
|
||||
return this->error_desc;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
IEvent *GetFatalDirtyEvent();
|
||||
const FatalConfig &GetFatalConfig();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue