additional fixes to memory card interface

improved some menu transitions
changed default background color
This commit is contained in:
ekeeke31 2010-04-15 12:01:14 +00:00
parent 0ac9bd43da
commit 334e8a0478
4 changed files with 33 additions and 45 deletions

View File

@ -39,9 +39,6 @@ char rom_filename[MAXJOLIET];
* libOGC System Work Area
*/
static u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32);
static card_dir CardDir;
static card_file CardFile;
static card_stat CardStatus;
/**
* DMA Transfer Area.
@ -190,8 +187,9 @@ static int MountTheCard (u8 slot)
****************************************************************************/
static int CardFileExists (char *filename, u8 slot)
{
card_dir CardDir;
int CardError = CARD_FindFirst (slot, &CardDir, TRUE);
while (CardError != CARD_ERROR_NOFILE)
while (CardError >= 0)
{
CardError = CARD_FindNext (&CardDir);
if (strcmp ((char *) CardDir.filename, filename) == 0)
@ -282,6 +280,8 @@ int ManageSRAM (u8 direction, u8 device)
int outbytes = 0;
int sbo;
unsigned long inzipped,outzipped;
card_file CardFile;
card_stat CardStatus;
/* First, build a filename */
sprintf (filename, "MD-%04X.srm", realchecksum);
@ -398,13 +398,6 @@ int ManageSRAM (u8 direction, u8 device)
default: /*** Loading ***/
if (!CardFileExists (filename,CARDSLOT))
{
GUI_WaitPrompt("Error","File does not exist !");
CARD_Unmount (CARDSLOT);
return 0;
}
memset (&CardFile, 0, sizeof (CardFile));
CardError = CARD_Open (CARDSLOT, filename, &CardFile);
if (CardError)
@ -489,6 +482,8 @@ int ManageState (u8 direction, u8 device)
int outbytes = 0;
int sbo;
int state_size = 0;
card_file CardFile;
card_stat CardStatus;
/* First, build a filename */
sprintf (filename, "MD-%04X.gpz", realchecksum);
@ -599,13 +594,6 @@ int ManageState (u8 direction, u8 device)
default: /*** Loading ***/
if (!CardFileExists (filename, CARDSLOT))
{
GUI_WaitPrompt("Error","File does not exist !");
CARD_Unmount (CARDSLOT);
return 0;
}
memset (&CardFile, 0, sizeof (CardFile));
CardError = CARD_Open (CARDSLOT, filename, &CardFile);
if (CardError)
@ -632,10 +620,10 @@ int ManageState (u8 direction, u8 device)
}
CARD_Close (&CardFile);
CARD_Unmount (CARDSLOT);
GUI_MsgBoxClose();
/*** Load State ***/
state_load(&savebuffer[2112]);
GUI_MsgBoxClose();
return 1;
}
}

View File

@ -164,7 +164,7 @@ int FileSelector(unsigned char *buffer, bool useFAT)
#endif
/* Background Settings */
if (config.bg_color == (BG_COLOR_MAX - 1))
if (config.bg_color == 0)
bg_filesel[0].data = Bg_main_2_png;
else
bg_filesel[0].data = Bg_main_png;

View File

@ -41,6 +41,7 @@ static GXColor bg_color;
/* various background colors */
static GXColor bg_colors[BG_COLOR_MAX]=
{
{0x00,0x00,0x00,0xff}, /* black */
{0xd4,0xd0,0xc8,0xff}, /* cream */
{0xbb,0xb0,0x99,0xff}, /* gold */
{0xd6,0xcb,0xba,0xff}, /* light gold */
@ -54,8 +55,7 @@ static GXColor bg_colors[BG_COLOR_MAX]=
{0xa9,0xc7,0xc6,0xff}, /* green blue */
{0x7d,0xa4,0x9f,0xff}, /* darker green blue */
{0x22,0x52,0x74,0xff}, /* dark blue */
{0x33,0x33,0x33,0xff}, /* dark grey */
{0x00,0x00,0x00,0xff} /* black */
{0x33,0x33,0x33,0xff} /* dark grey */
};

View File

