PCSX2 Libretro/RetroArch Core Progress Report – August 2021

We’re very excited to share with you all the work we’ve been putting into the PCSX2 core as of late.

Reducing file requirements

As a general baseline, Libretro strives to make sure that the cores we self-maintain are fairly portable. We’d like not to have the user to require to install several data files inside the System folder in order for an emulator core to work. The problem with the PCSX2 core up to this point was that it was too much of a straight port – PCSX2 by itself writes to dozens of files during startup and logging. However, it also has many config files scattered about the place.

We have cut all this config file reading/writing. Now, the only configuration file that gets written to is the ever-trusty ‘core options config file’ from Libretro/RetroArch.

Furthermore, the only files you need to have in your /pcsx2 folder are your BIOS files inside /pcsx2/bios. Anything else is not necessary. You can still have a ‘cheats’ and _cheats_ws’ folder where you store custom .pnach files for games, but it’s optional and not necessary. Memory cards will continue getting written to /pcsx2/memcards if you used this folder in previous versions of the core, otherwise they will be written in /retroarch/saves/pcsx2.

Other under the hood changes: all the internal GS shaders are now embedded as strings into the GS renderer instead of being loaded in as resource files. We have also spent a lot of time reducing WxWidgets UI dependencies, although we are not quite there yet all the way. The core should also be way smaller as a result. It used to be as big as 10MB but now clocks in as low as 7MB or less.

The core now also uses an internal game database (see here). This is converted at compilation time into a header file and baked into the core. This way, we once again do not require the user to have this game database file inside his/her system folder. Instead, the core comes with nearly everything that the user would need to get started.

Reduced dependencies on Linux

The core used to have many runtime library dependencies before and therefore be quite nonportable across Linux distributions. We have since severely lessened our dependencies on external system libs. Glib, X11 and Libpng have all been eliminated as are other things.

Built-in widescreen patches


The core now has an embedded widescreen patch database. We are going to try and keep this database updated as time goes along. Many thanks to the members of the PCSX2 Forums for posting all these wonderful patches.

Built-in no-interlacing patches


Many PS2 games render in interlaced resolutions. While this might have looked fine on a CRT TV, this can lead to bad image quality when running these games on a modern LCD or OLED display.

Many no-interlacing patches have been written for PS2 games running in PCSX2. These usually come in the form of .pnach patches. However, what we’re attempting to do here is apply these automagically. We want to give the user a seamless experience where they can just insert the game and we try to apply the right no-interlacing patch behind the scenes to make it look as users would expect without having to fiddle with deinterlacing settings.

With a no-interlacing patch, Tekken Tag Tournament on PS2 looks visually indistinguishable from the PS3 version that was released years later
With a no-interlacing patch, Tekken Tag Tournament on PS2 looks visually indistinguishable from the PS3 version that was released years later

So, what we have done is implement a ‘No-interlacing patch’ option to the ‘Deinterlacing’ setting. You don’t need to manually source together a bunch of .pnach patches – simply make sure you set ‘Deinterlacing’ to ‘No-interlacing patch’, and start up the game. If the internal database has an entry for the game, a popup message will show up saying that a no-interlacing patch has been applied. NOTE: The no-interlacing patch is only applied once at startup. If you change it mid-game, you will have to restart PCSX2 in order for these changes to take effect.

In some cases, a game might have a built-in option to remove interlacing. This is what was commonly known as the Progressive Scan option, and it was enabled in many games in the US by press and holding Square and Triangle at startup. For games like Soulcalibur 2/3 and Tekken 4/5, it will then ask you to boot to this progressive mode.

We hope that we can find patches to automate this procedure as well, so that the user doesn’t have to do this manually. In some cases like Tekken 4, people are returning empty handed, for the Gran Turismo games it’s been reported that with the proper patch, it can be changed into always loading in progressive mode.

NOTE: If it can’t find a non-interlacing patch inside the database for the game, it will have the same effect as if the setting were 0 – no deinterlacing will be applied.

Here is a list of all the games we currently have no-interlacing patches for.

IMPORTANT PERFORMANCE HINT: No-interlacing patches (when applied) can be significantly lighter on your GPU’s resources vs. deinterlacing. We can skip several rendering pipelines when we render a non-interlaced image vs. an interlaced one, because the odd and even lines need blending, which is done with separate shader passes.

