diff --git a/arm9/source/common/colors.h b/arm9/source/common/colors.h index 993676a..6c6e2bc 100644 --- a/arm9/source/common/colors.h +++ b/arm9/source/common/colors.h @@ -1,5 +1,6 @@ #pragma once +#include "lottery.h" #define RGB(r,g,b) ((b)<<16|(g)<<8|(r)) @@ -31,8 +32,8 @@ #define COLOR_SUPERFUCHSIA RGB(0xFF, 0x00, 0xEF) // standard colors - used everywhere -#define COLOR_STD_BG COLOR_BLACK -#define COLOR_STD_FONT COLOR_WHITE +#define COLOR_STD_BG LOTTERY_COLOR_BG +#define COLOR_STD_FONT LOTTERY_COLOR_FONT // colors for GodMode9 file browser #define COLOR_SIDE_BAR COLOR_DARKGREY diff --git a/arm9/source/common/lottery.c b/arm9/source/common/lottery.c new file mode 100644 index 0000000..15437c8 --- /dev/null +++ b/arm9/source/common/lottery.c @@ -0,0 +1,54 @@ +#include "lottery.h" +#include "rtc.h" +#include "colors.h" +#include "vram0.h" + +#define LOTTERY_MAX 8 + +const LotteryTheme lo_theme[] = +{ + { // standard scheme + COLOR_WHITE, + COLOR_BLACK, + VRAM0_SPLASH_PCX, + VRAM0_FONT_PBM, + false + }, + { // bricked scheme + RGB(0xFF, 0xFF, 0x00), + RGB(0x00, 0x00, 0xFF), + "lottery/bricked/bootrom_splash.pcx", + "lottery/bricked/font_nbraille_4x6.pbm", + true + }, + { // C64 scheme + RGB(0x7B, 0x71, 0xD5), + RGB(0x41, 0x30, 0xA4), + "lottery/c64/c64_splash.pcx", + "lottery/c64/font_c64_8x8.pbm", + false + }, + { // mirror scheme + COLOR_WHITE, + COLOR_BLACK, + "lottery/mirror/mirror_splash.pcx", + "lottery/mirror/font_6x10_mr.pbm", + false + }, + { // zuish scheme + COLOR_WHITE, + COLOR_BLACK, + "lottery/zuish/zuish_splash.pcx", + "lottery/zuish/font_zuish_8x8.pbm", + false + } +}; + +u32 lo_n = 0; + +u32 InitLottery(void) { + DsTime dstime; + get_dstime(&dstime); + lo_n = (DSTIMEGET(&dstime, bcd_s)>>1) % LOTTERY_MAX; + return lo_n; +} diff --git a/arm9/source/common/lottery.h b/arm9/source/common/lottery.h new file mode 100644 index 0000000..7cc4f7e --- /dev/null +++ b/arm9/source/common/lottery.h @@ -0,0 +1,26 @@ +#pragma once + +#include "common.h" + + +// general scheme access +#define LOTTERY_N ((lo_n > 4) ? 0 : lo_n) +#define LOTTERY_COLOR_FONT (lo_theme[LOTTERY_N].color_font) +#define LOTTERY_COLOR_BG (lo_theme[LOTTERY_N].color_bg) +#define LOTTERY_SPLASH (lo_theme[LOTTERY_N].splash) +#define LOTTERY_FONT (lo_theme[LOTTERY_N].font) +#define LOTTERY_PROMPTHACK (lo_theme[LOTTERY_N].prompthack) + + +typedef struct { + const u32 color_font; + const u32 color_bg; + const char* splash; + const char* font; + const bool prompthack; +} __attribute__((packed)) LotteryTheme; + +extern const LotteryTheme lo_theme[]; +extern u32 lo_n; + +u32 InitLottery(void); diff --git a/arm9/source/common/ui.c b/arm9/source/common/ui.c index 47a7726..b313528 100644 --- a/arm9/source/common/ui.c +++ b/arm9/source/common/ui.c @@ -14,6 +14,7 @@ #include "timer.h" #include "power.h" #include "hid.h" +#include "lottery.h" #define STRBUF_SIZE 512 // maximum size of the string buffer #define FONT_MAX_WIDTH 8 @@ -95,7 +96,7 @@ bool SetFontFromPbm(const void* pbm, u32 pbm_size) { if (!pbm) { u64 pbm_size64 = 0; - pbm = FindVTarFileInfo(VRAM0_FONT_PBM, &pbm_size64); + pbm = FindVTarFileInfo(LOTTERY_FONT, &pbm_size64); pbm_size = (u32) pbm_size64; } @@ -276,6 +277,7 @@ void DrawStringCenter(u8* screen, int color, int bgcolor, const char *format, .. u32 h = GetDrawStringHeight(str); int x = (w >= SCREEN_WIDTH(screen)) ? 0 : (SCREEN_WIDTH(screen) - w) >> 1; int y = (h >= SCREEN_HEIGHT) ? 0 : (SCREEN_HEIGHT - h) >> 1; + if (LOTTERY_PROMPTHACK) x = y = 8; DrawStringF(screen, x, y, color, bgcolor, str); } diff --git a/arm9/source/godmode.c b/arm9/source/godmode.c index ace1cdb..4006ca7 100644 --- a/arm9/source/godmode.c +++ b/arm9/source/godmode.c @@ -19,6 +19,7 @@ #include "power.h" #include "vram0.h" #include "i2c.h" +#include "lottery.h" #define N_PANES 2 @@ -47,7 +48,7 @@ typedef struct { u32 SplashInit(const char* modestr) { u64 splash_size; - u8* splash = FindVTarFileInfo(VRAM0_SPLASH_PCX, &splash_size); + u8* splash = FindVTarFileInfo(LOTTERY_SPLASH, &splash_size); u8* bitmap = (u8*) malloc(SCREEN_SIZE_TOP); const char* namestr = FLAVOR " " VERSION; const char* loadstr = "booting..."; @@ -61,7 +62,7 @@ u32 SplashInit(const char* modestr) { if (splash && bitmap && PCX_Decompress(bitmap, SCREEN_SIZE_TOP, splash, splash_size)) { PCXHdr* hdr = (PCXHdr*) (void*) splash; DrawBitmap(TOP_SCREEN, -1, -1, PCX_Width(hdr), PCX_Height(hdr), bitmap); - } else DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(" VRAM0_SPLASH_PCX " not found)"); + } else DrawStringF(TOP_SCREEN, 10, 10, COLOR_STD_FONT, COLOR_TRANSPARENT, "(%s not found)", LOTTERY_SPLASH); if (modestr) DrawStringF(TOP_SCREEN, SCREEN_WIDTH_TOP - 10 - GetDrawStringWidth(modestr), SCREEN_HEIGHT - 10 - GetDrawStringHeight(modestr), COLOR_STD_FONT, COLOR_TRANSPARENT, modestr); @@ -1932,7 +1933,8 @@ u32 GodMode(int entrypoint) { show_splash = !bootloader; #endif - // init font + // init font / lottery + InitLottery(); if (!SetFontFromPbm(NULL, 0)) return exit_mode; // show splash screen (if enabled) diff --git a/data/lottery/bricked/bootrom_splash.pcx b/data/lottery/bricked/bootrom_splash.pcx new file mode 100644 index 0000000..b425832 Binary files /dev/null and b/data/lottery/bricked/bootrom_splash.pcx differ diff --git a/data/lottery/bricked/font_nbraille_4x6.pbm b/data/lottery/bricked/font_nbraille_4x6.pbm new file mode 100644 index 0000000..fcf6806 Binary files /dev/null and b/data/lottery/bricked/font_nbraille_4x6.pbm differ diff --git a/data/lottery/c64/c64_splash.pcx b/data/lottery/c64/c64_splash.pcx new file mode 100644 index 0000000..ce95349 Binary files /dev/null and b/data/lottery/c64/c64_splash.pcx differ diff --git a/data/lottery/c64/font_c64_8x8.pbm b/data/lottery/c64/font_c64_8x8.pbm new file mode 100644 index 0000000..fa48740 Binary files /dev/null and b/data/lottery/c64/font_c64_8x8.pbm differ diff --git a/data/lottery/mirror/font_6x10_mr.pbm b/data/lottery/mirror/font_6x10_mr.pbm new file mode 100644 index 0000000..994c7ad Binary files /dev/null and b/data/lottery/mirror/font_6x10_mr.pbm differ diff --git a/data/lottery/mirror/mirror_splash.pcx b/data/lottery/mirror/mirror_splash.pcx new file mode 100644 index 0000000..eb566ce Binary files /dev/null and b/data/lottery/mirror/mirror_splash.pcx differ diff --git a/data/lottery/zuish/font_zuish_8x8.pbm b/data/lottery/zuish/font_zuish_8x8.pbm new file mode 100644 index 0000000..b64f146 Binary files /dev/null and b/data/lottery/zuish/font_zuish_8x8.pbm differ diff --git a/data/lottery/zuish/zuish_splash.pcx b/data/lottery/zuish/zuish_splash.pcx new file mode 100644 index 0000000..9e8b2c8 Binary files /dev/null and b/data/lottery/zuish/zuish_splash.pcx differ