Esempio n. 1
0
void ogc_input__init(void)
{
  PAD_Init ();

#ifdef HW_RVL
  WPAD_Init();
	WPAD_SetIdleTimeout(60);
  WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
  WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
#endif
}
Esempio n. 2
0
/****************************************************************************
 * SetupPads
 *
 * Sets up userInput triggers for use
 ***************************************************************************/
void SetupPads()
{
	WPAD_SetIdleTimeout(60);

	// read wiimote accelerometer and IR data
	WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
	WPAD_SetVRes(WPAD_CHAN_0, screenwidth, screenheight);

	userInput[0].chan = 0;
	userInput[0].wpad = WPAD_Data(0);
}
Esempio n. 3
0
void ogc_input__init(void)
{
  PAD_Init ();

#ifdef HW_RVL
  WPAD_Init();
  WPAD_SetIdleTimeout(60);
  WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
  WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
#endif
  /* register SOFTRESET */
  SYS_SetResetCallback(set_softreset);
}
Esempio n. 4
0
void Open_Inputs(void)
{
    s32 status = WPAD_GetStatus();
    if(status != WPAD_STATE_ENABLED && status != WPAD_STATE_ENABLING)
    {
        /* Initialize Wiimote subsystem */
        PAD_Init();
        WPAD_Init();

        /* Set POWER button callback */
        WPAD_SetPowerButtonCallback(__Wpad_PowerCallback);

        WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);

        WPAD_SetIdleTimeout(60*5); // idle after 5 minutes
    }
}
Esempio n. 5
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();
}