diff --git a/data/banner.ppm.bin b/data/banner.ppm.bin new file mode 100644 index 0000000..3a63f84 --- /dev/null +++ b/data/banner.ppm.bin Binary files differ diff --git a/source/arm9/menu.c b/source/arm9/menu.c index ad6a164..1c1a76c 100644 --- a/source/arm9/menu.c +++ b/source/arm9/menu.c @@ -61,7 +61,7 @@ consoleSelect(&con_top); - uiPrintCentered("3DS Bootloader v%" PRIu16 ".%" PRIu16, + uiPrintCentered("fastboot 3DS v%" PRIu16 ".%" PRIu16, BOOTLOADER_VERSION>>16, BOOTLOADER_VERSION & 0xFFFFu); printf(" Model: %s\n", bootInfo.model); diff --git a/source/arm9/ui.c b/source/arm9/ui.c index ec66121..23b95a9 100644 --- a/source/arm9/ui.c +++ b/source/arm9/ui.c @@ -9,9 +9,12 @@ #include "arm9/main.h" #include "arm9/ui.h" #include "arm9/console.h" +#include "banner_ppm_bin.h" static u8 randomColor; +static void uiDrawPPM(unsigned start_x, unsigned start_y, const u8 *data); + static void consoleMainInit() { /* Initialize console for both screens using the two different PrintConsole we have defined */ @@ -30,6 +33,8 @@ void uiInit() { consoleMainInit(); + uiDrawPPM(30,30, banner_ppm_bin); // test + wait(0x6000000); } static void clearConsoles() @@ -112,3 +117,30 @@ // TODO }*/ + +static void uiDrawPPM(unsigned start_x, unsigned start_y, const u8 *data) +{ + unsigned width, height; + u16 *framebuf = (u16 *) FRAMEBUF_TOP_A_1; + + /* get image dimensions */ + const char *ptr = (const char *) data + 3; + while(*ptr != 0x0A) ptr++; + ptr++; + + //sscanf(ptr, "%i %i", &width, &height); + width = 204; height = 21; + + const u8 *imagedata = data + 0x26; // skip ppm header + + + for(unsigned x = 0; x < width; x++) + { + for(unsigned y = start_y; y < height+start_y; y++) + { + framebuf = &((u16*)FRAMEBUF_TOP_A_1)[SCREEN_HEIGHT_TOP * x + y]; + u8 *pixeldata = &imagedata[(y*width+x)*3]; + *framebuf = RGB8_to_565(pixeldata[0], pixeldata[1], pixeldata[2]); + } + } +}