Beetle PSX HW – Experimental texture replacement now available!

DISCLAIMER: Libretro as a group or entity has no affiliation or involvement in the creation of assets contained in any texture pack

So this has been a project that has been cooking in the oven for about a year in the form of a bounty. The goal is to come up with a way to not only dump all the textures of a PlayStation1 game, but also to replace them with user-supplied textures.

Doing this is hard with PlayStation renderers due to the general low level of abstraction of these renderers, which is why it’s not exactly a commonplace feature in many PS1 emulators.

So far we have let it cook slowly in the oven. However, the recent release of people preparing a Proof Of Concept demo in the form of a Chrono Cross texture pack and the circulation of a modified Beetle PSX HW core that adds support for custom texture injection has led us to make the decision to include this feature already in the buildbot cores rather than wait it out. We hope by doing this, that this feature can organically grow and that more people start taking an active interest in making their own texture packs this way for their own favorite content. Libretro is all about enabling people the power and freedom to do what they want with their legally bought content, after all.

Requirements/Availability

Should only require the Vulkan renderer and a graphics card that is compatible with the Vulkan API. Will not work with either OpenGL or software rendering.

Android, Linux and Windows are all supported targets.

How to get it

The usual. Either you have Beetle PSX HW already installed, in which case you would just go to RetroArch’s Online Updater and select ‘Update Cores’. In case you don’t have it already installed, go to ‘Online Updater’, select ‘Core Updater’ or ‘Core Downloader’ (depends on the version of RetroArch you’re using), and then download Beetle PSX HW.

Explanation of core options

Two new core options have been added.

Dump Textures

While the game is running, it will dump all current active textures it comes across to a directory. The name of this folder is [gamename]-texture-replacements, and it will dumped inside the same dir that your content (ISO or other image format) comes from.

Replace Textures

It will attempt to use all HD textures from the ‘texture-replacements’ directory. The name of this folder is [gamename]-texture-replacements, and it will try to read this directory from the same dir that your content (ISO or other image format) comes from.

NOTE: Later on, we might add another option that allows you to point the dumping and injection path to somewhere else. Right now this is a problem for instance when you have your content stored on a slow disk device like a HDD but you want your texture replacement files to be read from your much faster but smaller SSD instead. Right now, you are forced to move the image to your SSD as well, because otherwise it just dumps and/or reads these texture replacement files from the same dir as the image, in this case the mechanical harddrive.

How to make it work

Make sure you have the textures extracted already in your [ganename]texture-replacements dir, and make sure that the dir is in the same dir that your game content file (ISO or other image format) comes from.

Start Beetle PSX HW, make sure that you are using the Vulkan renderer (it won’t work with either the software renderer or GL renderer), and then make sure the ‘Replace Textures’ option is enabled.

If it works properly, you’ll start seeing low-resolution textures replaced by higher-resolution ones.

Screenshots

Future

We hope to provide you with an article in the near future that goes into how to create your own texture pack for a game.

Is the format set in stone? Is it complete? Probably no to both. It is a Work-In-Progress. However, we hope that by putting it out there already, the community can already start experimenting with the option, putting it through its paces, and see what its limitations are and how far it can be pushed.

Beetle PSX Dynarec – Public Beta Out Now! Fast and accurate wins the race!

We are delighted to announce that the Beetle PSX dynarec bounty is finally entering its public beta stage and is available to the public right now!

The dynarec project for Beetle PSX would not be where it is today without the combined efforts of simias, pcercuei and Zach Cook!

If you are on Android, Windows, Linux and/or macOS, all you have to do to get the latest core is to open RetroArch, go to Online Updater, and either select ‘Update Installed Cores’ (if you already installed the Beetle PSX core before), or install the Beetle PSX and/or Beetle PSX HW cores separately.

What’s this all about?

In 2017, we started a bounty for Beetle PSX, our own heavily modified fork of Mednafen PSX that has pretty much become its own thing at this point. Mednafen PSX is a highly accurate PlayStation1 emulator. However, unlike emulators like ePSXe, it only has a CPU interpreter, which means that the emulator is fairly slow and is therefore not really usable on anything but desktop PCs and high end mobile phones. The bounty was created on BountySource in hopes of attracting someone who could add a dynamic recompiler to Beetle PSX so that it could run much faster and therefore be a viable emulator on lower end hardware, such as mid range mobile phones, game consoles, older PCs, etc.

What pcercuei and Zach Cook have come up with is a Lightrec-based dynamic recompiler implementation. Zach Cook has done most of the integration of Lightrec in Beetle PSX, while pcercuei did Lightrec itself. Lightrec is pcercuei’s dynamic recompiler for MIPS that uses GNU Lightning as the backend. There should be working implementations for nearly all system architectures, from x86 (64bit/32bit) to MIPS and ARM (64bit/32bit). It bears mentioning that pcercuei also already has Lightrec hooked up to PCSX Reloaded, and used this as a testbed.

Platforms

The dynarec is available for the following platforms:

  • Linux
  • Windows
  • Android *
  • MacOS *

We are able to confirm that the performance gains for x86 and x86_64 are significant, as you can see down below (see Performance tests). We don’t know what the results are for ARM Linux, let us know how it performs!

* Performance right now is pretty bad for the Android and macOS platforms. We hope that after the public beta test, performance will improve a lot for these platforms. So while there is a framerate gain, it isn’t anywhere near what it should be.

How to use it – what the options do

First, update your Beetle PSX cores. We already explained before but we’ll repeat it here for the sake of it –

If you are on Android, Windows, Linux and/or macOS, all you have to do to get the latest core is to open RetroArch, go to Online Updater, and either select ‘Update Installed Cores’ (if you already installed the Beetle PSX core before), or install the Beetle PSX and/or Beetle PSX HW cores separately.

