mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-25 18:51:50 +01:00
fix performance for progress bar
This commit is contained in:
parent
e222775a1a
commit
2f85a83ef9
@ -206,6 +206,8 @@ LoadFATFile (char * rbuffer, int length)
|
|||||||
fseek(fatfile, 2048, SEEK_SET); // seek back to point where we left off
|
fseek(fatfile, 2048, SEEK_SET); // seek back to point where we left off
|
||||||
memcpy (rbuffer, zipbuffer, 2048); // copy what we already read
|
memcpy (rbuffer, zipbuffer, 2048); // copy what we already read
|
||||||
|
|
||||||
|
ShowProgress ((char *)"Loading...", 2048, size);
|
||||||
|
|
||||||
u32 offset = 2048;
|
u32 offset = 2048;
|
||||||
while(offset < size)
|
while(offset < size)
|
||||||
{
|
{
|
||||||
|
@ -920,29 +920,34 @@ DrawLine (int x1, int y1, int x2, int y2, u8 r, u8 g, u8 b)
|
|||||||
*
|
*
|
||||||
* Show the user what's happening
|
* Show the user what's happening
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ShowProgress(char *msg, int done, int total)
|
void
|
||||||
|
ShowProgress (char *msg, int done, int total)
|
||||||
{
|
{
|
||||||
if(total <= 0) // division by 0 is bad!
|
if(total <= 0) // division by 0 is bad!
|
||||||
return;
|
return;
|
||||||
else if(done > total) // this shouldn't happen
|
else if(done > total) // this shouldn't happen
|
||||||
done = total;
|
done = total;
|
||||||
|
|
||||||
int ypos = (screenheight - 30) >> 1;
|
int xpos, ypos;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(done < 5000) // we just started!
|
||||||
|
{
|
||||||
|
ypos = (screenheight - 30) >> 1;
|
||||||
|
|
||||||
if (screenheight == 480)
|
if (screenheight == 480)
|
||||||
ypos += 52;
|
ypos += 52;
|
||||||
else
|
else
|
||||||
ypos += 32;
|
ypos += 32;
|
||||||
|
|
||||||
int xpos;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
clearscreen ();
|
clearscreen ();
|
||||||
|
setfontsize(20);
|
||||||
DrawText (-1, ypos, msg);
|
DrawText (-1, ypos, msg);
|
||||||
|
|
||||||
/*** Draw a white outline box ***/
|
/*** Draw a white outline box ***/
|
||||||
for (i = 380; i < 401; i++)
|
for (i = 380; i < 401; i++)
|
||||||
DrawLine (100, i, 540, i, 0xff, 0xff, 0xff);
|
DrawLine (100, i, 540, i, 0xff, 0xff, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
/*** Show progess ***/
|
/*** Show progess ***/
|
||||||
xpos = (int) (((float) done / (float) total) * 438);
|
xpos = (int) (((float) done / (float) total) * 438);
|
||||||
@ -950,8 +955,11 @@ void ShowProgress(char *msg, int done, int total)
|
|||||||
for (i = 381; i < 400; i++)
|
for (i = 381; i < 400; i++)
|
||||||
DrawLine (101, i, 101 + xpos, i, 0x00, 0x00, 0x80);
|
DrawLine (101, i, 101 + xpos, i, 0x00, 0x00, 0x80);
|
||||||
|
|
||||||
|
if(done < 5000) // we just started!
|
||||||
|
{
|
||||||
showscreen ();
|
showscreen ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* DrawPolygon
|
* DrawPolygon
|
||||||
|
Loading…
Reference in New Issue
Block a user