-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3e5c7c6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that after a few reboots that the "lottery" has some bugs, namely always running the "standard" mode. To fix this one should simply turn off the 3DS and boot GM9.
3e5c7c6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not possible. The pseudo RNG in there is actually based on the current seconds in the RTC. You might get a lot of normal boots in succession, but it won't be stuck on the normal boot.
3e5c7c6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was because I was rebooting in quick succession, so the RTC was essentially the same. Why can't we generate true random numbers? Is the arm11 not powerful enough?