diff --git a/arm9/source/godmode.c b/arm9/source/godmode.c index aae0c85..af6254a 100644 --- a/arm9/source/godmode.c +++ b/arm9/source/godmode.c @@ -118,9 +118,7 @@ u32 BootFirmHandler(const char* bootpath, bool verbose, bool delete) { } u32 SplashInit(const char* modestr) { - u16* bitmap; u64 splash_size; - u32 splash_width, splash_height; u8* splash = FindVTarFileInfo(VRAM0_SPLASH_PNG, &splash_size); const char* namestr = FLAVOR " " VERSION; const char* loadstr = "booting..."; @@ -132,11 +130,14 @@ u32 SplashInit(const char* modestr) { ClearScreenF(true, true, COLOR_STD_BG); if (splash) { - bitmap = PNG_Decompress(splash, splash_size, &splash_width, &splash_height); - if (bitmap) DrawBitmap(TOP_SCREEN, -1, -1, splash_width, splash_height, bitmap); + u32 splash_width, splash_height; + u16* bitmap = PNG_Decompress(splash, splash_size, &splash_width, &splash_height); + if (bitmap) { + DrawBitmap(TOP_SCREEN, -1, -1, splash_width, splash_height, bitmap); + free(bitmap); + } } else { DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(" VRAM0_SPLASH_PNG " not found)"); - bitmap = NULL; } if (modestr) DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(modestr), @@ -150,7 +151,6 @@ u32 SplashInit(const char* modestr) { DrawStringF(BOT_SCREEN, pos_xu, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, loadstr); DrawStringF(BOT_SCREEN, pos_xb, pos_yu, COLOR_STD_FONT, COLOR_STD_BG, "built: " DBUILTL); - free(bitmap); return 0; } diff --git a/arm9/source/system/vram0.h b/arm9/source/system/vram0.h index afde55f..b3f5fec 100644 --- a/arm9/source/system/vram0.h +++ b/arm9/source/system/vram0.h @@ -15,6 +15,7 @@ #define VRAM0_SCRIPTS "scripts" #define VRAM0_README_MD "README_internal.md" #define VRAM0_SPLASH_PNG FLAVOR "_splash.png" +#define VRAM0_EASTER_BIN "easter.bin" #define VRAM0_OFFSET 0x18000000 diff --git a/arm9/source/utils/paint9.c b/arm9/source/utils/paint9.c index 145f819..2f394f0 100644 --- a/arm9/source/utils/paint9.c +++ b/arm9/source/utils/paint9.c @@ -1,4 +1,6 @@ #include "paint9.h" +#include "vram0.h" +#include "png.h" #include "hid.h" #include "ui.h" @@ -100,10 +102,21 @@ u32 Paint9(void) { u16 color = *color_picker_tmp; u32 brush_id = 0; - // clear screens, draw title + // clear screens, draw logo + const char* snapstr = "(use L+R to save)"; + u64 logo_size; + u8* logo = FindVTarFileInfo(VRAM0_EASTER_BIN, &logo_size); ClearScreenF(true, true, COLOR_STD_BG); - DrawStringCenter(TOP_SCREEN, COLOR_STD_FONT, COLOR_TRANSPARENT, - "Paint9\n \nYou may save your creation at\nany time via the screenshot\nfunction (L+R).\n \nHave fun!"); + if (logo) { + u32 logo_width, logo_height; + u16* bitmap = PNG_Decompress(logo, logo_size, &logo_width, &logo_height); + if (bitmap) { + DrawBitmap(TOP_SCREEN, -1, -1, logo_width, logo_height, bitmap); + free(bitmap); + } + } else DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(" VRAM0_EASTER_BIN " not found)"); + DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(snapstr), + SCREEN_HEIGHT - 10 - GetDrawStringHeight(snapstr), COLOR_STD_FONT, COLOR_TRANSPARENT, snapstr); // outline canvas DrawRectangle(BOT_SCREEN, 0, 0, 30, SCREEN_HEIGHT, outline_bg); @@ -129,8 +142,6 @@ u32 Paint9(void) { // Paint9 main loop while (1) { - DrawStringF(TOP_SCREEN, 16, 16, COLOR_STD_FONT, COLOR_STD_BG, - "Touchscreen coordinates (0/0) "); Paint9_DrawBrush(x_cb, y_cb, color, brush_bg, brush_id); if (InputWait(0) & BUTTON_B) break; @@ -140,8 +151,6 @@ u32 Paint9(void) { u16 ty_prev = 0; u32 tb_id_prev = 0; while (HID_ReadTouchState(&tx, &ty)) { - DrawStringF(TOP_SCREEN, 16, 16, COLOR_STD_FONT, COLOR_STD_BG, - "Touchscreen coordinates (%d/%d) ", tx, ty); TouchBoxGet(&tb_id, tx, ty, paint9_boxes, 8); if (tb_id == P9BOX_CANVAS) { if (tb_id_prev == P9BOX_CANVAS) diff --git a/data/easter.bin b/data/easter.bin new file mode 100644 index 0000000..bc98c62 Binary files /dev/null and b/data/easter.bin differ