diff --git a/stratosphere/fatal/source/fatal_main.cpp b/stratosphere/fatal/source/fatal_main.cpp index ae8f0ce19..211c22374 100644 --- a/stratosphere/fatal/source/fatal_main.cpp +++ b/stratosphere/fatal/source/fatal_main.cpp @@ -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(); diff --git a/stratosphere/fatal/source/fatal_task.cpp b/stratosphere/fatal/source/fatal_task.cpp index a01ac6244..9725d02f8 100644 --- a/stratosphere/fatal/source/fatal_task.cpp +++ b/stratosphere/fatal/source/fatal_task.cpp @@ -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)); } diff --git a/stratosphere/fatal/source/fatal_task_power.cpp b/stratosphere/fatal/source/fatal_task_power.cpp new file mode 100644 index 000000000..59ffb062b --- /dev/null +++ b/stratosphere/fatal/source/fatal_task_power.cpp @@ -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 . + */ + +#include +#include "fatal_task_power.hpp" + +Result StateTransitionStopTask::Run() { + /* Nintendo ignores the output of this call... */ + spsmPutErrorState(); + return 0; +} diff --git a/stratosphere/fatal/source/fatal_task_power.hpp b/stratosphere/fatal/source/fatal_task_power.hpp new file mode 100644 index 000000000..e97f71978 --- /dev/null +++ b/stratosphere/fatal/source/fatal_task_power.hpp @@ -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 . + */ + +#pragma once +#include +#include +#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"; + } +}; \ No newline at end of file