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.

Libretro Core Updates/Progress Report – April/May 2021

PCSX2

* Added widescreen, speedhacks options and some userhacks, some code refactoring and cleanup
* Added core option to force widescreen
* Refactoring of core options based on libretro standard
Added option to set pcsx2 Accurancy/Speed presets
* Added bios list at runtime to libretro options
* Fixed speedhacks presets option
Added fallback to default safe preset if speedhack option is disabled
Code cleanup
* Added userhack options: Align Sprite and Merge Sprite
* Fixed a problem which prevented to select the correct HW renderer
Fixed null renderer problem that, if selected, freezed the frontend
* Fixed the rumble issue where it doesn’t stop when triggered
* Add CHD support
* Added option to disable gamepad rumble
* Added option to set rumble intensity
* Replace “Force Widescreen” option with “Aspect Ratio” option
* Add ‘Enable Widescreen Patches’ option
* Added option to set System Language per game
* Added support for scph39001 bios
* Added function for sending message notifications to frontend
* Added notification to frontent about widescreen patches found or not found for the loaded content
* Improved reliability of BIOS detection for language injection
* Added language support for all EU and NA BIOS
* Fixed a memory access violation during init
* CDVD: Adjust read speed depending on if in inner/outer edge. This fixes a number of CDVD timing issues, e.g. the missing sound in Klonoa 2.
* GameDB: Remove SkipmMPEG patch for Arctic Thunder. Removes a GameDB hack for Arctic Thunder as it’s no longer needed thanks to the above CDVD improvement.
* IPU: Return contents of the bottom of the FIFO in CMD except FDEC/VDEC. Fixes the FMVs in Shox.

Update policy for this core
This core is maintained by libretro.

SwanStation core

SwanStation is a PlayStation1 emulator core.

Some things that were added recently to this include software rendering upscaling support.

FCEUmm

FCEUmm is a Nintendo Entertainment System / Famicom emulator core.

Some update notes (from NewRisingSun):

