Merge pull request #708 from mikusp/inputlag

Fix input responsiveness
This commit is contained in:
Henrik Rydgård 2013-02-16 05:04:24 -08:00
commit 03c383d49c
4 changed files with 16 additions and 26 deletions

View file

@ -219,19 +219,6 @@ void EmuThread::run()
host->BootDone();
needInitGame = false;
}
UpdateInputState(input_state);
for (int i = 0; i < controllistCount; i++) {
if (input_state->pad_buttons_down & controllist[i].emu_id) {
__CtrlButtonDown(controllist[i].psp_id);
}
if (input_state->pad_buttons_up & controllist[i].emu_id) {
__CtrlButtonUp(controllist[i].psp_id);
}
}
__CtrlSetAnalog(input_state->pad_lstick_x, input_state->pad_lstick_y);
EndInputState(input_state);
glstate.Restore();
glViewport(0, 0, pixel_xres, pixel_yres);

View file

@ -48,7 +48,6 @@ void QtHost::SetWindowTitle(const char *message)
void QtHost::UpdateUI()
{
mainWindow->Update();
mainWindow->UpdateMenus();
}
@ -77,7 +76,9 @@ void QtHost::SetDebugMode(bool mode)
void QtHost::BeginFrame()
{
mainWindow->Update();
}
void QtHost::EndFrame()
{
}

View file

@ -697,22 +697,12 @@ void MainWindow::keyPressEvent(QKeyEvent *e)
return;
}
for (int b = 0; b < controllistCount; b++) {
if (e->key() == controllist[b].key)
{
input_state.pad_buttons |= (controllist[b].emu_id);
}
}
pressedKeys.insert(e->key());
}
void MainWindow::keyReleaseEvent(QKeyEvent *e)
{
for (int b = 0; b < controllistCount; b++) {
if (e->key() == controllist[b].key)
{
input_state.pad_buttons &= ~(controllist[b].emu_id);
}
}
pressedKeys.remove(e->key());
}
void MainWindow::on_MainWindow_destroyed()
@ -928,7 +918,17 @@ void MainWindow::ShowMemory(u32 addr)
void MainWindow::Update()
{
UpdateInputState(&input_state);
for (int i = 0; i < controllistCount; i++)
{
if (pressedKeys.contains(controllist[i].key) ||
input_state.pad_buttons_down & controllist[i].emu_id)
__CtrlButtonDown(controllist[i].psp_id);
else
__CtrlButtonUp(controllist[i].psp_id);
}
__CtrlSetAnalog(input_state.pad_lstick_x, input_state.pad_lstick_y);
}
void MainWindow::on_action_EmulationReset_triggered()

View file

@ -192,6 +192,8 @@ private:
Debugger_Memory *memoryWindow;
Controls* controls;
GamePadDialog* gamePadDlg;
QSet<int> pressedKeys;
};
#endif // MAINWINDOW_H