Revisiting My libretro Frontend

Ever since noticing that SDL2 on Wayland has macOS-style high-DPI support, I’ve amended some of my projects to make use of it. The first of which was my Mega Drive emulator, then my Doom sourceport, and now I have just gotten done doing so with my libretro frontend.

Yeah, that old thing… I haven’t worked on it since just after writing that cranky blog post back in December of 2020, which was almost exactly three years ago.

Like my other projects, enabling SDL2’s high-DPI support causes it to render incorrectly, as it uses device coordinates in some places that it should be using pixel coordinates. I blame SDL2 for exposing device coordinates at all, despite them working horribly with fractional scaling. Anyway, fixing this was easy: just use the renderer’s output size instead of the window size.

That fixed the bugged rendering, but the options menu didn’t scale at all, which caused it to appear small at high DPI settings, so I fixed that too by implementing proper DPI scaling.

Another improvement that I made was to introduce dynamic rate control to the audio system, as it suffered from the same skipping issue as my emulator. Any audio crackling that the frontend had before should be gone now. Honestly, that was probably one of my biggest complains about my libretro frontend, so it’s great to see it finally gone.

Finally, I backported the font system from my game engine. The font system was originally written for the Linux port of CSE2 (the Cave Story decompilation), before being extracted and integrated into my libretro frontend, and then later ported to my game engine. With each successive port, improvements to the font system were made, meaning that the version that was in my game engine had many improvements that the version in my libretro frontend lacked. In particular, the font system gained support for using the stb_truetype library in place of the FreeType library, which is considerably lighter and more permissively-licensed.

And that’s it for the notable changes! This has been just one day’s work, but it was nice to revisit such an old and neglected project, even if only briefly. It’s also neat to use such a no-frills emulation environment: no sprawling mess of configuration options, no heavy dependencies nor enormous codebase, and no save states, rewinding, nor cheats; just the game and the libretro core’s settings. It makes my Mega Drive emulator’s frontend look like complete overkill!

Looking at its Git history, it turns out that I originally only worked on this libretro frontend for nine days – starting on 20th December 2020 and ending on the 29th. Well, happy third birthday, clownlibretro.

clownlibretro’s source code can be found at https://github.com/Clownacy/clownlibretro

2 thoughts on “Revisiting My libretro Frontend

Leave a comment

Design a site like this with WordPress.com
Get started