fatal: Write ErrorReportTask

This commit is contained in:
Michael Scire 2018-11-10 01:04:40 -08:00
parent 21b0f228b6
commit 4d1481e2eb
5 changed files with 73 additions and 9 deletions

View file

@ -32,7 +32,7 @@ extern "C" {
u32 __nx_applet_type = AppletType_None;
#define INNER_HEAP_SIZE 0x20000
#define INNER_HEAP_SIZE 0x380000
size_t nx_inner_heap_size = INNER_HEAP_SIZE;
char nx_inner_heap[INNER_HEAP_SIZE];

View file

@ -18,6 +18,9 @@
#include "fatal_types.hpp"
#include "fatal_task.hpp"
#include "fatal_task_error_report.hpp"
static constexpr size_t MaxTasks = 8;
static HosThread g_task_threads[MaxTasks];
static size_t g_num_threads = 0;
@ -44,12 +47,12 @@ static void RunTask(IFatalTask *task) {
}
void RunFatalTasks(FatalContext *ctx, u64 title_id, bool error_report, Event *erpt_event, Event *battery_event) {
/* TODO: RunTask(new ErrorReportTask(ctx, title_id, error_report, erpt_event); */
/* TODO: RunTask(new PowerControlTask(ctx, title_id, battery_event); */
/* TODO: RunTask(new ShowFatalTask(ctx, title_id, battery_event); */
/* TODO: RunTask(new StopSoundTask(); */
/* TODO: RunTask(new BacklightControlTask(); */
/* TODO: RunTask(new AdjustClockTask(); */
/* TODO: RunTask(new PowerButtonTask(erpt_event); */
/* TODO: RunTask(new StateTransitionStop(); */
RunTask(new ErrorReportTask(ctx, title_id, error_report, erpt_event));
/* TODO: RunTask(new PowerControlTask(ctx, title_id, battery_event)); */
/* TODO: RunTask(new ShowFatalTask(ctx, title_id, battery_event)); */
/* TODO: RunTask(new StopSoundTask()); */
/* TODO: RunTask(new BacklightControlTask()); */
/* TODO: RunTask(new AdjustClockTask()); */
/* TODO: RunTask(new PowerButtonTask(erpt_event)); */
/* TODO: RunTask(new StateTransitionStop()); */
}

View file

@ -24,6 +24,7 @@ class IFatalTask {
FatalContext *ctx;
u64 title_id;
public:
IFatalTask(FatalContext *ctx, u64 tid) : ctx(ctx), title_id(tid) { }
virtual Result Run() = 0;
virtual const char *GetName() const = 0;
};

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2018 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/>.
*/
#include <switch.h>
#include "fatal_task_error_report.hpp"
Result ErrorReportTask::Run() {
if (this->create_report) {
/* Here, Nintendo creates an error report with erpt. AMS will not do that. */
/* TODO: Should atmosphere log reports to to the SD card? */
}
/* Signal we're done with our job. */
eventFire(this->erpt_event);
}

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2018 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 <switch.h>
#include <stratosphere.hpp>
#include "fatal_task.hpp"
class ErrorReportTask : public IFatalTask {
private:
bool create_report;
Event *erpt_event;
public:
ErrorReportTask(FatalContext *ctx, u64 title_id, bool error_report, Event *evt) : IFatalTask(ctx, title_id), create_report(error_report), erpt_event(evt) { }
virtual Result Run() override;
virtual const char *GetName() const override {
return "WriteErrorReport";
}
};