minor bug fixes, modified SRAM/SaveState filenames

This commit is contained in:
ekeeke31 2008-12-12 13:27:38 +00:00
parent 00a61b4762
commit 7b8984f729
12 changed files with 80 additions and 55 deletions

View File

@ -1,7 +1,7 @@
Genesis Plus for Gamecube Genesis Plus for Gamecube
------------------------------ ------------------------------
11/12/2008: 12/12/2008:
----------- -----------
[Genesis] [Genesis]
- YM2612 bugfixes (MAME core): - YM2612 bugfixes (MAME core):
@ -26,8 +26,8 @@ Genesis Plus for Gamecube
- removed embedded font, (re)enabled IPL font support: now should works for Qoob users too (thanks to emukiddid) - removed embedded font, (re)enabled IPL font support: now should works for Qoob users too (thanks to emukiddid)
- fixed "Reset" button behavior, now acts more like Genesis Reset button ;-) - fixed "Reset" button behavior, now acts more like Genesis Reset button ;-)
- patched libfat for faster SDCARD accesses (thanks to svpe) - patched libfat for faster SDCARD accesses (thanks to svpe)
- various bugfixes and menu tweaks - SRAM and SaveState files are now based on the ROM filename
- various bugfixes, menu tweaks and code cleanup
[NGC only] [NGC only]
- added 480p support in menu - added 480p support in menu

View File

@ -51,8 +51,8 @@
/* System IO ports */ /* System IO ports */
#define NO_SYSTEM (0) /* Unconnected Port*/ #define NO_SYSTEM (0) /* Unconnected Port*/
#define SYSTEM_MOUSE (1) /* Sega Mouse */ #define SYSTEM_GAMEPAD (1) /* Single Gamepad */
#define SYSTEM_GAMEPAD (2) /* Single Gamepad */ #define SYSTEM_MOUSE (2) /* Sega Mouse */
#define SYSTEM_MENACER (3) /* Sega Menacer (port 2) */ #define SYSTEM_MENACER (3) /* Sega Menacer (port 2) */
#define SYSTEM_JUSTIFIER (4) /* Konami Justifier (port 2) */ #define SYSTEM_JUSTIFIER (4) /* Konami Justifier (port 2) */
#define SYSTEM_TEAMPLAYER (5) /* Sega TeamPlayer */ #define SYSTEM_TEAMPLAYER (5) /* Sega TeamPlayer */

View File

@ -25,9 +25,9 @@
#include <sys/dir.h> #include <sys/dir.h>
#ifdef HW_RVL #ifdef HW_RVL
#define CONFIG_VERSION "GENPLUS 1.2.2W" #define CONFIG_VERSION "GENPLUS 1.2.3W"
#else #else
#define CONFIG_VERSION "GENPLUS 1.2.2G" #define CONFIG_VERSION "GENPLUS 1.2.3G"
#endif #endif
void config_save() void config_save()

View File