Many thanks to the members of the PCSX2 Forums for posting all these wonderful patches. If you have new no-interlacing patches you’d love to add to the PCSX2 libretro core, please do not hesitate to contact us. We’d love your contributions.

Built-in 60fps patches


We have implemented an integrated 60fps patch database for a select number of games.

We do have some standards as to which patches we will include. If framerate unlocking results in the game running at double speed, we don’t include the patch. The game has to be able to run at least normally at proper speeds. There can be small inaccuracies like certain physics or animations not updating at a proper 60fps rate, but these we consider to be nonessential.

Please keep in mind that these 60fps patches will increase the system requirements severely in some cases. In some rare instances (like Silent Hill 2), the game might internally slow down at certain spots when experiencing heavy EE/GS load. In such cases, a generous Emotion Engine overclock could help alleviate this. Unfortunately, we have not yet hooked up Emotion Engine/CPU overclocking as a core option, but we intend to do so soon.

God Hand, Space Channel 5 Part 2, Silent Hill 2/3, Rule of Rose, Ico and GTA3 are some of the bigger games that now have embedded 60fps patches
God Hand, Space Channel 5 Part 2, Silent Hill 2/3, Rule of Rose, Ico and GTA3 are some of the bigger games that now have embedded 60fps patches

Here is a list of all the games we currently have 60fps patches for. For some games, you might need specific versions of the game (from specific regions). We are trying to test the codes per-game first to ensure they meet our minimum standards (see above).

We can tell you that playing some of the games in the list above at 60fps is a transformative experience. If you have the system specs for it, definitely consider replaying your PS2 games again at much smoother framerates.

Many thanks to the members of the PCSX2 Forums for posting all these wonderful patches. If you have new 60fps patches you’d love to add to the PCSX2 libretro core, please do not hesitate to contact us. We’d love your contributions.

A lot more settings have been hooked up

We have expanded the amount of core options considerably. Later on we also want to add support for the newly added core option categories that you can see in RetroArch v1.9.8 right now. This will significantly reduce the clutter onscreen when browsing the core options.

Plenty of backports/updates

Finally, there have been plenty of backports and updates.

Do note that our current core is:
1) more recent than the last PCSX2 stable (1.6.0)
2) is basically following standalone upstream master in terms of development but with severe tweaks for better libretro integration
3) is using the x64 JIT code. This is a new codepath that is less well tested than the 32bit codepath, but it’s the future regardless.

Tips and tricks

Here are some tips you might be able to appreciate:

If you experience heavy latency – You could experiment with the option ‘Emulation: Vsyncs in MTGS Queue’. Try lowering this to 1 or even 0. Depending on the amount of lag frames a game has, this could cut down on the latency severely, at the expense of some slight performance. 2 is the default but you might want to turn this down lower.

If a game has vertical lines across the screen – Try turning on a setting like ‘Merge Sprite’ or ‘Align Sprite’. Usually this takes care of the issue. This can be game specific. We intend to automate this for the problematic games in the near future, so you don’t have to.

If OpenGL performs too slowly and you’re on Windows – You could always try the Direct3D 11 renderer. While this renderer has less blending options than GL, it can sometimes be significantly faster than the GL renderer. So it’s definitely worth a try.

Regarding Xbox latest Dashboard issues

We have been notified that the latest dashboard updates on the Xbox systems have decreased compatibility of the PCSX2 libretro by a fairly significant amount. This comes as a bit of unfortunate timing with this blog post. We haven’t had the proper time yet to look into this issue, and we don’t know if it will even be fixable in the short term. Nevertheless, we will take a look regardless and move from there.

RetroArch 1.9.8 released!


RetroArch 1.9.8 has just been released.

Grab it here.

If you’d like to learn more about upcoming releases, please consult our roadmap here. The next version of Lakka (with an updated RetroArch 1.9.8 version) is scheduled to be released a week from today.

Remember that this project exists for the benefit of our users, and that we wouldn’t keep doing this were it not for spreading the love to our users. This project exists because of your support and belief in us to keep going doing great things. If you’d like to show your support, consider donating to us. Check here in order to learn more. In addition to being able to support us on Patreon, there is now also the option to sponsor us on Github Sponsors! You can also help us out by buying some of our merch on our Teespring store!

Highlights

New RetroFW port

We added support for OpenDingux before for JZ4770-based handhelds. After this, we added support for RetroMini RS-90 devices.

