- [Psy-X] fix emscripten firefox slowdown

This commit is contained in:
Ilya Shurumov 2021-04-11 05:03:34 +06:00
parent 1e5cfd58e7
commit 55b9a7efbb
6 changed files with 13 additions and 8 deletions

View File

@ -301,6 +301,10 @@ void ShowBonusGallery()
ReadControllers();
VSync(-1);
#ifdef __EMSCRIPTEN__
emscripten_sleep(0);
#endif
if(Pads[0].dirnew & 0x8000)
{
currentImage--;

View File

@ -1676,8 +1676,9 @@ void DrawGame(void)
}
#ifdef __EMSCRIPTEN__
emscripten_sleep(0);
while ((VSync(-1) - frame) < 2)
emscripten_sleep(1);
emscripten_sleep(0);
#else
while ((VSync(-1) - frame) < 2);
#endif

View File

@ -841,7 +841,7 @@ void StopChannel(int channel)
if (SpuGetKeyStatus(channels[channel].attr.voice) == 0)
break;
#ifdef __EMSCRIPTEN__
emscripten_sleep(1);
emscripten_sleep(0);
#endif
} while (VSync(-1) - vsync < 8);

View File

@ -1026,6 +1026,10 @@ CDTYPE DiscSwapped(char* filename)
if(gImitateDiscSwap == 4)
g_cdNumFrames = 28;
#ifdef __EMSCRIPTEN__
emscripten_sleep(0);
#endif
if (VSync(-1) - gImitateDiscSwapFrames > g_cdNumFrames)
{
gImitateDiscSwap++;

View File

@ -27,11 +27,7 @@ extern int PsyX_Sys_GetVBlankCount();
int VSync(int mode)
{
if (mode < 0)
{
#ifdef __EMSCRIPTEN__
emscripten_sleep(1);
#endif
{
// don't wait but still return vblank count
return PsyX_Sys_GetVBlankCount();
}

View File

@ -866,7 +866,7 @@ void PsyX_WaitForTimestep(int count)
do
{
#ifdef __EMSCRIPTEN__
emscripten_sleep(1);
emscripten_sleep(0);
#endif
}while (g_psxSysCounters[PsxCounter_VBLANK] - swapLastVbl < count);