fix incorrect file loading

This commit is contained in:
dborth 2008-10-03 05:24:51 +00:00
parent 29e6ef31e5
commit 91cc202511
2 changed files with 9 additions and 9 deletions

View File

@ -139,6 +139,8 @@ int GCMemROM(int method, int size)
{
if(biosSize > 0)
WaitPrompt("FDS BIOS file is invalid!");
return 0; // BIOS not loaded, do not load game
}
free(tmpbuffer);
}

View File

@ -231,8 +231,7 @@ int
LoadBufferFromFAT (char * sbuffer, char *filepath, bool silent)
{
FILE *handle;
int boffset = 0;
int read = 0;
int size = 0;
handle = fopen (filepath, "rb");
@ -247,15 +246,14 @@ LoadBufferFromFAT (char * sbuffer, char *filepath, bool silent)
return 0;
}
/*** This is really nice, just load the file and decode it ***/
while ((read = fread (savebuffer + boffset, 1, 1024, handle)) > 0)
{
boffset += read;
}
// Just load the file up
fseek(handle, 0, SEEK_END); // go to end of file
size = ftell(handle); // get filesize
fseek(handle, 0, SEEK_SET); // go to start of file
fread (sbuffer, 1, size, handle);
fclose (handle);
return boffset;
return size;
}
/****************************************************************************