Esempio n. 1
0
//---------------------------------------------------------------------------------
// main!
//---------------------------------------------------------------------------------
int main(int argc, char **argv) 
{
#ifdef PLATFORM_IS_WII
	try
	{
		// Setup the remote debugger if possible...
		DEBUG_Init(GDBSTUB_DEVICE_USB, 1);

		// Initialize filesystem to load from SD Card - This should change to NAND for official releases ...
		fatInitDefault();

		for(int i = 0; i < 100; i++)
		{
			usleep(100);
		}	

		//setupTrace("//Map.csv");
		
		srand ( time(NULL) );

		AUDIO_Init(NULL);
        ASND_Init();
        ASND_Pause(0);

		//setupUnitTesting();
		
		RunGameMain();
		
		ASND_Pause(1);
        ASND_End();

		//MemTrack::TrackListMemoryUsage();

		//shutDownTrace();

	}
	catch(int ex)
	{
		printf("\x1b[2;0H");printf("Exception Triggered, Executing Breakpoint!\n");
		ASSERT(false);

		_break();
	}
#endif

#ifdef PLATFORM_IS_WIN
	runUnitTests();
#endif

	return 0;
}
Esempio n. 2
0
/****************************************************************************
 * SwitchAudioMode
 *
 * Switches between menu sound and emulator sound
 ***************************************************************************/
static void SwitchAudioMode(int mode)
{
	if(mode == 0) // emulator
	{
		ASND_Pause(1);
		AUDIO_StopDMA();
		WII_AudioStart();
	}
	else // menu
	{
		WII_AudioStop();
		ASND_Init();
		ASND_Pause(0);
	}
}
Esempio n. 3
0
/*** 
      gx_audio_Start

     This function restarts the audio engine
     This is called when coming back from Main Menu
 ***/
void gx_audio_Start(void)
{
  /* shutdown background music */
  PauseOgg(1);	
  StopOgg();	
  
  /* shutdown menu audio processing */
  ASND_Pause(1);
  ASND_End();
  AUDIO_StopDMA();
  AUDIO_RegisterDMACallback(NULL);
  DSP_Halt();

  /* DMA Interrupt callback */
  AUDIO_RegisterDMACallback(ai_callback);

  /* emulation is synchronized with audio hardware by default */
  audioSync = AUDIO_WAIT;

  /* reset emulation audio processing */
  memset(soundbuffer, 0, sizeof(soundbuffer));
  audioWait = 0;
  bufferSize = 0;
  bufferIndex = 0;
}
Esempio n. 4
0
/* AUDIO engine shutdown */
void gx_audio_Shutdown(void)
{
  PauseOgg(1);
  StopOgg();
  ASND_Pause(1);
  ASND_End();
  if (Bg_music_ogg)
  {
    free(Bg_music_ogg);
  }
}
Esempio n. 5
0
int sound_init_asnd() {
	
	ASND_Init();
	ASND_Pause(0);
	ordenador.sign=0;
	ordenador.format=2; //16 bit BE
	ordenador.channels=2; //stereo
	ordenador.freq=48000;
	ordenador.buffer_len=4096;
	started_sound_asnd = 0;
	return 0;

}
Esempio n. 6
0
/***
      gx_audio_Stop

     This function stops current Audio DMA process
     This is called when going back to Main Menu
 ***/
void gx_audio_Stop(void)
{
  /* restart menu audio processing */
  DSP_Unhalt();
  ASND_Init();
  ASND_Pause(0);
	
  /* play background music */
  if (Bg_music_ogg && !Shutdown)
  {
    PauseOgg(0);	
    PlayOgg((char *)Bg_music_ogg, Bg_music_ogg_size, 0, OGG_INFINITE_TIME);	
    SetVolumeOgg(((int)config.bgm_volume * 255) / 100);	
  }
}
Esempio n. 7
0
/*** 
      gx_audio_Start

     This function restart the audio engine
     This is called when coming back from Main Menu
 ***/
void gx_audio_Start(void)
{
  /* shutdown background music */
  PauseOgg(1);	
  StopOgg();	
  
  /* shutdown menu audio processing */
  ASND_Pause(1);
  AUDIO_StopDMA();
  AUDIO_RegisterDMACallback(NULL);
  DSP_Halt();

  /* when not using 60hz mode, frame emulation is synchronized with Audio Interface DMA */
  if (gc_pal | vdp_pal)
  {
    AUDIO_RegisterDMACallback(ai_callback);
  }

  /* reset emulation audio processing */
  memset(soundbuffer, 0, 2 * 3840);
  audioStarted = 0;
  mixbuffer = 0;
}
Esempio n. 8
0
void config_default(void)
{
  /* version TAG */
  strncpy(config.version,CONFIG_VERSION,16);

  /* sound options */
  config.psg_preamp     = 150;
  config.fm_preamp      = 100;
  config.hq_fm          = 1;
  config.psgBoostNoise  = 1;
  config.filter         = 1;
  config.lp_range       = 0x9999; /* 0.6 in 16.16 fixed point */
  config.low_freq       = 880;
  config.high_freq      = 5000;
  config.lg             = 1.0;
  config.mg             = 1.0;
  config.hg             = 1.0;
  config.dac_bits       = 14;
  config.ym2413         = 2; /* AUTO */
  config.mono           = 0;

  /* system options */
  config.system         = 0; /* AUTO */
  config.region_detect  = 0; /* AUTO */
  config.vdp_mode       = 0; /* AUTO */
  config.master_clock   = 0; /* AUTO */
  config.force_dtack    = 0;
  config.addr_error     = 1;
  config.bios           = 0;
  config.lock_on        = 0;
  config.hot_swap       = 0;

  /* video options */
  config.xshift   = 0;
  config.yshift   = 0;
  config.xscale   = 0;
  config.yscale   = 0;
  config.aspect   = 1;
  config.overscan = 3; /* FULL */
  config.gg_extra = 0;
  config.lcd      = 0;
  config.ntsc     = 0;
  config.vsync    = 1; /* AUTO */
  config.bilinear = 0;
  config.vfilter  = 1;

  if (VIDEO_HaveComponentCable())
  {
    config.render = 2;
  }
  else
  {
    config.render = 0;
  }

  switch (vmode->viTVMode >> 2)
  {
    case VI_PAL:
      config.tv_mode = 1; /* 50hz only */
      break;

    case VI_EURGB60:
      config.tv_mode = 2; /* 50/60hz */
      break;
    
    default:
      config.tv_mode = 0; /* 60hz only */
      break;
  }

#ifdef HW_RVL
  config.trap = 0;
  config.gamma = VI_GM_1_0 / 10.0;
#else
  config.v_prog = 1;
#endif

  /* NTSC filter options */
  config.ntsc_sharpness   = 0.0;
  config.ntsc_resolution  = 0.0;
  config.ntsc_artifacts   = 0.0;
  config.ntsc_fringing    = 0.0;
  config.ntsc_bleed       = 0.0;

  /* controllers options */
  config.gun_cursor[0]  = 1;
  config.gun_cursor[1]  = 1;
  config.invert_mouse   = 0;

  /* on-screen options */
  config.cd_leds = 0;
  config.fps     = 0;

  /* menu options */
  config.autoload     = 0;
  config.autocheat    = 0;
  config.s_auto       = 1;
  config.s_default    = 1;
  config.s_device     = 0;
  config.bg_overlay   = 0;
  config.screen_w     = 658;
  config.bgm_volume   = 100.0;
  config.sfx_volume   = 100.0;
#ifdef HW_RVL
  config.autosleep    = 1;
  config.calx         = 0;
  config.caly         = 0;
#endif

  /* default ROM directories */
#ifdef HW_RVL
  DIR *dir = opendir("sd:/");
  if (dir)
  {
    config.l_device = TYPE_SD;
    closedir(dir);
  }
  else
  {
    config.l_device = TYPE_USB;
  }
  sprintf (config.lastdir[0][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[0][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[0][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
#else
  config.l_device = TYPE_SD;
  sprintf (config.lastdir[0][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[0][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
#endif

  /* system ROM paths */
  sprintf (config.sys_rom[0],   "%s/bios/bios_CD_U.bin",  DEFAULT_PATH);
  sprintf (config.sys_rom[1],   "%s/bios/bios_CD_E.bin",  DEFAULT_PATH);
  sprintf (config.sys_rom[2],   "%s/bios/bios_CD_J.bin",  DEFAULT_PATH);
  sprintf (config.sys_rom[3],   "%s/bios/bios_MD.bin",  DEFAULT_PATH);
  sprintf (config.sys_rom[4],   "%s/bios/bios_U.sms", DEFAULT_PATH);
  sprintf (config.sys_rom[5],   "%s/bios/bios_E.sms", DEFAULT_PATH);
  sprintf (config.sys_rom[6],   "%s/bios/bios_J.sms", DEFAULT_PATH);
  sprintf (config.sys_rom[7],   "%s/bios/bios.gg",  DEFAULT_PATH);
  sprintf (config.sys_rom[8],   "%s/lock-on/ggenie.bin",  DEFAULT_PATH);
  sprintf (config.sys_rom[9],   "%s/lock-on/areplay.bin", DEFAULT_PATH);
  sprintf (config.sys_rom[10],  "%s/lock-on/sk.bin",  DEFAULT_PATH);
  sprintf (config.sys_rom[11],  "%s/lock-on/sk2chip.bin", DEFAULT_PATH);

  /* try to restore user config */
  int loaded = config_load();
  
#ifdef HW_RVL
  /* initialize WPAD timeout */
  WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800);
#else
  /* check if component cable was detected */
  if (VIDEO_HaveComponentCable())
  {
    /* when component cable is detected, libogc automatically enables progressive mode  */
    /* as preferred video mode but it could still be used on TV not supporting 480p/576p */
    PAD_ScanPads();

    /* detect progressive mode switch requests */
    if (PAD_ButtonsHeld(0) & PAD_BUTTON_B)
    {
      /* swap progressive mode enable flag */
      config.v_prog ^= 1;

      /* play some sound to inform user */
      ASND_Pause(0);
      int voice = ASND_GetFirstUnusedVoice();
      ASND_SetVoice(voice,VOICE_MONO_16BIT,44100,0,(u8 *)intro_pcm,intro_pcm_size,200,200,NULL);
      sleep (2);
      ASND_Pause(1);
    }

    /* check if progressive mode should be disabled */
    if (!config.v_prog)
    {
      /* switch menu video mode to interlaced */
      vmode->viTVMode = (vmode->viTVMode & ~3) | VI_INTERLACE;
      VIDEO_Configure(vmode);
      VIDEO_Flush();
      VIDEO_WaitVSync();
      VIDEO_WaitVSync();
    }
  }
#endif

  /* inform user if default config is used */
  if (!loaded)
  {
    GUI_WaitPrompt("Warning","Default Settings restored");
    gx_input_SetDefault();
  }

  /* default emulated inputs */
  input.system[0] = SYSTEM_GAMEPAD;
  input.system[1] = (config.input[1].device != -1) ? SYSTEM_GAMEPAD : NO_SYSTEM;
  input_init();
}
Esempio n. 9
0
/****************************************************************************
 * ShutdownAudio
 *
 * Shuts down audio subsystem. Useful to avoid unpleasant sounds if a
 * crash occurs during shutdown.
 ***************************************************************************/
void ShutdownAudio() {
    ASND_Pause(1);
    ASND_End();
}
Esempio n. 10
0
/****************************************************************************
 * InitAudio
 *
 * Initializes the Wii's audio subsystem
 ***************************************************************************/
void InitAudio() {
    AUDIO_Init(NULL);
    ASND_Init();
    ASND_Pause(0);
}
Esempio n. 11
0
static void * ogg_player_thread(private_data_ogg * priv)
{
	int first_time = 1;
	long ret;

	//init
	LWP_InitQueue(&oggplayer_queue);

	priv[0].vi = ov_info(&priv[0].vf, -1);

	ASND_Pause(0);

	priv[0].pcm_indx = 0;
	priv[0].pcmout_pos = 0;
	priv[0].eof = 0;
	priv[0].flag = 0;
	priv[0].current_section = 0;

	ogg_thread_running = 1;

	while (!priv[0].eof && ogg_thread_running)
	{
		if (priv[0].flag)
			LWP_ThreadSleep(oggplayer_queue); // wait only when i have samples to send

		if (priv[0].flag == 0) // wait to all samples are sent
		{
			if (ASND_TestPointer(0, priv[0].pcmout[priv[0].pcmout_pos])
					&& ASND_StatusVoice(0) != SND_UNUSED)
			{
				priv[0].flag |= 64;
				continue;
			}
			if (priv[0].pcm_indx < READ_SAMPLES)
			{
				priv[0].flag = 3;

				if (priv[0].seek_time >= 0)
				{
					ov_time_seek(&priv[0].vf, priv[0].seek_time);
					priv[0].seek_time = -1;
				}

				ret
						= ov_read(
								&priv[0].vf,
								(void *) &priv[0].pcmout[priv[0].pcmout_pos][priv[0].pcm_indx],
								MAX_PCMOUT,/*0,2,1,*/&priv[0].current_section);
				priv[0].flag &= 192;
				if (ret == 0)
				{
					/* EOF */
					if (priv[0].mode & 1)
						ov_time_seek(&priv[0].vf, 0); // repeat
					else
						priv[0].eof = 1; // stops
				}
				else if (ret < 0)
				{
					/* error in the stream.  Not a problem, just reporting it in
					 case we (the app) cares.  In this case, we don't. */
					if (ret != OV_HOLE)
					{
						if (priv[0].mode & 1)
							ov_time_seek(&priv[0].vf, 0); // repeat
						else
							priv[0].eof = 1; // stops
					}
				}
				else
				{
					/* we don't bother dealing with sample rate changes, etc, but
					 you'll have to*/
					priv[0].pcm_indx += ret >> 1; //get 16 bits samples
				}
			}
			else
				priv[0].flag = 1;
		}
Esempio n. 12
0
void _Music_Start()
{
	int ret;

	// always init SND, so banner sounds play if music disabled
	ASND_Init();
	ASND_Pause(0);

	if (CFG.music == 0) {
		dbg_printf(gt("Music: Disabled"));
		dbg_printf("\n");
		return;
	} else {
		dbg_printf(gt("Music: Enabled"));
		dbg_printf("\n");
	}
	
	was_playing = false;

	//get a music file
	ret = get_music_file();
	if (ret==0) return;

	if (music_format == FORMAT_MP3) {

		MP3Player_Init();
		MP3Player_Volume(0x80); // of 255
		//ret = MP3Player_PlayBuffer(music_buf, music_size, NULL);
		ret = MP3Player_PlayFile(music_f, mp3_reader, NULL);
		dbg_printf("mp3 play: %s (%d)\n", ret? gt("ERROR"):gt("OK"), ret);
		if (ret) goto err_play;
		usleep(10000); // wait 10ms and verify if playing
		if (!MP3Player_IsPlaying()) {
			err_play:
			printf(gt("Error playing %s"), music_fname);
			printf("\n");
			Music_Stop();
			sleep(1);
		}

	} else {

		music_buf = malloc(music_size);
		if (!music_buf) {
			printf(gt("music file too big (%d) %s"), music_size, music_fname);
			printf("\n");
			sleep(1);
			music_format = 0;
			return;
		}
		//printf("Loading...\n");
		ret = fread(music_buf, music_size, 1, music_f);
		//printf("size: %d %d\n", music_size, ret); sleep(2);
		fclose(music_f);
		music_f = NULL;
		if (ret != 1) {
			printf(gt("error reading: %s (%d)"), music_fname, music_size); printf("\n"); sleep(2);
			free(music_buf);
			music_buf = NULL;
			music_size = 0;
			music_format = 0;
			return;
		}
		MODPlay_Init(&mod);
		ret = MODPlay_SetMOD(&mod, music_buf);
		dbg_printf("mod play: %s (%d)\n", ret?gt("ERROR"):gt("OK"), ret);
		if (ret < 0 ) {
			Music_Stop();
		} else  {
			MODPlay_SetVolume(&mod, 32,32); // fix the volume to 32 (max 64)
			MODPlay_Start(&mod); // Play the MOD
		}
	}
}
Esempio n. 13
0
void config_default(void)
{
  /* version TAG */
  strncpy(config.version,CONFIG_VERSION,16);

  /* sound options */
  config.psg_preamp     = 150;
  config.fm_preamp      = 100;
  config.hq_fm          = 1;
  config.psgBoostNoise  = 1;
  config.filter         = 1;
  config.lp_range       = 0x9999; /* 0.6 in 16.16 fixed point */
  config.low_freq       = 880;
  config.high_freq      = 5000;
  config.lg             = 1.0;
  config.mg             = 1.0;
  config.hg             = 1.0;
  config.dac_bits       = 14;
  config.ym2413         = 2; /* AUTO */
  config.mono           = 0;

  /* system options */
  config.system         = 0; /* AUTO */
  config.region_detect  = 0; /* AUTO */
  config.vdp_mode       = 0; /* AUTO */
  config.master_clock   = 0; /* AUTO */
  config.force_dtack    = 0;
  config.addr_error     = 1;
  config.bios           = 0;
  config.lock_on        = 0;
  config.hot_swap       = 0;

  /* video options */
  config.xshift   = 0;
  config.yshift   = 0;
  config.xscale   = 0;
  config.yscale   = 0;
  config.aspect   = 1;
  config.overscan = 3; /* FULL */
  config.gg_extra = 0;
  config.ntsc     = 0;
  config.vsync    = 1; /* AUTO */
  config.bilinear = 1;
  config.vfilter  = 1;

  if (VIDEO_HaveComponentCable())
  {
    config.render = 2;
  }
  else
  {
    config.render = 0;
  }

  switch (vmode->viTVMode >> 2)
  {
    case VI_PAL:
      config.tv_mode = 1; /* 50hz only */
      break;

    case VI_EURGB60:
      config.tv_mode = 2; /* 50/60hz */
      break;
    
    default:
      config.tv_mode = 0; /* 60hz only */
      break;
  }

#ifdef HW_RVL
  config.trap = 0;
  config.gamma = VI_GM_1_0 / 10.0;
#endif

  /* controllers options */
  config.gun_cursor[0]  = 1;
  config.gun_cursor[1]  = 1;
  config.invert_mouse   = 0;

  /* on-screen options */
  config.cd_leds = 0;

  /* menu options */
  config.autoload     = 0;
  config.autocheat    = 0;
#ifdef HW_RVL
  config.s_auto       = 1;
#else
  config.s_auto       = 0;
  config.v_prog       = 1;
#endif
  config.s_default    = 1;
  config.s_device     = 0;
  config.l_device     = 0;
  config.bg_overlay   = 0;
  config.screen_w     = 658;
  config.bgm_volume   = 100.0;
  config.sfx_volume   = 100.0;

  /* default ROM directories */
#ifdef HW_RVL
  sprintf (config.lastdir[0][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_SD],  "sd:%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[0][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_USB], "usb:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[0][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
#else
  sprintf (config.lastdir[0][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_SD],  "%s/roms/",  DEFAULT_PATH);
  sprintf (config.lastdir[0][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[1][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[2][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[3][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
  sprintf (config.lastdir[4][TYPE_DVD], "dvd:%s/roms/", DEFAULT_PATH);
#endif

  /* try to restore user config */
  int loaded = config_load();

#ifndef HW_RVL
  /* detect progressive mode enable/disable requests */
  PAD_ScanPads();
  if (PAD_ButtonsHeld(0) & PAD_BUTTON_B)
  {
    /* swap progressive mode enable flag and play some sound to inform user */
    config.v_prog ^= 1;
    ASND_Pause(0);
    int voice = ASND_GetFirstUnusedVoice();
    ASND_SetVoice(voice,VOICE_MONO_16BIT,44100,0,(u8 *)intro_pcm,intro_pcm_size,200,200,NULL);
    sleep (2);
    ASND_Pause(1);
  }

  /* switch into 480p if component cable has been detected and progressive mode is enabled */
  if (VIDEO_HaveComponentCable() && config.v_prog)
  {
    vmode = &TVNtsc480Prog;
    VIDEO_Configure (vmode);
    VIDEO_Flush();
    VIDEO_WaitVSync();
    VIDEO_WaitVSync();
  }
#endif

  /* inform user if default config is used */
  if (!loaded)
  {
    GUI_WaitPrompt("Warning","Default Settings restored");
    gx_input_SetDefault();
  }

  /* default emulated inputs */
  input.system[0] = SYSTEM_MD_GAMEPAD;
  input.system[1] = (config.input[1].device != -1) ? SYSTEM_MD_GAMEPAD : NO_SYSTEM;
  input_init();
}
Esempio n. 14
0
void legal ()
{
  int count = 2000;
  int vis = 0;

#ifdef HW_RVL
  gx_texture *button = gxTextureOpenPNG(Key_A_wii_png,0);
#else
  gx_texture *button = gxTextureOpenPNG(Key_A_gcn_png,0);
#endif

  gx_texture *logo_left= gxTextureOpenPNG(Bg_intro_c5_png,0);
  gx_texture *logo_right = gxTextureOpenPNG(Bg_intro_c4_png,0);

  gxClearScreen((GXColor)BLACK);
  show_disclaimer(56);
  gxDrawTexture(logo_left, (640-logo_left->width-logo_right->width -32)/2, 480-logo_left->height-24, logo_left->width, logo_left->height,255);
  gxDrawTexture(logo_right, (640-logo_left->width-logo_right->width -32)/2+logo_left->width+32, 480-logo_right->height-24, logo_right->width, logo_right->height,255);
  gxSetScreen();

  sleep(1);

  while (!(m_input.keys & PAD_BUTTON_A) && (count > 0))
  {
    gxClearScreen((GXColor)BLACK);
    show_disclaimer(56);
    if (count%25 == 0) vis^=1;
    if (vis)
    {
      FONT_writeCenter("Press    button to continue.",24,0,640,366,(GXColor)SKY_BLUE);
      gxDrawTexture(button, 220, 366-24+(24-button->height)/2,  button->width, button->height,255);
    }
    gxDrawTexture(logo_left, (640-logo_left->width-logo_right->width -32)/2, 480-logo_left->height-24, logo_left->width, logo_left->height,255);
    gxDrawTexture(logo_right, (640-logo_left->width-logo_right->width -32)/2+logo_left->width+32, 480-logo_right->height-24, logo_right->width, logo_right->height,255);
    gxSetScreen();
    count--;
  }

  gxTextureClose(&button);
  gxTextureClose(&logo_left);
  gxTextureClose(&logo_right);

  if (count > 0)
  {
    ASND_Init();
    ASND_Pause(0);
    int voice = ASND_GetFirstUnusedVoice();
    ASND_SetVoice(voice,VOICE_MONO_16BIT,44100,0,(u8 *)button_select_pcm,button_select_pcm_size,200,200,NULL);
    GUI_FadeOut();
    ASND_Pause(1);
    ASND_End();
    return;
  }

  gxClearScreen((GXColor)BLACK);
  gx_texture *texture = gxTextureOpenPNG(Bg_intro_c1_png,0);
  if (texture)
  {
    gxDrawTexture(texture, (640-texture->width)/2, (480-texture->height)/2,  texture->width, texture->height,255);
    if (texture->data) free(texture->data);
    free(texture);
  }
  gxSetScreen();

  sleep (1);

  gxClearScreen((GXColor)WHITE);
  texture = gxTextureOpenPNG(Bg_intro_c2_png,0);
  if (texture)
  {
    gxDrawTexture(texture, (640-texture->width)/2, (480-texture->height)/2,  texture->width, texture->height,255);
    if (texture->data) free(texture->data);
    free(texture);
  }
  gxSetScreen();

  sleep (1);

  gxClearScreen((GXColor)BLACK);
  texture = gxTextureOpenPNG(Bg_intro_c3_png,0);
  if (texture)
  {
    gxDrawTexture(texture, (640-texture->width)/2, (480-texture->height)/2,  texture->width, texture->height,255);
    if (texture->data) free(texture->data);
    free(texture);
  }
  gxSetScreen();

  ASND_Pause(0);
  int voice = ASND_GetFirstUnusedVoice();
  ASND_SetVoice(voice,VOICE_MONO_16BIT,44100,0,(u8 *)intro_pcm,intro_pcm_size,200,200,NULL);
  sleep (2);
  ASND_Pause(1);
}