mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-24 02:01:48 +01:00
added DVD file autosorting, fixed automatic savestate/sram, fixed interlaced video mode switch, fixed audio buffers reset
This commit is contained in:
parent
871375cc36
commit
d21047daed
@ -275,6 +275,10 @@ int DVD_ParseDirectory ()
|
||||
len += 2048;
|
||||
pdoffset = rdoffset + len;
|
||||
}
|
||||
|
||||
/* Sort the file list */
|
||||
qsort(filelist, filecount, sizeof(FILEENTRIES), FileSortCallback);
|
||||
|
||||
return filecount;
|
||||
}
|
||||
|
||||
|
@ -94,33 +94,6 @@ int FAT_UpdateDir(int go_up)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* FileSortCallback (Marty Disibio)
|
||||
*
|
||||
* Quick sort callback to sort file entries with the following order:
|
||||
* .
|
||||
* ..
|
||||
* <dirs>
|
||||
* <files>
|
||||
***************************************************************************/
|
||||
static int FileSortCallback(const void *f1, const void *f2)
|
||||
{
|
||||
/* Special case for implicit directories */
|
||||
if(((FILEENTRIES *)f1)->filename[0] == '.' || ((FILEENTRIES *)f2)->filename[0] == '.')
|
||||
{
|
||||
if(strcmp(((FILEENTRIES *)f1)->filename, ".") == 0) { return -1; }
|
||||
if(strcmp(((FILEENTRIES *)f2)->filename, ".") == 0) { return 1; }
|
||||
if(strcmp(((FILEENTRIES *)f1)->filename, "..") == 0) { return -1; }
|
||||
if(strcmp(((FILEENTRIES *)f2)->filename, "..") == 0) { return 1; }
|
||||
}
|
||||
|
||||
/* If one is a file and one is a directory the directory is first. */
|
||||
if(((FILEENTRIES *)f1)->flags == 1 && ((FILEENTRIES *)f2)->flags == 0) return -1;
|
||||
if(((FILEENTRIES *)f1)->flags == 0 && ((FILEENTRIES *)f2)->flags == 1) return 1;
|
||||
|
||||
return stricmp(((FILEENTRIES *)f1)->filename, ((FILEENTRIES *)f2)->filename);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* FAT_ParseDirectory
|
||||
*
|
||||
|
@ -39,7 +39,6 @@ int haveDVDdir = 0;
|
||||
int haveFATdir = 0;
|
||||
|
||||
FILEENTRIES filelist[MAXFILES];
|
||||
char rom_filename[MAXJOLIET];
|
||||
|
||||
/***************************************************************************
|
||||
* ShowFiles
|
||||
@ -66,6 +65,33 @@ static void ShowFiles (int offset, int selection)
|
||||
SetScreen ();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* FileSortCallback (Marty Disibio)
|
||||
*
|
||||
* Quick sort callback to sort file entries with the following order:
|
||||
* .
|
||||
* ..
|
||||
* <dirs>
|
||||
* <files>
|
||||
***************************************************************************/
|
||||
int FileSortCallback(const void *f1, const void *f2)
|
||||
{
|
||||
/* Special case for implicit directories */
|
||||
if(((FILEENTRIES *)f1)->filename[0] == '.' || ((FILEENTRIES *)f2)->filename[0] == '.')
|
||||
{
|
||||
if(strcmp(((FILEENTRIES *)f1)->filename, ".") == 0) { return -1; }
|
||||
if(strcmp(((FILEENTRIES *)f2)->filename, ".") == 0) { return 1; }
|
||||
if(strcmp(((FILEENTRIES *)f1)->filename, "..") == 0) { return -1; }
|
||||
if(strcmp(((FILEENTRIES *)f2)->filename, "..") == 0) { return 1; }
|
||||
}
|
||||
|
||||
/* If one is a file and one is a directory the directory is first. */
|
||||
if(((FILEENTRIES *)f1)->flags == 1 && ((FILEENTRIES *)f2)->flags == 0) return -1;
|
||||
if(((FILEENTRIES *)f1)->flags == 0 && ((FILEENTRIES *)f2)->flags == 1) return 1;
|
||||
|
||||
return stricmp(((FILEENTRIES *)f1)->filename, ((FILEENTRIES *)f2)->filename);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* FileSelector
|
||||
*
|
||||
@ -203,16 +229,8 @@ int FileSelector(unsigned char *buffer)
|
||||
if (go_up) return 0;
|
||||
|
||||
/* Load file */
|
||||
if (useFAT) ret = FAT_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;
|
||||
if (useFAT) return FAT_LoadFile(buffer);
|
||||
else return DVD_LoadFile(buffer);
|
||||
}
|
||||
redraw = 1;
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ typedef struct
|
||||
|
||||
/* Global Variables */
|
||||
extern FILEENTRIES filelist[MAXFILES];
|
||||
extern char rom_filename[MAXJOLIET];
|
||||
extern int maxfiles;
|
||||
extern int offset;
|
||||
extern int selection;
|
||||
@ -56,5 +55,6 @@ extern int haveDVDdir;
|
||||
extern int haveFATdir;
|
||||
|
||||
extern int FileSelector(unsigned char *buffer);
|
||||
extern int FileSortCallback(const void *f1, const void *f2);
|
||||
|
||||
#endif
|
||||
|
@ -47,6 +47,7 @@ static card_stat CardStatus;
|
||||
* 64k SRAM + 2k Icon
|
||||
*/
|
||||
static u8 savebuffer[0x26000] ATTRIBUTE_ALIGN (32);
|
||||
char rom_filename[MAXJOLIET];
|
||||
|
||||
int ManageSRAM(u8 direction, u8 device);
|
||||
int ManageState(u8 direction, u8 device);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "font.h"
|
||||
#include "file_dvd.h"
|
||||
#include "file_fat.h"
|
||||
#include "filesel.h"
|
||||
|
||||
#ifdef HW_RVL
|
||||
#include <wiiuse/wpad.h>
|
||||
@ -889,6 +890,7 @@ int filemenu ()
|
||||
* Load Rom menu
|
||||
*
|
||||
****************************************************************************/
|
||||
extern char rom_filename[MAXJOLIET];
|
||||
static u8 load_menu = 0;
|
||||
static u8 dvd_on = 0;
|
||||
|
||||
@ -946,6 +948,9 @@ int loadmenu ()
|
||||
genromsize = size;
|
||||
memfile_autosave();
|
||||
reloadrom();
|
||||
sprintf(rom_filename,"%s",filelist[selection].filename);
|
||||
rom_filename[strlen(rom_filename) - 4] = 0;
|
||||
memfile_autoload();
|
||||
memfile_autoload();
|
||||
return 1;
|
||||
}
|
||||
@ -968,9 +973,12 @@ int loadmenu ()
|
||||
size = FAT_Open(ret,cart_rom);
|
||||
if (size)
|
||||
{
|
||||
genromsize = size;
|
||||
memfile_autosave();
|
||||
genromsize = size;
|
||||
reloadrom();
|
||||
sprintf(rom_filename,"%s",filelist[selection].filename);
|
||||
rom_filename[strlen(rom_filename) - 4] = 0;
|
||||
memfile_autoload();
|
||||
memfile_autoload();
|
||||
return 1;
|
||||
}
|
||||
|
@ -263,6 +263,7 @@ int main (int argc, char *argv[])
|
||||
ConfigRequested = 0;
|
||||
|
||||
/* reset frame timings */
|
||||
frameticker = 0;
|
||||
prev = gettime();
|
||||
FrameCount = 0;
|
||||
RenderedFrameCount = 0;
|
||||
|
@ -69,7 +69,6 @@ void ogc_audio__init(void)
|
||||
AUDIO_Init (NULL);
|
||||
AUDIO_SetDSPSampleRate (AI_SAMPLERATE_48KHZ);
|
||||
AUDIO_RegisterDMACallback (AudioSwitchBuffers);
|
||||
memset(soundbuffer, 0, 16 * 3840);
|
||||
}
|
||||
|
||||
void ogc_audio__reset(void)
|
||||
@ -78,6 +77,7 @@ void ogc_audio__reset(void)
|
||||
IsPlaying = 0;
|
||||
mixbuffer = 0;
|
||||
playbuffer = 0;
|
||||
memset(soundbuffer, 0, 16 * 3840);
|
||||
}
|
||||
|
||||
void ogc_audio__update(void)
|
||||
|
@ -537,8 +537,8 @@ void ogc_video__reset()
|
||||
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
else while (VIDEO_GetNextField()) VIDEO_WaitVSync();
|
||||
|
||||
/* reset frame counter */
|
||||
frameticker = 0;
|
||||
/* reset frame counter (unless it's interlaced mode change) */
|
||||
if (!interlaced) frameticker = 0;
|
||||
|
||||
/* Configure GX */
|
||||
GX_SetViewport (0.0F, 0.0F, rmode->fbWidth, rmode->efbHeight, 0.0F, 1.0F);
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
extern void ogc_video__init(void);
|
||||
extern void ogc_video__update(void);
|
||||
extern void ogc_video__reset(void);
|
||||
extern void ogc_video__reset();
|
||||
|
||||
extern BOOL gc_pal;
|
||||
extern unsigned int *xfb[2];
|
||||
|
Loading…
Reference in New Issue
Block a user