diff --git a/stratosphere/fatal/source/fatal_main.cpp b/stratosphere/fatal/source/fatal_main.cpp index 9ed72b2e6..31cb4a798 100644 --- a/stratosphere/fatal/source/fatal_main.cpp +++ b/stratosphere/fatal/source/fatal_main.cpp @@ -32,10 +32,13 @@ extern "C" { u32 __nx_applet_type = AppletType_None; - #define INNER_HEAP_SIZE 0x380000 + #define INNER_HEAP_SIZE 0x3C0000 size_t nx_inner_heap_size = INNER_HEAP_SIZE; char nx_inner_heap[INNER_HEAP_SIZE]; + u32 __nx_nv_transfermem_size = 0x40000; + ViServiceType __nx_gfx_vi_service_type = ViServiceType_Manager; + void __libnx_initheap(void); void __appInit(void); void __appExit(void); @@ -120,18 +123,22 @@ void __appExit(void) { int main(int argc, char **argv) { - consoleDebugInit(debugDevice_SVC); - + /* TODO: Load settings from set:sys. */ + + /* TODO: Load shared font. */ + + /* TODO: Check whether we should throw fatal due to repair process... */ + /* TODO: What's a good timeout value to use here? */ auto server_manager = new WaitableManager(1); - + /* TODO: Create services. */ server_manager->AddWaitable(new ServiceServer("fatal:p", 4)); server_manager->AddWaitable(new ServiceServer("fatal:u", 4)); /* Loop forever, servicing our services. */ server_manager->Process(); - + delete server_manager; return 0; diff --git a/stratosphere/fatal/source/fatal_task.cpp b/stratosphere/fatal/source/fatal_task.cpp index 53c3c2853..39a1c82d1 100644 --- a/stratosphere/fatal/source/fatal_task.cpp +++ b/stratosphere/fatal/source/fatal_task.cpp @@ -56,7 +56,7 @@ static void RunTask(IFatalTask *task) { void RunFatalTasks(FatalContext *ctx, u64 title_id, bool error_report, Event *erpt_event, Event *battery_event) { RunTask(new ErrorReportTask(ctx, title_id, error_report, erpt_event)); RunTask(new PowerControlTask(ctx, title_id, erpt_event, battery_event)); - /* TODO: RunTask(new ShowFatalTask(ctx, title_id, battery_event)); */ + RunTask(new ShowFatalTask(ctx, title_id, battery_event)); RunTask(new StopSoundTask(ctx, title_id)); RunTask(new BacklightControlTask(ctx, title_id)); RunTask(new AdjustClockTask(ctx, title_id)); diff --git a/stratosphere/fatal/source/fatal_task_screen.cpp b/stratosphere/fatal/source/fatal_task_screen.cpp index 98e42859e..a28be3fa3 100644 --- a/stratosphere/fatal/source/fatal_task_screen.cpp +++ b/stratosphere/fatal/source/fatal_task_screen.cpp @@ -17,6 +17,20 @@ #include #include "fatal_task_screen.hpp" +Result ShowFatalTask::ShowFatal() { + Result rc = 0; + + /* TODO: Get graphics to work, draw fatal screen. */ + + return rc; +} + +Result ShowFatalTask::Run() { + /* Don't show the fatal error screen until we've verified the battery is okay. */ + eventWait(this->battery_event, U64_MAX); + + return ShowFatal(); +} void BacklightControlTask::TurnOnBacklight() { lblSwitchBacklightOn(0); diff --git a/stratosphere/fatal/source/fatal_task_screen.hpp b/stratosphere/fatal/source/fatal_task_screen.hpp index 3ea9151ee..a456a9860 100644 --- a/stratosphere/fatal/source/fatal_task_screen.hpp +++ b/stratosphere/fatal/source/fatal_task_screen.hpp @@ -19,6 +19,19 @@ #include #include "fatal_task.hpp" +class ShowFatalTask : public IFatalTask { + private: + Event *battery_event; + private: + Result ShowFatal(); + public: + ShowFatalTask(FatalContext *ctx, u64 title_id, Event *evt) : IFatalTask(ctx, title_id), battery_event(evt) { } + virtual Result Run() override; + virtual const char *GetName() const override { + return "ShowFatal"; + } +}; + class BacklightControlTask : public IFatalTask { private: void TurnOnBacklight();