Input Lag Compensation to compensate for game's internal lag?

Fixed QuickNES and Snes9X cores for testing (Windows 64-bit)

4 Likes

Thatā€™s so fastā€¦

How comes snes9x isnā€™t showing pause/next frame like quicknes?
Pretty sure the lag reduction works while pushing ā€œKā€ tells otherwise.

(itā€™s spamming msu search in the log too)

Just tested both cores. QuickNES was tested with Mega Man 2 and SMB. Both worked without any glitches what so ever and pause + frame advance confirmed next frame response.

EDIT: Oh, and playing Mega Man 2 emulated at ~2 frames of total input lag is a pretty cool feeling. :sunglasses:

However, while Snes9x runs without glitches, it also responds the same as without the fix, i.e. SMW responds on the third frame instead of the second. The regular Snes9x build, but with your modified retroarch.exe responds on the second frame (but with audio glitches).

Just to make be sure: You did build Snes9x with LAG_FIX=1 defined, right? It is the default, but itā€™s worth checking.

Itā€™s not too early to start thinking about what term to call this. People are going to need to know how to refer to this feature when they start blogging and making youtube videos about it. Which will probably be very soon from what I can see.

Iā€™d like to suggest something with just a tiny amount of snazinnes.

My best idea so far is Libretro Unlag. Used like this ā€œGo to the Options, Activate Unlag, and set it to 3 frames.ā€ etc.

Other terminology thatā€™s been used includes:

  • Input Lag Compensation (or just Lag Compensation)
  • Lag Reduction
  • Latency Adjustment

Well, you get the picture. Just a thought from the peanut gallery. Exciting work, whatever you call it!

It was built using the MSVC 2010 project file, then I added in msu1.cpp, which was missing from the project.

I see no references to LAG_FIX anywhere in the code, so I donā€™t think defining LAG_FIX would do anything.

I also notice that Pausing with the P key blanks the screen until you hit the frame advance K button.

LAGFIX in the makefile.

Activates that here, and more bellow.

Sorry, itā€™s LAGFIX, as @Tatsuya79 correctly wrote.

Also, the changes I made now appear to be live on Core Updater, so you could try that build too.

I can confirm that the build of Snes9x on the Core Updater behaves correctly in terms of input lag, i.e. it responds on frame two in SMW. So, please use that for testing.

Spent some 20 minutes testing:

Super Mario World: Just some quick tests of the first couple of levels. No issues. Responds on frame number 2 (frame number 3 before fix).

Mega Man X: Played the intro stage and half of Armored Armadilloā€™s stage. No issues. Responds on frame number 2 (frame number 3 before fix).

Cool, looks like I should try adding a number to adjust the setting.

1 Like

I can also confirm no issues with Snes9X from the buildbot and the patched retroarch.exe. Music and video seem perfect. Pause + K method shows one less frame of lag.

Note this is on an Atom Windows 10 device, so itā€™s pretty astounding to have a full frame of lag shaved off. I was quite surprised to see it work this well, since this device can only achieve a frame_delay value of 5 with Snes9X before audio starts to crackleā€¦ :smiley:

@Brunnis Hope you find some time these days to do a camera test

A few friends emulate SNES via an HDMI projector which seems to add the equivalent of a couple of frames of lag. Iā€™m looking forward to finding out if an adjustable setting would make that feel as snappy as a CRT.

Iā€™m going through NES games right now to count the number of input lag frames you can see using Frame Advance. This is about the games themselves. I think it might be possible to build a database of games and their lag times, then use that to suggest default values for run-ahead.

Fun fact: Action 52 has 4 frames of internal lag.

Edit: This would be much better done as a Google Spreadsheetā€¦

2 Likes

I tried to load a (slang) shader with the d3d11 driver, but it does not work with your custom build. (Only for GL shaders work.)

In the drivers tab also the Wasapi audio driver is missing.

Would be nice if both could be enabled.

edit: more recent build later on

It should have the same support the buildbot build has.

QuickNES builds are live on the core updater too now.

Seems to work fine with mednafen PCE_fast/SGX (CD games too), Genesis+GX, Gambatte and of course snes9x and quickNES here.

Just got stuck on level 3 loading in Skate or Die with Gambatte. (happens randomly)
So probably some issues there.

1 Like

Gameboy games are always problematic since they can shut off the display, then no frames happen during that time. Then they can restart the display at any time, doesnā€™t have to be aligned to the usual framerate.

Maybe save state right before level 3, and see if the problem happens in vanilla RetroArch.

edit: This game lets you select levels, and the crash can happen even when dying in the level. Not seeing the glitch on Vanilla retroarch. I suspect it has to do with saving state with the display off.

Thatā€™s great! Iā€™ll provide some values as well. Just so that the terminology is clear: what you measure is how many additional frames a game takes to respond compared to next frame latency, right? The reason Iā€™m asking is that I tried Lolo and I got a response on frame number 2 (i.e. two frame advances), but your sheet says 1.

Maybe it would be better to rename the column to ā€œLag framesā€? Or just call it ā€œReponds on frameā€ and add one to the numbers youā€™ve already input?

On core compatibility, a few pretty important ones currently have problems with audio (video appears fine):

  • FCEUmm
  • Nestopia
  • Mesen
  • Snes9x2010

All of them have what appears to be the same kind of audio glitch. Will you be able to look into those as well, @Dwedit?

1 Like