~fixed some small bugs in Controllers Settings Menu

~fixed a bug with J-CART
~fixed a bug corrupting selection bar in ROM File Browser
-removed useless entry from DVD filelist
This commit is contained in:
ekeeke31 2009-05-06 10:03:33 +00:00
parent 737c7244c4
commit 51ba38b6a1
4 changed files with 76 additions and 66 deletions

View File

@ -603,7 +603,7 @@ void teamplayer_2_write (uint32 data)
uint32 jcart_read(uint32 address) uint32 jcart_read(uint32 address)
{ {
return (gamepad_read(2) | ((gamepad_read(3)&0x3f) << 8)); /* fixes Micro Machines 2 (is it correct ?) */ return (gamepad_read(5) | ((gamepad_read(6)&0x3f) << 8)); /* fixes Micro Machines 2 (is it correct ?) */
} }
void jcart_write(uint32 address, uint32 data) void jcart_write(uint32 address, uint32 data)

View File

@ -157,7 +157,7 @@ static int getentry (int entrycount)
if (strlen (fname) == 0) fname[0] = filename[0]; if (strlen (fname) == 0) fname[0] = filename[0];
} }
if (strlen (fname) == 0) strcpy (fname, "."); if (strlen (fname) == 0) return -1;
else else
{ {
if (fname[0] == 1) strcpy (fname, ".."); if (fname[0] == 1) strcpy (fname, "..");
@ -248,6 +248,7 @@ int DVD_ParseDirectory ()
u64 rdoffset; u64 rdoffset;
int len = 0; int len = 0;
int filecount = 0; int filecount = 0;
int ret;
pdoffset = rdoffset = rootdir; pdoffset = rdoffset = rootdir;
pdlength = rootdirlength; pdlength = rootdirlength;
@ -259,13 +260,16 @@ int DVD_ParseDirectory ()
/*** Get as many files as possible ***/ /*** Get as many files as possible ***/
while (len < pdlength) while (len < pdlength)
{ {
if (dvd_read (&dvdbuffer, 2048, pdoffset) == 0) return 0; if (dvd_read (&dvdbuffer, 2048, pdoffset) == 0)
return 0;
diroffset = 0; diroffset = 0;
while (getentry (filecount)) ret = getentry (filecount);
while (ret != 0)
{ {
if (filecount < MAXFILES) filecount++; if ((ret > 0) && (filecount < MAXFILES)) filecount++;
ret = getentry (filecount);
} }
len += 2048; len += 2048;

View File

@ -167,7 +167,7 @@ int FileSelector(unsigned char *buffer)
int go_up = 0; int go_up = 0;
int quit =0; int quit =0;
int old = -1; int old = -1;
char text[MAXJOLIET+2]; char text[MAXPATHLEN];
char fname[MAXPATHLEN]; char fname[MAXPATHLEN];
FILE *xml,*snap; FILE *xml,*snap;
@ -198,10 +198,13 @@ int FileSelector(unsigned char *buffer)
bar_over.y = -(bar_over.h - dir_icon.h)/2; bar_over.y = -(bar_over.h - dir_icon.h)/2;
while (!quit) while (!quit)
{
/* Ensure a file is selected */
if (!filelist[selection].flags)
{ {
/* get ROM filename without extension */ /* get ROM filename without extension */
sprintf (text, "%s", filelist[selection].filename); sprintf (text, "%s", filelist[selection].filename);
text[strlen(text) - 4] = 0; if (strlen(text) >= 4) text[strlen(text) - 4] = 0;
/* ROM database informations */ /* ROM database informations */
sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text); sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text);
@ -235,6 +238,7 @@ 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;
} }
} }
}
/* Draw menu*/ /* Draw menu*/
GUI_DrawMenu(m); GUI_DrawMenu(m);

View File

