Пример #1
0
static int
NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
    SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
    int valid_datatype = 0;

    this->hidden = SDL_malloc(sizeof(*(this->hidden)));
    if (!this->hidden) {
        SDL_OutOfMemory();
        return 0;
    }
    SDL_memset(this->hidden, 0, (sizeof *this->hidden));

    while ((!valid_datatype) && (test_format)) {
        this->spec.format = test_format;
        switch (test_format) {
        case AUDIO_S8:
            /*case AUDIO_S16LSB: */
            valid_datatype = 1;
            break;
        default:
            test_format = SDL_NextAudioFormat();
            break;
        }
    }

#if 0
    /* set the generic sound parameters */
    setGenericSound(22050,      /* sample rate */
                    127,        /* volume */
                    64,         /* panning/balance */
                    0);         /* sound format */
#endif

    return 1;
}
Пример #2
0
int main()
{	
	struct timeval tv;
	
	powerON(POWER_ALL);

	//set mode 0, enable BG0 and set it to 3D
	videoSetMode(MODE_0_3D);
	
	//Use console
	videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);	//sub bg 0 will be used to print text
	vramSetBankC(VRAM_C_SUB_BG); 
	SUB_BG0_CR = BG_MAP_BASE(31);
	BG_PALETTE_SUB[255] = RGB15(31,31,31);	//by default font will be rendered with color 255
	consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
	
	//iprintf("Starting up...\n");
	
	// install the default exception handler
	defaultExceptionHandler();


	//irqs are nice
	irqInit();
	irqEnable(IRQ_VBLANK);
	
	// set the generic sound parameters
	setGenericSound(	11025,	/* sample rate */
						127,	/* volume */
						64,		/* panning */
						1 );	/* sound format*/
						

	glInit();
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
		
	//this should work the same as the normal gl call
	glViewPort(0,0,255,191);
	
	glClearColor(0,0,0,0);
	glClearDepth(0x7FFF);
	
	vramSetBankA(VRAM_A_TEXTURE);
	vramSetBankB(VRAM_B_TEXTURE);
	
	logo();

	glGenTextures(1, &textureID);
	glBindTexture(0, textureID);
	glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_256 , TEXTURE_SIZE_256, 0, TEXGEN_TEXCOORD , (u8*)die_bmp_bin);
	
	
	glGenTextures(1, &textureID2);
	glBindTexture(0, textureID2);
	glTexImage2D(0, 0, GL_RGBA, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, (u8*)mario_bmp_bin);
	
	gettimeofday(&tv, NULL);
	//iprintf("Seeding with %d\n", tv.tv_usec);
    srand(tv.tv_usec);

	while(1){
		gameLoop();
	}

	return 0;
}//end main 
Пример #3
0
void initProgram()
{
	//------------------------
	// start initializing crap
	//------------------------
	defaultExceptionHandler(); // set up the exception handler

    powerON(POWER_ALL_2D); // turn on everything

	#ifndef DEBUG_MODE
	fb_init(); // initialize top screen video
	#else
	debugInit();
	#endif
	bg_init(); // initialize bottom screen video

	setNewOrientation(ORIENTATION_0);

	// set up extra vram banks to be scratch memory
	vramSetBankE(VRAM_E_LCD);
	vramSetBankF(VRAM_F_LCD);
	vramSetBankG(VRAM_G_LCD);
	vramSetBankH(VRAM_H_LCD);
	vramSetBankI(VRAM_I_LCD);

	fb_setBGColor(30653);
	bg_setBGColor(0);
	drawStartSplash();

	lcdMainOnTop(); // set fb to top screen
	fb_swapBuffers();
	bg_swapBuffers();

	// out of order for competition
	irqInit(); // initialize irqs

    irqSet(IRQ_VBLANK, startvBlank);
	irqEnable(IRQ_VBLANK);

	setMode(INITFAT);
	setSoundInterrupt(); // initialize fifo irq

	setGenericSound(11025, 127, 64, 1);
	waitForInit(); // wait until arm7 has loaded and gone to sleep
	initComplexSound(); // initialize sound variables
	initWifi();
	fixGautami();

	setCursorProperties(0, 2, 0, 0);
	initCapture();
	initClipboard();

	// set defaults to english in case we can't load the langauge file for
	// some reason also takes care of partial translations.
	initLanguage();
	initRandomList();
	fixAndTags();

	resetKeyboard();
	setDate();

	if(!DRAGON_InitFiles())
	{
		// oops, no cf card!
		setMode(DISPLAYCOW);

		setFont(font_arial_11);
		setColor(0xFFFF);

		bg_dispSprite(96, 5, errmsg, 0);
		bg_setClipping(5,25,250,181);
		bg_dispString(0,0,l_nofat);
		bg_swapBuffers();

		while(1)
		{
			// wee, la la la!
		  // More or less, we aren't going to do nothing here
		}
	}

	//--------------------------------------------------------------------
	//finished init, now check to make sure the DSOrganize dir is there...
	//--------------------------------------------------------------------

	findDataDirectory();
	makeDirectories();

	if(DRAGON_FileExists("DSOrganize") != FE_DIR)
	{
		setMode(DISPLAYCOW);

		// oops, not there, we must create!
		DRAGON_mkdir("DSOrganize");
		DRAGON_chdir("DSOrganize");
		DRAGON_mkdir("DAY");
		DRAGON_mkdir("HELP");
		DRAGON_mkdir("LANG");
		DRAGON_mkdir("RESOURCES");
		DRAGON_mkdir("REMINDER");
		DRAGON_mkdir("SCRIBBLE");
		DRAGON_mkdir("TODO");
		DRAGON_mkdir("VCARD");
		DRAGON_mkdir("ICONS");
		DRAGON_mkdir("CACHE");
		DRAGON_mkdir("COOKIES");
		DRAGON_mkdir("HOME");
		DRAGON_chdir("/");

		makeDefaultSettings();

		setFont(font_arial_11);
		setColor(0xFFFF);

		bg_dispSprite(96, 5, errmsg, 0);
		bg_setClipping(5,25,250,181);
		bg_dispString(0,0, l_createdir);
		bg_swapBuffers();

		while(!keysDown())
		{
			scanKeys();
		}
	}

	setMode(INITPLUGIN);

	//-------------------------------------------------------------------
	//finished creating dirs, now check to make sure if they extracted it
	//did their extracting program actually get all the dirs?
	//-------------------------------------------------------------------

	DRAGON_chdir(d_base);

	if(DRAGON_FileExists("Day") != FE_DIR)
	{
		DRAGON_mkdir("DAY");
	}
	if(DRAGON_FileExists("Help") != FE_DIR)
	{
		DRAGON_mkdir("HELP");
	}
	if(DRAGON_FileExists("Lang") != FE_DIR)
	{
		DRAGON_mkdir("LANG");
	}
	if(DRAGON_FileExists("Reminder") != FE_DIR)
	{
		DRAGON_mkdir("REMINDER");
	}
	if(DRAGON_FileExists("Scribble") != FE_DIR)
	{
		DRAGON_mkdir("SCRIBBLE");
	}
	if(DRAGON_FileExists("Todo") != FE_DIR)
	{
		DRAGON_mkdir("TODO");
	}
	if(DRAGON_FileExists("VCard") != FE_DIR)
	{
		DRAGON_mkdir("VCARD");
	}
	if(DRAGON_FileExists("Icons") != FE_DIR)
	{
		DRAGON_mkdir("ICONS");
	}
	if(DRAGON_FileExists("Cache") != FE_DIR)
	{
		DRAGON_mkdir("CACHE");
	}
	if(DRAGON_FileExists("Cookies") != FE_DIR)
	{
		DRAGON_mkdir("COOKIES");
	}
	if(DRAGON_FileExists("Home") != FE_DIR)
	{
		DRAGON_mkdir("HOME");
	}

	DRAGON_chdir("/");

	//-------------------------------------------
	//how about we load the settings for them eh?
	//-------------------------------------------
	loadSettings();

	DRAGON_chdir(d_base);

	if(DRAGON_FileExists("startup.wav") == FE_FILE)
	{
		char tStr[256];

		sprintf(tStr, "%sstartup.wav", d_base);
		loadWavToMemory();
		loadSound(tStr);
	}

	DRAGON_chdir("/");
	initStartScreen();

    irqSet(IRQ_VBLANK, vBlank);
	fb_setBGColor(genericFillColor);
	bg_setBGColor(genericFillColor);
}