fatal: Implement StateTransitionStopTask

This commit is contained in:
Michael Scire 2018-11-10 01:19:52 -08:00
parent 4d1481e2eb
commit b771c42f7f
4 changed files with 69 additions and 9 deletions

View file

@ -59,24 +59,30 @@ void __appInit(void) {
rc = smInitialize();
if (R_FAILED(rc)) {
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM));
std::abort();
}
rc = setsysInitialize();
if (R_FAILED(rc)) {
fatalSimple(rc);
std::abort();
}
rc = pminfoInitialize();
if (R_FAILED(rc)) {
fatalSimple(rc);
std::abort();
}
CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION);
rc = spsmInitialize();
if (R_FAILED(rc)) {
std::abort();
}
/* fatal cannot throw fatal, so don't do: CheckAtmosphereVersion(CURRENT_ATMOSPHERE_VERSION); */
}
void __appExit(void) {
/* Cleanup services. */
spsmExit();
pminfoExit();
setsysExit();
smExit();

View file

@ -19,6 +19,7 @@
#include "fatal_task.hpp"
#include "fatal_task_error_report.hpp"
#include "fatal_task_power.hpp"
static constexpr size_t MaxTasks = 8;
@ -50,9 +51,9 @@ void RunFatalTasks(FatalContext *ctx, u64 title_id, bool error_report, Event *er
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()); */
/* TODO: RunTask(new StopSoundTask(ctx, title_id)); */
/* TODO: RunTask(new BacklightControlTask(ctx, title_id)); */
/* TODO: RunTask(new AdjustClockTask(ctx, title_id)); */
/* TODO: RunTask(new PowerButtonTask(ctx, title_id, erpt_event)); */
RunTask(new StateTransitionStopTask(ctx, title_id));
}

View file

@ -0,0 +1,24 @@
/*
* 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_power.hpp"
Result StateTransitionStopTask::Run() {
/* Nintendo ignores the output of this call... */
spsmPutErrorState();
return 0;
}

View file

@ -0,0 +1,29 @@
/*
* 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 StateTransitionStopTask : public IFatalTask {
public:
StateTransitionStopTask(FatalContext *ctx, u64 title_id) : IFatalTask(ctx, title_id) { }
virtual Result Run() override;
virtual const char *GetName() const override {
return "StateTransitionStopTask";
}
};