Skip to content

Comments

n64: fix VI bug causing spinloop#2300

Merged
LukeUsher merged 1 commit intoares-emulator:masterfrom
rasky:fix_vi_spinloop
Nov 27, 2025
Merged

n64: fix VI bug causing spinloop#2300
LukeUsher merged 1 commit intoares-emulator:masterfrom
rasky:fix_vi_spinloop

Conversation

@rasky
Copy link
Collaborator

@rasky rasky commented Nov 27, 2025

VI_H_TOTAL is defined as the number of cycles per scanline minus 1. We forgot to add that 1 back. Besides the minor inaccuracy in timing, we could hit a race condition during initial VI config: if the Ares VI thread ran when the display was turned on (VI_CTRL configured) but VI_H_TOTAL wasn't already configured (and thus defaulted to 0), the thread would spinloop forever because it would step by 0 cycles.

While fixing this, I also noticed that I wasn't properly taking into account leap timings because of a typo; this means that PAL timings were very slightly off.

Fixes #2293

VI_H_TOTAL is defined as the number of cycles per scanline *minus 1*.
We forgot to add that 1 back. Besides the minor inaccuracy in timing,
we could hit a race condition during initial VI config: if the Ares
VI thread ran when the display was turned on (VI_CTRL configured) but
VI_H_TOTAL wasn't already configured (and thus defaulted to 0), the
thread would spinloop forever because it would step by 0 cycles.

While fixing this, I also noticed that I wasn't properly taking into
account leap timings because of a typo; this means that PAL timings
were very slightly off.

Fixes ares-emulator#2293
@LukeUsher LukeUsher merged commit 361fb49 into ares-emulator:master Nov 27, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[N64] Emulator hangs up with recompiler

2 participants