mirror of
https://github.com/dborth/fceugx.git
synced 2024-11-01 06:55:05 +01:00
fix incorrect file loading
This commit is contained in:
parent
29e6ef31e5
commit
91cc202511
@ -139,6 +139,8 @@ int GCMemROM(int method, int size)
|
|||||||
{
|
{
|
||||||
if(biosSize > 0)
|
if(biosSize > 0)
|
||||||
WaitPrompt("FDS BIOS file is invalid!");
|
WaitPrompt("FDS BIOS file is invalid!");
|
||||||
|
|
||||||
|
return 0; // BIOS not loaded, do not load game
|
||||||
}
|
}
|
||||||
free(tmpbuffer);
|
free(tmpbuffer);
|
||||||
}
|
}
|
||||||
|
@ -231,8 +231,7 @@ int
|
|||||||
LoadBufferFromFAT (char * sbuffer, char *filepath, bool silent)
|
LoadBufferFromFAT (char * sbuffer, 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");
|
||||||
|
|
||||||
@ -247,15 +246,14 @@ LoadBufferFromFAT (char * sbuffer, char *filepath, bool silent)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** This is really nice, just load the file and decode it ***/
|
// Just load the file up
|
||||||
while ((read = fread (savebuffer + boffset, 1, 1024, handle)) > 0)
|
fseek(handle, 0, SEEK_END); // go to end of file
|
||||||
{
|
size = ftell(handle); // get filesize
|
||||||
boffset += read;
|
fseek(handle, 0, SEEK_SET); // go to start of file
|
||||||
}
|
fread (sbuffer, 1, size, handle);
|
||||||
|
|
||||||
fclose (handle);
|
fclose (handle);
|
||||||
|
|
||||||
return boffset;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user