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:
parent
9415a939e1
commit
173350b860
2 changed files with 6 additions and 2 deletions
|
@ -123,6 +123,9 @@ void Console::Run()
|
||||||
stats.DisplayStats(lastFrameTime);
|
stats.DisplayStats(lastFrameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_controlManager->UpdateInputState();
|
||||||
|
_internalRegisters->ProcessAutoJoypadRead();
|
||||||
|
|
||||||
previousFrameCount = _ppu->GetFrameCount();
|
previousFrameCount = _ppu->GetFrameCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +141,9 @@ void Console::RunSingleFrame()
|
||||||
uint32_t lastFrameNumber = _ppu->GetFrameCount();
|
uint32_t lastFrameNumber = _ppu->GetFrameCount();
|
||||||
_emulationThreadId = std::this_thread::get_id();
|
_emulationThreadId = std::this_thread::get_id();
|
||||||
|
|
||||||
|
_controlManager->UpdateInputState();
|
||||||
|
_internalRegisters->ProcessAutoJoypadRead();
|
||||||
|
|
||||||
while(_ppu->GetFrameCount() == lastFrameNumber) {
|
while(_ppu->GetFrameCount() == lastFrameNumber) {
|
||||||
_cpu->Exec();
|
_cpu->Exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,8 +399,6 @@ bool Ppu::ProcessEndOfScanline(uint16_t hClock)
|
||||||
|
|
||||||
_frameCount++;
|
_frameCount++;
|
||||||
_console->GetSpc()->ProcessEndFrame();
|
_console->GetSpc()->ProcessEndFrame();
|
||||||
_console->GetControlManager()->UpdateInputState();
|
|
||||||
_regs->ProcessAutoJoypadRead();
|
|
||||||
_regs->SetNmiFlag(true);
|
_regs->SetNmiFlag(true);
|
||||||
SendFrame();
|
SendFrame();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue