mirror of
https://github.com/dborth/vbagx.git
synced 2025-01-13 02:59:07 +01:00
enable readahead cache for faster file access
This commit is contained in:
parent
fcbefda1f5
commit
cb83ca6688
@ -60,18 +60,17 @@ bool ChangeFATInterface(int method, bool silent)
|
|||||||
{
|
{
|
||||||
devFound = true;
|
devFound = true;
|
||||||
fatSetDefaultInterface(PI_INTERNAL_SD);
|
fatSetDefaultInterface(PI_INTERNAL_SD);
|
||||||
|
fatEnableReadAhead (PI_INTERNAL_SD, 6, 64);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!devFound && FatIsMounted(PI_SDGECKO_A))
|
if (!devFound && FatIsMounted(PI_SDGECKO_A))
|
||||||
{
|
{
|
||||||
devFound = true;
|
devFound = true;
|
||||||
fatSetDefaultInterface(PI_SDGECKO_A);
|
|
||||||
}
|
}
|
||||||
if(!devFound && FatIsMounted(PI_SDGECKO_B))
|
if(!devFound && FatIsMounted(PI_SDGECKO_B))
|
||||||
{
|
{
|
||||||
devFound = true;
|
devFound = true;
|
||||||
fatSetDefaultInterface(PI_SDGECKO_B);
|
|
||||||
}
|
}
|
||||||
if(!devFound)
|
if(!devFound)
|
||||||
{
|
{
|
||||||
@ -86,6 +85,7 @@ bool ChangeFATInterface(int method, bool silent)
|
|||||||
{
|
{
|
||||||
devFound = true;
|
devFound = true;
|
||||||
fatSetDefaultInterface(PI_USBSTORAGE);
|
fatSetDefaultInterface(PI_USBSTORAGE);
|
||||||
|
fatEnableReadAhead (PI_USBSTORAGE, 6, 64);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -222,8 +222,7 @@ int
|
|||||||
LoadBufferFromFAT (char *filepath, bool silent)
|
LoadBufferFromFAT (char *filepath, bool silent)
|
||||||
{
|
{
|
||||||
FILE *handle;
|
FILE *handle;
|
||||||
int boffset = 0;
|
int size = 0;
|
||||||
int read = 0;
|
|
||||||
|
|
||||||
handle = fopen (filepath, "rb");
|
handle = fopen (filepath, "rb");
|
||||||
|
|
||||||
@ -238,15 +237,15 @@ LoadBufferFromFAT (char *filepath, bool silent)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** This is really nice, just load the file and decode it ***/
|
fseek(handle, 0, SEEK_END); // go to end of file
|
||||||
while ((read = fread (savebuffer + boffset, 1, 1024, handle)) > 0)
|
size = ftell(handle); // get filesize
|
||||||
{
|
fseek(handle, 0, SEEK_SET); // go to start of file
|
||||||
boffset += read;
|
fread (savebuffer, 1, size, handle);
|
||||||
}
|
fclose (handle);
|
||||||
|
|
||||||
fclose (handle);
|
fclose (handle);
|
||||||
|
|
||||||
return boffset;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -33,7 +33,7 @@ extern int offset;
|
|||||||
extern int selection;
|
extern int selection;
|
||||||
extern char currentdir[MAXPATHLEN];
|
extern char currentdir[MAXPATHLEN];
|
||||||
extern int maxfiles;
|
extern int maxfiles;
|
||||||
extern char romFilename[512];
|
extern char ROMFilename[512];
|
||||||
|
|
||||||
void AllocSaveBuffer();
|
void AllocSaveBuffer();
|
||||||
void FreeSaveBuffer();
|
void FreeSaveBuffer();
|
||||||
|
@ -74,7 +74,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize libFAT for SD and USB
|
// Initialize libFAT for SD and USB
|
||||||
fatInitDefault();
|
fatInit (8, false);
|
||||||
|
|
||||||
// Initialize DVD subsystem (GameCube only)
|
// Initialize DVD subsystem (GameCube only)
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user