Skip to content

Commit

Permalink
Remove 1 frame of input lag
Browse files Browse the repository at this point in the history
  • Loading branch information
energy-t committed Nov 3, 2021
1 parent 0eab2fe commit 1a4d34b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/emu/machine.cpp
Expand Up @@ -1449,6 +1449,11 @@ void running_machine::retro_machineexit(){

void running_machine::retro_loop(){

// get most recent input now
m_manager.osd().input_update();
// perform tasks for this frame
call_notifiers(MACHINE_NOTIFY_FRAME);

while (RLOOP==1) {

// execute CPUs if not paused
Expand Down
4 changes: 4 additions & 0 deletions src/emu/video.cpp
Expand Up @@ -243,15 +243,19 @@ void video_manager::frame_update(bool from_debugger)
if (!from_debugger && !skipped_it && phase > machine_phase::INIT && m_low_latency && effective_throttle())
update_throttle(current_time);

#if !defined(__LIBRETRO__)
// get most recent input now
machine().osd().input_update();
#endif

emulator_info::periodic_check();

if (!from_debugger)
{
#if !defined(__LIBRETRO__)
// perform tasks for this frame
machine().call_notifiers(MACHINE_NOTIFY_FRAME);
#endif

// update frameskipping
if (phase > machine_phase::INIT)
Expand Down
4 changes: 2 additions & 2 deletions src/osd/libretro/video.cpp
Expand Up @@ -120,6 +120,8 @@ void retro_osd_interface::update(bool skip_redraw)
// if we're running, disable some parts of the debugger
if ((machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
debugger_update();

RLOOP=0;
}

//============================================================
Expand All @@ -131,8 +133,6 @@ void retro_osd_interface::input_update()
process_events_buf();
poll_inputs(machine());
check_osd_inputs(machine());

RLOOP=0;
}

//============================================================
Expand Down

0 comments on commit 1a4d34b

Please sign in to comment.