And now thanks to Poligraf, we have a working build for all the JZ4760-based handheld devices running RetroFW. RetroFW is a Dingoo based firmware runnin on the MIPS 4760 which is around 50% the speed compared to other devices running Opendingux.

Which devices does this cover?

  • RS-97
  • LDK
  • RG-300
  • Powkiddy Q80

A full listing can be found here.

  • 29 cores available at launch: Atari800, BlueMSX, Cap32, FCEUmm, fMSX, FreeCHAF, FreeIntv, FUSE, Gambatte, Genesis Plus GX, gpSP, GW, Handy, LRMAME2003, LRMAME2003 Plus, Mednafen PCE Fast, NXEngine, O2EM, Picodrive, Pokemini, Potator, Prboom, Prosystem, QuickNES, RACE, Retro8, SMS Plus, Stella 2014, Vecx

We have been told these cores all run well on the hardware.

All of these low powered handheld devices help us tremendously in optimizing our cores for the low end spectrum of hardware devices. gpSP, PCSX ReARMed and Picodrive are already starting to reap the benefits of it.

Core option categories

We are going to be making a persistent effort now to enhance RetroArch’s UX and lower the acessibility curve. To that end, we now have also implemented core option categories support.

Up to this point, every core option in a core (Quick Menu -> Options) has all been shown in a a flat alphabetical list. Users can quickly get confused if they have to scroll down a massive list of options.

So, 1.9.8 finally adds core option categories. Options assigned to a category will be displayed in a submenu of the main core options menu on supported frontends. For example – here we assign Gambatte’s mulitplayer options to a Game Boy Link category:

If you do not like this new behavior, there are always options to turn it off. Go to Settings > Core > Core Option Categories setting (enabled by default). When disabled, core option categories are ignored, and core options will effectively be displayed using the old v1 format.

Cores that already support core option categories

