Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inverted logic fix #1566

Merged
merged 1 commit into from
Sep 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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