mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2025-01-11 01:19:07 +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();
|
||||
|
||||
// io is really slow on the Wii U
|
||||
// so we're buffering files
|
||||
#ifdef __WIIU__
|
||||
#define BUFFER
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Windows FILE is BROKEN for GTA.
|
||||
*
|
||||
@ -22,6 +28,9 @@ struct myFILE
|
||||
{
|
||||
bool isText;
|
||||
FILE *file;
|
||||
#ifdef BUFFER
|
||||
char* buf;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NUMFILES 20
|
||||
@ -80,6 +89,10 @@ found:
|
||||
myfiles[fd].file = fcaseopen(filename, realmode);
|
||||
if(myfiles[fd].file == nil)
|
||||
return 0;
|
||||
#ifdef BUFFER
|
||||
myfiles[fd].buf = (char*) malloc(BUFSIZ);
|
||||
setbuf(myfiles[fd].file, myfiles[fd].buf);
|
||||
#endif
|
||||
return fd;
|
||||
}
|
||||
|
||||
@ -91,6 +104,9 @@ myfclose(int fd)
|
||||
if(myfiles[fd].file){
|
||||
ret = fclose(myfiles[fd].file);
|
||||
myfiles[fd].file = nil;
|
||||
#ifdef BUFFER
|
||||
free(myfiles[fd].buf);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
return EOF;
|
||||
|
Loading…
x
Reference in New Issue
Block a user