mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-29 04:31:49 +01:00
added automatic access to last ROM directory (SD/USB)
added an option to automatically load last ROM file on startup
This commit is contained in:
parent
a6fdb00469
commit
7a827f7a71
@ -115,6 +115,7 @@ void config_default(void)
|
|||||||
gx_input_SetDefault();
|
gx_input_SetDefault();
|
||||||
|
|
||||||
/* menu options */
|
/* menu options */
|
||||||
|
config.autoload = 0;
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
config.s_auto = 1;
|
config.s_auto = 1;
|
||||||
#else
|
#else
|
||||||
@ -125,10 +126,15 @@ void config_default(void)
|
|||||||
config.bg_color = 0;
|
config.bg_color = 0;
|
||||||
config.bg_overlay = 0;
|
config.bg_overlay = 0;
|
||||||
config.screen_w = 658;
|
config.screen_w = 658;
|
||||||
config.ask_confirm = 0;
|
|
||||||
config.bgm_volume = 100.0;
|
config.bgm_volume = 100.0;
|
||||||
config.sfx_volume = 100.0;
|
config.sfx_volume = 100.0;
|
||||||
|
|
||||||
|
/* default ROM directories */
|
||||||
|
sprintf (config.sddir, "sd:%s/roms/", DEFAULT_PATH);
|
||||||
|
#ifdef HW_RVL
|
||||||
|
sprintf (config.usbdir, "usb:%s/roms/", DEFAULT_PATH);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* restore from config file */
|
/* restore from config file */
|
||||||
config_load();
|
config_load();
|
||||||
io_init();
|
io_init();
|
||||||
|
@ -31,12 +31,12 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char version[16];
|
char version[16];
|
||||||
uint8 hq_fm;
|
|
||||||
uint8 psgBoostNoise;
|
|
||||||
int32 psg_preamp;
|
int32 psg_preamp;
|
||||||
int32 fm_preamp;
|
int32 fm_preamp;
|
||||||
|
uint8 hq_fm;
|
||||||
|
uint8 psgBoostNoise;
|
||||||
uint8 filter;
|
uint8 filter;
|
||||||
int16 lp_range;
|
int8 lp_range;
|
||||||
int16 low_freq;
|
int16 low_freq;
|
||||||
int16 high_freq;
|
int16 high_freq;
|
||||||
float lg;
|
float lg;
|
||||||
@ -61,24 +61,26 @@ typedef struct
|
|||||||
uint8 render;
|
uint8 render;
|
||||||
uint8 ntsc;
|
uint8 ntsc;
|
||||||
uint8 bilinear;
|
uint8 bilinear;
|
||||||
#ifdef HW_RVL
|
|
||||||
uint8 trap;
|
|
||||||
float gamma;
|
|
||||||
#endif
|
|
||||||
uint8 gun_cursor[2];
|
uint8 gun_cursor[2];
|
||||||
uint8 invert_mouse;
|
uint8 invert_mouse;
|
||||||
uint16 pad_keymap[4][MAX_KEYS];
|
uint16 pad_keymap[4][MAX_KEYS];
|
||||||
uint32 wpad_keymap[4*3][MAX_KEYS];
|
|
||||||
t_input_config input[MAX_INPUTS];
|
t_input_config input[MAX_INPUTS];
|
||||||
|
uint8 autoload;
|
||||||
uint8 s_auto;
|
uint8 s_auto;
|
||||||
uint8 s_default;
|
uint8 s_default;
|
||||||
uint8 s_device;
|
uint8 s_device;
|
||||||
int8 bg_color;
|
int8 bg_color;
|
||||||
int8 bg_overlay;
|
int8 bg_overlay;
|
||||||
int16 screen_w;
|
int16 screen_w;
|
||||||
uint8 ask_confirm;
|
|
||||||
float bgm_volume;
|
float bgm_volume;
|
||||||
float sfx_volume;
|
float sfx_volume;
|
||||||
|
char sddir[MAXPATHLEN];
|
||||||
|
#ifdef HW_RVL
|
||||||
|
float gamma;
|
||||||
|
uint32 trap;
|
||||||
|
uint32 wpad_keymap[4*3][MAX_KEYS];
|
||||||
|
char usbdir[MAXPATHLEN];
|
||||||
|
#endif
|
||||||
} t_config;
|
} t_config;
|
||||||
|
|
||||||
/* Global data */
|
/* Global data */
|
||||||
|
@ -45,7 +45,8 @@ static u8 DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32); /* data buffer for all DVD
|
|||||||
u32 dvd_read (void *dst, u32 len, u64 offset)
|
u32 dvd_read (void *dst, u32 len, u64 offset)
|
||||||
{
|
{
|
||||||
/*** We only allow 2k reads **/
|
/*** We only allow 2k reads **/
|
||||||
if (len > DVDCHUNK) return 0;
|
if (len > DVDCHUNK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/*** Let's not read past end of DVD ***/
|
/*** Let's not read past end of DVD ***/
|
||||||
if(offset < DvdMaxOffset)
|
if(offset < DvdMaxOffset)
|
||||||
@ -64,14 +65,17 @@ u32 dvd_read (void *dst, u32 len, u64 offset)
|
|||||||
dvd[7] = 3;
|
dvd[7] = 3;
|
||||||
|
|
||||||
/*** Enable reading with DMA ***/
|
/*** Enable reading with DMA ***/
|
||||||
while (dvd[7] & 1) usleep(10);
|
while (dvd[7] & 1)
|
||||||
|
usleep(10);
|
||||||
memcpy (dst, buffer, len);
|
memcpy (dst, buffer, len);
|
||||||
|
|
||||||
/*** Ensure it has completed ***/
|
/*** Ensure it has completed ***/
|
||||||
if (dvd[0] & 0x4) return 0;
|
if (dvd[0] & 0x4)
|
||||||
|
return 0;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if (DI_ReadDVD(buffer, len >> 11, (u32)(offset >> 11))) return 0;
|
if (DI_ReadDVD(buffer, len >> 11, (u32)(offset >> 11)))
|
||||||
|
return 0;
|
||||||
memcpy (dst, buffer, len);
|
memcpy (dst, buffer, len);
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
@ -100,7 +104,8 @@ void dvd_motor_off( )
|
|||||||
dvd[5] = 0;
|
dvd[5] = 0;
|
||||||
dvd[6] = 0;
|
dvd[6] = 0;
|
||||||
dvd[7] = 1; // Do immediate
|
dvd[7] = 1; // Do immediate
|
||||||
while (dvd[7] & 1) usleep(10);
|
while (dvd[7] & 1)
|
||||||
|
usleep(10);
|
||||||
|
|
||||||
/*** PSO Stops blackscreen at reload ***/
|
/*** PSO Stops blackscreen at reload ***/
|
||||||
dvd[0] = 0x14;
|
dvd[0] = 0x14;
|
||||||
@ -133,8 +138,8 @@ void uselessinquiry ()
|
|||||||
dvd[5] = 0x80000000;
|
dvd[5] = 0x80000000;
|
||||||
dvd[6] = 0x20;
|
dvd[6] = 0x20;
|
||||||
dvd[7] = 1;
|
dvd[7] = 1;
|
||||||
|
while (dvd[7] & 1)
|
||||||
while (dvd[7] & 1) usleep(10);
|
usleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -153,11 +158,11 @@ void dvd_drive_detect()
|
|||||||
dvd[5] = 0x80000000;
|
dvd[5] = 0x80000000;
|
||||||
dvd[6] = 0x20;
|
dvd[6] = 0x20;
|
||||||
dvd[7] = 3;
|
dvd[7] = 3;
|
||||||
while( dvd[7] & 1 ) usleep(10);
|
while (dvd[7] & 1)
|
||||||
DCFlushRange((void *)0x80000000, 32);
|
usleep(10);
|
||||||
|
|
||||||
|
DCFlushRange((void *)0x80000000, 32);
|
||||||
int driveid = (int)inquiry[2];
|
int driveid = (int)inquiry[2];
|
||||||
|
|
||||||
if ((driveid == 4) || (driveid == 6) || (driveid == 8))
|
if ((driveid == 4) || (driveid == 6) || (driveid == 8))
|
||||||
{
|
{
|
||||||
/* Gamecube DVD Drive (1.4 GB)*/
|
/* Gamecube DVD Drive (1.4 GB)*/
|
||||||
|
@ -79,11 +79,14 @@ static int getpvd()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return 0; /*** Can't read sector! ***/
|
else
|
||||||
|
return 0; /*** Can't read sector! ***/
|
||||||
|
|
||||||
sector++;
|
sector++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsJoliet > 0) return 1; /*** Joliet PVD Found ? ***/
|
if (IsJoliet > 0)
|
||||||
|
return 1; /*** Joliet PVD Found ? ***/
|
||||||
|
|
||||||
/*** Look for standard ISO9660 PVD ***/
|
/*** Look for standard ISO9660 PVD ***/
|
||||||
sector = 16;
|
sector = 16;
|
||||||
@ -101,8 +104,10 @@ static int getpvd()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return 0; /*** Can't read sector! ***/
|
else
|
||||||
sector++;
|
return 0; /*** Can't read sector! ***/
|
||||||
|
|
||||||
|
sector++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IsJoliet == 0);
|
return (IsJoliet == 0);
|
||||||
@ -125,8 +130,10 @@ static int getentry(int entrycount)
|
|||||||
u32 offset32;
|
u32 offset32;
|
||||||
|
|
||||||
/* Basic checks */
|
/* Basic checks */
|
||||||
if (entrycount >= MAXFILES) return 0;
|
if (entrycount >= MAXFILES)
|
||||||
if (diroffset >= DVDCHUNK) return 0;
|
return 0;
|
||||||
|
if (diroffset >= DVDCHUNK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/** Decode this entry **/
|
/** Decode this entry **/
|
||||||
if (dvdbuffer[diroffset]) /* Record length available */
|
if (dvdbuffer[diroffset]) /* Record length available */
|
||||||
@ -139,32 +146,36 @@ static int getentry(int entrycount)
|
|||||||
|
|
||||||
/* Check for wrap round - illegal in ISO spec,
|
/* Check for wrap round - illegal in ISO spec,
|
||||||
* but certain crap writers do it! */
|
* but certain crap writers do it! */
|
||||||
if ((diroffset + dvdbuffer[diroffset]) > DVDCHUNK) return 0;
|
if ((diroffset + dvdbuffer[diroffset]) > DVDCHUNK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (*filenamelength)
|
if (*filenamelength)
|
||||||
{
|
{
|
||||||
memset (&fname, 0, 512);
|
memset (&fname, 0, 512);
|
||||||
|
|
||||||
/*** Do ISO 9660 first ***/
|
/** Do ISO 9660 first **/
|
||||||
if (!IsJoliet) strcpy (fname, filename);
|
if (!IsJoliet)
|
||||||
|
strcpy (fname, filename);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*** The more tortuous unicode joliet entries ***/
|
/** The more tortuous unicode joliet entries **/
|
||||||
for (j = 0; j < (*filenamelength >> 1); j++)
|
for (j = 0; j < (*filenamelength >> 1); j++)
|
||||||
{
|
|
||||||
fname[j] = filename[j * 2 + 1];
|
fname[j] = filename[j * 2 + 1];
|
||||||
}
|
|
||||||
|
|
||||||
fname[j] = 0;
|
fname[j] = 0;
|
||||||
|
|
||||||
if (strlen (fname) >= MAXJOLIET) fname[MAXJOLIET - 1] = 0;
|
if (strlen (fname) >= MAXJOLIET)
|
||||||
if (strlen (fname) == 0) fname[0] = filename[0];
|
fname[MAXJOLIET - 1] = 0;
|
||||||
|
if (strlen (fname) == 0)
|
||||||
|
fname[0] = filename[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen (fname) == 0) strcpy (fname, ".");
|
if (strlen (fname) == 0)
|
||||||
|
strcpy (fname, ".");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (fname[0] == 1) strcpy (fname, "..");
|
if (fname[0] == 1)
|
||||||
|
strcpy (fname, "..");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -176,20 +187,20 @@ static int getentry(int entrycount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Rockridge Check **/
|
/* Rockridge Check */
|
||||||
rr = strstr (fname, ";");
|
rr = strstr (fname, ";");
|
||||||
if (rr != NULL) *rr = 0;
|
if (rr != NULL)
|
||||||
|
*rr = 0;
|
||||||
|
|
||||||
strcpy (filelist[entrycount].filename, fname);
|
strcpy (filelist[entrycount].filename, fname);
|
||||||
memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4);
|
memcpy (&offset32, &dvdbuffer[diroffset + EXTENT], 4);
|
||||||
filelist[entrycount].offset = (u64)offset32;
|
filelist[entrycount].offset = (u64)offset32;
|
||||||
memcpy (&filelist[entrycount].length, &dvdbuffer[diroffset + FILE_LENGTH], 4);
|
memcpy (&filelist[entrycount].length, &dvdbuffer[diroffset + FILE_LENGTH], 4);
|
||||||
memcpy (&filelist[entrycount].flags, &dvdbuffer[diroffset + FILE_FLAGS], 1);
|
memcpy (&filelist[entrycount].flags, &dvdbuffer[diroffset + FILE_FLAGS], 1);
|
||||||
|
|
||||||
filelist[entrycount].offset <<= 11;
|
filelist[entrycount].offset <<= 11;
|
||||||
filelist[entrycount].flags = filelist[entrycount].flags & 2;
|
filelist[entrycount].flags = filelist[entrycount].flags & 2;
|
||||||
|
|
||||||
/*** Prepare for next entry ***/
|
/* Prepare for next entry */
|
||||||
diroffset += dvdbuffer[diroffset];
|
diroffset += dvdbuffer[diroffset];
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -216,7 +227,8 @@ void DVD_ClearDirectory(void)
|
|||||||
int DVD_UpdateDirectory(bool go_up, u64 offset, u32 length)
|
int DVD_UpdateDirectory(bool go_up, u64 offset, u32 length)
|
||||||
{
|
{
|
||||||
/* root has no parent directory */
|
/* root has no parent directory */
|
||||||
if (go_up && (basedir == rootdir)) return 0;
|
if (go_up && (basedir == rootdir))
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* simply update current root directory */
|
/* simply update current root directory */
|
||||||
rootdir = offset;
|
rootdir = offset;
|
||||||
@ -252,7 +264,8 @@ int DVD_ParseDirectory(void)
|
|||||||
/*** Get as many files as possible ***/
|
/*** Get as many files as possible ***/
|
||||||
while (len < pdlength)
|
while (len < pdlength)
|
||||||
{
|
{
|
||||||
if (dvd_read (&dvdbuffer, DVDCHUNK, pdoffset) == 0) return 0;
|
if (dvd_read (&dvdbuffer, DVDCHUNK, pdoffset) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
diroffset = 0;
|
diroffset = 0;
|
||||||
|
|
||||||
@ -342,8 +355,9 @@ int DVD_Open(void)
|
|||||||
/* is DVD mounted ? */
|
/* is DVD mounted ? */
|
||||||
if (!getpvd())
|
if (!getpvd())
|
||||||
{
|
{
|
||||||
/* mount DVD */
|
/* remount DVD */
|
||||||
GUI_MsgBoxOpen("Information", "Mounting DVD ...",1);
|
GUI_MsgBoxOpen("Information", "Mounting DVD ...",1);
|
||||||
|
haveDVDdir = 0;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
u32 val;
|
u32 val;
|
||||||
@ -368,7 +382,6 @@ int DVD_Open(void)
|
|||||||
DVD_Mount();
|
DVD_Mount();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
haveDVDdir = 0;
|
|
||||||
if (!getpvd())
|
if (!getpvd())
|
||||||
{
|
{
|
||||||
GUI_WaitPrompt("Error","Disc can not be read !");
|
GUI_WaitPrompt("Error","Disc can not be read !");
|
||||||
@ -378,27 +391,32 @@ int DVD_Open(void)
|
|||||||
GUI_MsgBoxClose();
|
GUI_MsgBoxClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (haveDVDdir == 0)
|
if (!haveDVDdir)
|
||||||
{
|
{
|
||||||
/* reset root directory */
|
/* reset current directory */
|
||||||
rootdir = basedir;
|
rootdir = basedir;
|
||||||
|
|
||||||
/* parse root directory */
|
/* parse current directory */
|
||||||
int max = DVD_ParseDirectory ();
|
int max = DVD_ParseDirectory ();
|
||||||
|
|
||||||
if (max)
|
if (max)
|
||||||
{
|
{
|
||||||
/* set DVD as default */
|
/* set DVD access flag */
|
||||||
haveDVDdir = 1;
|
haveDVDdir = 1;
|
||||||
FAT_ClearDirectory();
|
|
||||||
|
|
||||||
/* reset File selector */
|
/* reset File selector */
|
||||||
ClearSelector(max);
|
ClearSelector(max);
|
||||||
|
|
||||||
|
/* clear FAT access flag */
|
||||||
|
FAT_ClearDirectory();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no entries found */
|
/* no entries found */
|
||||||
GUI_WaitPrompt("Error","No files found !");
|
GUI_WaitPrompt("Error","No files found !");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,24 +29,20 @@
|
|||||||
#include "file_fat.h"
|
#include "file_fat.h"
|
||||||
#include "file_dvd.h"
|
#include "file_dvd.h"
|
||||||
|
|
||||||
/* FAT directory has been updated */
|
|
||||||
static int haveFATdir = 0;
|
|
||||||
|
|
||||||
/* current FAT directory */
|
/* current FAT directory */
|
||||||
static char fatdir[MAXPATHLEN];
|
static char *fatdir;
|
||||||
|
|
||||||
/* current FAT device */
|
/* current FAT device */
|
||||||
static int fat_type = 0;
|
static int fatType = -1;
|
||||||
static int useHistory = 0;
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* FAT_ClearDirectory
|
* FAT_ClearDirectory
|
||||||
*
|
*
|
||||||
* Clear FAT directory flag
|
* Clear FAT access flag
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void FAT_ClearDirectory(void)
|
void FAT_ClearDirectory(void)
|
||||||
{
|
{
|
||||||
haveFATdir = 0;
|
fatType = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -54,14 +50,14 @@ void FAT_ClearDirectory(void)
|
|||||||
*
|
*
|
||||||
* Update FAT current root directory
|
* Update FAT current root directory
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int FAT_UpdateDirectory(bool go_up, char *filename)
|
int FAT_UpdateDirectory(bool go_up, char *dirname)
|
||||||
{
|
{
|
||||||
int size=0;
|
int size=0;
|
||||||
char *test;
|
char *test;
|
||||||
char temp[1024];
|
char temp[1024];
|
||||||
|
|
||||||
/* go up to parent directory */
|
/* go up to parent directory */
|
||||||
if (strcmp(filename,"..") == 0)
|
if (strcmp(dirname,"..") == 0)
|
||||||
{
|
{
|
||||||
/* determine last subdirectory namelength */
|
/* determine last subdirectory namelength */
|
||||||
sprintf(temp,"%s",fatdir);
|
sprintf(temp,"%s",fatdir);
|
||||||
@ -84,7 +80,7 @@ int FAT_UpdateDirectory(bool go_up, char *filename)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* by default, simply append folder name */
|
/* by default, simply append folder name */
|
||||||
sprintf(fatdir, "%s%s/",fatdir, filename);
|
sprintf(fatdir, "%s%s/",fatdir, dirname);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -137,55 +133,51 @@ int FAT_ParseDirectory(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int FAT_LoadFile(u8 *buffer, u32 selection)
|
int FAT_LoadFile(u8 *buffer, u32 selection)
|
||||||
{
|
{
|
||||||
/* If loading from history then we need to setup a few more things. */
|
char fname[MAXPATHLEN];
|
||||||
if(useHistory)
|
int length = 0;
|
||||||
|
|
||||||
|
/* Loading from history */
|
||||||
|
if(fatType == TYPE_RECENT)
|
||||||
{
|
{
|
||||||
/* Get the parent folder for the file. */
|
/* full filename */
|
||||||
strncpy(fatdir, history.entries[selection].filepath, MAXJOLIET-1);
|
sprintf(fname,"%s%s",history.entries[selection].filepath,filelist[selection].filename);
|
||||||
fatdir[MAXJOLIET-1] = '\0';
|
|
||||||
|
|
||||||
/* Get the length of the file. This has to be done
|
/* get the length of the file */
|
||||||
* before calling LoadFile(). */
|
|
||||||
char filepath[MAXJOLIET];
|
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
snprintf(filepath, MAXJOLIET-1, "%s%s", history.entries[selection].filepath, history.entries[selection].filename);
|
if(stat(fname, &filestat) == 0)
|
||||||
filepath[MAXJOLIET-1] = '\0';
|
length = filestat.st_size;
|
||||||
if(stat(filepath, &filestat) == 0)
|
|
||||||
{
|
|
||||||
filelist[selection].length = filestat.st_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update filelist */
|
|
||||||
haveFATdir = 0;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* full filename */
|
||||||
|
sprintf(fname, "%s%s",fatdir,filelist[selection].filename);
|
||||||
|
|
||||||
/* file size */
|
/* get the length of the file */
|
||||||
int length = filelist[selection].length;
|
length = filelist[selection].length;
|
||||||
|
}
|
||||||
|
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
{
|
{
|
||||||
/* Add/move the file to the top of the history. */
|
/* Open file */
|
||||||
history_add_file(fatdir, filelist[selection].filename);
|
|
||||||
|
|
||||||
/* full filename */
|
|
||||||
char fname[MAXPATHLEN];
|
|
||||||
sprintf(fname, "%s%s",fatdir,filelist[selection].filename);
|
|
||||||
|
|
||||||
/* open file */
|
|
||||||
FILE *sdfile = fopen(fname, "rb");
|
FILE *sdfile = fopen(fname, "rb");
|
||||||
if (sdfile == NULL)
|
if (sdfile == NULL)
|
||||||
{
|
{
|
||||||
GUI_WaitPrompt("Error","Unable to open file !");
|
GUI_WaitPrompt("Error","Unable to open file !");
|
||||||
haveFATdir = 0;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add/move the file to the top of the history. */
|
||||||
|
if(fatType == TYPE_RECENT)
|
||||||
|
history_add_file(history.entries[selection].filepath, filelist[selection].filename);
|
||||||
|
else
|
||||||
|
history_add_file(fatdir, filelist[selection].filename);
|
||||||
|
|
||||||
/* Read first data chunk */
|
/* Read first data chunk */
|
||||||
unsigned char temp[FATCHUNK];
|
unsigned char temp[FATCHUNK];
|
||||||
fread(temp, FATCHUNK, 1, sdfile);
|
fread(temp, FATCHUNK, 1, sdfile);
|
||||||
fclose(sdfile);
|
fclose(sdfile);
|
||||||
|
|
||||||
/* determine file type */
|
/* Determine file type */
|
||||||
if (!IsZipFile ((char *) temp))
|
if (!IsZipFile ((char *) temp))
|
||||||
{
|
{
|
||||||
/* re-open and read file */
|
/* re-open and read file */
|
||||||
@ -195,22 +187,23 @@ int FAT_LoadFile(u8 *buffer, u32 selection)
|
|||||||
char msg[50];
|
char msg[50];
|
||||||
sprintf(msg,"Loading %d bytes ...", length);
|
sprintf(msg,"Loading %d bytes ...", length);
|
||||||
GUI_MsgBoxOpen("Information",msg,1);
|
GUI_MsgBoxOpen("Information",msg,1);
|
||||||
int i = 0;
|
int done = 0;
|
||||||
while (length > FATCHUNK)
|
while (length > FATCHUNK)
|
||||||
{
|
{
|
||||||
fread(buffer+i, FATCHUNK, 1, sdfile);
|
fread(buffer + done, FATCHUNK, 1, sdfile);
|
||||||
length -= FATCHUNK;
|
length -= FATCHUNK;
|
||||||
i += FATCHUNK;
|
done += FATCHUNK;
|
||||||
}
|
}
|
||||||
fread(buffer+i, length, 1, sdfile);
|
fread(buffer + done, length, 1, sdfile);
|
||||||
|
done += length;
|
||||||
fclose(sdfile);
|
fclose(sdfile);
|
||||||
return filelist[selection].length;
|
return done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* unzip file */
|
/* unzip file */
|
||||||
return UnZipBuffer (buffer, 0, fname);
|
return UnZipBuffer(buffer, 0, fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,78 +218,73 @@ int FAT_LoadFile(u8 *buffer, u32 selection)
|
|||||||
int FAT_Open(int type)
|
int FAT_Open(int type)
|
||||||
{
|
{
|
||||||
int max = 0;
|
int max = 0;
|
||||||
char root[10] = "";
|
|
||||||
|
|
||||||
#ifdef HW_RVL
|
if (type == TYPE_RECENT)
|
||||||
/* FAT header */
|
|
||||||
if (type == TYPE_SD) sprintf (root, "sd:");
|
|
||||||
else if (type == TYPE_USB) sprintf (root, "usb:");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* if FAT device type changed, reload filelist */
|
|
||||||
if (fat_type != type)
|
|
||||||
{
|
{
|
||||||
fat_type = type;
|
/* fetch history list */
|
||||||
haveFATdir = 0;
|
int i;
|
||||||
}
|
for(i=0; i < NUM_HISTORY_ENTRIES; i++)
|
||||||
|
|
||||||
/* update filelist */
|
|
||||||
if (haveFATdir == 0)
|
|
||||||
{
|
|
||||||
useHistory = 0;
|
|
||||||
if (type == TYPE_RECENT)
|
|
||||||
{
|
{
|
||||||
/* fetch history list */
|
if(history.entries[i].filepath[0] > 0)
|
||||||
useHistory = 1;
|
|
||||||
int i;
|
|
||||||
for(i=0; i < NUM_HISTORY_ENTRIES; i++)
|
|
||||||
{
|
{
|
||||||
if(history.entries[i].filepath[0] > 0)
|
filelist[i].offset = 0;
|
||||||
{
|
filelist[i].length = 0;
|
||||||
filelist[i].offset = 0;
|
filelist[i].flags = 0;
|
||||||
filelist[i].length = 0;
|
strncpy(filelist[i].filename, history.entries[i].filename, MAXJOLIET-1);
|
||||||
filelist[i].flags = 0;
|
filelist[i].filename[MAXJOLIET-1] = '\0';
|
||||||
strncpy(filelist[i].filename, history.entries[i].filename, MAXJOLIET-1);
|
max++;
|
||||||
filelist[i].filename[MAXJOLIET-1] = '\0';
|
}
|
||||||
max++;
|
else
|
||||||
}
|
{
|
||||||
else
|
/* Found the end of the list. */
|
||||||
{
|
break;
|
||||||
/* Found the end of the list. */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* default directory */
|
||||||
|
fatdir = config.sddir;
|
||||||
|
#ifdef HW_RVL
|
||||||
|
if (type == TYPE_USB)
|
||||||
|
fatdir = config.usbdir;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* verify current dir exists, otherwise browse from root */
|
||||||
|
DIR_ITER *dir = diropen(fatdir);
|
||||||
|
if (dir)
|
||||||
|
dirclose(dir);
|
||||||
|
#ifdef HW_RVL
|
||||||
|
else if (type == TYPE_USB)
|
||||||
|
sprintf (fatdir, "usb:/");
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
sprintf (fatdir, "sd:/");
|
||||||
/* reset root directory */
|
|
||||||
sprintf (fatdir, "%s%s/roms/", root, DEFAULT_PATH);
|
|
||||||
|
|
||||||
/* if directory doesn't exist, use root as default */
|
/* parse current directory */
|
||||||
DIR_ITER *dir = diropen(fatdir);
|
max = FAT_ParseDirectory ();
|
||||||
if (dir == NULL) sprintf (fatdir, "%s/", root);
|
}
|
||||||
else dirclose(dir);
|
|
||||||
|
|
||||||
/* parse root directory */
|
if (max < 0)
|
||||||
max = FAT_ParseDirectory ();
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (max > 0)
|
if (max == 0)
|
||||||
{
|
{
|
||||||
/* FAT is default */
|
GUI_WaitPrompt("Error","No files found !");
|
||||||
haveFATdir = 1;
|
return 0;
|
||||||
DVD_ClearDirectory();
|
}
|
||||||
|
|
||||||
/* reset File selector */
|
/* check if access type has changed */
|
||||||
ClearSelector(max);
|
if (type != fatType)
|
||||||
return 1;
|
{
|
||||||
}
|
/* set current access type */
|
||||||
else
|
fatType = type;
|
||||||
{
|
|
||||||
/* no entries found */
|
/* reset File selector */
|
||||||
if (max == 0) GUI_WaitPrompt("Error","No files found !");
|
ClearSelector(max);
|
||||||
return 0;
|
|
||||||
}
|
/* clear DVD access flag */
|
||||||
|
DVD_ClearDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#define TYPE_RECENT 0
|
#define TYPE_RECENT 0
|
||||||
#define TYPE_SD 1
|
#define TYPE_SD 1
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#define TYPE_USB 2
|
#define TYPE_USB 2
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,9 +105,7 @@ void history_default(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < NUM_HISTORY_ENTRIES; i++)
|
for(i=0; i < NUM_HISTORY_ENTRIES; i++)
|
||||||
{
|
|
||||||
memset(&history.entries[i], 0, sizeof(t_history_entry));
|
memset(&history.entries[i], 0, sizeof(t_history_entry));
|
||||||
}
|
|
||||||
|
|
||||||
/* restore history */
|
/* restore history */
|
||||||
history_load();
|
history_load();
|
||||||
|
@ -115,7 +115,8 @@ int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
|
|||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
fatfile = fopen(filename, "rb");
|
fatfile = fopen(filename, "rb");
|
||||||
if (fatfile == NULL) return 0;
|
if (fatfile == NULL)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Read Zip Header ***/
|
/*** Read Zip Header ***/
|
||||||
@ -203,12 +204,15 @@ int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
|
|||||||
inflateEnd (&zs);
|
inflateEnd (&zs);
|
||||||
|
|
||||||
/* close file */
|
/* close file */
|
||||||
if (fatfile) fclose(fatfile);
|
if (fatfile)
|
||||||
|
fclose(fatfile);
|
||||||
|
|
||||||
if (res == Z_STREAM_END)
|
if (res == Z_STREAM_END)
|
||||||
{
|
{
|
||||||
if (FLIP32 (pkzip.uncompressedSize) == (u32) bufferoffset) return bufferoffset;
|
if (FLIP32 (pkzip.uncompressedSize) == (u32) bufferoffset)
|
||||||
else return FLIP32 (pkzip.uncompressedSize);
|
return bufferoffset;
|
||||||
|
else
|
||||||
|
return FLIP32 (pkzip.uncompressedSize);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -540,35 +540,28 @@ int FileSelector(unsigned char *buffer, bool useFAT)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* user confirmation */
|
/* Load ROM file from device */
|
||||||
if (GUI_ConfirmPrompt("Load selected File ?"))
|
if (useFAT)
|
||||||
|
size = FAT_LoadFile(buffer,selection);
|
||||||
|
else
|
||||||
|
size = DVD_LoadFile(buffer,selection);
|
||||||
|
|
||||||
|
/* Reload emulation */
|
||||||
|
if (size)
|
||||||
{
|
{
|
||||||
/* Load ROM file from device */
|
if (config.s_auto & 2)
|
||||||
if (useFAT)
|
slot_autosave(config.s_default,config.s_device);
|
||||||
size = FAT_LoadFile(buffer,selection);
|
reloadrom(size,filelist[selection].filename);
|
||||||
else
|
if (config.s_auto & 1)
|
||||||
size = DVD_LoadFile(buffer,selection);
|
slot_autoload(0,config.s_device);
|
||||||
|
if (config.s_auto & 2)
|
||||||
/* Reload emulation */
|
slot_autoload(config.s_default,config.s_device);
|
||||||
if (size)
|
|
||||||
{
|
|
||||||
if (config.s_auto & 2)
|
|
||||||
slot_autosave(config.s_default,config.s_device);
|
|
||||||
reloadrom(size,filelist[selection].filename);
|
|
||||||
if (config.s_auto & 1)
|
|
||||||
slot_autoload(0,config.s_device);
|
|
||||||
if (config.s_auto & 2)
|
|
||||||
slot_autoload(config.s_default,config.s_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Exit */
|
|
||||||
GUI_MsgBoxClose();
|
|
||||||
GUI_DeleteMenu(m);
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user canceled */
|
/* Exit */
|
||||||
GUI_MsgBoxClose();
|
GUI_MsgBoxClose();
|
||||||
|
GUI_DeleteMenu(m);
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2027,37 +2027,6 @@ void GUI_WaitPrompt(char *title, char *msg)
|
|||||||
GUI_MsgBoxClose();
|
GUI_MsgBoxClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUI_ConfirmPrompt(char *msg)
|
|
||||||
{
|
|
||||||
if (config.ask_confirm)
|
|
||||||
{
|
|
||||||
/* update message box */
|
|
||||||
GUI_MsgBoxOpen("User Confirmation", msg, 0);
|
|
||||||
|
|
||||||
/* allocate textures */
|
|
||||||
message_box.buttonA = gxTextureOpenPNG(Key_A_png,0);
|
|
||||||
message_box.buttonB = gxTextureOpenPNG(Key_B_png,0);
|
|
||||||
|
|
||||||
/* wait for button A or button B*/
|
|
||||||
s16 p = 0;
|
|
||||||
while (m_input.keys)
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
while (!(p & (PAD_BUTTON_A | PAD_BUTTON_B)))
|
|
||||||
{
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
p = m_input.keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return user choice */
|
|
||||||
if (p & PAD_BUTTON_A)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Basic Fading */
|
/* Basic Fading */
|
||||||
void GUI_FadeOut()
|
void GUI_FadeOut()
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,6 @@ extern void GUI_MsgBoxOpen(char *title, char *msg, bool throbber);
|
|||||||
extern void GUI_MsgBoxUpdate(char *title, char *msg);
|
extern void GUI_MsgBoxUpdate(char *title, char *msg);
|
||||||
extern void GUI_MsgBoxClose(void);
|
extern void GUI_MsgBoxClose(void);
|
||||||
extern void GUI_WaitPrompt(char *title, char *msg);
|
extern void GUI_WaitPrompt(char *title, char *msg);
|
||||||
extern int GUI_ConfirmPrompt(char *msg);
|
|
||||||
extern void GUI_FadeOut();
|
extern void GUI_FadeOut();
|
||||||
extern GXColor *GUI_GetBgColor(void);
|
extern GXColor *GUI_GetBgColor(void);
|
||||||
extern void GUI_SetBgColor(u8 color);
|
extern void GUI_SetBgColor(u8 color);
|
||||||
|
@ -284,14 +284,14 @@ static gui_item items_video[8] =
|
|||||||
/* Menu options */
|
/* Menu options */
|
||||||
static gui_item items_prefs[8] =
|
static gui_item items_prefs[8] =
|
||||||
{
|
{
|
||||||
{NULL,NULL,"Auto SRAM: OFF", "Enable/disable automatic SRAM", 52,132,276,48},
|
{NULL,NULL,"Load ROM Auto: OFF","Enable/Disable automatic ROM loading on startup", 52,132,276,48},
|
||||||
{NULL,NULL,"Auto STATE: OFF", "Enable/disable automatic Savestate", 52,132,276,48},
|
{NULL,NULL,"Auto Saves: OFF", "Enable/Disable automatic saves", 52,132,276,48},
|
||||||
{NULL,NULL,"SFX Volume: 100", "Adjust sound effects volume", 52,132,276,48},
|
{NULL,NULL,"Saves Device: FAT", "Configure default device for saves", 52,132,276,48},
|
||||||
{NULL,NULL,"BGM Volume: 100", "Adjust background music volume", 52,132,276,48},
|
{NULL,NULL,"SFX Volume: 100", "Adjust sound effects volume", 52,132,276,48},
|
||||||
{NULL,NULL,"BG Color: DEFAULT", "Change background color", 52,132,276,48},
|
{NULL,NULL,"BGM Volume: 100", "Adjust background music volume", 52,132,276,48},
|
||||||
{NULL,NULL,"BG Overlay: ON", "Enable/disable background overlay", 52,132,276,48},
|
{NULL,NULL,"BG Color: DEFAULT", "Select background color", 52,132,276,48},
|
||||||
{NULL,NULL,"Screen Width: 658", "Adjust Screen Width", 52,132,276,48},
|
{NULL,NULL,"BG Overlay: ON", "Enable/disable background overlay", 52,132,276,48},
|
||||||
{NULL,NULL,"Confirm Box: OFF", "Enable/disable user confirmation", 52,132,276,48}
|
{NULL,NULL,"Screen Width: 658", "Adjust menu screen width in pixels", 52,132,276,48},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Save Manager */
|
/* Save Manager */
|
||||||
@ -552,29 +552,29 @@ static void prefmenu ()
|
|||||||
gui_menu *m = &menu_prefs;
|
gui_menu *m = &menu_prefs;
|
||||||
gui_item *items = m->items;
|
gui_item *items = m->items;
|
||||||
|
|
||||||
|
sprintf (items[0].text, "Load ROM Auto: %s", config.autoload ? "ON":"OFF");
|
||||||
if (config.s_auto == 3)
|
if (config.s_auto == 3)
|
||||||
sprintf (items[0].text, "Auto Saves: ALL");
|
sprintf (items[1].text, "Auto Saves: ALL");
|
||||||
else if (config.s_auto == 2)
|
else if (config.s_auto == 2)
|
||||||
sprintf (items[0].text, "Auto Saves: STATE ONLY");
|
sprintf (items[1].text, "Auto Saves: STATE ONLY");
|
||||||
else if (config.s_auto == 1)
|
else if (config.s_auto == 1)
|
||||||
sprintf (items[0].text, "Auto Saves: SRAM ONLY");
|
sprintf (items[1].text, "Auto Saves: SRAM ONLY");
|
||||||
else
|
else
|
||||||
sprintf (items[0].text, "Auto Saves: NONE");
|
sprintf (items[1].text, "Auto Saves: NONE");
|
||||||
if (config.s_device == 1)
|
if (config.s_device == 1)
|
||||||
sprintf (items[1].text, "Saves Device: MCARD A");
|
sprintf (items[2].text, "Saves Device: MCARD A");
|
||||||
else if (config.s_device == 2)
|
else if (config.s_device == 2)
|
||||||
sprintf (items[1].text, "Saves Device: MCARD B");
|
sprintf (items[2].text, "Saves Device: MCARD B");
|
||||||
else
|
else
|
||||||
sprintf (items[1].text, "Saves Device: FAT");
|
sprintf (items[2].text, "Saves Device: FAT");
|
||||||
sprintf (items[2].text, "SFX Volume: %1.1f", config.sfx_volume);
|
sprintf (items[3].text, "SFX Volume: %1.1f", config.sfx_volume);
|
||||||
sprintf (items[3].text, "BGM Volume: %1.1f", config.bgm_volume);
|
sprintf (items[4].text, "BGM Volume: %1.1f", config.bgm_volume);
|
||||||
if (config.bg_color)
|
if (config.bg_color)
|
||||||
sprintf (items[4].text, "BG Color: TYPE %d", config.bg_color);
|
sprintf (items[5].text, "BG Color: TYPE %d", config.bg_color);
|
||||||
else
|
else
|
||||||
sprintf (items[4].text, "BG Color: DEFAULT");
|
sprintf (items[5].text, "BG Color: DEFAULT");
|
||||||
sprintf (items[5].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
sprintf (items[6].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
||||||
sprintf (items[6].text, "Screen Width: %d", config.screen_w);
|
sprintf (items[7].text, "Screen Width: %d", config.screen_w);
|
||||||
sprintf (items[7].text, "Confirmation Box: %s",config.ask_confirm ? "ON":"OFF");
|
|
||||||
|
|
||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
GUI_SlideMenuTitle(m,strlen("Menu "));
|
GUI_SlideMenuTitle(m,strlen("Menu "));
|
||||||
@ -585,45 +585,56 @@ static void prefmenu ()
|
|||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0: /*** Auto load/save ***/
|
case 0: /* Auto load last ROM file */
|
||||||
|
config.autoload ^= 1;
|
||||||
|
sprintf (items[ret].text, "Load ROM Auto: %s", config.autoload ? "ON":"OFF");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: /*** Auto load/save STATE & SRAM files ***/
|
||||||
config.s_auto = (config.s_auto + 1) % 4;
|
config.s_auto = (config.s_auto + 1) % 4;
|
||||||
if (config.s_auto == 3)
|
if (config.s_auto == 3)
|
||||||
sprintf (items[0].text, "Auto Saves: ALL");
|
sprintf (items[ret].text, "Auto Saves: ALL");
|
||||||
else if (config.s_auto == 2)
|
else if (config.s_auto == 2)
|
||||||
sprintf (items[0].text, "Auto Saves: STATE ONLY");
|
sprintf (items[ret].text, "Auto Saves: STATE ONLY");
|
||||||
else if (config.s_auto == 1)
|
else if (config.s_auto == 1)
|
||||||
sprintf (items[0].text, "Auto Saves: SRAM ONLY");
|
sprintf (items[ret].text, "Auto Saves: SRAM ONLY");
|
||||||
else
|
else
|
||||||
sprintf (items[0].text, "Auto Saves: NONE");
|
sprintf (items[ret].text, "Auto Saves: NONE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: /*** Default saves device ***/
|
case 2: /*** Default saves device ***/
|
||||||
config.s_device = (config.s_device + 1) % 3;
|
config.s_device = (config.s_device + 1) % 3;
|
||||||
if (config.s_device == 1)
|
if (config.s_device == 1)
|
||||||
sprintf (items[1].text, "Saves Device: MCARD A");
|
sprintf (items[ret].text, "Saves Device: MCARD A");
|
||||||
else if (config.s_device == 2)
|
else if (config.s_device == 2)
|
||||||
sprintf (items[1].text, "Saves Device: MCARD B");
|
sprintf (items[ret].text, "Saves Device: MCARD B");
|
||||||
else
|
else
|
||||||
sprintf (items[1].text, "Saves Device: FAT");
|
sprintf (items[ret].text, "Saves Device: FAT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /*** Sound effects volume ***/
|
case 3: /*** Sound effects volume ***/
|
||||||
GUI_OptionBox(m,0,"SFX Volume",(void *)&config.sfx_volume,10.0,0.0,100.0,0);
|
GUI_OptionBox(m,0,"SFX Volume",(void *)&config.sfx_volume,10.0,0.0,100.0,0);
|
||||||
sprintf (items[2].text, "SFX Volume: %1.1f", config.sfx_volume);
|
sprintf (items[ret].text, "SFX Volume: %1.1f", config.sfx_volume);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /*** Background music volume ***/
|
case 4: /*** Background music volume ***/
|
||||||
GUI_OptionBox(m,update_bgm,"BGM Volume",(void *)&config.bgm_volume,10.0,0.0,100.0,0);
|
GUI_OptionBox(m,update_bgm,"BGM Volume",(void *)&config.bgm_volume,10.0,0.0,100.0,0);
|
||||||
sprintf (items[3].text, "BGM Volume: %1.1f", config.bgm_volume);
|
sprintf (items[ret].text, "BGM Volume: %1.1f", config.bgm_volume);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: /*** Background color ***/
|
case 5: /*** Background color ***/
|
||||||
if (ret < 0) config.bg_color --;
|
if (ret < 0)
|
||||||
else config.bg_color ++;
|
config.bg_color --;
|
||||||
if (config.bg_color < 0) config.bg_color = BG_COLOR_MAX - 1;
|
else
|
||||||
else if (config.bg_color >= BG_COLOR_MAX) config.bg_color = 0;
|
config.bg_color ++;
|
||||||
if (config.bg_color) sprintf (items[4].text, "BG Color: TYPE %d", config.bg_color);
|
if (config.bg_color < 0)
|
||||||
else sprintf (items[4].text, "BG Color: DEFAULT");
|
config.bg_color = BG_COLOR_MAX - 1;
|
||||||
|
else if (config.bg_color >= BG_COLOR_MAX)
|
||||||
|
config.bg_color = 0;
|
||||||
|
if (config.bg_color)
|
||||||
|
sprintf (items[ret].text, "BG Color: TYPE %d", config.bg_color);
|
||||||
|
else
|
||||||
|
sprintf (items[ret].text, "BG Color: DEFAULT");
|
||||||
GUI_SetBgColor((u8)config.bg_color);
|
GUI_SetBgColor((u8)config.bg_color);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
if (config.bg_color == 0)
|
if (config.bg_color == 0)
|
||||||
@ -645,9 +656,8 @@ static void prefmenu ()
|
|||||||
GUI_InitMenu(m);
|
GUI_InitMenu(m);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: /*** Background items ***/
|
case 6: /*** Background items ***/
|
||||||
config.bg_overlay ^= 1;
|
config.bg_overlay ^= 1;
|
||||||
sprintf (items[5].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
|
||||||
if (config.bg_overlay)
|
if (config.bg_overlay)
|
||||||
{
|
{
|
||||||
bg_main[1].state |= IMAGE_VISIBLE;
|
bg_main[1].state |= IMAGE_VISIBLE;
|
||||||
@ -664,16 +674,12 @@ static void prefmenu ()
|
|||||||
bg_list[1].state &= ~IMAGE_VISIBLE;
|
bg_list[1].state &= ~IMAGE_VISIBLE;
|
||||||
bg_saves[2].state &= ~IMAGE_VISIBLE;
|
bg_saves[2].state &= ~IMAGE_VISIBLE;
|
||||||
}
|
}
|
||||||
|
sprintf (items[ret].text, "BG Overlay: %s", config.bg_overlay ? "ON":"OFF");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /*** Screen Width ***/
|
case 7: /*** Screen Width ***/
|
||||||
GUI_OptionBox(m,update_screen_w,"Screen Width",(void *)&config.screen_w,2,640,VI_MAX_WIDTH_NTSC,1);
|
GUI_OptionBox(m,update_screen_w,"Screen Width",(void *)&config.screen_w,2,640,VI_MAX_WIDTH_NTSC,1);
|
||||||
sprintf (items[6].text, "Screen Width: %d", config.screen_w);
|
sprintf (items[ret].text, "Screen Width: %d", config.screen_w);
|
||||||
break;
|
|
||||||
|
|
||||||
case 7: /*** User COnfirmation ***/
|
|
||||||
config.ask_confirm ^= 1;
|
|
||||||
sprintf (items[7].text, "Confirmation Box: %s",config.ask_confirm ? "ON":"OFF");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
@ -2229,7 +2235,6 @@ static void optionmenu(void)
|
|||||||
|
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
config_save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -2393,7 +2398,6 @@ static int savemenu(void)
|
|||||||
case 6: /* set default slot */
|
case 6: /* set default slot */
|
||||||
{
|
{
|
||||||
config.s_default = slot;
|
config.s_default = slot;
|
||||||
config_save();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2952,7 +2956,8 @@ void MainMenu (void)
|
|||||||
|
|
||||||
/*** ROM information screen (TODO !!!) ***/
|
/*** ROM information screen (TODO !!!) ***/
|
||||||
case 8:
|
case 8:
|
||||||
if (!cart.romsize) break;
|
if (!cart.romsize)
|
||||||
|
break;
|
||||||
GUI_DrawMenuFX(m,30,1);
|
GUI_DrawMenuFX(m,30,1);
|
||||||
GUI_DeleteMenu(m);
|
GUI_DeleteMenu(m);
|
||||||
showrominfo();
|
showrominfo();
|
||||||
|
@ -36,9 +36,6 @@
|
|||||||
/* lower is the value, faster is the key update */
|
/* lower is the value, faster is the key update */
|
||||||
#define HELD_SPEED 4
|
#define HELD_SPEED 4
|
||||||
|
|
||||||
/* Menu request flag */
|
|
||||||
u32 ConfigRequested = 0;
|
|
||||||
|
|
||||||
/* Configurable Genesis keys */
|
/* Configurable Genesis keys */
|
||||||
#define KEY_BUTTONA 0
|
#define KEY_BUTTONA 0
|
||||||
#define KEY_BUTTONB 1
|
#define KEY_BUTTONB 1
|
||||||
|
@ -49,6 +49,4 @@ extern void gx_input_Config(u8 num, u8 type, u8 max_keys);
|
|||||||
extern void gx_input_UpdateEmu(void);
|
extern void gx_input_UpdateEmu(void);
|
||||||
extern void gx_input_UpdateMenu(u32 cnt);
|
extern void gx_input_UpdateMenu(u32 cnt);
|
||||||
|
|
||||||
extern u32 ConfigRequested;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,10 +25,12 @@
|
|||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "history.h"
|
|
||||||
#include "aram.h"
|
#include "aram.h"
|
||||||
#include "dvd.h"
|
#include "dvd.h"
|
||||||
|
#include "history.h"
|
||||||
#include "file_slot.h"
|
#include "file_slot.h"
|
||||||
|
#include "file_fat.h"
|
||||||
|
#include "filesel.h"
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#include "usb2storage.h"
|
#include "usb2storage.h"
|
||||||
@ -42,6 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 Shutdown = 0;
|
u32 Shutdown = 0;
|
||||||
|
u32 ConfigRequested = 1;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -196,6 +199,7 @@ void reloadrom (int size, char *name)
|
|||||||
void shutdown(void)
|
void shutdown(void)
|
||||||
{
|
{
|
||||||
/* system shutdown */
|
/* system shutdown */
|
||||||
|
config_save();
|
||||||
if (config.s_auto & 2)
|
if (config.s_auto & 2)
|
||||||
slot_autosave(config.s_default,config.s_device);
|
slot_autosave(config.s_default,config.s_device);
|
||||||
system_shutdown();
|
system_shutdown();
|
||||||
@ -249,26 +253,30 @@ int main (int argc, char *argv[])
|
|||||||
/* initialize FAT devices */
|
/* initialize FAT devices */
|
||||||
if (fatInitDefault())
|
if (fatInitDefault())
|
||||||
{
|
{
|
||||||
DIR_ITER *dir = NULL;
|
|
||||||
|
|
||||||
/* base directory */
|
/* base directory */
|
||||||
char pathname[MAXPATHLEN];
|
char pathname[MAXPATHLEN];
|
||||||
sprintf (pathname, DEFAULT_PATH);
|
sprintf (pathname, DEFAULT_PATH);
|
||||||
dir = diropen(pathname);
|
DIR_ITER *dir = diropen(pathname);
|
||||||
if (dir == NULL) mkdir(pathname,S_IRWXU);
|
if (dir)
|
||||||
else dirclose(dir);
|
dirclose(dir);
|
||||||
|
else
|
||||||
|
mkdir(pathname,S_IRWXU);
|
||||||
|
|
||||||
/* default SRAM & Savestate files directory */
|
/* default SRAM & Savestate files directory */
|
||||||
sprintf (pathname, "%s/saves",DEFAULT_PATH);
|
sprintf (pathname, "%s/saves",DEFAULT_PATH);
|
||||||
dir = diropen(pathname);
|
dir = diropen(pathname);
|
||||||
if (dir == NULL) mkdir(pathname,S_IRWXU);
|
if (dir)
|
||||||
else dirclose(dir);
|
dirclose(dir);
|
||||||
|
else
|
||||||
|
mkdir(pathname,S_IRWXU);
|
||||||
|
|
||||||
/* default Snapshot files directory */
|
/* default Snapshot files directory */
|
||||||
sprintf (pathname, "%s/snaps",DEFAULT_PATH);
|
sprintf (pathname, "%s/snaps",DEFAULT_PATH);
|
||||||
dir = diropen(pathname);
|
dir = diropen(pathname);
|
||||||
if (dir == NULL) mkdir(pathname,S_IRWXU);
|
if (dir)
|
||||||
else dirclose(dir);
|
dirclose(dir);
|
||||||
|
else
|
||||||
|
mkdir(pathname,S_IRWXU);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize input engine */
|
/* initialize input engine */
|
||||||
@ -286,16 +294,35 @@ int main (int argc, char *argv[])
|
|||||||
/* run any injected rom */
|
/* run any injected rom */
|
||||||
if (cart.romsize)
|
if (cart.romsize)
|
||||||
{
|
{
|
||||||
ARAMFetch((char *)cart.rom, (void *)0x8000, cart.romsize);
|
int size = cart.romsize;
|
||||||
reloadrom (cart.romsize,"INJECT.bin");
|
cart.romsize = 0;
|
||||||
|
ARAMFetch((char *)cart.rom, (void *)0x8000, size);
|
||||||
|
reloadrom(size,"INJECT.bin");
|
||||||
|
ConfigRequested = 0;
|
||||||
gx_video_Start();
|
gx_video_Start();
|
||||||
gx_audio_Start();
|
gx_audio_Start();
|
||||||
frameticker = 1;
|
frameticker = 1;
|
||||||
}
|
}
|
||||||
else
|
else if (config.autoload)
|
||||||
{
|
{
|
||||||
/* Main Menu */
|
SILENT = 1;
|
||||||
ConfigRequested = 1;
|
if (FAT_Open(TYPE_RECENT))
|
||||||
|
{
|
||||||
|
int size = FAT_LoadFile(cart.rom,0);
|
||||||
|
if (size)
|
||||||
|
{
|
||||||
|
reloadrom(size,filelist[0].filename);
|
||||||
|
if (config.s_auto & 1)
|
||||||
|
slot_autoload(0,config.s_device);
|
||||||
|
if (config.s_auto & 2)
|
||||||
|
slot_autoload(config.s_default,config.s_device);
|
||||||
|
gx_video_Start();
|
||||||
|
gx_audio_Start();
|
||||||
|
frameticker = 1;
|
||||||
|
ConfigRequested = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SILENT = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize GUI engine */
|
/* initialize GUI engine */
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
#define SK_UPMEM "/genplus/sk2chip.bin"
|
#define SK_UPMEM "/genplus/sk2chip.bin"
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#define VERSION "version 1.4.0W"
|
#define VERSION "version 1.3.xW"
|
||||||
#else
|
#else
|
||||||
#define VERSION "version 1.4.0G"
|
#define VERSION "version 1.3.xG"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define osd_input_Update() gx_input_UpdateEmu()
|
#define osd_input_Update() gx_input_UpdateEmu()
|
||||||
@ -50,5 +50,6 @@ extern void reloadrom (int size, char *name);
|
|||||||
extern void shutdown();
|
extern void shutdown();
|
||||||
extern u32 frameticker;
|
extern u32 frameticker;
|
||||||
extern u32 Shutdown;
|
extern u32 Shutdown;
|
||||||
|
extern u32 ConfigRequested;
|
||||||
|
|
||||||
#endif /* _OSD_H_ */
|
#endif /* _OSD_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user