A number of submappers have been assigned to mapper 176 (https://wiki.nesdev.com/w/index.php/INES_Mapper_176) based on real-hardware tests. This update rewrites the mapper 176 emulation accordingly and adds all affected ROM images knownst to me to the ines-correct.h database. I made sure that I have every mapper 176 ROM file that previously was in ines-correct.h.

UNIF files remain a problem, since the UNIF file loader does not use that database, and the four UNIF MAPRs (BMC-FK23C, BMC-FK23CA, BMC-Super24in1SC03, WAIXING-FS005) do not neatly correspond to the actual hardware variants. For example, several BMC-FK23C(A) are actually FS005. The heuristic that I used works for all UNIF files that I had in my possession.

Another issue is the DIP switch. Some carts act quite erratically when the address mask changes on every soft reset, and the old code to decide that did not work well for .NES files. (And “BMC-FK23CA”, previously described as explicitly denoting a DIP switch, is used for a few carts that do not like DIP switch changes between resets at all.) I introduced a new heuristic that worked for all files in the database. The problem remains that the code does not know up to which value the address mask should shift, so that “76 in 1 CHEER – TECH” acts strangely from the fourth to the eighth reset. I see no way of solving this short of creating a database of valid DIP switch positions for every known file hash. (I have done such a thing for NintendulatorNRS.)

Finally, a small number (I counted two) homebrew multicarts from nesbbs no longer work with the newer, more hardware-accurate emulation. “Homebrew multicarts” here refers existing multicart ROMs modified to replace one or two games, and make make changes to the menu code to work better in some other emulators.

* A Pixel Perfect (PAR 1:1, DAR 16:15) option was added.

* Should now handle paths with special characters when using Windows.

FreeIntv

FreeIntv is an Mattel Intellivision emulator core.

Several major improvements have been made to this core recently thanks to nanochess.

* Corrected bug in Overflow flag for SUB/CMP.
* Corrected scrolling visuals for several games (adding timing count for STIC).
* Corrected several instruction timings and interruption timing.
* Now the following games look and/or scroll correctly:
– Cloudy Mountain
– Tower of Doom
– Mountain Madness Skiing
– Super Pro Decathlon
– Stadium Mud Buggies
– Hover Force
* Solved bug in border color. Implemented STIC screen disable.
* Shows explanation if GROM and EXEC are missing.
* HALT and undefined instructions shows a message instead of exiting.
* Corrected position of messages for cartridge load.
* Solved bug in STIC border collision and optimized it

Update policy for this core
This core is maintained by libretro.

prboom

prboom is a Doom 1/2 game engine core.

* PS2 support has been added.

Update policy for this core
This core is maintained by libretro.

FUSE

FUSE is a ZX Spectrum Emulator core.

* Fix ‘Some +3 .dsk don’t load if they use more than 40 tracks’ issue – fixes Sword of Ianna.
* Do not autoload tapes on Scorpion – fix for the issue of autoloading tapes freezing the Scorpion 256 machine type.

It basically disables autoload when loading a tape image (TAP or TZX) with a Scorpion machine. The tape has to be loaded manually by entering the BASIC interpreter and typing load “”

Update policy for this core
This core is maintained by libretro.

Beetle PSX

Beetle PSX is a PlayStation1 emulator core.

* Dynarec updates

Update policy for this core
This core is maintained by libretro.

O2EM

O2EM is a Magnavox Odyssey 2 emulator core.

Standalone O2EM can emulate The Voice expansion module using wav sound samples that the user must place in a specific folder, similarly to what happens with the bios. The libretro port, however, didn’t include The Voice support, as the corresponding code was simply disabled.

The Voice emulation has now been ported to work in a libretro context, using libretro-common’s own audio mixer to load and play the sound samples, which should be placed in a voice folder under the usual System folder.

NOTE: This feature has not been enabled for every platform, but most non-memory constrained platforms should incorporate it now.

External RAM is now exposed through RETRO_MEMORY_SYSTEM_RAM, right after the internal RAM. This memory map is virtual, as the console itself accesses the two RAMs using specific instructions instead of mapping them to a single address space.

Update policy for this core
This core is maintained by libretro.

PokeMini

Before, the core has a Turbo A button with a fixed rate of four presses per second. Now, the turbo period is configurable via a new Turbo Button Period core option. Increasing the period to 0.5-0.75 seconds makes it much easier to speed through rounds of Pokémon Zany Cards without accidentally triggering unwanted input.

Update policy for this core
This core is maintained by libretro.

DOSbox Pure

DOSbox Pure is an MS-DOS/Windows 9x emulator core.

General updates along with a PS Vita port now.

Dolphin

Dolphin is a GameCube/Wii emulator core.

* Add Fast Depth Calculation option

This option is useful for certain games for which having Fast Depth Calculation enabled causes texture issues. For example, disabling Fast Depth Calculation restores the missing text in Def Jam: Fight for NY.

Update policy for this core
This core is maintained by libretro.

gpSP

gpSP is a Game Boy Advance emulator core.

Tons of updates:

* Fix palette writes in MIPS –

Was not writing to the right address (but decoded memory was working).
Most game worked well except those that depend on modifying the existing
palette bits (instead of copying from ROM/RAM). Fixes several games.

* Fix RTC support for MIPS

* Fix Vita port and likely some Linux/Android hidden issues –

Using an invalid SP makes Vita crash (for an unkown reason) and makes
things like C signal handlers crash (luckily Retroarch doesn’t use
them). It is also a violation of the ABI and not a great idea.
Recycled some little used registers to free SP. Perf should be roughly
the same.

* Fix invalid memory map entries

* Adding Code Breaker cheat support –

This works on both interpreter and dynarec.
Tested in MIPS, ARM and x86, still needs some more testing, some edge
cases can be buggy.

* Fix aligned32 reads in interpreter mode –

An address check was missing to read aligned 32 (stm/ldm) data from
high mem areas (0xX0000000). This fixes SM4 EU that for some reason has
some weird memory access (perhaps a bug?)

* Small optimization (~2-4%) and whitespace cleanup! –

Cleans up a ton of whitespace in cpu.c (like 100KB!) and improves
readability of some massive decode statements.

Added an optimization for PC-relative loads (pool load) in ROM (since
it’s read only and cannot possibily change) that directly emits an
immediate load. This is way faster, specially in MIPS/x86, ARM can be
even faster if we rewrite the immediate load macros to also use a pool.

* Add dedicated RetroPad fast-forward button

* Fix ARM dynarec unaligned 32 bit loads –

This might make a handful games slightly slower (but on the upper side
they work now instead of crashing or restarting).
Also while at it, fix some minor stuff in arm stubs for speed.

* Add ROM mirroring and fix mult. cycle count –

This should correct some minor issues in some games.

* Add turbo A/B buttons

Update policy for this core
This core is maintained by libretro.

Beetle Saturn

Beetle Saturn is a Sega Saturn emulator core.

* Backport VDP2 render thread ‘busy wait’ performance fix
* Fix hang on boot when rewind or runahead is enabled
* Prevent hang when launching Blast Wind

Update policy for this core
This core is maintained by libretro.

bsnes

bsnes is a Super Nintendo/Super Famicom emulator core.

* Refactor and upgrade Core Options (version 1.3) with sublabels and translation support

Update policy for this core
This core is maintained by libretro.

SMS Plus GX

SMSPlus GX is a Sega Master System/Game Gear emulator core.

* SMS: Center the image when remove border option is enabled
* Merge recent changes from upstream

Update policy for this core
This core is maintained by libretro.

LRMAME 2000

LRMAME2000 is an arcade emulator based on an old version of MAME circa 2000.

* Changed /samples dir to be in the system directory (parity with other MAME cores)

LRMAME 2003

LRMAME2003 is an arcade emulator core based on the original MAME 0.78 source code base .

Contra protection improvements –

furrtek Added Konami 007452 multiplier/divider fixes rolling mines trajectories in contra

Rather than add a whole new device im just hooking it directly into the Contra driver for this core. Combat School Flak Attack and WACLeMans also use this but for now im focusing on Contra as the game improvements are known

Whereas with the others the benefits over the original simulations are not as yet known if indeed there are any.

Update policy for this core
This core is maintained by the LRMAME2003 Plus team.

Mesen

Mesen is a Nintendo Entertainment System/Famicom emulator core.

* Fix Twin Dragons support. Also fixes Mystic Origins.

Update policy for this core
This core is maintained by the Libretro team.

Stella 2014

Stella is an Atari 2600 emulator core.

Before, the core supported analog paddle input when using gamepads (#71), with relative paddle motion corresponding to analog stick displacement.

Unfortunately, this is incompatible with real, physical paddles (Stelladaptor, iCode, etc.) , which require absolute positioning to function correctly.

Now, it enables support for these devices by adding a new virtual controller type. In Quick Menu > Controls > Port x Controls, Device Type can be set to Gamepad for regular input, or Paddles (Stelladaptor) for real paddle input.

When Paddles (Stelladaptor) is selected, inputs are mapped as follows (this is the normal convention for Atari controller adaptors):

Port 1:

P1 Fire: RetroPad A
P1 Wheel: RetroPad Left Analog X
P2 Fire: RetroPad B
P2 Wheel: RetroPad Left Analog Y
Port 2:

P3 Fire: RetroPad A
P3 Wheel: RetroPad Left Analog X
P4 Fire: RetroPad B
P4 Wheel: RetroPad Left Analog Y

Note that 4-player games are now supported.

Update policy for this core
This core is maintained by the Libretro team.

FBAlpha 2012 CPS3

This is a cut-down version of FBAlpha 2012. Only CPS3 emulation support has been kept in this core. It is mainly meant to be used with Capcom Play System III games.

* (3DS) Use custom memory allocator

Re-implement custom memory allocator initially from FBAlpha 2012 Neogeo.

Update policy for this core
This core is maintained by the Libretro team.

Other updates

* Atari800 (Update strategy: Maintained by Libretro)
* bsnes HD (Update strategy: Upstream)
* DOSbox Core (Update strategy: Maintained by RealNC)
* EasyRPG (Update strategy: Upstream)
* FBNeo (Update strategy: Upstream)
* LRMAME (Update strategy: Maintained by Libretro – updated to 0.330)
* LRMAME2003 Plus (Update Strategy: Maintained by LRMAME2003 Plus team)
* Mupen64Plus Next (Update Strategy: Maintained by m4xw)
* Picodrive (Update strategy: Maintained by Libretro)
* PPSSPP (Update strategy: Upstream)
* PX68K (Update strategy: Maintained by Libretro/NegativeExponent)
* Kronos (Update strategy: Upstream)
* Stella (Update strategy: Upstream)
* UAE (Update strategy: Maintained by Libretro)
* VICE
* VBA-M (Update Strategy: Maintained by Libretro/NegativeExponent)

If we forgot any updates to any core during this period, let us know and we will update this article. Thanks.