various menu bugfixes

This commit is contained in:
ekeeke31 2009-05-07 13:00:57 +00:00
parent 64676a0b45
commit 9204498c96
6 changed files with 72 additions and 84 deletions

View File

@ -265,7 +265,7 @@ int DVD_ParseDirectory ()
while (getentry (filecount)) while (getentry (filecount))
{ {
if (!strcmp(filelist[filecount].filename,".") && (filecount < MAXFILES)) if (strcmp(filelist[filecount].filename,".") && (filecount < MAXFILES))
filecount++; filecount++;
} }

View File

@ -238,17 +238,16 @@ int FileSelector(unsigned char *buffer)
if (bg_filesel[8].texture) bg_filesel[8].state |= IMAGE_VISIBLE; if (bg_filesel[8].texture) bg_filesel[8].state |= IMAGE_VISIBLE;
} }
} }
strcpy(action_select.comment,"Load ROM File");
}
else
{
/* update helper */ /* update helper */
if (!strcmp(filelist[selection].filename,"..")) if (!strcmp(filelist[selection].filename,".."))
strcpy(action_select.comment,"Previous Directory"); strcpy(action_select.comment,"Previous Directory");
else else
strcpy(action_select.comment,"Open Directory"); strcpy(action_select.comment,"Open Directory");
} }
else
{
strcpy(action_select.comment,"Load ROM File");
}
/* Draw menu*/ /* Draw menu*/
GUI_DrawMenu(m); GUI_DrawMenu(m);

View File

@ -32,9 +32,6 @@
#include <asndlib.h> #include <asndlib.h>
#include <oggplayer.h> #include <oggplayer.h>
/* Global datas */
t_input_menu m_input;
#ifdef HW_RVL #ifdef HW_RVL
gx_texture *w_pointer; gx_texture *w_pointer;
#endif #endif
@ -889,7 +886,7 @@ void GUI_FadeOut()
{ {
gxDrawRectangle(0, 0, 640, 480, alpha, (GXColor)BLACK); gxDrawRectangle(0, 0, 640, 480, alpha, (GXColor)BLACK);
gxSetScreen(); gxSetScreen();
alpha ++; alpha +=2;
} }
} }
@ -1961,7 +1958,12 @@ static void ctrlmenu_raz(void)
if (input.dev[5] != NO_DEVICE) if (input.dev[5] != NO_DEVICE)
{ {
m->buttons[6].shift[1] = 1; m->buttons[6].shift[1] = 1;
if (input.dev[6] != NO_DEVICE) m->buttons[7].shift[1] = 1; if (input.dev[6] != NO_DEVICE)
{
m->buttons[7].shift[1] = 1;
if (input.dev[7] != NO_DEVICE) m->buttons[8].shift[1] = 1;
else m->buttons[8].shift[1] = 0;
}
else m->buttons[7].shift[1] = 0; else m->buttons[7].shift[1] = 0;
} }
else m->buttons[6].shift[1] = 0; else m->buttons[6].shift[1] = 0;
@ -2280,6 +2282,7 @@ static void ctrlmenu(void)
m->buttons[11].shift[2] = 11 - m->selected; m->buttons[11].shift[2] = 11 - m->selected;
m->buttons[12].shift[2] = 12 - m->selected; m->buttons[12].shift[2] = 12 - m->selected;
GUI_DrawMenuFX(m, 20, 0); GUI_DrawMenuFX(m, 20, 0);
m->selected = 10;
/* update title */ /* update title */
if (j_cart && (player > 1)) if (j_cart && (player > 1))
@ -2289,53 +2292,36 @@ static void ctrlmenu(void)
break; break;
case 10: /* specific option */ case 10: /* specific option */
*special ^= 1; if (special == &config.input[player].padtype)
if (config.input[player].device == 1)
{ {
/* force 3-Buttons pad */ if (config.input[player].device == 1) break;
config.input[player].padtype = DEVICE_3BUTTON; config.input[player].padtype ^= 1;
}
io_reset(); io_reset();
}
else
{
*special ^= 1;
}
/* update menu items */ /* update menu items */
memcpy(&m->items[10],&items[*special],sizeof(gui_item)); memcpy(&m->items[10],&items[*special],sizeof(gui_item));
break; break;
case 11: /* input controller selection */ case 11: /* input controller selection */
#ifdef HW_RVL
/* no input device */ /* no input device */
if (config.input[player].device < 0) if (config.input[player].device > 0)
{
/* use gamecube pad */
config.input[player].device = 0;
config.input[player].port = 0;
}
else
{ {
/* use next port */ /* use next port */
config.input[player].port ++; config.input[player].port ++;
} }
else
/* autodetect connected gamepads */
if (config.input[player].device == 0)
{ {
while ((config.input[player].port<4) && !(PAD_ScanPads() & (1<<config.input[player].port))) /* use gamecube pad */
{ config.input[player].device ++;
/* try next port */ config.input[player].port = config.input[player].device ? 0 : (player%4);
config.input[player].port ++;
} }
if (config.input[player].port >= 4)
{
config.input[player].port = 0;
#ifdef HW_RVL
/* no gamecube pad found, try wiimote+nunchuks */
config.input[player].device = 1;
#endif
}
}
#ifdef HW_RVL
/* autodetect connected wiimotes (without nunchuk) */ /* autodetect connected wiimotes (without nunchuk) */
if (config.input[player].device == 1) if (config.input[player].device == 1)
{ {
@ -2417,8 +2403,8 @@ static void ctrlmenu(void)
if (config.input[player].port >= 4) if (config.input[player].port >= 4)
{ {
/* no classic controller found, use default gamecube pad */ /* no classic controller found, use default gamecube pad */
config.input[player].port = 0;
config.input[player].device = 0; config.input[player].device = 0;
config.input[player].port = player%4;
} }
} }
@ -2428,6 +2414,11 @@ static void ctrlmenu(void)
config.input[player].padtype = DEVICE_3BUTTON; config.input[player].padtype = DEVICE_3BUTTON;
memcpy(&m->items[10],&items[*special],sizeof(gui_item)); memcpy(&m->items[10],&items[*special],sizeof(gui_item));
} }
#else
/* use gamecube pad */
config.input[player].device = 0;
config.input[player].port = player%4;
#endif #endif
/* update menu items */ /* update menu items */

