1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-29 23:32:23 +00:00
Atmosphere/stratosphere/fatal/source/fatal_config.hpp

96 lines
2.9 KiB
C++
Raw Normal View History

/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stratosphere.hpp>
namespace ams::fatal::srv {
2019-07-19 03:09:35 +01:00
class FatalConfig {
private:
2021-10-10 08:14:06 +01:00
settings::system::SerialNumber m_serial_number{};
settings::system::FirmwareVersion m_firmware_version{};
u64 m_language_code{};
TimeSpan m_quest_reboot_interval{};
bool m_transition_to_fatal{};
bool m_show_extra_info{};
bool m_quest_flag{};
const char *m_error_msg{};
const char *m_error_desc{};
const char *m_quest_desc{};
TimeSpan m_fatal_auto_reboot_interval{};
bool m_fatal_auto_reboot_enabled{};
2019-07-19 03:09:35 +01:00
public:
FatalConfig();
const settings::system::SerialNumber &GetSerialNumber() const {
2021-10-10 08:14:06 +01:00
return m_serial_number;
2019-07-19 03:09:35 +01:00
}
const settings::system::FirmwareVersion &GetFirmwareVersion() const {
2021-10-10 08:14:06 +01:00
return m_firmware_version;
2019-07-19 03:09:35 +01:00
}
void UpdateLanguageCode() {
2021-10-10 08:14:06 +01:00
setGetLanguageCode(&m_language_code);
2019-07-19 03:09:35 +01:00
}
u64 GetLanguageCode() const {
2021-10-10 08:14:06 +01:00
return m_language_code;
2019-07-19 03:09:35 +01:00
}
bool ShouldTransitionToFatal() const {
2021-10-10 08:14:06 +01:00
return m_transition_to_fatal;
2019-07-19 03:09:35 +01:00
}
bool ShouldShowExtraInfo() const {
2021-10-10 08:14:06 +01:00
return m_show_extra_info;
2019-07-19 03:09:35 +01:00
}
bool IsQuest() const {
2021-10-10 08:14:06 +01:00
return m_quest_flag;
2019-07-19 03:09:35 +01:00
}
bool IsFatalRebootEnabled() const {
2021-10-10 08:14:06 +01:00
return m_fatal_auto_reboot_enabled;
2019-07-19 03:09:35 +01:00
}
2020-08-04 03:52:53 +01:00
TimeSpan GetQuestRebootTimeoutInterval() const {
2021-10-10 08:14:06 +01:00
return m_quest_reboot_interval;
2019-07-19 03:09:35 +01:00
}
2020-08-04 03:52:53 +01:00
TimeSpan GetFatalRebootTimeoutInterval() const {
2021-10-10 08:14:06 +01:00
return m_fatal_auto_reboot_interval;
2019-07-19 03:09:35 +01:00
}
const char *GetErrorMessage() const {
2021-10-10 08:14:06 +01:00
return m_error_msg;
2019-07-19 03:09:35 +01:00
}
const char *GetErrorDescription() const {
if (this->IsQuest()) {
2021-10-10 08:14:06 +01:00
return m_quest_desc;
2019-07-19 03:09:35 +01:00
} else {
2021-10-10 08:14:06 +01:00
return m_error_desc;
2019-07-19 03:09:35 +01:00
}
}
};
os::MultiWaitHolderType *GetFatalDirtyMultiWaitHolder();
void OnFatalDirtyEvent();
2019-07-19 03:09:35 +01:00
const FatalConfig &GetFatalConfig();
}