mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-04 18:05:06 +01:00
~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:
parent
737c7244c4
commit
51ba38b6a1
@ -603,7 +603,7 @@ void teamplayer_2_write (uint32 data)
|
||||
|
||||
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)
|
||||
|
@ -157,7 +157,7 @@ static int getentry (int entrycount)
|
||||
if (strlen (fname) == 0) fname[0] = filename[0];
|
||||
}
|
||||
|
||||
if (strlen (fname) == 0) strcpy (fname, ".");
|
||||
if (strlen (fname) == 0) return -1;
|
||||
else
|
||||
{
|
||||
if (fname[0] == 1) strcpy (fname, "..");
|
||||
@ -211,7 +211,7 @@ int DVD_UpdateDir(int go_up)
|
||||
/* by default, update current directory */
|
||||
rootdir = filelist[selection].offset;
|
||||
rootdirlength = filelist[selection].length;
|
||||
|
||||
|
||||
/* reinit selector (previous value is saved for one level) */
|
||||
if (selection == 1)
|
||||
{
|
||||
@ -248,6 +248,7 @@ int DVD_ParseDirectory ()
|
||||
u64 rdoffset;
|
||||
int len = 0;
|
||||
int filecount = 0;
|
||||
int ret;
|
||||
|
||||
pdoffset = rdoffset = rootdir;
|
||||
pdlength = rootdirlength;
|
||||
@ -259,13 +260,16 @@ int DVD_ParseDirectory ()
|
||||
/*** Get as many files as possible ***/
|
||||
while (len < pdlength)
|
||||
{
|
||||
if (dvd_read (&dvdbuffer, 2048, pdoffset) == 0) return 0;
|
||||
if (dvd_read (&dvdbuffer, 2048, pdoffset) == 0)
|
||||
return 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;
|
||||
|
@ -167,7 +167,7 @@ int FileSelector(unsigned char *buffer)
|
||||
int go_up = 0;
|
||||
int quit =0;
|
||||
int old = -1;
|
||||
char text[MAXJOLIET+2];
|
||||
char text[MAXPATHLEN];
|
||||
char fname[MAXPATHLEN];
|
||||
FILE *xml,*snap;
|
||||
|
||||
@ -199,40 +199,44 @@ int FileSelector(unsigned char *buffer)
|
||||
|
||||
while (!quit)
|
||||
{
|
||||
/* get ROM filename without extension */
|
||||
sprintf (text, "%s", filelist[selection].filename);
|
||||
text[strlen(text) - 4] = 0;
|
||||
|
||||
/* ROM database informations */
|
||||
sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text);
|
||||
xml = fopen(fname, "rb");
|
||||
if (xml)
|
||||
/* Ensure a file is selected */
|
||||
if (!filelist[selection].flags)
|
||||
{
|
||||
bg_filesel[6].state |= IMAGE_VISIBLE;
|
||||
fclose(xml); /* TODO */
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_filesel[6].state &= ~IMAGE_VISIBLE;
|
||||
}
|
||||
/* get ROM filename without extension */
|
||||
sprintf (text, "%s", filelist[selection].filename);
|
||||
if (strlen(text) >= 4) text[strlen(text) - 4] = 0;
|
||||
|
||||
/* ROM snapshot */
|
||||
if (old != selection)
|
||||
{
|
||||
old = selection;
|
||||
|
||||
/* delete previous texture if any */
|
||||
gxTextureClose(&bg_filesel[8].texture);
|
||||
bg_filesel[8].state &= ~IMAGE_VISIBLE;
|
||||
|
||||
/* open screenshot file */
|
||||
sprintf (fname, "%s/snaps/%s.png", DEFAULT_PATH, text);
|
||||
snap = fopen(fname, "rb");
|
||||
if (snap)
|
||||
/* ROM database informations */
|
||||
sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text);
|
||||
xml = fopen(fname, "rb");
|
||||
if (xml)
|
||||
{
|
||||
bg_filesel[8].texture = gxTextureOpenPNG(0,snap);
|
||||
fclose(snap);
|
||||
if (bg_filesel[8].texture) bg_filesel[8].state |= IMAGE_VISIBLE;
|
||||
bg_filesel[6].state |= IMAGE_VISIBLE;
|
||||
fclose(xml); /* TODO */
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_filesel[6].state &= ~IMAGE_VISIBLE;
|
||||
}
|
||||
|
||||
/* ROM snapshot */
|
||||
if (old != selection)
|
||||
{
|
||||
old = selection;
|
||||
|
||||
/* delete previous texture if any */
|
||||
gxTextureClose(&bg_filesel[8].texture);
|
||||
bg_filesel[8].state &= ~IMAGE_VISIBLE;
|
||||
|
||||
/* open screenshot file */
|
||||
sprintf (fname, "%s/snaps/%s.png", DEFAULT_PATH, text);
|
||||
snap = fopen(fname, "rb");
|
||||
if (snap)
|
||||
{
|
||||
bg_filesel[8].texture = gxTextureOpenPNG(0,snap);
|
||||
fclose(snap);
|
||||
if (bg_filesel[8].texture) bg_filesel[8].state |= IMAGE_VISIBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +256,7 @@ int FileSelector(unsigned char *buffer)
|
||||
string_offset = 0;
|
||||
filelist[i].filename_offset = 0;
|
||||
}
|
||||
sprintf(text, "%s ",filelist[i].filename + string_offset);
|
||||
sprintf(text, "%s ",filelist[i].filename + string_offset);
|
||||
strncat(text, filelist[i].filename, string_offset);
|
||||
|
||||
gxDrawTexture(bar_over.texture,bar_over.x,yoffset+bar_over.y,bar_over.w,bar_over.h,255);
|
||||
|
@ -1937,7 +1937,10 @@ static void ctrlmenu_raz(void)
|
||||
m->buttons[i+2].data = &button_player_data;
|
||||
m->buttons[i+2].state |= BUTTON_ACTIVE;
|
||||
sprintf(m->items[i+2].text,"%d",max + 1);
|
||||
sprintf(m->items[i+2].comment,"Configure Player %d settings", 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);
|
||||
max++;
|
||||
}
|
||||
}
|
||||
@ -1946,22 +1949,17 @@ static void ctrlmenu_raz(void)
|
||||
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 m->buttons[0].shift[3] = 0;
|
||||
|
||||
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 m->buttons[1].shift[3] = 0;
|
||||
|
||||
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 m->buttons[2].shift[1] = 0;
|
||||
|
||||
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 m->buttons[6].shift[0] = 0;
|
||||
|
||||
if (input.dev[4] != NO_DEVICE) m->buttons[5].shift[1] = 1;
|
||||
else m->buttons[5].shift[1] = 0;
|
||||
|
||||
if (input.dev[5] != NO_DEVICE)
|
||||
{
|
||||
m->buttons[6].shift[1] = 1;
|
||||
@ -2111,12 +2109,11 @@ static void ctrlmenu(void)
|
||||
{
|
||||
switch (m->selected)
|
||||
{
|
||||
case 0:
|
||||
case 0: /* update port 1 system */
|
||||
if (j_cart) break;
|
||||
input.system[0] ++;
|
||||
if (input.system[0] == SYSTEM_MENACER) 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] ++;
|
||||
if (input.system[0] == SYSTEM_MOUSE) input.system[0] +=3; /* lightguns are never used on Port 1 */
|
||||
else input.system[0] ++;
|
||||
if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[0] +=3;
|
||||
if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY;
|
||||
if (input.system[0] > SYSTEM_WAYPLAY)
|
||||
{
|
||||
@ -2160,7 +2157,7 @@ static void ctrlmenu(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 1: /* update port 2 system */
|
||||
if (j_cart) break;
|
||||
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;
|
||||
|
||||
case 10: /* specific option */
|
||||
if ((config.input[player].device == 1) && (input.dev[m->selected-2] <= DEVICE_6BUTTON)) break;
|
||||
*special ^= 1;
|
||||
if (config.input[player].device == 1)
|
||||
{
|
||||
/* force 3-Buttons pad */
|
||||
config.input[player].padtype = DEVICE_3BUTTON;
|
||||
}
|
||||
io_reset();
|
||||
|
||||
/* update menu items */
|
||||
@ -2403,13 +2404,16 @@ static void ctrlmenu(void)
|
||||
|
||||
/* force 3-buttons gamepad when using Wiimote */
|
||||
if (config.input[player].device == 1)
|
||||
{
|
||||
config.input[player].padtype = DEVICE_3BUTTON;
|
||||
memcpy(&m->items[10],&items[*special],sizeof(gui_item));
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
/* use default gamecube pad */
|
||||
config.input[player].device = 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* update menu items */
|
||||
memcpy(&m->items[11],&items_device[config.input[player].device + 1],sizeof(gui_item));
|
||||
break;
|
||||
@ -2451,7 +2455,7 @@ static void ctrlmenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* remove configuration window */
|
||||
/* disable configuration window */
|
||||
m->bg_images[7].state &= ~IMAGE_VISIBLE;
|
||||
|
||||
/* disable configuration buttons */
|
||||
@ -2459,7 +2463,7 @@ static void ctrlmenu(void)
|
||||
m->buttons[11].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[3].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[9].shift[3] = 0;
|
||||
|
||||
/* restore title */
|
||||
/* clear menu title */
|
||||
strcpy(m->title,"Controller Settings");
|
||||
|
||||
/* clear menu items */
|
||||
m->items[0].texture = NULL;
|
||||
m->items[1].texture = NULL;
|
||||
m->items[10].texture = NULL;
|
||||
m->items[11].texture = NULL;
|
||||
m->items[0].data = NULL;
|
||||
m->items[1].data = NULL;
|
||||
m->items[10].data = NULL;
|
||||
m->items[11].data = NULL;
|
||||
memset(&m->items[0],0,sizeof(gui_item));
|
||||
memset(&m->items[1],0,sizeof(gui_item));
|
||||
memset(&m->items[10],0,sizeof(gui_item));
|
||||
memset(&m->items[11],0,sizeof(gui_item));
|
||||
|
||||
/* clear player buttons */
|
||||
m->buttons[2].data = NULL;
|
||||
m->buttons[3].data = NULL;
|
||||
m->buttons[4].data = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user