@ -195,7 +195,7 @@ int FAT_LoadFile (u8 *buffer)
if (length > 0) if (length > 0)
{ {
/* Add/move the file to the top of the history. */ /* Add/move the file to the top of the history. */
history_add_file(fatdir, filelist[selection].filename); if(!useHistory) history_add_file(fatdir, filelist[selection].filename);
/* full filename */ /* full filename */
char fname[MAXPATHLEN]; char fname[MAXPATHLEN];

View File

@ -39,6 +39,7 @@ int haveDVDdir = 0;
int haveFATdir = 0; int haveFATdir = 0;
FILEENTRIES filelist[MAXFILES]; FILEENTRIES filelist[MAXFILES];
char rom_filename[MAXJOLIET];
/*************************************************************************** /***************************************************************************
* ShowFiles * ShowFiles
@ -80,7 +81,7 @@ int FileSelector(unsigned char *buffer)
int go_up = 0; int go_up = 0;
int ret; int ret;
int i,size; int i,size;
while (1) while (1)
{ {
if (redraw) ShowFiles (offset, selection); if (redraw) ShowFiles (offset, selection);
@ -108,7 +109,7 @@ int FileSelector(unsigned char *buffer)
redraw = 1; redraw = 1;
} }
} }
/* highlight next item */ /* highlight next item */
else if (p & PAD_BUTTON_DOWN) else if (p & PAD_BUTTON_DOWN)
{ {
@ -118,7 +119,7 @@ int FileSelector(unsigned char *buffer)
if ((selection - offset) >= PAGESIZE) offset += PAGESIZE; if ((selection - offset) >= PAGESIZE) offset += PAGESIZE;
redraw = 1; redraw = 1;
} }
/* highlight previous item */ /* highlight previous item */
else if (p & PAD_BUTTON_UP) else if (p & PAD_BUTTON_UP)
{ {
@ -133,7 +134,7 @@ int FileSelector(unsigned char *buffer)
if (offset < 0) offset = 0; if (offset < 0) offset = 0;
redraw = 1; redraw = 1;
} }
/* go back one page */ /* go back one page */
else if (p & PAD_TRIGGER_L) else if (p & PAD_TRIGGER_L)
{ {
@ -148,7 +149,7 @@ int FileSelector(unsigned char *buffer)
if (offset < 0) offset = 0; if (offset < 0) offset = 0;
redraw = 1; redraw = 1;
} }
/* go forward one page */ /* go forward one page */
else if (p & PAD_TRIGGER_R) else if (p & PAD_TRIGGER_R)
{ {
@ -158,14 +159,14 @@ int FileSelector(unsigned char *buffer)
if ((selection - offset) >= PAGESIZE) offset += PAGESIZE; if ((selection - offset) >= PAGESIZE) offset += PAGESIZE;
redraw = 1; redraw = 1;
} }
/* quit */ /* quit */
if (p & PAD_TRIGGER_Z) if (p & PAD_TRIGGER_Z)
{ {
filelist[selection].filename_offset = 0; filelist[selection].filename_offset = 0;
return 0; return 0;
} }
/* open selected file or directory */ /* open selected file or directory */
if ((p & PAD_BUTTON_A) || (p & PAD_BUTTON_B)) if ((p & PAD_BUTTON_A) || (p & PAD_BUTTON_B))
{ {
@ -178,7 +179,7 @@ int FileSelector(unsigned char *buffer)
go_up = 1; go_up = 1;
selection = useFAT ? 0 : 1; selection = useFAT ? 0 : 1;
} }
/*** This is directory ***/ /*** This is directory ***/
if (filelist[selection].flags) if (filelist[selection].flags)
{ {
@ -198,9 +199,20 @@ int FileSelector(unsigned char *buffer)
/*** This is a file ***/ /*** This is a file ***/
else else
{ {
/* root directory ? */
if (go_up) return 0;
/* Load file */ /* Load file */
if (useFAT) return FAT_LoadFile(buffer); if (useFAT) ret = FAT_LoadFile(buffer);
else return DVD_LoadFile(buffer); else ret = DVD_LoadFile(buffer);
if (ret)
{
/* get filename and remove extension */
sprintf(rom_filename,"%s", filelist[selection].filename);
rom_filename[strlen(rom_filename) - 5] = 0;
}
return ret;
} }
redraw = 1; redraw = 1;
} }

View File

@ -45,6 +45,7 @@ typedef struct
/* Global Variables */ /* Global Variables */
extern FILEENTRIES filelist[MAXFILES]; extern FILEENTRIES filelist[MAXFILES];
extern char rom_filename[MAXJOLIET];
extern int maxfiles; extern int maxfiles;
extern int offset; extern int offset;
extern int selection; extern int selection;

View File

@ -129,7 +129,7 @@ int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
/*** Copy PKZip header to local, used as info ***/ /*** Copy PKZip header to local, used as info ***/
memcpy (&pkzip, &readbuffer, sizeof (PKZIPHEADER)); memcpy (&pkzip, &readbuffer, sizeof (PKZIPHEADER));
sprintf (msg, "Unzipping %d bytes ... Wait", FLIP32 (pkzip.uncompressedSize)); sprintf (msg, "Unzipping %d bytes ...", FLIP32 (pkzip.uncompressedSize));
ShowAction (msg); ShowAction (msg);
/*** Prepare the zip stream ***/ /*** Prepare the zip stream ***/

View File

@ -24,6 +24,7 @@
#include "shared.h" #include "shared.h"
#include "font.h" #include "font.h"
#include "saveicon.h" #include "saveicon.h"
#include "filesel.h"
#ifndef HW_RVL #ifndef HW_RVL
#include "dvd.h" #include "dvd.h"
@ -97,7 +98,7 @@ void memfile_autosave()
* We use the same buffer as for Memory Card manager * We use the same buffer as for Memory Card manager
* Function returns TRUE on success. * Function returns TRUE on success.
*****************************************************************************/ *****************************************************************************/
static int SD_ManageFile(char *filename, int direction, int filetype) static int FAT_ManageFile(char *filename, int direction, int filetype)
{ {
char pathname[MAXPATHLEN]; char pathname[MAXPATHLEN];
int done = 0; int done = 0;
@ -241,7 +242,24 @@ int CardFileExists (char *filename, u8 slot)
****************************************************************************/ ****************************************************************************/
int ManageSRAM (u8 direction, u8 device) int ManageSRAM (u8 direction, u8 device)
{ {
char filename[128]; if (!genromsize) return 0;
char filename[MAXJOLIET];
/* clean buffer */
memset(savebuffer, 0, 0x24000);
if (direction) ShowAction ("Loading SRAM ...");
else ShowAction ("Saving SRAM ...");
if (device == 0)
{
/* FAT support */
sprintf (filename, "%s.srm", rom_filename);
return FAT_ManageFile(filename,direction,1);
}
/* Memory CARD support */
char action[80]; char action[80];
int CardError; int CardError;
unsigned int SectorSize; unsigned int SectorSize;
@ -251,26 +269,15 @@ int ManageSRAM (u8 direction, u8 device)
int sbo; int sbo;
unsigned long inzipped,outzipped; unsigned long inzipped,outzipped;
if (!genromsize) return 0;
/* clean buffer */
memset(savebuffer, 0, 0x24000);
if (direction) ShowAction ("Loading SRAM ...");
else ShowAction ("Saving SRAM ...");
/* First, build a filename */ /* First, build a filename */
sprintf (filename, "MD-%04X.srm", realchecksum); sprintf (filename, "MD-%04X.srm", realchecksum);
strcpy (comment[1], filename); strcpy (comment[1], filename);
/* device is SDCARD, let's go */
if (device == 0) return SD_ManageFile(filename,direction,1);
/* set MCARD slot nr. */ /* set MCARD slot nr. */
u8 CARDSLOT = device - 1; u8 CARDSLOT = device - 1;
/* device is MCARD, we continue */ /* Saving */
if (direction == 0) /*** Saving ***/ if (direction == 0)
{ {
/*** Build the output buffer ***/ /*** Build the output buffer ***/
memcpy (&savebuffer, &icon, 2048); memcpy (&savebuffer, &icon, 2048);
@ -432,7 +439,24 @@ int ManageSRAM (u8 direction, u8 device)
****************************************************************************/ ****************************************************************************/
int ManageState (u8 direction, u8 device) int ManageState (u8 direction, u8 device)
{ {
char filename[128]; if (!genromsize) return 0;
char filename[MAXJOLIET];
/* clean buffer */
memset(savebuffer, 0, 0x24000);
if (direction) ShowAction ("Loading State ...");
else ShowAction ("Saving State ...");
if (device == 0)
{
/* FAT support */
sprintf (filename, "%s.gpz", rom_filename);
return FAT_ManageFile(filename,direction,0);
}
/* Memory CARD support */
char action[80]; char action[80];
int CardError; int CardError;
unsigned int SectorSize; unsigned int SectorSize;
@ -442,26 +466,15 @@ int ManageState (u8 direction, u8 device)
int sbo; int sbo;
int state_size = 0; int state_size = 0;
if (!genromsize) return 0;
/* clean buffer */
memset(savebuffer, 0, 0x24000);
if (direction) ShowAction ("Loading State ...");
else ShowAction ("Saving State ...");
/* First, build a filename */ /* First, build a filename */
sprintf (filename, "MD-%04X.gpz", realchecksum); sprintf (filename, "MD-%04X.gpz", realchecksum);
strcpy (comment[1], filename); strcpy (comment[1], filename);
/* device is SDCARD, let's go */
if (device == 0) return SD_ManageFile(filename,direction,0);
/* set MCARD slot nr. */ /* set MCARD slot nr. */
u8 CARDSLOT = device - 1; u8 CARDSLOT = device - 1;
/* device is MCARD, we continue */ /* Saving */
if (direction == 0) /* Saving */ if (direction == 0)
{ {
/* Build the output buffer */ /* Build the output buffer */
memcpy (&savebuffer, &icon, 2048); memcpy (&savebuffer, &icon, 2048);

View File

@ -712,8 +712,7 @@ void ConfigureJoypads ()
break; break;
case 7: case 7:
/* special case: wiimote controls lightgun */ if (config.input[player].device < 0) break;
ogc_input__config(config.input[player].port, config.input[player].device, input.padtype[player]); ogc_input__config(config.input[player].port, config.input[player].device, input.padtype[player]);
break; break;

View File

@ -167,6 +167,7 @@ int main (int argc, char *argv[])
} }
/* Default Config */ /* Default Config */
legal();
set_config_defaults(); set_config_defaults();
config_load(); config_load();
@ -185,7 +186,6 @@ int main (int argc, char *argv[])
} }
/* Show Menu */ /* Show Menu */
legal();
MainMenu(); MainMenu();
ConfigRequested = 0; ConfigRequested = 0;

View File

@ -52,14 +52,14 @@ static void AudioSwitchBuffers()
AUDIO_StartDMA(); AUDIO_StartDMA();
/* increment soundbuffers index */ /* increment soundbuffers index */
playbuffer++;
playbuffer &= 0xf;
if (playbuffer == mixbuffer) if (playbuffer == mixbuffer)
{ {
playbuffer--; playbuffer--;
if ( playbuffer < 0 ) playbuffer = 15; if ( playbuffer < 0 ) playbuffer = 15;
} }
playbuffer++;
playbuffer &= 0xf;
IsPlaying = 1; IsPlaying = 1;
} }

View File

@ -655,7 +655,7 @@ void ogc_input__set_defaults(void)
int j; int j;
for (i=0; i<4; i++) for (i=0; i<4; i++)
{ {
/* autodetect connected controller */ /* try to autodetect connected controller */
exp = 255; exp = 255;
WPAD_Probe(i, &exp); WPAD_Probe(i, &exp);
if (exp <= WPAD_EXP_CLASSIC) if (exp <= WPAD_EXP_CLASSIC)