This repository has been archived on 2022-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Luma3DS-3GX/source/draw.c

48 lines
1.0 KiB
C
Raw Normal View History

2015-08-05 11:54:00 +02:00
/*
* draw.c
* by Reisyukaku
2015-08-15 04:28:26 +02:00
* Copyright (c) 2015 All Rights Reserved
2015-08-05 11:54:00 +02:00
*/
#include "draw.h"
#include "fs.h"
#include "memory.h"
2015-08-05 11:54:00 +02:00
2016-03-10 14:58:11 +01:00
static const struct fb {
u8 *top_left;
u8 *top_right;
u8 *bottom;
} *const fb = (struct fb *)0x23FFFE00;
2016-02-08 03:37:03 +01:00
2016-03-10 14:58:11 +01:00
void __attribute__((naked)) shutdownLCD(void){
2016-02-29 16:28:43 +01:00
2016-03-10 14:58:11 +01:00
vu32 *const arm11 = (u32 *)0x1FFFFFF8;
2016-02-29 16:28:43 +01:00
//Clear ARM11 entry offset
*arm11 = 0;
//Shutdown LCDs
2016-03-10 03:06:18 +01:00
*(vu32 *)0x10202A44 = 0;
*(vu32 *)0x10202244 = 0;
*(vu32 *)0x10202014 = 0;
2016-02-29 16:28:43 +01:00
//Wait for the entry to be set
2016-03-06 16:24:42 +01:00
while(!*arm11);
2016-02-29 16:28:43 +01:00
//Jump to it
((void (*)())*arm11)();
}
2016-03-10 14:58:11 +01:00
static void clearScreen(void){
2016-03-02 00:49:14 +01:00
memset(fb->top_left, 0, 0x46500);
memset(fb->top_right, 0, 0x46500);
memset(fb->bottom, 0, 0x38400);
}
2015-08-05 11:54:00 +02:00
void loadSplash(void){
clearScreen();
2016-03-10 03:06:18 +01:00
//Don't delay boot if no splash image is on the SD
2016-03-10 04:25:38 +01:00
if(fileRead(fb->top_left, "/rei/splash.bin", 0x46500) +
fileRead(fb->bottom, "/rei/splashbottom.bin", 0x38400)){
u64 i = 0xFFFFFF; while(--i) __asm("mov r0, r0"); //Less Ghetto sleep func
}
2015-08-05 11:54:00 +02:00
}