summaryrefslogtreecommitdiff
path: root/arm9/source/devices/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/source/devices/screen.c')
-rw-r--r--arm9/source/devices/screen.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arm9/source/devices/screen.c b/arm9/source/devices/screen.c
index 0d2fc36..5c16d8f 100644
--- a/arm9/source/devices/screen.c
+++ b/arm9/source/devices/screen.c
@@ -19,6 +19,31 @@ a 16-bit tile index (low 10 bits are tile index, then h-flip, then v-flip, then
#include "screen.h"
#include "../bang.h"
+Screen scr_main = {
+ .bgv = BG_TILE_RAM(BG_SLOT_VIS),
+ .fgv = BG_TILE_RAM(FG_SLOT_VIS),
+ .bg = BG_TILE_RAM(BG_SLOT),
+ .fg = BG_TILE_RAM(FG_SLOT),
+ .map = BG_MAP_RAM(MAP_SLOT),
+ .palv = BG_PALETTE,
+};
+Screen scr_sub = {
+ .bgv = BG_TILE_RAM_SUB(BG_SLOT_VIS),
+ .fgv = BG_TILE_RAM_SUB(FG_SLOT_VIS),
+ .bg = BG_TILE_RAM_SUB(BG_SLOT),
+ .fg = BG_TILE_RAM_SUB(FG_SLOT),
+ .map = BG_MAP_RAM_SUB(MAP_SLOT),
+ .palv = BG_PALETTE_SUB,
+};
+
+void scr_make_main(ScreenDevice *scr) {
+ scr->nds = &scr_main;
+}
+
+void scr_make_sub(ScreenDevice *scr) {
+ scr->nds = &scr_sub;
+}
+
void init_screens(void) {
// Allocate VRAM for screens
videoSetMode(DISPLAY_BG0_ACTIVE | DISPLAY_BG1_ACTIVE | MODE_0_2D);
@@ -127,6 +152,9 @@ void erase_screen(Screen *nds) {
void flip_buffer(Screen *nds) {
dmaCopyWords(0, nds->bg, nds->bgv, TILES_MEM);
dmaCopyWords(0, nds->fg, nds->fgv, TILES_MEM);
+ for (int i=0; i<16; i++) {
+ nds->palv[i] = nds->pal[i];
+ }
}
void black_screen(Screen *nds) {