@ -1937,6 +1937,9 @@ static void ctrlmenu_raz(void)
m->buttons[i+2].data = &button_player_data; m->buttons[i+2].data = &button_player_data;
m->buttons[i+2].state |= BUTTON_ACTIVE; m->buttons[i+2].state |= BUTTON_ACTIVE;
sprintf(m->items[i+2].text,"%d",max + 1); sprintf(m->items[i+2].text,"%d",max + 1);
if (j_cart && (i > 4))
sprintf(m->items[i+2].comment,"Configure Player %d (J-CART) settings", max + 1);
else
sprintf(m->items[i+2].comment,"Configure Player %d settings", max + 1); sprintf(m->items[i+2].comment,"Configure Player %d settings", max + 1);
max++; max++;
} }
@ -1946,22 +1949,17 @@ static void ctrlmenu_raz(void)
if (input.dev[0] != NO_DEVICE) m->buttons[0].shift[3] = 2; if (input.dev[0] != NO_DEVICE) m->buttons[0].shift[3] = 2;
else if (input.dev[4] != NO_DEVICE) m->buttons[0].shift[3] = 6; else if (input.dev[4] != NO_DEVICE) m->buttons[0].shift[3] = 6;
else m->buttons[0].shift[3] = 0; else m->buttons[0].shift[3] = 0;
if (input.dev[4] != NO_DEVICE) m->buttons[1].shift[3] = 5; if (input.dev[4] != NO_DEVICE) m->buttons[1].shift[3] = 5;
else if (input.dev[0] != NO_DEVICE) m->buttons[1].shift[3] = 1; else if (input.dev[0] != NO_DEVICE) m->buttons[1].shift[3] = 1;
else m->buttons[1].shift[3] = 0; else m->buttons[1].shift[3] = 0;
if (input.dev[1] != NO_DEVICE) m->buttons[2].shift[1] = 1; if (input.dev[1] != NO_DEVICE) m->buttons[2].shift[1] = 1;
else if (input.dev[4] != NO_DEVICE) m->buttons[2].shift[1] = 4; else if (input.dev[4] != NO_DEVICE) m->buttons[2].shift[1] = 4;
else m->buttons[2].shift[1] = 0; else m->buttons[2].shift[1] = 0;
if (input.dev[3] != NO_DEVICE) m->buttons[6].shift[0] = 1; if (input.dev[3] != NO_DEVICE) m->buttons[6].shift[0] = 1;
else if (input.dev[0] != NO_DEVICE) m->buttons[6].shift[0] = 4; else if (input.dev[0] != NO_DEVICE) m->buttons[6].shift[0] = 4;
else m->buttons[6].shift[0] = 0; else m->buttons[6].shift[0] = 0;
if (input.dev[4] != NO_DEVICE) m->buttons[5].shift[1] = 1; if (input.dev[4] != NO_DEVICE) m->buttons[5].shift[1] = 1;
else m->buttons[5].shift[1] = 0; else m->buttons[5].shift[1] = 0;
if (input.dev[5] != NO_DEVICE) if (input.dev[5] != NO_DEVICE)
{ {
m->buttons[6].shift[1] = 1; m->buttons[6].shift[1] = 1;
@ -2111,12 +2109,11 @@ static void ctrlmenu(void)
{ {
switch (m->selected) switch (m->selected)
{ {
case 0: case 0: /* update port 1 system */
if (j_cart) break; if (j_cart) break;
input.system[0] ++; if (input.system[0] == SYSTEM_MOUSE) input.system[0] +=3; /* lightguns are never used on Port 1 */
if (input.system[0] == SYSTEM_MENACER) input.system[0] ++; else input.system[0] ++;
if (input.system[0] == SYSTEM_JUSTIFIER) input.system[0] ++; if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[0] +=3;
if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[0] ++;
if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY; if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY;
if (input.system[0] > SYSTEM_WAYPLAY) if (input.system[0] > SYSTEM_WAYPLAY)
{ {
@ -2160,7 +2157,7 @@ static void ctrlmenu(void)
} }
break; break;
case 1: case 1: /* update port 2 system */
if (j_cart) break; if (j_cart) break;
input.system[1] ++; input.system[1] ++;
if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[1] ++; if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[1] ++;
@ -2291,8 +2288,12 @@ static void ctrlmenu(void)
break; break;
case 10: /* specific option */ case 10: /* specific option */
if ((config.input[player].device == 1) && (input.dev[m->selected-2] <= DEVICE_6BUTTON)) break;
*special ^= 1; *special ^= 1;
if (config.input[player].device == 1)
{
/* force 3-Buttons pad */
config.input[player].padtype = DEVICE_3BUTTON;
}
io_reset(); io_reset();
/* update menu items */ /* update menu items */
@ -2403,7 +2404,10 @@ static void ctrlmenu(void)
/* force 3-buttons gamepad when using Wiimote */ /* force 3-buttons gamepad when using Wiimote */
if (config.input[player].device == 1) if (config.input[player].device == 1)
{
config.input[player].padtype = DEVICE_3BUTTON; config.input[player].padtype = DEVICE_3BUTTON;
memcpy(&m->items[10],&items[*special],sizeof(gui_item));
}
#else #else
/* use default gamecube pad */ /* use default gamecube pad */
@ -2451,7 +2455,7 @@ static void ctrlmenu(void)
} }
} }
/* remove configuration window */ /* disable configuration window */
m->bg_images[7].state &= ~IMAGE_VISIBLE; m->bg_images[7].state &= ~IMAGE_VISIBLE;
/* disable configuration buttons */ /* disable configuration buttons */
@ -2459,7 +2463,7 @@ static void ctrlmenu(void)
m->buttons[11].state &= (~BUTTON_VISIBLE & ~BUTTON_ACTIVE); m->buttons[11].state &= (~BUTTON_VISIBLE & ~BUTTON_ACTIVE);
m->buttons[12].state &= (~BUTTON_VISIBLE & ~BUTTON_ACTIVE); m->buttons[12].state &= (~BUTTON_VISIBLE & ~BUTTON_ACTIVE);
/* restore directions */ /* clear directions */
m->buttons[2].shift[3] = 0; m->buttons[2].shift[3] = 0;
m->buttons[3].shift[3] = 0; m->buttons[3].shift[3] = 0;
m->buttons[4].shift[3] = 0; m->buttons[4].shift[3] = 0;
@ -2469,18 +2473,16 @@ static void ctrlmenu(void)
m->buttons[8].shift[3] = 0; m->buttons[8].shift[3] = 0;
m->buttons[9].shift[3] = 0; m->buttons[9].shift[3] = 0;
/* restore title */ /* clear menu title */
strcpy(m->title,"Controller Settings"); strcpy(m->title,"Controller Settings");
/* clear menu items */ /* clear menu items */
m->items[0].texture = NULL; memset(&m->items[0],0,sizeof(gui_item));
m->items[1].texture = NULL; memset(&m->items[1],0,sizeof(gui_item));
m->items[10].texture = NULL; memset(&m->items[10],0,sizeof(gui_item));
m->items[11].texture = NULL; memset(&m->items[11],0,sizeof(gui_item));
m->items[0].data = NULL;
m->items[1].data = NULL; /* clear player buttons */
m->items[10].data = NULL;
m->items[11].data = NULL;
m->buttons[2].data = NULL; m->buttons[2].data = NULL;
m->buttons[3].data = NULL; m->buttons[3].data = NULL;
m->buttons[4].data = NULL; m->buttons[4].data = NULL;