fatal: Skeleton ScreenDrawing code

This commit is contained in:
Michael Scire 2018-11-10 11:59:55 -08:00
parent 5d5f8ad3d5
commit 5f3187300d
4 changed files with 40 additions and 6 deletions

View file

@ -32,10 +32,13 @@ extern "C" {
u32 __nx_applet_type = AppletType_None; 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; size_t nx_inner_heap_size = INNER_HEAP_SIZE;
char nx_inner_heap[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 __libnx_initheap(void);
void __appInit(void); void __appInit(void);
void __appExit(void); void __appExit(void);
@ -120,7 +123,11 @@ void __appExit(void) {
int main(int argc, char **argv) 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? */ /* TODO: What's a good timeout value to use here? */
auto server_manager = new WaitableManager(1); auto server_manager = new WaitableManager(1);

View file

@ -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) { 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 ErrorReportTask(ctx, title_id, error_report, erpt_event));
RunTask(new PowerControlTask(ctx, title_id, erpt_event, battery_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 StopSoundTask(ctx, title_id));
RunTask(new BacklightControlTask(ctx, title_id)); RunTask(new BacklightControlTask(ctx, title_id));
RunTask(new AdjustClockTask(ctx, title_id)); RunTask(new AdjustClockTask(ctx, title_id));

View file

@ -17,6 +17,20 @@
#include <switch.h> #include <switch.h>
#include "fatal_task_screen.hpp" #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() { void BacklightControlTask::TurnOnBacklight() {
lblSwitchBacklightOn(0); lblSwitchBacklightOn(0);

View file

@ -19,6 +19,19 @@
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "fatal_task.hpp" #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 { class BacklightControlTask : public IFatalTask {
private: private:
void TurnOnBacklight(); void TurnOnBacklight();