mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 04:24:16 +01:00
fix bug w/ reading files < 2048 bytes
This commit is contained in:
parent
59b7c2f6d3
commit
874525235d
@ -442,13 +442,12 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
fstat(file->_file, &fileinfo);
|
fstat(file->_file, &fileinfo);
|
||||||
size = fileinfo.st_size;
|
size = fileinfo.st_size;
|
||||||
|
|
||||||
memcpy (rbuffer, zipbuffer, 2048); // copy what we already read
|
memcpy (rbuffer, zipbuffer, readsize); // copy what we already read
|
||||||
|
|
||||||
ShowProgress ("Loading...", 2048, length);
|
u32 offset = readsize;
|
||||||
|
|
||||||
u32 offset = 2048;
|
|
||||||
while(offset < size)
|
while(offset < size)
|
||||||
{
|
{
|
||||||
|
ShowProgress ("Loading...", offset, size);
|
||||||
readsize = fread (rbuffer + offset, 1, (1024*512), file); // read in 512K chunks
|
readsize = fread (rbuffer + offset, 1, (1024*512), file); // read in 512K chunks
|
||||||
|
|
||||||
if(readsize <= 0 || readsize > (1024*512))
|
if(readsize <= 0 || readsize > (1024*512))
|
||||||
@ -456,7 +455,6 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
|
|
||||||
if(readsize > 0)
|
if(readsize > 0)
|
||||||
offset += readsize;
|
offset += readsize;
|
||||||
ShowProgress ("Loading...", offset, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(offset != size) // # bytes read doesn't match # expected
|
if(offset != size) // # bytes read doesn't match # expected
|
||||||
|
@ -810,6 +810,8 @@ ShowProgress (const char *msg, int done, int total)
|
|||||||
return;
|
return;
|
||||||
else if(done > total) // this shouldn't happen
|
else if(done > total) // this shouldn't happen
|
||||||
done = total;
|
done = total;
|
||||||
|
else if(total < (256*1024)) // don't bother showing progress for small files
|
||||||
|
return;
|
||||||
|
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
int i;
|
int i;
|
||||||
|
@ -277,9 +277,8 @@ void InitialiseVideo ()
|
|||||||
|
|
||||||
switch (vmode->viTVMode >> 2)
|
switch (vmode->viTVMode >> 2)
|
||||||
{
|
{
|
||||||
case VI_PAL: // 576 lines (PAL 50Hz)
|
case VI_PAL:
|
||||||
// force PAL60
|
// 576 lines (PAL 50hz)
|
||||||
//vmode = &TVEurgb60Hz480IntDf;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VI_NTSC:
|
case VI_NTSC:
|
||||||
|
Loading…
Reference in New Issue
Block a user