Core Progress – Snes9x 2002 – Input lag reduced by 1-2 frames

Written by Brunis:

There’s probably a good number of people still using RetroArch’s snes9x2002 core for SNES emulation on low-performance devices (primarily Raspberry Pi 1 and Zero). There’s probably also going to be a resurgence now that the Retroflag GPI Case is coming. Because of this, I had a look at snes9x2002, testing both the performance (frame rate) and input lag. Turns out snes9x2002 had two issues with input lag:

In the LibRetro layer: The emulator would first run to generate a frame, then the input would be sampled, instead of the other way around. This means that the input fed to the emulator was always that which was sampled after rendering the previous frame. This added between 0 and 1 frame of input lag, depending on frame rendering time.

In the emulator itself: Each time the emulator was kicked off to render the next frame, it would start at the first scanline and run to the last. Due to how most SNES games work (polling input at the beginning of VBLANK, running game logic during VBLANK and scanning out the resulting lines from scanline 0 to 226/240), the optimal thing to do is to start the emulator at VBLANK, just before polling input, and then run it for a complete frame until the start of the next VBLANK. That means you capture input polling, game logic and resulting image within one and the same emulator loop. This issue added exactly 1 frame of input lag.

I fixed these issues (with Tatsuya79 on GitHub helping out with committing the LibRetro layer fix) and the result is a reduction of input lag by 1-2 frames (16.7 to 33.3 ms), without any increased computational demands. The updated core is available now, by updating from source or using the Online Updater in RetroArch.

It’s important to mention that these fixes bring snes9x2002 up to par with the other RetroArch snes9x cores in terms of input lag. Unless you have a really low-performance device, you’re still better off using snes9x2005 and upwards for the superior emulation.

Update on the Retro Freak situation

After getting into contact with Cyber Gadget and explaining to them the situation pertaining to the illegal usage of non-commercially licensed open source emulators, we are pleased to report the following –

“Dear Mr. Matteis,

Our sales of the Retro Freak are being suspended at the moment to
investigate the legitimacy of the open source software we use.
Our company has been trying to comply with any kind of law, however
our developer claims that the use of the software is not illegal, so, we are requesting them to prove and provide us the evidence.
If your claim is proven to be correct, we would be willing to take necessary
arrangements.”

We now know of the contractor that was responsible for this and had been selling this software to companies like Cyber Gadget ( basically sublicensing code out to other companies to which he holds zero rights, operating from Hong Kong), and we will be sure to contact the other companies as well that he had been sublicensing this to.

All we want is for open source creators to be safe in the knowledge their rights are being respected and that they are not being taken advantage of. The venerable Snes9x emulator has since its very inception been licensed as non-commercial (see the copyright header at the top of each file – https://github.com/snes9xgit/snes9x/blob/master/snes9x.cpp). It cannot be sold, period. There are multiple copyright holders (including myself, Daniel De Matteis) and it will be impossible to obtain the consent and approval of all copyright holders. Speaking strictly for myself, I will never give them permission on my behalf merely on principle, and the software in question that had been sold to the likes of Cyber Gadget and Hyperkin was using our libretro forked repo, Snes9x 2010 (https://github.com/libretro/snes9x2010) as per the contractor’s admittance. By contractors like this exploiting open source projects like this against their will and against their licenses, they cause massive damages to the continued goodwill of volunteers who band together to make awesome projects like this.

To learn more about this story, check our previous articles here –

Appeal to game journalists – about Retro-Bit and about the new ‘retro emulation industry’ in general

CyberGadget’s RetroFreak proven to use Snes9x Next/2010 code, non-commercial code being sold

Regards,
Daniel De Matteis

P.S. To our Japanese readers –

更新: 日本語に翻訳していた記事がここにあります –

http://famicoroti.blog81.fc2.com/blog-entry-2688.html.