mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-25 02:31: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,37 +920,45 @@ 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;
|
||||||
|
|
||||||
if (screenheight == 480)
|
|
||||||
ypos += 52;
|
|
||||||
else
|
|
||||||
ypos += 32;
|
|
||||||
|
|
||||||
int xpos;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
clearscreen();
|
if(done < 5000) // we just started!
|
||||||
DrawText(-1, ypos, msg);
|
{
|
||||||
|
ypos = (screenheight - 30) >> 1;
|
||||||
|
|
||||||
/*** Draw a white outline box ***/
|
if (screenheight == 480)
|
||||||
for (i = 380; i < 401; i++)
|
ypos += 52;
|
||||||
DrawLine(100, i, 540, i, 0xff, 0xff, 0xff);
|
else
|
||||||
|
ypos += 32;
|
||||||
|
|
||||||
|
clearscreen ();
|
||||||
|
setfontsize(20);
|
||||||
|
DrawText (-1, ypos, msg);
|
||||||
|
|
||||||
|
/*** Draw a white outline box ***/
|
||||||
|
for (i = 380; i < 401; i++)
|
||||||
|
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);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
showscreen();
|
if(done < 5000) // we just started!
|
||||||
|
{
|
||||||
|
showscreen ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user