TASEmulators / TASEmulators/BizHawk

[GBHawk + SubGBHawk] Lag Detection seems to be mostly broken

Open
#2,751 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Core: GBHawk help wanted
Dominant language
C#
Stars
2.8k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

This has been an issue for a while but seems like no one has bothered to file an issue with this yet so I'm just going to put it here:

GBHawk: Lag detection doesn't really seem to work, the only frames that are ever marked as lag seem to just be frames where the LCD is off and no input gets polled at that time. If the LCD is on, GBHawk appears to just mark the frames as non-lag unconditionally, even when no input polling is happening.

SubGBHawk: All the frames are lag if they are 70224 cycles long (maximum/default), and if they are shorter they get marked as non-lag frames.

EDIT: Peeking at the code, this code looks like this may be at fault for GBHawk's lag detection issue: https://github.com/TASEmulators/BizHawk/blob/84e195659c47fdf8b617777a1504efe5cffb169e/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs#L143-L147

Seems like the code just marks a frame as non-lag if a new vblank is present... which doesn't really make sense on its own? And there doesn't appear to be any code to set it back as a lag frame if the joypad port isn't open (which would be a simple fix + mirror gambatte's behavior).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs around lines 143-147, then trace the corresponding GBHawk and SubGBHawk lag-detection paths. Reproduce the reported LCD/input and frame-length cases, and verify that both cores classify lag consistently with their input-polling behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.