示例#1
0
void Display::modeSelektor(){
	//Displaying bg3, and mode sprites
	bgSetPriority(this->subbg3, 1);
	DC_FlushAll();
	dmaCopy(greyedBgSubTiles,	bgGetGfxPtr(this->subbg3), greyedBgSubTilesLen);
	dmaCopy(greyedBgSubMap,		bgGetMapPtr(this->subbg3), greyedBgSubMapLen);
	bgShow(subbg3);
	s8 i;
	
	
	for (i = 0; i < 4; ++i){
		modesSprite->display(64 + i, 32 +  128 * (i % 2), 16 + 96 * (i / 2), OBJPRIORITY_0, i);
	}
	oamUpdate(&oamSub);
	input->paused = true;
	while(!(Cfg::modeSelector && input->pad->select() == DOWN) && input->modeSelektor() != 1){
		swiWaitForVBlank();
	}
	Cfg::modeSelector = false;
	oamClear(&oamSub, 64, 4);
	if (Cfg::mode == SLIDERS){
		dmaCopy(slidersBg3SubTiles,		bgGetGfxPtr(this->subbg3), slidersBg3SubTilesLen);
		dmaCopy(this->slidersBg3Map,	bgGetMapPtr(this->subbg3), 1536);
	} else {
		bgSetPriority(this->subbg3, 2);
		bgHide(this->subbg3);
	}
}
示例#2
0
void init_backgrounds()
{
	int main_bg2 = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	bgSetPriority(main_bg2, BG_PRIORITY(1));
	int main_bg3 = bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 6, 0);
	bgSetPriority(main_bg3, BG_PRIORITY(0));
	consoleInit(&top_screen, 0, BgType_Text4bpp, BgSize_T_256x256, 31, 0, 0, 1);
	consoleSelect(&top_screen);
	consoleClear();
	puts("Made by Lennart Kroes, s1062295");
}
void advMultipleLayers(void)
{
	videoSetMode(MODE_5_2D);
	vramSetBankA(VRAM_A_MAIN_BG);
	
	//initialize the backgrounds
	int bg1 = bgInit(0, BgType_Text8bpp, BgSize_ER_256x256, 0,1);
	int bg2 = bgInit(1, BgType_Text8bpp, BgSize_ER_256x256, 1,1);
	int bg3 = bgInit(2, BgType_ExRotation, BgSize_ER_256x256, 2,1);
	
	//make sure the floor is on the bottom (by default hardware layer 0 will be rendered last)
	bgSetPriority(bg1, 3);
	bgSetPriority(bg2, 2);
	bgSetPriority(bg3, 1);
	
	//they all share tiles and a palette
	dmaCopy(MultilayerTiles, bgGetGfxPtr(bg1), sizeof(MultilayerTiles));
	dmaCopy(MultilayerPal, BG_PALETTE, sizeof(MultilayerPal));

	//all we need to do is copy in the maps
	dmaCopy(Layer_1Map, bgGetMapPtr(bg1),  Layer_1MapLen);
	dmaCopy(Layer_2Map, bgGetMapPtr(bg2),  Layer_2MapLen);
	dmaCopy(Layer_3Map, bgGetMapPtr(bg3),  Layer_3MapLen);
	
	int keys = 0;
	bool bg1_hidden = false;
	bool bg2_hidden = false;
	bool bg3_hidden = false;

	while(!(keys & KEY_B))
	{
		scanKeys();
		
		keys = keysDown();
		
		if(keys & KEY_UP) bg1_hidden = !bg1_hidden;
		if(keys & KEY_DOWN) bg2_hidden = !bg2_hidden;
		if(keys & KEY_LEFT) bg3_hidden = !bg3_hidden;
		
		swiWaitForVBlank();
		
		bg1_hidden ? bgHide(bg1) : bgShow(bg1);
		bg2_hidden ? bgHide(bg2) : bgShow(bg2);
		bg3_hidden ? bgHide(bg3) : bgShow(bg3);
		
		consoleClear();

		iprintf("Press UP DOWN LEFT to toggle the layers\n\n");
		iprintf("Floor (UP): %s\n", bg1_hidden ? "hidden" : "displayed");
		iprintf("Walls (DOWN): %s\n", bg2_hidden ? "hidden" : "displayed");
		iprintf("Decorations (LEFT): %s\n", bg3_hidden ? "hidden" : "displayed");
	}
}
示例#4
0
文件: main.cpp 项目: fincs/b0rkshell
void videoInit()
{
	videoSetModeSub(MODE_0_2D);
	oamInit(&oamSub, SpriteMapping_Bmp_1D_128, false);

	int bgId = bgInitSub(3, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
	bgSetPriority(bgId, 3);
	dmaCopy(background.gfxData, bgGetGfxPtr(bgId), MemChunk_GetSize(background.gfxData));
	dmaCopy(background.mapData, bgGetMapPtr(bgId), MemChunk_GetSize(background.mapData));
	dmaCopy(background.palData, BG_PALETTE_SUB,    MemChunk_GetSize(background.palData));

	videoSetMode(MODE_3_2D);

	int bgBmp = bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
	bmpBuf = bgGetGfxPtr(bgBmp);
	clearBitmap();

	int bgTop = bgInit(2, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
	bgSetPriority(bgTop, 3);
	dmaCopy(topscr.gfxData, bgGetGfxPtr(bgTop), MemChunk_GetSize(topscr.gfxData));
	dmaCopy(topscr.mapData, bgGetMapPtr(bgTop), MemChunk_GetSize(topscr.mapData));
	dmaCopy(topscr.palData, BG_PALETTE,         MemChunk_GetSize(topscr.palData));

	u16* gfx = SPRITE_GFX_SUB;
	for (int i = 0; i < 6; i ++)
	{
		int xPos = 16 + (i % 3) * (64+16);
		int yPos = 48 + (i / 3) * (64+8);
		oamSet(&oamSub, i, xPos, yPos, 1, 15, SpriteSize_64x64, SpriteColorFormat_Bmp, gfx, -1, 0, false, false, false, false);
		gfx += 64*64;
	}
	{
		dmaCopy(selection.gfxData, gfx, MemChunk_GetSize(selection.gfxData));
		oamSet(&oamSub, 6, 0, 0, 0, 15, SpriteSize_16x16, SpriteColorFormat_Bmp, gfx, -1, 0, false, false, false, false);
		gfx += 16*16;
	}
	for (int i = 0; i < MAX_RUNNING_APP_COUNT; i ++)
	{
		oamSet(&oamSub, 7+i, 64+(i*(16+8)), 16, 1, 15, SpriteSize_16x16, SpriteColorFormat_Bmp, gfx, -1, 0, false, false, false, false);
		oamSub_mem[7+i].isHidden = true;
		gfx += 16*16;
	}

	g_appListChanged = true;

	bump.init(BG_PALETTE_SUB);
	bump.SelectBump(page);
	updCursor();
	loadPageIcons();
	updAppList();
	forceTopScrRefresh = true;
}
示例#5
0
void Display::editKaossParams(){
	CCParam* ccParam = NULL;

	bgSetPriority(this->subbg3, 1);
	DC_FlushAll();
	dmaCopy(greyedBgSubTiles,	bgGetGfxPtr(this->subbg3), greyedBgSubTilesLen);
	dmaCopy(greyedBgSubMap,		bgGetMapPtr(this->subbg3), greyedBgSubMapLen);
	bgShow(this->subbg3);
	while(!(Cfg::editParams && input->pad->start() == DOWN)){
		for (u8 i = 0; i<3; ++i){
			if (i == 0){
				echo(0, RED, 5, 7 + 8*(i%8), "X");
				ccParam = &Cfg::kaoss.x[Cfg::kaoss.bank];
			}
			if (i == 1){
				echo(0, RED, 5, 7 + 8*(i%8), "Y");
				ccParam = &Cfg::kaoss.y[Cfg::kaoss.bank];
			}
			if (i == 2){
				echo(0, RED, 5, 7 + 8*(i%8), "Z");
				ccParam = &Cfg::kaoss.z[Cfg::kaoss.bank];
			}
			

			echo(0, WHITE, 8, 7 + 8*(i%8), "CC");
			paramsEditSprite->display(16+i, 56 + 64*(i%8), 72, OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 10, 6 + 8*(i%8), (*ccParam).cc);
			paramsEditSprite->display(32+i, 56 + 64*(i%8), 88, OBJPRIORITY_0, 1);
			
			echo(0, WHITE, 13, 7 + 8*(i%8), "CH");
			paramsEditSprite->display(48+i, 56 + 64*(i%8), 112, OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 15, 6 + 8*(i%8), 1 + (*ccParam).channel);
			paramsEditSprite->display(64+i, 56 + 64*(i%8), 128, OBJPRIORITY_0, 1);
		}
		oamUpdate(&oamSub);
		input->editKaossParams();
		Cfg::editParams = true;
		swiWaitForVBlank();
	}
	Cfg::editParams = false;
	save->write();
	oamClear(&oamSub, 16, 80);	
	consoleClear();
	if (Cfg::mode == SLIDERS){
		dmaCopy(slidersBg3SubTiles,	bgGetGfxPtr(this->subbg3), slidersBg3SubTilesLen);
		dmaCopy(slidersBg3Map,		bgGetMapPtr(this->subbg3), 1536);
	} else {
		bgSetPriority(this->subbg3, 2);
		bgHide(this->subbg3);
	}
}
示例#6
0
文件: arm9_main.c 项目: 0xtob/dsmi
int main(void)
{
	// Video setup
	lcdMainOnBottom();
	irqEnable(IRQ_VBLANK);
	
	vramSetBankC(VRAM_C_SUB_BG);
	
    // Text console
	videoSetModeSub(MODE_5_2D);
	PrintConsole *pc = consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 4, 0, false, true);
	BG_PALETTE_SUB[255] = RGB15(31,15,0);
	bgSetPriority(pc->bgId, 0);
	
    // DSMI Logo
	int bg2 = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
	bgSetPriority(bg2, 1);
	u16 *bg2vram = bgGetGfxPtr(bg2);
	dmaCopy(dsmi_logo_dsBitmap, bg2vram, 256*192);
	
	iprintf("\x1b[12;12HPulse DS\n");
	
	// Connect
	int res = dsmi_connect();
	while(res == 0) {
		iprintf("\x1b[15;0H\x1b[KCould not connect. We apologize for the inconvecience.\n");
		while(1);
	}
	
	iprintf("\x1b[15;0H\x1b[KRunning.\n");
	
	u8 message, data1, data2;
	while(1)
	{
		// We query every 60th of a second (notice the swiWaitForVBlank).
		// For lower latency you should query more frequently.
		
		// Query and play until there are no more new messages
		while(dsmi_read(&message, &data1, &data2)) {
			printf("0x%x 0x%x 0x%x\n", message, data1, data2);
			midiToArm7(message, data1, data2);
		}
		
		swiWaitForVBlank();
	}
	
	return 0;
}
示例#7
0
void Display::editMixerParams(){
	CCParam ccParam;

	bgSetPriority(this->subbg3, 1);
	DC_FlushAll();
	dmaCopy(greyedBgSubTiles,	bgGetGfxPtr(this->subbg3), greyedBgSubTilesLen);
	dmaCopy(greyedBgSubMap,		bgGetMapPtr(this->subbg3), greyedBgSubMapLen);
	bgShow(this->subbg3);

	echo(0, RED, 0, 13, "MIXER");
	echo(0, RED, 12, 13, "MUTES");
	while(!(Cfg::editParams && input->pad->start() == DOWN)){
		for (u8 i = 0; i<8; ++i){
			ccParam = Cfg::mixer.ccs[i];
			
			echo(0, WHITE, 2, 1 + 4*(i%8), "CC");
			paramsEditSprite->display(16+i, 8 + 32*(i%8), 24, OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 4, 4*(i%8), ccParam.cc);
			paramsEditSprite->display(32+i, 8 + 32*(i%8), 40, OBJPRIORITY_0, 1);
			
			echo(0, WHITE, 6, 1 + 4*(i%8), "CH");
			paramsEditSprite->display(48+i, 8 + 32*(i%8), 56, OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 8, 4*(i%8), 1 + ccParam.channel);
			paramsEditSprite->display(64+i, 8 + 32*(i%8), 72, OBJPRIORITY_0, 1);
			
			ccParam = Cfg::mixer.mutes[i];

			echo(0, WHITE, 14, 1 + 4*(i%8), "CC");
			paramsEditSprite->display(24+i, 8 + 32*(i%8), 120, OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 16, 4*(i%8), ccParam.cc);
			paramsEditSprite->display(40+i, 8 + 32*(i%8), 136, OBJPRIORITY_0, 1);
			
			echo(0, WHITE, 18, 1 + 4*(i%8), "CH");
			paramsEditSprite->display(56+i, 8 + 32*(i%8), 152, OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 20, 4*(i%8), 1 + ccParam.channel);
			paramsEditSprite->display(72+i, 8 + 32*(i%8), 168, OBJPRIORITY_0, 1);
		}
		oamUpdate(&oamSub);
		input->editMixerParams();
		Cfg::editParams = true;
		swiWaitForVBlank();
	}
	save->write();
	Cfg::editParams = false;
	oamClear(&oamSub, 16, 80);	
	consoleClear();
}
示例#8
0
	void init() {

		initMemory();

		//Init backgrounds
		// Main 3D
		init3DSettings();
		// Main Map:
		mapEngine = new MapEngine(1, 4, 1);
		// Main Console:
		consoleInit(&main_console,3,BgType_ExRotation, BgSize_ER_256x256, 31, 0, true, false);
		bg3 = main_console.bgId;
		bgSetCenter(bg3, 254, 0);
		bgSetRotate(bg3, -8192);

		// Sub Console:
		consoleInit(&sub_console,3,BgType_ExRotation, BgSize_ER_256x256, 31, 1, false, false);
		bg3Sub = sub_console.bgId;
		bgSetCenter(bg3Sub, 254, 0);
		bgSetRotate(bg3Sub, -8192);

		// Sub Image:
		bg2Sub = bgInitSub(2, BgType_Bmp8, BgSize_B8_256x256, 4,0);
		dmaCopy(leftmenuBitmap, bgGetGfxPtr(bg2Sub), 256*192);
		dmaCopy(leftmenuPal, BG_PALETTE_SUB, leftmenuPalLen);

		// Init Sprites
		oamInit(&oamMain, SpriteMapping_1D_128, false);

		// Set the priorities
		bgSetPriority(0,1);
		bgSetPriority(1,2);
		bgSetPriority(2,3);
		bgSetPriority(3,0);
		bgSetPriority(bg3Sub, 2);
		bgSetPriority(bg2Sub, 3);

		//Init font
		font.gfx = (u16*)fontTiles;
		font.pal = (u16*)fontPal;
		font.numChars = 95;
		font.numColors =  fontPalLen / 2;
		font.bpp = 8;
		font.asciiOffset = 32;
		font.convertSingleColor = false;
		consoleSetFont(&main_console, &font);
		consoleSetFont(&sub_console, &font);

		consoleSelect(&main_console);
		iprintf("\x1b[2J");
		iprintf("Arkham Tower v0.01");
		consoleSelect(&sub_console);
		iprintf("\x1b[2J");
	}
示例#9
0
void Display::editSliderParams(){
	CCParam ccParam;
	u8		color;

	bgSetPriority(this->subbg3, 1);
	DC_FlushAll();
	dmaCopy(greyedBgSubTiles,	bgGetGfxPtr(this->subbg3), greyedBgSubTilesLen);
	dmaCopy(greyedBgSubMap,		bgGetMapPtr(this->subbg3), greyedBgSubMapLen);
	bgShow(this->subbg3);

	while(!(Cfg::editParams && input->pad->start() == DOWN)){
		for (u8 i = 0; i<16; ++i){
			ccParam = Cfg::sliders.ccs[Cfg::sliders.bank][i];
			color = Cfg::sliders.colors[Cfg::sliders.bank][i];

			echo(0, WHITE, 12*(i/8) , 1 + 4*(i%8), "CC");
			paramsEditSprite->display(16+i, 8 + 32*(i%8), 8 + 96*(i/8), OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 2 + 12*(i/8) , 4*(i%8), ccParam.cc);
			paramsEditSprite->display(32+i, 8 + 32*(i%8), 24 + 96*(i/8), OBJPRIORITY_0, 1);
			
			echo(0, WHITE, 4+12*(i/8) , 1 + 4*(i%8), "CH");
			paramsEditSprite->display(48+i, 8 + 32*(i%8), 40 + 96*(i/8), OBJPRIORITY_0, 0);
			iprintf("\x1b[%d;%dH%3d", 6 + 12*(i/8) , 4*(i%8), 1 + ccParam.channel);
			paramsEditSprite->display(64+i, 8 + 32*(i%8), 56 + 96*(i/8), OBJPRIORITY_0, 1);

			paramsEditSprite->display(80+i, 8 + 32*(i%8), 72 + 96*(i/8), OBJPRIORITY_0, color + 2);
		}
		oamUpdate(&oamSub);
		input->editSliderParams();
		Cfg::editParams = true;
		swiWaitForVBlank();
	}
	save->write();
	Cfg::editParams = false;
	oamClear(&oamSub, 16, 80);	
	consoleClear();
	sliders();
}
示例#10
0
Display::Display(){

// INIT
//-------------------------------------------------------------------------
	frame = 0;
	srand((int)NULL);

	// Main Init
	videoSetMode(MODE_5_2D | DISPLAY_BG_EXT_PALETTE);
	oamInit(&oamMain, SpriteMapping_1D_128, true);

	// Sub Init
	videoSetModeSub(MODE_5_2D | DISPLAY_BG_EXT_PALETTE);
	oamInit(&oamSub, SpriteMapping_1D_128, true);
//-------------------------------------------------------------------------
	

// FONT LOADING
//-------------------------------------------------------------------------
	ConsoleFont font;
	font.gfx				= (u16*)fontTiles;
	font.pal				= (u16*)fontPal;
	font.numChars			= 95;
	font.numColors			=  16;
	font.bpp				= 4;
	font.asciiOffset		= 32;
	font.convertSingleColor = true;
//-------------------------------------------------------------------------


// MAIN BACKGROUNDS
//-------------------------------------------------------------------------
	//BG Palettes
	vramSetBankE(VRAM_E_LCD);
	dmaCopy(fontPal,	VRAM_E_EXT_PALETTE[0], 512);
	dmaCopy(bgMainPal,	VRAM_E_EXT_PALETTE[2], 512);
	dmaCopy(padsBgMainPal,	VRAM_E_EXT_PALETTE[3], 512);
	vramSetBankE(VRAM_E_BG_EXT_PALETTE);

	//BG0 : Text
	mainbg0 = bgInit(0, BgType_Text4bpp, BgSize_T_256x256, 1, 0);
	consoleInit(&this->mainConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 1, 0, true, false);
	consoleSetFont(&this->mainConsole, &font);
	bgSetPriority(this->mainbg0, 0);

	//BG2
	mainbg2 = bgInit(2, BgType_Rotation, BgSize_R_256x256, 7,	1);
	dmaCopy(bgMainTiles,	bgGetGfxPtr(mainbg2), bgMainTilesLen);
	dmaCopy(bgMainMap,		bgGetMapPtr(mainbg2), bgMainMapLen);
	bgSetPriority(this->mainbg2, 3);
	bgHide(mainbg2);

	//BG3
	mainbg3 = bgInit(3, BgType_Rotation, BgSize_R_256x256, 12,	2);
	dmaCopy(padsBgMainTiles,	bgGetGfxPtr(mainbg3), padsBgMainTilesLen);
	dmaCopy(padsBgMainMap,		bgGetMapPtr(mainbg3), padsBgMainMapLen);
	bgSetPriority(this->mainbg3, 2);
	bgHide(mainbg3);
//-------------------------------------------------------------------------
	

// MAIN SPRITES
//-------------------------------------------------------------------------
	//Palettes
	vramSetBankF(VRAM_F_LCD);
	dmaCopy(dotSpritePal,			VRAM_F_EXT_SPR_PALETTE[0], 512);
	dmaCopy(ledSpritePal,			VRAM_F_EXT_SPR_PALETTE[1], 512);
	dmaCopy(banksSpritePal,			VRAM_F_EXT_SPR_PALETTE[2], 512);
	dmaCopy(octaveSelectSpritePal,	VRAM_F_EXT_SPR_PALETTE[3], 512);
	vramSetBankF(VRAM_F_SPRITE_EXT_PALETTE);
	
	//Sprites loading
	dotSprite			= new Sprite(1, dotSpriteTiles,				0, SpriteSize_64x32, 3);
	ledSprite			= new Sprite(1, ledSpriteTiles,				1, SpriteSize_16x16, 4);
	banksSprite			= new Sprite(1, banksSpriteTiles,			2, SpriteSize_16x16, 8);
	octaveSelectSprite	= new Sprite(1, octaveSelectSpriteTiles,	3, SpriteSize_32x16, 1);
//-------------------------------------------------------------------------


// SUB BACKGROUNDS
//-------------------------------------------------------------------------
	//BG Palettes
	vramSetBankH(VRAM_H_LCD);
	dmaCopy(fontPal, VRAM_H_EXT_PALETTE[0], 512);
	dmaCopy(slidersBg2SubPal, VRAM_H_EXT_PALETTE[2], 512);
	dmaCopy(slidersBg3SubPal, VRAM_H_EXT_PALETTE[3], 512);
	vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE);

	//BG0 : Text
	subbg0 = bgInitSub(0, BgType_Text4bpp, BgSize_T_256x256, 4, 0);
	consoleInit(&subConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, false, true);
	consoleSetFont(&subConsole, &font);
	bgSetPriority(subbg0, 1);

	//BG2
	subbg2 = bgInitSub(2, BgType_Rotation, BgSize_R_256x256, 5,1);
	bgSetPriority(subbg2, 3);

	//BG3
	subbg3 = bgInitSub(3, BgType_Rotation, BgSize_R_256x256, 6,2);
	bgSetPriority(subbg3, 2);
	bgHide(subbg3);
//-------------------------------------------------------------------------
	

// SUB SPRITES
//-------------------------------------------------------------------------
	//Palettes
	vramSetBankI(VRAM_I_LCD);
	dmaCopy(kaossBrickSpritePal,	VRAM_I_EXT_SPR_PALETTE[0], 512);
	dmaCopy(padSpritePal,			VRAM_I_EXT_SPR_PALETTE[1], 512);
	dmaCopy(modeSpritePal,			VRAM_I_EXT_SPR_PALETTE[2], 512);
	dmaCopy(sliderCursorSpritePal,	VRAM_I_EXT_SPR_PALETTE[3], 512);
	dmaCopy(muteSpritePal,			VRAM_I_EXT_SPR_PALETTE[4], 512);
	dmaCopy(editParamsSpritePal,	VRAM_I_EXT_SPR_PALETTE[5], 512);
	vramSetBankI(VRAM_I_SUB_SPRITE_EXT_PALETTE);

	//Sprites loading	
	kaossBrickSprite	= new Sprite(0, kaossBrickSpriteTiles,		0, SpriteSize_32x32, 16);
	padSprite			= new Sprite(0, padSpriteTiles,				1, SpriteSize_64x64, 2);
	modesSprite			= new Sprite(0, modeSpriteTiles,			2, SpriteSize_64x64, 4);
	sliderCursorSprite	= new Sprite(0, sliderCursorSpriteTiles,	3, SpriteSize_32x16, 6);
	muteSprite			= new Sprite(0, muteSpriteTiles,			4, SpriteSize_32x32, 2);
	paramsEditSprite	= new Sprite(0, editParamsSpriteTiles,		5, SpriteSize_16x16, 8);
//-------------------------------------------------------------------------


// STRUCTURES INITIALISATION
//-------------------------------------------------------------------------
	kaossBricksState = new u8**[4];
	for (u8 b = 0; b < 4; ++b){
		kaossBricksState[b] = new u8*[8];
		for (u8 i = 0; i < 8; ++i){
			kaossBricksState[b][i] = new u8[8];
			for (u8 j = 0; j < 8; ++j)
				kaossBricksState[b][i][j] = 0;
		}
	}
	slidersBg2Map	= new unsigned short[768];
	slidersBg3Map	= new unsigned short[768];
//-------------------------------------------------------------------------
	consoleSelect(&mainConsole);
	consoleClear();

	dmaCopy(bgSplashTiles,	bgGetGfxPtr(subbg2), bgSplashTilesLen);
	dmaCopy(bgSplashMap,	bgGetMapPtr(subbg2), bgSplashMapLen);

	echo(0, GREY, 12, 10, "Connecting...");
	echo(0, WHITE, 23, 6, "midicontrolds.blogspot.com");
}
示例#11
0
文件: main.c 项目: 0xtob/dsmi
int main(void)
{
	lcdMainOnBottom();
	
	// Register vblank IRQ
	irqEnable(IRQ_VBLANK);
	
	// Set banks
	vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000,
	           VRAM_C_SUB_BG_0x06200000 , VRAM_D_LCD);
	
	// Set modes
	videoSetMode(MODE_5_2D);
	videoSetModeSub(MODE_5_2D);
	
	// sub display
	int sub_bg3 = bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
	bgSetPriority(sub_bg3, 1);
	
