Baekalfen/PyBoy

Input always changes on same scanline

Open

#116 aperta il 22 mar 2020

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Python (461 fork)batch import
enhancementgood first issue

Metriche repository

Star
 (4223 star)
Metriche merge PR
 (Merge medio 25g 13h) (2 PR mergiate in 30 g)

Descrizione

A program can tell that it's running on PyBoy because the buttons always change right at vblank.

To reproduce:

  1. Install PyBoy
  2. Start the test ROM "Telling LYs?" (which I have precompiled for your convenience here)
  3. Press all 8 buttons in any order
  4. Watch the arrow sprite at the right side

Expect: Arrow moves after each press, followed by "Pass", as on a real GameBoy

Actual: Arrow stays at upper right of the screen, followed by an "Incorrect behavior" message that clearly isn't "Pass", as below:

tellinglys

The Game Boy emulator BGB by beware passes this test. Normally it changes the input on the first scanline of vertical blanking to reduce input latency. But if a program reads input multiple times during a frame, the emulator starts to randomize on which scanline the input changes. This way, the program can't discern that it's being emulated and freeze on a copy protection screen, but it adds one frame of lag. Once the program returns to polling once a frame, BGB returns to the low-latency behavior.

Related forum topic: https://forums.nesdev.com/viewtopic.php?f=20&t=18026

Guida contributor