@ -93,7 +93,7 @@ static gui_item action_select =
/*****************************************************************************/
static gui_image bg_main[4] =
{
{NULL,Bg_main_png,IMAGE_VISIBLE|IMAGE_FADE,178,28,284,288,255},
{NULL,Bg_main_png,IMAGE_VISIBLE,178,28,284,288,255},
{NULL,Bg_overlay_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
{NULL,Banner_main_png,IMAGE_VISIBLE|IMAGE_SLIDE_BOTTOM,0,340,640,140,255},
{NULL,Main_logo_png,IMAGE_VISIBLE|IMAGE_SLIDE_BOTTOM,202,362,232,56,255}
@ -101,7 +101,7 @@ static gui_image bg_main[4] =
static gui_image bg_misc[5] =
{
{NULL,Bg_main_png,IMAGE_VISIBLE|IMAGE_FADE,178,96,284,288,255},
{NULL,Bg_main_png,IMAGE_VISIBLE,178,96,284,288,255},
{NULL,Bg_overlay_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
{NULL,Banner_top_png,IMAGE_VISIBLE|IMAGE_SLIDE_TOP,0,0,640,108,255},
{NULL,Banner_bottom_png,IMAGE_VISIBLE|IMAGE_SLIDE_BOTTOM,0,380,640,100,255},
@ -270,15 +270,15 @@ static gui_butn buttons_list[4] =
/* Main menu */
static gui_butn buttons_main[9] =
{
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,0,1}, 80, 50,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},246, 50,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},412, 50,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX ,{3,0,1,1}, 80,194,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX ,{3,0,1,1},246,194,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX ,{3,0,1,0},412,194,148,132},
{NULL , BUTTON_FADE|BUTTON_OVER_SFX ,{3,0,1,1}, 10,372, 84, 32},
{NULL , BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,1,1,1},546,334, 84, 32},
{NULL , BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{1,0,1,0},546,372, 84, 32}
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,0,1}, 80, 50,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},246, 50,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},412, 50,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX ,{3,0,1,1}, 80,194,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX ,{3,0,1,1},246,194,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX ,{3,0,1,0},412,194,148,132},
{NULL , BUTTON_OVER_SFX ,{3,0,1,1}, 10,372, 84, 32},
{NULL , BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,1,1,1},546,334, 84, 32},
{NULL , BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{1,0,1,0},546,372, 84, 32}
};
/* Controllers Menu */
@ -302,24 +302,24 @@ static gui_butn buttons_ctrls[13] =
/* Load Game menu */
static gui_butn buttons_load[4] =
{
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,2,0,1},246,102,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{1,0,1,1}, 80,248,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,2,0,1},246,102,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{1,0,1,1}, 80,248,148,132},
#ifdef HW_RVL
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,0,1,1},246,248,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{3,0,1,0},412,248,148,132}
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,0,1,1},246,248,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{3,0,1,0},412,248,148,132}
#else
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,0,1,0},412,248,148,132}
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,0,1,0},412,248,148,132}
#endif
};
/* Options menu */
static gui_butn buttons_options[5] =
{
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,0,1}, 80,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},246,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,2,1,1},412,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{3,0,1,1},162,264,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_FADE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,0,1,0},330,264,148,132}
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,0,1}, 80,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},246,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,2,1,1},412,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{3,0,1,1},162,264,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{2,0,1,0},330,264,148,132}
};
/*****************************************************************************/
@ -642,7 +642,7 @@ static void prefmenu ()
else sprintf (items[4].text, "BG Color: DEFAULT");
GUI_SetBgColor((u8)config.bg_color);
GUI_DeleteMenu(m);
if (config.bg_color == (BG_COLOR_MAX - 1))
if (config.bg_color == 0)
{
bg_main[0].data = Bg_main_2_png;
bg_misc[0].data = Bg_main_2_png;
@ -2577,7 +2577,7 @@ void MainMenu (void)
/* Background Settings */
GUI_SetBgColor((u8)config.bg_color);
if (config.bg_color == (BG_COLOR_MAX - 1))
if (config.bg_color == 0)
{
bg_main[0].data = Bg_main_2_png;
bg_misc[0].data = Bg_main_2_png;