#ifdef DEBUG
	// Text bg on sub
	PrintConsole *pc = consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 4, 0, false);
	bgSetPriority(pc->bgId, 0);
	BG_PALETTE_SUB[255] = RGB15(31,0,31);
#endif
	// The main display is for graphics.
	// Set up an extended rotation background for background gfx
	int main_bg2 = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
	bgSetPriority(main_bg2, 1);
	
	// Set up tile mode for the keyboard
	int main_bg0 = bgInit(0, BgType_Text4bpp, BgSize_T_256x256, 8, 0);
	bgSetPriority(main_bg0, 0);
	
	// Clear tile mem
	u16 *tile_ram = (u16*)bgGetGfxPtr(main_bg0);
	u32 i;
	for(i=0; i<(32*1024); ++i) {
		tile_ram[i] = 0;
	}
	
	// Copy tiles and palettes
	dmaCopy((uint16*)keyboard_Palette, (uint16*)BG_PALETTE, 32);
	dmaCopy((uint16*)keyboard_fullnotehighlight_Palette, (uint16*)BG_PALETTE+16, 32);
	dmaCopy((uint16*)keyboard_halfnotehighlight_Palette, (uint16*)BG_PALETTE+32, 32);
	dmaCopy((uint16*)keyboard_Tiles, (uint16*)CHAR_BASE_BLOCK(0), 736);
	
	// Fill screen with empty tiles
	u16 *map = (u16*)bgGetMapPtr(main_bg0);
	for(i=0;i<768;++i) {
		map[i] = 28;
	}
	
	// Draw the backgrounds
	main_vram = (u16*)bgGetGfxPtr(main_bg2);
	for(i=0; i<192*256; ++i) {
		main_vram[i] = ((uint16*)bg_main)[i];
	}
	
	u16 *sub_vram = (u16*)bgGetGfxPtr(sub_bg3);
	for(i=0; i<192*256; ++i) {
		sub_vram[i] = ((uint16*)bg_sub)[i];
	}

	
	displayChannel(channel);
	displayOctave(baseOctave);
	
	drawString("connecting ...", 89, 96);
	
	iprintf("Connecting\n");
	int res = dsmi_connect();
	if(res == 1) {
		iprintf("OK\n");
	} else {
		iprintf("Oh no! Could not connect\n");
		drawString("failed!", 180, 96);
		while(1);
	}
	
	iprintf("Ready.\n");

	// Copy the keyboard to the screen
	kb_map = (u16*)bgGetMapPtr(main_bg0);
	u8 x, y;
	for(y=0; y<5; ++y) {
		for(x=0; x<28; ++x) {
			kb_map[32*(y+keyb_ypos)+(x+keyb_xpos)] = keyboard_Map[29*y+x+1];
		}
	}

	while(1) {
		VblankHandler();
		swiWaitForVBlank();
	}

	return 0;
}
示例#12
0
文件: game.c 项目: dibas/portalDS
void initGame(void)
{
	lcdMainOnTop();
	int oldv=getMemFree();
	NOGBA("mem free : %dko (%do)",getMemFree()/1024,getMemFree());
	NOGBA("initializing...");
	videoSetMode(MODE_5_3D | DISPLAY_BG3_ACTIVE);
	videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE);
	
	glInit();
	
	vramSetPrimaryBanks(VRAM_A_TEXTURE,VRAM_B_TEXTURE,VRAM_C_LCD,VRAM_D_MAIN_BG_0x06000000);
	vramSetBankH(VRAM_H_SUB_BG);
	vramSetBankI(VRAM_I_SUB_BG_0x06208000);
	
	glEnable(GL_TEXTURE_2D);
	// glEnable(GL_ANTIALIAS);
	glDisable(GL_ANTIALIAS);
	glEnable(GL_BLEND);
	glEnable(GL_OUTLINE);
	
	glSetOutlineColor(0,RGB15(0,0,0)); //TEMP?
	glSetOutlineColor(1,RGB15(0,0,0)); //TEMP?
	glSetOutlineColor(7,RGB15(31,0,0)); //TEMP?
	glSetToonTableRange(0, 15, RGB15(8,8,8)); //TEMP?
	glSetToonTableRange(16, 31, RGB15(24,24,24)); //TEMP?
	
	glClearColor(31,31,0,31);
	glClearPolyID(63);
	glClearDepth(0x7FFF);

	glViewport(0,0,255,191);
	
	// initVramBanks(1);
	initVramBanks(2);
	initTextures();
	initSound();
	
	initCamera(NULL);
	
	initPlayer(NULL);
	
	initLights();
	initParticles();
	
	initMaterials();
	
	loadMaterialSlices("slices.ini");
	loadMaterials("materials.ini");
	loadControlConfiguration("config.ini");
	
	initElevators();
	initWallDoors();
	initTurrets();
	initBigButtons();
	initTimedButtons();
	initEnergyBalls();
	initPlatforms();
	initCubes();
	initEmancipation();
	initDoors();
	initSludge();
	initPause();

	initText();

	NOGBA("lalala");

	getPlayer()->currentRoom=&gameRoom;
	
	currentBuffer=false;
	
	getVramStatus();
	fadeIn();
	
	mainBG=bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	bgSetPriority(mainBG, 0);
	REG_BG0CNT=BG_PRIORITY(3);
	
	#ifdef DEBUG_GAME
		consoleInit(&bottomScreen, 3, BgType_Text4bpp, BgSize_T_256x256, 16, 0, false, true);
		consoleSelect(&bottomScreen);
	#endif
	
	// glSetToonTableRange(0, 14, RGB15(16,16,16));
	// glSetToonTableRange(15, 31, RGB15(26,26,26));
	
	initPortals();
	
	//PHYSICS
	initPI9();

	strcpy(&mapFilePath[strlen(mapFilePath)-3], "map");
	newReadMap(mapFilePath, NULL, 255);
	
	transferRectangles(&gameRoom);
	makeGrid();
	generateRoomGrid(&gameRoom);
	gameRoom.displayList=generateRoomDisplayList(&gameRoom, vect(0,0,0), vect(0,0,0), false);
	
	getVramStatus();
	
	startPI();

	NOGBA("START mem free : %dko (%do)",getMemFree()/1024,getMemFree());
	NOGBA("vs mem free : %dko (%do)",oldv/1024,oldv);

	levelInfoCounter=60;
}
示例#13
0
void TunnelPartInit(void)
{
	T_Mesh* mesh;
	int i;
	
	/* 
	 * Initialisation vidéo
	 */ 
	/* Modes video */
	videoSetMode(MODE_5_3D);
	videoSetModeSub(MODE_5_2D);
	lcdMainOnBottom();
	
	vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
	vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
	vramSetBankC(VRAM_C_SUB_BG_0x06200000);
	vramSetBankD(VRAM_D_TEXTURE_SLOT3);
	
	videoBgEnable(DISPLAY_BG0_ACTIVE | DISPLAY_BG2_ACTIVE);
	videoBgEnableSub(DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE);
	
	/* Le BG qui servira pour le tunnel */
	TunnelBgId = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	TunnelBgPixels = (u16*)bgGetGfxPtr(TunnelBgId);
	bgSetPriority(TunnelBgId, 2); /* Le tunnel en fond */

	/* L'avant plan de l'éléphant */	
	FrontLayerId = bgInit(2, BgType_Bmp8, BgSize_B8_256x256, 8, 0);
	FrontLayerPixels = (u8*)bgGetGfxPtr(FrontLayerId);
	bgSetPriority(FrontLayerId, 0); /* En avant plan */
	decompress(bouleBitmap, FrontLayerPixels, LZ77Vram);
	decompress(boulePal, BG_PALETTE, LZ77Vram); 
	
	bgSetPriority(0, 1); /* La 3D entre les deux */
	
	
	/* Initialisation de la 3D */
    Init3DEngine();
    
	TunnelFxInit(TunnelBgPixels);
	        
    mesh = CreateMesh();
    mesh->display_list = DiscoElephant_mesh;
    mesh->alpha = 31;
    mesh->texturing = TRUE;
    mesh->lighting = TRUE;
    DiscoElephant = CreateObj3D(mesh);
    Scene = CreateScene();
    AddObject(Scene, DiscoElephant);
    
    Scene->lights[0] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(16, 0, 01), TRUE);
    Scene->lights[1] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(0, 16, 0), TRUE);
    Scene->lights[2] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(0, 0, 16), TRUE);
    Scene->lights[3] = CreateLight(floattov10(0), floattov10(0), floattov10(-1), RGB15(16, 16, 0), TRUE);
    
    glClearColor(0, 0, 0, 0);
    
    flare_tex = CreateTextureFromMemory((u8*)flareBitmap, GL_RGBA, 0, 16, 64, TRUE, LZ77Vram);
    
    for(i=0; i<4; i++) {
    	flares[i] = malloc(sizeof(*flares[i]));
    }
    
    flares[0]->position[0] = 0;
    flares[0]->position[1] = 0;
    flares[0]->position[2] = floattof32(-1);
    flares[0]->poly_alpha = 16;
    flares[0]->color = RGB15(31, 0, 0);
    flares[0]->size = floattov16(0.15f);
    flares[0]->texture_id = flare_tex->id;
    flares[0]->poly_id = 5;
    
    flares[1]->position[0] = 0;
    flares[1]->position[1] = 0;
    flares[1]->position[2] = floattof32(-1);
    flares[1]->poly_alpha = 16;
    flares[1]->color = RGB15(0, 31, 0);
    flares[1]->size = floattov16(0.15f);
    flares[1]->texture_id = flare_tex->id;
    flares[1]->poly_id = 6;
    
    flares[2]->position[0] = 0;
    flares[2]->position[1] = 0;
    flares[2]->position[2] = floattof32(-1);
    flares[2]->poly_alpha = 16;
    flares[2]->color = RGB15(0, 0, 31);
    flares[2]->size = floattov16(0.15f);
    flares[2]->texture_id = flare_tex->id;
    flares[2]->poly_id = 6;
    
    flares[3]->position[0] = 0;
    flares[3]->position[1] = 0;
    flares[3]->position[2] = floattof32(-1);
    flares[3]->poly_alpha = 16;
    flares[3]->color = RGB15(31, 31, 0);
    flares[3]->size = floattov16(0.15f);
    flares[3]->texture_id = flare_tex->id;
    flares[3]->poly_id = 7;
    
    tex = CreateTextureFromMemory((u8*)DiscoElephantBitmap, GL_RGB, 0, 16, 64, TRUE, LZ77Vram);
    DiscoElephant->mesh->texture_id = tex->id;
    DiscoElephant->mesh->texturing = TRUE;
    
	/* Initialisation du fade in depuis le blanc */
	REG_MASTER_BRIGHT = (1<<14);
	REG_MASTER_BRIGHT_SUB = REG_MASTER_BRIGHT;
	
	StartFlash(-1000); // pour éviter un flash à la première seconde
	
	glMaterialf(GL_AMBIENT, RGB15(16,16,16));
    glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31));
	glMaterialShinyness();
}
示例#14
0
int main() {

	// initialize the geometry engine
	glInit();	

	// Setup the Main screen for 3D 
	videoSetMode(MODE_0_3D);
	
	//map some vram to background for printing
	vramSetBankC(VRAM_C_MAIN_BG_0x06000000);
 
	consoleInit(0,1, BgType_Text4bpp, BgSize_T_256x256, 31,0, true, true);

	//put bg 0 at a lower priority than the text background
	bgSetPriority(0, 1);
  

 
	// enable antialiasing
	glEnable(GL_ANTIALIAS);
 
	// setup the rear plane
	glClearColor(0,0,0,31); // BG must be opaque for AA to work
	glClearPolyID(63); // BG must have a unique polygon ID for AA to work
	glClearDepth(0x7FFF);
 
	// Set our viewport to be the same size as the screen
	glViewport(0,0,255,191);
 
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(70, 256.0 / 192.0, 0.1, 100);
 
	//ds specific, several attributes can be set here	
	glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
 
	// Set the current matrix to be the model matrix
	glMatrixMode(GL_MODELVIEW);
 
	iprintf("      Hello DS World\n");
	iprintf("     www.devkitpro.org\n");
	iprintf("   www.drunkencoders.com\n");

	while (1) {
 
		DrawGLScene();
 
		// flush to screen	
		glFlush(0);
 
		// wait for the screen to refresh
		swiWaitForVBlank();

		printf("\x1b[15;5H rtri  = %f     \n", rtri);
		printf("\x1b[16;5H rquad = %f     \n", rquad);
		rtri+=0.9f;										// Increase The Rotation Variable For The Triangle ( NEW )
		rquad-=0.75f;									// Decrease The Rotation Variable For The Quad ( NEW )

		rtri  = fmodf( rtri , 360 );
		rquad = fmodf( rquad, 360 );

	}
 
	return 0;
}
示例#15
0
void mode__intro__credits___init(void) {

  // initialize main screen
  videoSetMode(MODE_5_2D);

  // map main screen background fourth (128k) region to vram bank A
  vramSetBankA(VRAM_A_MAIN_BG_0x06060000);
  
  // set the secondary/sub screen for text and a background
  videoSetModeSub(MODE_5_2D);

  // map sub screen background (only? 1/4?) to vram bank C
  vramSetBankC(VRAM_C_SUB_BG);

  // FRAK, may need to reimplement this with mcp_bg_init...
  // XXX: time will tell if this flickers
  consoleInit(&bottom_screen, 
	      0, 
	      BgType_Text4bpp, 
	      BgSize_T_256x256, 
	      31, 
	      0, 
	      false,
	      true);

  // set printf sink
  consoleSelect(&bottom_screen);

  // set console background layer to top priority
  bgSetPriority(bottom_screen.bgId, 0);

  // note: this must be done _after_ consoleInit (as that resets it)
  //       and _after_ loading our 8bit indexed bitmap reloads it
  // set to black to allow renderer to really control
  BG_PALETTE_SUB[255] = RGB15(0, 0, 0);

  // unfaded
  mcp_set_blend(MCP_MAIN_SCREEN,
		MCP_MAX_BLEND_LEVEL);
  mcp_set_blend(MCP_SUB_SCREEN,
		MCP_MAX_BLEND_LEVEL);

  // fade the mainscreen background to/from black, layer 3
  REG_BLDCNT = BLEND_FADE_BLACK | BLEND_SRC_BG3;
  // fade the lava background to/from black, layer 3
  REG_BLDCNT_SUB = BLEND_FADE_BLACK | BLEND_SRC_BG3;

  // init subscreen layer/background 3 
  // the mapbase offset of 24 here means 24*16k which means utilizing
  // the 4th of the possible main background memory regions that vram
  // bank A can be mapped to.  I.e. above we mapped to the 4th.  Had
  // we mapped to the 1st, we would have used offset 0.  
  // note: vram bank A is 128k, i.e. 8 * 16k.
  // note: *16k is because of bitmap type, else would be *2k
  //  bg3 = bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 24, 0);
  bg3 = mcp_bg_init(MCP_MAIN_SCREEN,
		    3, 
		    MCP_BG_HIDE,
		    BgType_Bmp16, 
		    BgSize_B16_256x256, 
		    24, 
		    0);

  // its initial priority, lowest (to emphasize lack of other enabled layers)
  // priorities 0..3, 0 highest priority
  bgSetPriority(bg3, 3);

  //  bgHide(bg3);

  // load main splash screen into screen/background memory (bgs3)
  // note: if I wanted to do this quickly/perfectly/doublebufferred somehow
  //       I'm not sure if I'd need to tweak the bgInitSub offset or pointer
  //       here or some such.  As it is, the fade to black ensures no tear
  //       as this new image gets loaded into display memory.
  decompress(guitar_zyx_splash_creditsBitmap, 
	     (u16*)bgGetGfxPtr(bg3),  
	     LZ77Vram);
  
  bgShow(bg3);

  // note: using offset=4, because 4 will be 64k offset, where 31 above is 62k
  // (thus above using only 2k? seems plausible with tiles for console text chars
  // NOTE: if this flickers, could try 2 instead of 3
  bgs3 = mcp_bg_init(MCP_SUB_SCREEN,
		     3,
		     MCP_BG_HIDE,
		     BgType_Bmp8, 
		     BgSize_B8_256x256, 
		     4, 
		     0);
  // its initial priority, lowest (to emphasize lack of other enabled layers)
  // priorities 0..3, 0 highest priority
  bgSetPriority(bgs3, 2);

  //  bgHide(bgs3);

  // as per libnds doc on dma
  DC_FlushRange(dlavaBitmap, 256*256);
  dmaCopy(dlavaBitmap, bgGetGfxPtr(bgs3), 256*256);
  DC_FlushRange(dlavaPal, 256*2);
  dmaCopy(dlavaPal, BG_PALETTE_SUB, 256*2);
  
  bgShow(bgs3);

  BG_PALETTE_SUB[255] = RGB15(0, 0, 0);
}
示例#16
0
void Outro_Run() {
	Outro_ConfigureHardware();

	/* Enable background blending */
	REG_BLDCNT = BLEND_SRC_BG0 | BLEND_SRC_BG3 | BLEND_FADE_BLACK;
	REG_BLDCNT_SUB = BLEND_SRC_BG0 | BLEND_SRC_BG3 | BLEND_FADE_BLACK;

	/* Configure background engines */	
	int bg0_main = bgInit(0, BgType_Text4bpp, BgSize_T_256x256, 1, 0);
	int bg0_sub = bgInitSub(0, BgType_Text4bpp, BgSize_T_256x256, 1, 0);

	/* Set background 0 to display below background 1 */
	bgSetPriority(bg0_main, 1);
	bgSetPriority(bg0_sub, 1);

	Outro_LoadResources(bg0_main, bg0_sub);

	/* Set up distortion effects */
	Distorter *distorter_main = malloc(sizeof(Distorter));
	Distorter_Init(distorter_main, 0, DistorterEngineMain, -(20 << 8), 96, 4 << 8);

	Distorter *distorter_sub = malloc(sizeof(Distorter));
	Distorter_Init(distorter_sub, 3, DistorterEngineSub, -(16 << 8), 96, 4 << 8);

	/* Create a console for the main display and print the message to it */
	PrintConsole display_console_main;	
	TitleConsole_Init(&display_console_main, 3, true, 2, 1);

	consoleSelect(&display_console_main);
	iprintf("THE\nEND");

	/* Create a console for the sub display and print the message to it */
	PrintConsole display_console_sub;	
	TitleConsole_Init(&display_console_sub, 3, false, 2, 1);

	consoleSelect(&display_console_sub);
	iprintf("MORE\nSOON");

	/* Offset each console so they are vertically centered */
	bgSetScroll(display_console_main.bgId, 0, -16);
	bgSetScroll(display_console_sub.bgId, 0, -16);
	bgUpdate();

	/* Fade in */
	for (int blend_factor = 0xf; blend_factor >= 0x0; blend_factor--) {
		Outro_Draw(distorter_main, distorter_sub);

		REG_BLDY = blend_factor;
		REG_BLDY_SUB = blend_factor;
	}

	/* Main stage loop. Exit when a key is pressed */
	while (!(keysDown() & KEY_START)) {
		Outro_Draw(distorter_main, distorter_sub);

		scanKeys();
	}

	Distorter_Free(distorter_main);
	free(distorter_main);

	Distorter_Free(distorter_sub);
	free(distorter_sub);
}
示例#17
0
void mode__intro__main___init(void) {

  // ooh, ahh, earcandy
  mmEffectEx(&sounds[SFX_STARTUP]);

  // initialize main screen 
  // edunote: had tried MODE_5_3D here, but after 3D was actually used,
  //          it would interfere with the bitmap showing.  I think I'm
  //          effectively bghiding all layers in intermode init, but
  //          maybe I'm not, or maybe there is another way to hide the 3D
  //          layer.  Probably I should figure out how to render 3D on 
  //          top of a bitmap successfully.  Then the rest might follow.
  videoSetMode(MODE_5_2D);

  // map main screen background fourth (128k) region to vram bank A
  vramSetBankA(VRAM_A_MAIN_BG_0x06060000);
  
  // NOTE: current half educated assumption is that or-ing together
  //       bg enabled layers here is nothing but effectively an
  //       advanced call to bgShow, which is also a part of bgInit
  // NOTE2: after some time, I'm convinced of the above, and about
  //        to write a function bg_init_hidden()
  videoSetModeSub(MODE_5_2D);

  // map sub screen background (only? 1/4?) to vram bank C
  vramSetBankC(VRAM_C_SUB_BG);

  mcp_console_init(&bottom_screen, 
		   MCP_SUB_SCREEN,
		   0, 
		   1,
		   1,
		   BgType_Text4bpp, 
		   BgSize_T_256x256, 
		   31, 
		   0);

  // set printf sink
  consoleSelect(&bottom_screen);

  // set console background layer to top priority
  bgSetPriority(bottom_screen.bgId, 0);

  // note: this must be done _after_ consoleInit (as that resets it)
  //       and _after_ loading our 8bit indexed bitmap reloads it
  // set to black to allow renderer to really control
  BG_PALETTE_SUB[255] = RGB15(0, 0, 0);

  // show the console layer
  mcp_bg_show(MCP_SUB_SCREEN, 0);

  // default to fully faded (to black)
  mcp_set_blend(MCP_MAIN_SCREEN, 
		MCP_MAX_BLEND_LEVEL);
  mcp_set_blend(MCP_SUB_SCREEN, 
		MCP_MAX_BLEND_LEVEL);

  // fade the mainscreen background to/from black, layer 3
  REG_BLDCNT = BLEND_FADE_BLACK | BLEND_SRC_BG3;
  // fade the lava background to/from black, layer 3
  REG_BLDCNT_SUB = BLEND_FADE_BLACK | BLEND_SRC_BG2;

  // init subscreen layer/background 3 
  // the mapbase offset of 24 here means 24*16k which means utilizing
  // the 4th of the possible main background memory regions that vram
  // bank A can be mapped to.  I.e. above we mapped to the 4th.  Had
  // we mapped to the 1st, we would have used offset 0.  
  // note: vram bank A is 128k, i.e. 8 * 16k.
  // note: *16k is because of bitmap type, else would be *2k
  //  bg3 = bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 24, 0);
  bg3 = mcp_bg_init(MCP_MAIN_SCREEN,
		    3, 
		    MCP_BG_HIDE,
		    BgType_Bmp16, 
		    BgSize_B16_256x256, 
		    24, 
		    0);
  // its initial priority, lowest (to emphasize lack of other enabled layers)
  // note: priorities 0..3, 0 highest priority
  bgSetPriority(bg3, 3);

  // mcp_bg_init covers this
  // maybe this prevents flicker during decompress
  //  bgHide(bg3);

  // load main splash screen into screen/background memory (bgs3)
  decompress(guitar_zyx_splash_mainBitmap, 
	     (u16*)bgGetGfxPtr(bg3),  
	     LZ77Vram);
  // maybe this prevents flicker during decompress
  mcp_bg_show(MCP_MAIN_SCREEN, 3);

  // note: using offset=4, because 4 will be 64k offset, where 31 above is 62k
  // (thus above using only 2k? seems plausible with tiles for console text chars
  //  bgs2 = bgInitSub(2, BgType_Bmp8, BgSize_B8_256x256, 4, 0);
  bgs2 = mcp_bg_init(MCP_SUB_SCREEN,
		     2,
		     MCP_BG_HIDE,
		     BgType_Bmp8, 
		     BgSize_B8_256x256, 
		     4, 
		     0);
  // its initial priority, lowest (to emphasize lack of other enabled layers)
  // priorities 0..3, 0 highest priority
  bgSetPriority(bgs2, 2);

  // mcp_bg_init covers this
  //  bgHide(bgs2);

  // note: as per libnds doc on dma, do the flush first
  DC_FlushRange(dlavaBitmap, 256*256);
  dmaCopy(dlavaBitmap, bgGetGfxPtr(bgs2), 256*256);
  DC_FlushRange(dlavaPal, 256*2);
  dmaCopy(dlavaPal, BG_PALETTE_SUB, 256*2);
  
  bgShow(bgs2);

  // reinitialize the text color
  BG_PALETTE_SUB[255] = RGB15(0, 0, 0);

  /* bad experiment, but probably will use later anyway)
  consoleInit(&bottom_screen_x, 
	      3, 
	      BgType_ExRotation,
	      BgSize_ER_256x256,
	      31, 
	      1, 
	      false,
	      false);

  // custom 8bpp font
  mcpfont.asciiOffset = 32;
  mcpfont.bpp = 8;
  mcpfont.convertSingleColor = false;
  mcpfont.gfx = (u16*)mcpfontTiles;
  mcpfont.numChars = 95;
  mcpfont.numColors =  mcpfontPalLen / 2;
  mcpfont.pal = (u16*)mcpfontPal;
  consoleSetFont(&bottom_screen, &mcpfont);

  // set console background layer to top priority
  bgSetPriority(bottom_screen_x.bgId, 0);
  bgShow(bottom_screen_x.bgId);
  */


}