mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 04:24:16 +01:00
prevent overrunning the file buffer (eg: loading a game cover image
that's too big). increase buffer size to load larger IPS/UPS files.
This commit is contained in:
parent
633bca15af
commit
85217f4c0d
@ -871,6 +871,18 @@ LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
|
|||||||
|
|
||||||
size_t LoadFile(char * filepath, bool silent)
|
size_t LoadFile(char * filepath, bool silent)
|
||||||
{
|
{
|
||||||
|
struct stat filestat;
|
||||||
|
|
||||||
|
if(stat(filepath, &filestat) != 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int size = filestat.st_size;
|
||||||
|
|
||||||
|
if(size >= SAVEBUFFERSIZE) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return LoadFile((char *)savebuffer, filepath, 0, silent);
|
return LoadFile((char *)savebuffer, filepath, 0, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define SAVEBUFFERSIZE (1024 * 512)
|
#define SAVEBUFFERSIZE (1024 * 1024 * 2) // leave room for IPS/UPS files and larger images
|
||||||
|
|
||||||
void InitDeviceThread();
|
void InitDeviceThread();
|
||||||
void ResumeDeviceThread();
|
void ResumeDeviceThread();
|
||||||
|
Loading…
Reference in New Issue
Block a user