[Wii] added configurable Wiimote timeout

This commit is contained in:
EkeEke 2014-04-05 01:15:43 +02:00
parent bc97224fef
commit 6394c0e482
4 changed files with 29 additions and 4 deletions

View File

@ -185,13 +185,13 @@ void config_default(void)
config.autocheat = 0;
#ifdef HW_RVL
config.s_auto = 1;
config.autosleep = 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;
@ -199,6 +199,9 @@ void config_default(void)
/* default ROM directories */
#ifdef HW_RVL
char dir[16];
getcwd(dir, 16);
config.l_device = strstr(dir, "sd") ? TYPE_SD : 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);
@ -215,6 +218,7 @@ void config_default(void)
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);

View File

@ -97,6 +97,7 @@ typedef struct
uint16 pad_keymap[4][MAX_KEYS+1];
#ifdef HW_RVL
uint32 wpad_keymap[4*3][MAX_KEYS];
uint8 autosleep;
#endif
uint8 autoload;
uint8 autocheat;

View File

@ -400,7 +400,11 @@ static gui_item items_video[16] =
};
/* Menu options */
#ifdef HW_RVL
static gui_item items_prefs[12] =
#else
static gui_item items_prefs[11] =
#endif
{
{NULL,NULL,"Auto ROM Load: OFF", "Enable/disable automatic ROM loading on startup", 56,132,276,48},
{NULL,NULL,"Auto Cheats: OFF", "Enable/disable automatic cheats activation", 56,132,276,48},
@ -413,6 +417,9 @@ static gui_item items_prefs[11] =
{NULL,NULL,"Screen Width: 658", "Adjust menu screen width in pixels", 56,132,276,48},
{NULL,NULL,"Show CD Leds: OFF", "Enable/disable CD leds display", 56,132,276,48},
{NULL,NULL,"Show FPS: OFF", "Enable/disable FPS counter", 56,132,276,48},
#ifdef HW_RVL
{NULL,NULL,"Wiimote Timeout: OFF","Enable/disable Wii remote automatic shutodwn", 56,132,276,48},
#endif
};
/* Save Manager */
@ -621,7 +628,7 @@ static gui_menu menu_prefs =
{
"Menu Settings",
0,0,
11,4,6,0,
12,4,6,0,
items_prefs,
buttons_list,
bg_list,
@ -690,6 +697,12 @@ static void prefmenu ()
sprintf (items[8].text, "Screen Width: %d", config.screen_w);
sprintf (items[9].text, "Show CD Leds: %s", config.cd_leds ? "ON":"OFF");
sprintf (items[10].text, "Show FPS: %s", config.fps ? "ON":"OFF");
#ifdef HW_RVL
sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5min":"30min");
m->max_items = 12;
#else
m->max_items = 11;
#endif
GUI_InitMenu(m);
GUI_SlideMenuTitle(m,strlen("Menu "));
@ -784,6 +797,14 @@ static void prefmenu ()
sprintf (items[10].text, "Show FPS: %s", config.fps ? "ON":"OFF");
break;
#ifdef HW_RVL
case 11: /*** Wii remote auto switch-off ***/
config.autosleep ^= 1;
sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5min":"30min");
WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800);
break;
#endif
case -1:
quit = 1;
break;
@ -1564,7 +1585,6 @@ static void videomenu ()
else
{
sprintf (items[VI_OFFSET+3+ntsc_offset].text, "Aspect: SCALED");
m->max_items++;
}
sprintf (items[VI_OFFSET+4+ntsc_offset].text, "Screen Position: (%s%02d,%s%02d)",

View File

@ -1058,7 +1058,7 @@ void gx_input_Init(void)
PAD_Init();
#ifdef HW_RVL
WPAD_Init();
WPAD_SetIdleTimeout(60);
WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800);
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
#endif