Input: Reduced input lag by 1 frame by moving the polling to be after the emulation sleeps, rather than before.

This commit is contained in:
Sour 2019-07-07 19:55:08 -04:00
parent 9415a939e1
commit 173350b860
2 changed files with 6 additions and 2 deletions

View file

@ -123,6 +123,9 @@ void Console::Run()
stats.DisplayStats(lastFrameTime);
}
_controlManager->UpdateInputState();
_internalRegisters->ProcessAutoJoypadRead();
previousFrameCount = _ppu->GetFrameCount();
}
}
@ -138,6 +141,9 @@ void Console::RunSingleFrame()
uint32_t lastFrameNumber = _ppu->GetFrameCount();
_emulationThreadId = std::this_thread::get_id();
_controlManager->UpdateInputState();
_internalRegisters->ProcessAutoJoypadRead();
while(_ppu->GetFrameCount() == lastFrameNumber) {
_cpu->Exec();
}

View file

@ -399,8 +399,6 @@ bool Ppu::ProcessEndOfScanline(uint16_t hClock)
_frameCount++;
_console->GetSpc()->ProcessEndFrame();
_console->GetControlManager()->UpdateInputState();
_regs->ProcessAutoJoypadRead();
_regs->SetNmiFlag(true);
SendFrame();