mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2025-01-11 09:29:09 +01:00
wiiu: use buffer for reading files
improves loading times
This commit is contained in:
parent
b5bf3d60e9
commit
21b7895b61
@ -10,6 +10,12 @@
|
|||||||
|
|
||||||
const char *_psGetUserFilesFolder();
|
const char *_psGetUserFilesFolder();
|
||||||
|
|
||||||
|
// io is really slow on the Wii U
|
||||||
|
// so we're buffering files
|
||||||
|
#ifdef __WIIU__
|
||||||
|
#define BUFFER
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Windows FILE is BROKEN for GTA.
|
* Windows FILE is BROKEN for GTA.
|
||||||
*
|
*
|
||||||
@ -22,6 +28,9 @@ struct myFILE
|
|||||||
{
|
{
|
||||||
bool isText;
|
bool isText;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
#ifdef BUFFER
|
||||||
|
char* buf;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUMFILES 20
|
#define NUMFILES 20
|
||||||
@ -80,6 +89,10 @@ found:
|
|||||||
myfiles[fd].file = fcaseopen(filename, realmode);
|
myfiles[fd].file = fcaseopen(filename, realmode);
|
||||||
if(myfiles[fd].file == nil)
|
if(myfiles[fd].file == nil)
|
||||||
return 0;
|
return 0;
|
||||||
|
#ifdef BUFFER
|
||||||
|
myfiles[fd].buf = (char*) malloc(BUFSIZ);
|
||||||
|
setbuf(myfiles[fd].file, myfiles[fd].buf);
|
||||||
|
#endif
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +104,9 @@ myfclose(int fd)
|
|||||||
if(myfiles[fd].file){
|
if(myfiles[fd].file){
|
||||||
ret = fclose(myfiles[fd].file);
|
ret = fclose(myfiles[fd].file);
|
||||||
myfiles[fd].file = nil;
|
myfiles[fd].file = nil;
|
||||||
|
#ifdef BUFFER
|
||||||
|
free(myfiles[fd].buf);
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return EOF;
|
return EOF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user