improved automatic frame-skipping (fixes Virtua Racing on Gamecube)

This commit is contained in:
ekeeke31 2010-05-25 07:34:02 +00:00
parent e2366f81a9
commit 70ef2fc20b
2 changed files with 14 additions and 7 deletions

View File

@ -1288,6 +1288,7 @@ void gx_video_Stop(void)
VIDEO_Configure(vmode); VIDEO_Configure(vmode);
/* starts menu rendering */ /* starts menu rendering */
gxClearScreen((GXColor)BLACK);
gxDrawScreenshot(0xff); gxDrawScreenshot(0xff);
gxSetScreen(); gxSetScreen();
} }

View File

@ -334,6 +334,7 @@ int main (int argc, char *argv[])
#endif #endif
/* main emulation loop */ /* main emulation loop */
int skip = 0;
while (1) while (1)
{ {
/* Main Menu request */ /* Main Menu request */
@ -350,23 +351,20 @@ int main (int argc, char *argv[])
/* start video & audio */ /* start video & audio */
gx_audio_Start(); gx_audio_Start();
gx_video_Start(); gx_video_Start();
frameticker = 1; skip = 0;
} }
if (frameticker > 1) frameticker = 0;
if (skip)
{ {
/* skip frame */ /* skip frame */
system_frame(1); system_frame(1);
--frameticker; skip = 0;
} }
else else
{ {
while (frameticker < 1)
usleep(10);
/* render frame */ /* render frame */
system_frame(0); system_frame(0);
--frameticker;
/* update video */ /* update video */
gx_video_Update(); gx_video_Update();
@ -374,6 +372,14 @@ int main (int argc, char *argv[])
/* update audio */ /* update audio */
gx_audio_Update(); gx_audio_Update();
/* wait for next frame */
while (frameticker < 1)
usleep(1);
/* automatic frame skipping */
if (frameticker > 1)
skip = 1;
} }
return 0; return 0;