Core option categories have to be specifically added per core. Some of the cores that already support core option categories are as follows:

  • Final Burn Neo
  • Mupen64Plus Next
  • Beetle Saturn
  • Beetle PSX
  • Beetle PCE
  • Beetle PCE Fast
  • Genesis Plus GX
  • Snes9x 2010/2005/2002
  • DOSbox Pure
  • DOSbox Core
  • UAE (Amiga)
  • VICE (Commodore 64)
  • Have you ever noticed RetroArch starting a game in windowed mode and then blowing up the window to ridiculous sizes that exceeds the boundaries of your desktop? Well, we now have a solution for that!

    At present, when RetroArch is in windowed mode with Remember Window Position and size disabled, the window size will be equal to the core provided base_width/base_height multiplied by the Windowed Scale. This is potentially ‘catastrophic’: if a core has a very large base_width/base_height (e.g. PPSSPP with a x7 internal scale factor) and Windowed Scale is set to the default x3, then the window size can be enormous – potentially exceeding the capacity of the host GPU and causing RetroArch to crash.

    1.9.8 adds two new options:

    • Settings > Video > Windowed Mode > Maximum Window Width (default: 1920)
    • Settings > Video > Windowed Mode > Maximum Window Height (default: 1080)
      …which can be used to cap the maximum window size to a ‘sane’ value.

    The PR also cleans up the Settings > Video > Windowed Mode menu, auto-hiding options where required, and re-initing drivers when toggling Remember Window Position and size. Also, since the ‘remember’ part of Remember Window Position and size is only enabled for Windows, an alternate Use Custom Window Size is provided on other platforms.

    Auto-updating core option menu visibility updates without toggling Quick Menu

    Cores are able to show or hide their options via the RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY callback on supported fontends. A significant shortcoming here is that if a change to one core option (via the frontend) affects the visibility of another option, the frontend cannot update the menu state until the core has run for at least one frame. So with the core options menu open, visibility updates cannot happen in real-time – instead, the user must toggle the quick menu off then on before the menu will change. This is ugly and confusing.

    1.9.8 adds a new RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK environment callback which allows the core to register a function that enables the frontend to (a) force a core-side option visibility update and (b) allows the frontend to check whether option visibility has changed. This means all show/hide operations can now generate real-time menu updates.

    Windows

    Plenty of important fixes for Windows users.

    If you experienced lockups in the past when disconnecting an audio device while using the WASAPI audio driver, well, rejoice, this will no longer happen.

    Simultaneous shift sticky fixes were made to the DirectInput input driver. Dinput would not send WM_KEYUP for both Shifts if they were pressed together and released, resulting in sticky Shifts
    = Pinball games ruined in DOSBox.

    The following fix was made to the Windows RawInput driver – the Left Alt key could get stuck when Alt-Tabbing. No more. The keyboard can now also be mapped to analog input axes, meaning you can bind the left and right analog stick on the RetroPad to your keyboard keys.

    PlayStation2 version

    1.9.8 solves the flickering issues that appear in the cores that use the FRAME_SKIP as Snes9x2002 does.

    Also, 1.9.8 basically mounts HDD partition if RetroArch actually started from the HDD unit.
    In this way, we skip the mount partition if the user just wants to use USB.

    macOS/OSX version

    Plenty of important fixes for macOS users this time!

    There were several serious memory leaks with the Metal video driver. These have now been fixed.

    Serious bugs related to the input autodetection subsystem have finally been fixed. Now when you connect a gamepad, it will no longer try to attach the same pad to two controller ports simultaneously. This has been a longstanding bug that we’re glad has finally been consigned to the dustbin of history thanks to the help of a generous contributor who did quite some work to delve deep into this issue. We also made sure everything still works across a wide variety of macOS machines (from a PowerPC Mac running OSX 10.5 to an Intel and ARM Mac running more recent macOS versions).

    WiiU version

    Lots of improvements have been made once again to the WiiU port.

    All the libretro RPX cores are now compressed. Not only do they load faster (leading to faster startup times), but it means you have a lot more space left on your SD card.

    L3 and R3 buttons have been fixed on several gamepads, they were previously completely nonfunctional.

    Furthermore, promising work is underway for a PlayStation1 emulator core running on RetroArch WiiU. More on that later once more news is forthcoming.

    UWP/Xbox versions

    We have been fixing several bugs with the UWP port, many of these affecting in particular RetroArch users on Xbox One/Series.

    Microsoft recently released a new Dashboard update that caused some breakage for existing RetroArch installs.

    We have managed to fix the startup problem that occurred on the latest dashboard. We also fixed the onscreen keyboard display which was previously completely glitched out.

    Note that on the latest Dashboard, some compatibility problems still persist. For instance, it has been reported that several games on PCSX2 no longer work as of the recent update. This will require investigation and it is our guess if anything can be done about this, we will have to determine this after more investigation has occurred. For now, you might experience scaling issues with some of the ANGLE/GL powered cores like Mupen64Plus Next and Flycast because of the Dashboard update. We hope that we will be able to transition from ANGLE to something like GLon12 soon. What this would buy us is full desktop OpenGL support instead of just OpenGLES. This would mean a more complete superset of OpenGL (up to 3.3 from what we can hear), more cores that would work out of the box instead of custom cores made to work with ANGLE, etc. We will see if we succeed in this, but that’s something for a later version.

    In the meantime, we have also enabled Translation features. Note that we haven’t been able to implement the Text-to-Speech accessibility feature yet, but all other features should be there now for experimentation.

    We have also re-enabled the “Explore” tab on the Main Menu. We haven’t found any issues with this anymore after the recent bugfixes/improvements we made to the underlying database code, but let us know if there are any more issues on that front.

    Several cores that used the libretro VFS subsystem and/or CHD loading previously no longer worked. Examples include the Beetle cores. This has been fixed.

    Screen resolution settings improvements

    Currently the “Screen Resolution” list wrongly alters also video_refresh_rate to the rounded value, as in 59.940 Hz becomes 59.000.

    This change makes sure all the 59.94 multiples (59/119 etc) result in the proper float value instead of integer.

    Also, previously notifications when setting the refresh rate would repeat itself twice. This has been fixed.

    Changelog

    1.9.8

    • AUDIO/WINDOWS/WASAPI: Stop deactivating audio on fast forward
    • CHEEVOS: Hide challenge indicators when resetting
    • CHEEVOS: Support for more than 64 memory regions
    • CHEEVOS: Automatically retry ‘http error code -1’
    • CONTENT INFORMATION: Show content info label+path rows always
    • CORE OPTIONS: Core option categories implemented
    • CORE OPTIONS: Add option to disable core option categories
    • D3D10/11/12: Fix gfx_display_draw_texture – fixes OSK (On-Screen Keyboard) issues
    • DATABASE: Fix heap-buffer-overflow when fetching CRC values
    • DATABASE/EXPLORE: Fix CRC32 reading in explore menu
    • DATABASE/LIBRETRODB: Fix writing of numerical values
    • DATABASE/LIBRETRODB: Fix libretro-db loading on big endian platforms
    • DUMMY CORE: Skip state_manager_event_{deinit/init} when core type is dummy, should skip warning spam ‘Implementation uses threaded audio. Cannot use rewind..’ when using rewind
    • INPUT/UDEV: Limit udev device scan to subsystem ‘input’
    • INPUT/SDL2/WINDOWS: Fix keyboard event keycodes
    • INPUT/WAYLAND: Fixes a bug where the first player’s mouse, pointer, and lightgun are echoed to the other ports. Now, those other ports correctly report zero. In the future support for multiple mouselike devices will need to be added, which is a bigger project
    • INPUT/WAYLAND: The driver now respects keyboard_mapping_blocked
    • INPUT/WAYLAND: When possible, deprecated lightgun defines are replaced with the new ones. The coordinates are still using the old relative callbacks
    • INPUT/WINRAW: Trigger joypad driver reinit on DEVICECHANGE – avoids fullscreen toggle
    • INPUT/WINRAW: Alt sticky fix
    • INPUT/WINRAW: Prevent Alt getting stuck when Alt-Tabbing
    • INPUT/WINRAW: Add pointer status
    • INPUT/WINRAW: Add missing analog keybinds
    • LIBNX/SWITCH: Fix poll missing for controller 2-8
    • LIBNX/SWITCH: Fix layout not applied correctly and hangs when splitting joycons
    • LIBRETRO: Core options category API implemented
    • LIBRETRO: Fix RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE callback when runahead is enabled
    • LIBRETRO: Add environment callback for enabling core option menu visibility updates without toggling Quick Menu
    • LOGGING: Starting logging and verbose mode before first config load
    • LINUX: In some Linux Desktop Environments, like Budgie, task bar feature is unable to pin applications. With StartupWMClass= present in .desktop file, it is possible to pin the application
    • LOCALIZATION: Fetch translations from Crowdin
    • MENU: Relocate ‘Manage Playlists’ to top
    • MENU: Fullscreen resolution width/height settings no longer require ‘advanced settings’
    • MENU/REFRESH RATE: Fix double notifications with refresh rate settings
    • MENU/OZONE: Ensure the existence of values used in selection calculation
    • MENU/OZONE/VULKAN: Casting to unsigned caused an integer overflow and after float promotion would lead to ‘x’ being a garbage value, leading to problems when this value was passed to vkCmdSetViewport. This stops Vulkan validation layers from complaining about it
    • METAL: Fixed font driver memory leaks
    • MOUSE: Change default mouse index to port index
    • MOUSE: Friendly names for mice where available
    • OSX: Fix some memory leaks
    • OSX: Fix controller duplication bug
    • PS2: Implement alpha for the video driver
    • PS2: Aspect ratio handling
    • RETROFW: Initial port
    • UWP/XBOX: Enable Explore tab by default – seems to work fine
    • UWP/XBOX: Fix startup issues with latest Xbox Dashboard updates – ANGLE cores still show up wrong
    • UWP/XBOX: fix issue where files where opened as OPENALWAYS instead of OPENEXISTING this fixes beetle cores
    • UWP/XBOX: fix issue where filesizes where not returned properly, this fixes loading arcade dat files
    • UWP/TRANSLATION: Enabled translation services for both UWP MSVC2017 and 2019. No TTS speech yet.
    • VIDEO: Fix refresh rate 59Hz rounding
    • WINDOWS: Remember original refresh rate
    • WINDOWS/VULKAN: Refresh rate fixes + cleanups
    • WIIU: Fix L3/R3 buttons
    • WIIU: Compress RPX libretro cores
    • WIIU: Add ICInvalidateRange (necessary for JITs)
    • WIIU: Slight filesystem optimisation
    • WIIU: Add option for running without core info (emscripten-style)

    What’s next

    It has been often requested during our project’s history, but yes, we finally want to do something on the UI/UX front. We have been considering introducing an ‘Easy Mode’ that should aim at making things much less of a maze to navigate for non savvy users.

    Stay tuned for more info!