View File

@ -171,15 +171,6 @@ extern const u32 button_over_pcm_size;
/* Generic GUI structures */ /* Generic GUI structures */
/*****************************************************************************/ /*****************************************************************************/
/* Menu Inputs */
typedef struct
{
u16 keys;
#ifdef HW_RVL
struct ir_t ir;
#endif
} t_input_menu;
/* Item descriptor*/ /* Item descriptor*/
typedef struct typedef struct
{ {
@ -242,10 +233,19 @@ typedef struct
bool screenshot; /* use gamescreen as background */ bool screenshot; /* use gamescreen as background */
} gui_menu; } gui_menu;
/* Menu Inputs */
struct t_input_menu
{
u32 connected;
u16 keys;
#ifdef HW_RVL
struct ir_t ir;
#endif
} m_input;
/* Global data */ /* Global data */
extern u8 SILENT; extern u8 SILENT;
extern t_input_menu m_input;
#ifdef HW_RVL #ifdef HW_RVL
extern gx_texture *w_pointer; extern gx_texture *w_pointer;

View File

@ -89,21 +89,18 @@ static void pad_config(int chan, int max_keys)
u16 p,key; u16 p,key;
char msg[30]; char msg[30];
/* disable inputs update callback */
VIDEO_SetPostRetraceCallback(NULL);
VIDEO_Flush();
/* Check if PAD is connected */ /* Check if PAD is connected */
if (!(PAD_ScanPads() & (1<<chan))) if (!(PAD_ScanPads() & (1<<chan)))
{ {
sprintf(msg, "PAD #%d is not connected !", chan+1); sprintf(msg, "PAD #%d is not connected !", chan+1);
WaitPrompt(msg); WaitPrompt(msg);
max_keys = 0;
/* remove any pending keys */
while (m_input.keys) VIDEO_WaitVSync();
return;
} }
/* disable inputs update callback */
VIDEO_SetPostRetraceCallback(NULL);
VIDEO_Flush();
/* Configure each keys */ /* Configure each keys */
for (i=0; i<max_keys; i++) for (i=0; i<max_keys; i++)
{ {
@ -142,6 +139,7 @@ static void pad_config(int chan, int max_keys)
/* update key mapping */ /* update key mapping */
if (key !=0xff) config.pad_keymap[chan][i] = key; if (key !=0xff) config.pad_keymap[chan][i] = key;
else break;
} }
/* remove any pending keys */ /* remove any pending keys */
@ -169,13 +167,6 @@ static void pad_update(s8 chan, u8 i)
set_softreset(); set_softreset();
} }
/* Menu */
else if (p & PAD_TRIGGER_Z)
{
ConfigRequested = 1;
return;
}
/* Retrieve current key mapping */ /* Retrieve current key mapping */
u16 pad_keymap[MAX_KEYS]; u16 pad_keymap[MAX_KEYS];
memcpy(pad_keymap, config.pad_keymap[chan], MAX_KEYS * sizeof(u16)); memcpy(pad_keymap, config.pad_keymap[chan], MAX_KEYS * sizeof(u16));
@ -323,6 +314,10 @@ static void wpad_config(u8 chan, u8 exp, u8 max_keys)
char msg[30]; char msg[30];
u32 key,p = 255; u32 key,p = 255;
/* disable inputs update callback */
VIDEO_SetPostRetraceCallback(NULL);
VIDEO_Flush();
/* Check if device is connected */ /* Check if device is connected */
WPAD_Probe(chan, &p); WPAD_Probe(chan, &p);
if (((exp > WPAD_EXP_NONE) && (p != exp)) || (p == 255)) if (((exp > WPAD_EXP_NONE) && (p != exp)) || (p == 255))
@ -331,16 +326,9 @@ static void wpad_config(u8 chan, u8 exp, u8 max_keys)
if (exp == WPAD_EXP_NUNCHUK) sprintf(msg, "NUNCHUK #%d is not connected !", chan+1); if (exp == WPAD_EXP_NUNCHUK) sprintf(msg, "NUNCHUK #%d is not connected !", chan+1);
if (exp == WPAD_EXP_CLASSIC) sprintf(msg, "CLASSIC #%d is not connected !", chan+1); if (exp == WPAD_EXP_CLASSIC) sprintf(msg, "CLASSIC #%d is not connected !", chan+1);
WaitPrompt(msg); WaitPrompt(msg);
max_keys = 0;
/* remove any pending buttons */
while (m_input.keys) VIDEO_WaitVSync();
return;
} }
/* disable inputs update callback */
VIDEO_SetPostRetraceCallback(NULL);
VIDEO_Flush();
/* loop on each mapped keys */ /* loop on each mapped keys */
for (i=0; i<max_keys; i++) for (i=0; i<max_keys; i++)
{ {
@ -415,6 +403,7 @@ static void wpad_config(u8 chan, u8 exp, u8 max_keys)
/* update key mapping */ /* update key mapping */
if (key != 0xff) config.wpad_keymap[exp + (chan * 3)][i] = key; if (key != 0xff) config.wpad_keymap[exp + (chan * 3)][i] = key;
else break;
} }
/* remove any pending buttons */ /* remove any pending buttons */
@ -447,13 +436,6 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
set_softreset(); set_softreset();
} }
/* Menu Request */
else if ((p & WPAD_BUTTON_HOME) || (p & WPAD_CLASSIC_BUTTON_HOME))
{
ConfigRequested = 1;
return;
}
/* Retrieve current key mapping */ /* Retrieve current key mapping */
u32 *wpad_keymap = config.wpad_keymap[exp + (3 * chan)]; u32 *wpad_keymap = config.wpad_keymap[exp + (3 * chan)];
@ -728,6 +710,21 @@ void gx_input_UpdateEmu(void)
WPAD_ScanPads(); WPAD_ScanPads();
#endif #endif
/* Menu Request */
if (PAD_ButtonsHeld(0) & PAD_TRIGGER_Z)
{
ConfigRequested = 1;
return;
}
#ifdef HW_RVL
if ((WPAD_ButtonsHeld(0) & WPAD_BUTTON_HOME) || (WPAD_ButtonsHeld(0) & WPAD_CLASSIC_BUTTON_HOME))
{
ConfigRequested = 1;
return;
}
#endif
for (i=0; i<MAX_DEVICES; i++) for (i=0; i<MAX_DEVICES; i++)
{ {
/* clear key status */ /* clear key status */
@ -743,6 +740,7 @@ void gx_input_UpdateEmu(void)
else if (config.input[player].device > 0) else if (config.input[player].device > 0)
wpad_update(config.input[player].port,i, config.input[player].device - 1); wpad_update(config.input[player].port,i, config.input[player].device - 1);
#endif #endif
player ++; player ++;
} }
} }
@ -752,7 +750,7 @@ void gx_input_UpdateEmu(void)
void gx_input_UpdateMenu(u32 cnt) void gx_input_UpdateMenu(u32 cnt)
{ {
/* PAD status update */ /* PAD status update */
PAD_ScanPads(); m_input.connected = PAD_ScanPads();
/* PAD pressed keys */ /* PAD pressed keys */
s16 pp = PAD_ButtonsDown(0); s16 pp = PAD_ButtonsDown(0);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB