Skip to content

Debounce the PLEASE WAIT overlay like the original - #17

Merged
colemancda merged 1 commit into
mainfrom
fix/wait-overlay-debounce
Jul 18, 2026
Merged

colemancda merged 1 commit into
mainfrom
fix/wait-overlay-debounce

Conversation

@colemancda

Copy link
Copy Markdown
Owner

Summary

The original client draws the waitmessage.img PLEASE WAIT overlay only once its wait counter passes 40 game ticks (~0.67 s at the 60 Hz tick): the counter (DAT_0056d118) is set to 0 when a request fires, incremented each GameTick, reset to -1 by the reply handler, and the draw gate is the signed cmp eax, 0x28 at 0x41363f. The debounce exists so a fast server reply never flashes the spinner. (Surfaced by the latest static-analysis work, which fixed a signed/unsigned bug in that very gate.)

Our port drew the overlay for the entire request, so every LAN-fast connect briefly flashed it. ServerSelectViewModel now tracks how long the current loading/connect has been in flight (re-armed on each transition into a busy state, mirroring the counter reset on request-fire) and exposes showsWaitOverlay only past the 40-tick debounce; ServerSelectScreen draws on that instead of the raw busy state.

Tests

waitOverlayIsDebounced: hidden inside the debounce window, shown past it, cleared immediately when the reply arrives, and re-armed from zero by the next request (connect after a row selection).

Test plan

  • swift test — 567 tests passing
  • CI green on this PR

The original draws the waitmessage.img overlay only once its wait
counter (DAT_0056d118: 0 when a request fires, +1 per GameTick, -1
idle) passes 40 ticks — the signed cmp eax,0x28 gate at 0x41363f — so
a fast server reply never flashes the spinner. Our port showed the
overlay for the entire request, flashing it on every LAN-fast connect.

ServerSelectViewModel now tracks how long the current loading/connect
has been in flight, re-arms on each transition into a busy state, and
exposes showsWaitOverlay only after the ~0.67 s (40 ticks at 60 Hz)
debounce; the screen draws on that instead of the raw busy state.
@colemancda
colemancda merged commit ef3a3cd into main Jul 18, 2026
5 checks passed
@colemancda
colemancda deleted the fix/wait-overlay-debounce branch July 18, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant