erpt: implement forced shutdown detection

This commit is contained in:
Michael Scire 2021-04-30 04:21:03 -07:00
parent ef0c15b764
commit 355010ad84
17 changed files with 645 additions and 53 deletions

View file

@ -22,8 +22,9 @@ namespace ams::erpt::srv {
constexpr inline const char ReportOnSdStoragePath[] = "ersd";
constexpr inline const char ReportStoragePath[] = "save";
constexpr inline const char JournalFileName[] = "save:/journal";
constexpr inline const char ReportStoragePath[] = "save";
constexpr inline const char JournalFileName[] = "save:/journal";
constexpr inline const char ForcedShutdownContextFileName[] = "save:/forced-shutdown";
constexpr size_t ReportFileNameLength = 64;
constexpr size_t AttachmentFileNameLength = 64;

View file

@ -16,4 +16,6 @@
#pragma once
#include <stratosphere/err/err_types.hpp>
#include <stratosphere/err/err_error_context.hpp>
#include <stratosphere/err/err_system_api.hpp>

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2018-2020 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 <vapours.hpp>
#include <stratosphere/err/err_types.hpp>
namespace ams::err {
ErrorCode ConvertResultToErrorCode(const Result &result);
void GetErrorCodeString(char *dst, size_t dst_size, ErrorCode error_code);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018-2020 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 <vapours.hpp>
namespace ams::err {
using ErrorCodeCategory = u32;
using ErrorCodeNumber = u32;
struct ErrorCode {
static constexpr auto StringLengthMax = 15;
ErrorCodeCategory category;
ErrorCodeNumber number;
constexpr ALWAYS_INLINE bool IsValid() const { return this->category > 0; }
};
constexpr inline ErrorCode InvalidErrorCode = {
.category = 0,
.number = 0,
};
}