Skip to content

Fix FPS limit not applying while the window is minimized - #5492

Merged
FileEX merged 1 commit into
multitheftauto:masterfrom
QueryOfficial:fix/fps-limiter-minimized
Oct 7, 2026
Merged

FileEX merged 1 commit into
multitheftauto:masterfrom
QueryOfficial:fix/fps-limiter-minimized

Conversation

@QueryOfficial

Copy link
Copy Markdown
Contributor

Summary

End the frame for the FPS limiter in CCore::HandleIdlePulse while the window is minimized, so the wait in OnGameTimerUpdate keeps running.

Motivation

Fixes #5487

MTA patches out GTA's foreground check (0x748A8D), so the game keeps ticking while minimized. RenderWare's camera begin update fails on IsIconic though, so nothing gets rendered and Present is never called. Alt-tab minimizes the window in both fullscreen modes.

Since #5169 the limiter only ran from Present, and since #5417 OnGameTimerUpdate only waits after a Present ended the frame. Minimized, that never happens, so the game runs uncapped (300-400 FPS in the issue), which also breaks onClientRender FPS counters and speeds up game logic. Before #5169 the limiter ran from DoPulsePostFrame, which HandleIdlePulse already calls while minimized, so this puts that back.

Also dropped "minimized" from the OnFrameEnd comment, the game timer does tick there.

Test plan

  1. Join a server with setFPSLimit(60) or vsync on, run showframegraph.
  2. Alt-tab out in borderless or fullscreen so the window minimizes, wait a few seconds, come back.
  3. The frame graph should show the limiter wait (LimiterStart/LimiterEnd) during the minimized part as well, and an onClientRender FPS counter should stay at the cap.
  4. Check normal play, loading and connecting from the main menu still hold the cap.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

GTA keeps ticking while minimized but renders nothing, so Present never
ends the frame and the game timer update never waits. End the frame in
HandleIdlePulse instead, like the limiter did before multitheftauto#5169.
@ArranTuna

Copy link
Copy Markdown
Collaborator

Tested and works.

@FileEX FileEX added the bugfix Solution to a bug of any kind label Oct 7, 2026
@FileEX FileEX added this to the 1.7 (Current) milestone Oct 7, 2026
@FileEX
FileEX merged commit 710ed99 into multitheftauto:master Oct 7, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[1.7] Framerate not capped/Frames get skipped when tabbed out/window not focused

3 participants