Once you’re on the latest core, you’ll notice that a lot more options show up now when you go to Quick Menu -> Options. We’ll go over these options and we’ll explain what they do.

NOTE: The dynarec is disabled by default – the default setting is still ‘Beetle Interpreter’. So if you’re wondering why things aren’t automatically faster, set it from Disabled to ‘Max Performance’ in Quick Menu -> Options.

CPU Dynarec – [Max Performance|Cycle Timing Check|Lightrec Interpreter|Disabled (Beetle Interpreter)]

Dynamically recompile CPU instructions to native instructions. Much faster than interpreter, but CPU timing is less accurate, and may have bugs.

Disabled (Beetle Interpreter) – This is the default setting, dynarec is disabled. This uses the default Beetle interpreter that has been used in Beetle PSX all up to this point. It’s faster than Lightrec Interpreter (for now) but much slower than any of the dynarec modes. We don’t recommend you use this unless ‘Max Performance’ or ‘Cycle Timing Check’ won’t work well for you on the game you’re trying to play.

Max Performance – Dynarec enabled with all features enabled. Should be the fastest option, but some games might require the ‘Cycle Timing Check’ mode instead.

Cycle Timing Check – Dynarec enabled, but with cycle timing check which makes it a fair bit slower. Some games might need this setting in order to work properly, so if you find that Max Performance has bugs with a game, try this mode instead.

Lightrec Interpreter – This is the slowest mode right now. It’s basically in the same ballpark as Beetle Interpreter but the Beetle one is actually faster. It’s basically Lightrec running in CPU interpreter mode instead of dynarec mode. We don’t recommend you use this.

Dynarec Code Invalidation – [Full/DMA Only [Slightly faster]]

Some games require a Full invalidation, some require DMA Only.

Dynarec DMA/GPU Event Cycles – 128 (Default) – can go up to 512

How many cycles can pass in the CPU before a GPU or DMA update is checked. A higher number will be faster, but also more likely to cause bugs or crashes. This option has much less impact on performance with Beetle Interpreter than any of the dynarec modes.

Performance tests

Test hardware: Desktop PC – Core i7 7700k, Windows 10

Game Beetle Interpreter Dynarec – Max Performance Dynarec – Max Performance (w/ DMA/GPU Event Cycles High) Dynarec – Cycle Timing Check Dynarec – Lightrec Interpreter
Tekken 3 151fps 223fps 252fps 209fps 117fps
Ridge Racer Type 4 132fps 323fps 325fps 289fps 132fps
Final Doom 216fps 401fps 456fps 359fps 142fps
Final Fantasy VIII 185fps 384fps 426fps 269fps 149fps
Rockman X3 211fps 414fps 450fps 319fps 152fps

Test hardware: Laptop PC – Core i5 3210M, Ubuntu Linux 19.04

Game Beetle Interpreter Dynarec – Max Performance Dynarec – Max Performance (w/ DMA/GPU Event Cycles High) Dynarec – Cycle Timing Check Dynarec – Lightrec Interpreter
Tekken 3 83fps 117fps 126fps 110fps 78fps
Ridge Racer Type 4 105fps 159fps 173fps 143fps 87fps
Final Doom 128fps 204fps 235fps 181fps 99fps
Final Fantasy VIII 128fps 232fps 277fps 152fps 97fps
Rockman X3 141fps 235fps 266fps 182fps 107fps

Currently known issues

* PGXP right now is disabled if you use any of the Dynarec modes. So don’t bother enabling PGXP modes for now when you use the Dynarec modes, you’ll just lose performance while gaining absolutely nothing. We hope that we are able to come up with a solution for this later.

* Make sure ‘Renderer’ is set to ‘Software’ if you want to use runahead. We recommend for runahead purposes you stick to 1x Internal GPU Resolution as even with the dynarec enabled, it can still be stressful on the CPU to go any higher than 1x with software rendering.

* If you are using the Android version and want to report bugs right now, please DO NOT use the Vulkan renderer right now. It currently has a couple of bugs on Android that the software renderer doesn’t have. So we advice you to use the software renderer for now on Android. On top of that, the software renderer right now is faster than Vulkan on Android, so you’re advised for now to use this during the public beta period.

Currently known compatibility issues

These are the current compatibility issues I have been able to notice on Windows.

Parasite Eve 2 (USA) (Disc 1)
Won’t continue from start with dynarec. It will freeze at the ‘Published by Square Electronic Arts’ screen.

There is a workaround for this – set CPU Overclock to 300%. The game will run too fast but it will at least be playable.

Brave Fencer Musashi (USA)
Hangs at ‘New Game’ – first world screen

There is a workaround for this – set CPU Overclock to 300%. The game will run too fast but it will at least be playable.

Gex – Enter The Gecko (USA)
Crashes after PSX copyright screen

Time Commando (USA)
Corrupted background graphics. Background graphics in this game are streaming FMV with polygon models on top.

Street Fighter Ex Plus Alpha (USA)
If you lose a fight and then select Continue, it will hang

Vanishing Point (USA)
It crashes once inside a race – with both full max or dma only

Battle Arena Toshinden 1 (USA)
It runs too fast.

WORKAROUND: By setting CPU to 90%, you can workaround this issue.

Alone In The Dark – One Eyed Jack’s Revenge (USA)
Crashes after the PSX copyright screen

Viewpoint (USA)
Crashes after the PSX copyright screen

Another big announcement at the end of the weekend

We have even bigger things for you in store by the end of this week. So stay tuned, because we have lots more to talk about very soon! It’s time to get the 5th gen out of the way and have it preserved for posterity!