Skip to content

Commit

Permalink
Merge pull request #1566 from paulsapps/master
Browse files Browse the repository at this point in the history
inverted logic fix
  • Loading branch information
Paul authored Sep 10, 2022
2 parents 514f1c0 + 6b7eda1 commit ee1738a
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions Source/AliveLibAE/Psx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,19 +899,19 @@ EXPORT s32 CC PSX_VSync_4F6170(s32 mode)
}
else
{
// During recording or playback do not call SsSeqCalledTbyT_4FDC80 an undeterminate
// amount of times as this can leak to de-syncs.
if (GetGameAutoPlayer().IsRecording() || GetGameAutoPlayer().IsPlaying())
s32 frameTimeInMilliseconds = currentTime - sVSyncLastMillisecond_BD0F2C;
if (mode > 0 && frameTimeInMilliseconds < 1000 * mode / 60)
{
s32 frameTimeInMilliseconds = currentTime - sVSyncLastMillisecond_BD0F2C;
if (mode > 0 && frameTimeInMilliseconds < 1000 * mode / 60)
{
s32 timeSinceLastFrame = 0;
sVSync_Unused_578325 = 1;
s32 timeSinceLastFrame = 0;
sVSync_Unused_578325 = 1;

do
do
{
timeSinceLastFrame = SYS_GetTicks() - sVSyncLastMillisecond_BD0F2C;
// During recording or playback do not call SsSeqCalledTbyT_4FDC80 an undeterminate
// amount of times as this can leak to de-syncs.
if (!GetGameAutoPlayer().IsRecording() && !GetGameAutoPlayer().IsPlaying())
{
timeSinceLastFrame = SYS_GetTicks() - sVSyncLastMillisecond_BD0F2C;
SsSeqCalledTbyT_4FDC80();

// Prevent max CPU usage, will probably cause stuttering on weaker machines
Expand All @@ -920,18 +920,16 @@ EXPORT s32 CC PSX_VSync_4F6170(s32 mode)
SDL_Delay(1);
}
}
while (timeSinceLastFrame < 1000 * mode / 60);

frameTimeInMilliseconds = 1000 * mode / 60;
}
while (timeSinceLastFrame < 1000 * mode / 60);

frameTimeInMilliseconds = 1000 * mode / 60;
}

sVSyncLastMillisecond_BD0F2C += frameTimeInMilliseconds;
sLastFrameTimestampMilliseconds_BD0F24 = currentTime + frameTimeInMilliseconds;
sVSyncLastMillisecond_BD0F2C += frameTimeInMilliseconds;
sLastFrameTimestampMilliseconds_BD0F24 = currentTime + frameTimeInMilliseconds;

return 240 * frameTimeInMilliseconds / 60000;
}
return 0;
return 240 * frameTimeInMilliseconds / 60000;
}
}

Expand Down

0 comments on commit ee1738a

Please sign in to comment.