Last week the Persona 5 video seen below was posted showing how RPCS3 had been improved to fix various emulation issues with the game. The issue where Persona 5 had broken bloom and depth of field, making various parts of it have incorrect colors and also look blurry, was fixed. Additionally performance had been improved thanks to the reworked PPU recompiler a few days earlier.
While game certainly looks playable in the video it really wasn’t until today. Two critical issues persisted: The game would crash every time when starting a battle if the frame rate was higher than about 10-15 fps, and without opening the RPCS3 debugger and pausing a few special threads performance would suffer. But these problems are now fixed, and using the work in progress build linked below Persona 5 is playable.
Is Persona 5 Really Playable?
Yes, a few people have already beaten the entire 100+ hours long game in RPCS3 so essentially every issue is known to the developers, and all of the critical problems have been fixed. As the game looks more or less fine, performs more or less fine, and is provably beatable now without any strange hacks and workarounds we classify it as playable, but not perfect. One important aspect of this is that the Persona 5 engine is “framerate unlocked” so to speak, that is the game runs at full speed at almost any frame rate, like most PC games do for example. The actual interval where it runs at full speed is 15 – 60 fps, and for example an overclocked Haswell i5 can expect to play the game at about 10 – 20 fps in school and around Tokyo, and at about 20 – 30 fps in dungeons and battles.
A RPCS3 screenshot showing that the game has been completed. Take note that the displayed play time is lower than the actual play time as the game slows down below 15 fps.
Fixing the battle crash
The game would start to crash when engaging in a battle if the frame rate was above about 10 – 15 fps or so. As frame rate increased so did the probability of the crash happening, and at 30 fps it was definitive. When investigating this it was discovered that the crash was happening in the graphics renderer thread because it was told to process a frame with a null pointer instead of a fragment shader. Combined with the previous knowledge that the probability of the crash increases with the frame rate it sounds like a sync issue in RPCS3, but actually it is probably a game engine bug. Recording the raw output of a real PS3 and stepping through it frame by frame we notice something interesting:
Take a look at what is labeled as frame two and three. Every frame before and after these are unique, but these two are duplicated. These duplicated frames occur exactly in the battle transition where RPCS3 was crashing. Could it be that the bad frame is actually bad on a real PS3 too, and the real graphics driver simply ignores it? Seems like it.
Fixing the need for thread pausing
This was a very interesting way of increasing performance in Persona 5. Like most games there are several threads running at the same time (around 20 in this case) doing various things like audio decoding, file loading, etc. Three to four out of six “cellSpursKernel” threads, running on the SPU part of the Cell CPU, could actually be paused when playing the game and for some counterintuitive reason the game would keep running just fine. Not only that, frame rate would increase and most noticeably lag spikes would be eliminated. The question can be asked: But surely if the threads can be paused indefinitely like that they can’t be doing anything important, and if they are not doing anything why is there such a noticeable performance increase?
It turns out that they are doing important work, but as a performance optimization on the real hardware several of these threads would be doing the same kind of work on the same data at the same time. On real hardware the first thread to start would get to do the work, the other threads would either do nothing or grab the next piece of data so to speak. However this high level of concurrency was not really happening in RPCS3, instead they would deadlock each other and in general just slow things down compared to letting one thread do everything. Hence pausing almost all of the threads made the game faster. The fix is to simply detect when multiple cellSpursKernel threads are about to do the same thing and stop them if they do. This fix could also speed up other games with the same design, for example Red Dead Redemption sees a small performance improvement.
Persona 5: from Nothing to Playable in Half a Year
From the initial release of the game in Japan in september of 2016 up until the middle of January in 2017 the game would instantly crash upon starting it with a stack overflow exception. Some fixes to how fibers are handled later and it would start up and with some luck go ingame and display one or two very broken looking frames at 1 fps before hanging forever. Here is the world’s first screenshot of Persona 5 going ingame in RPCS3:
January was also the month when the RPCS3 Patreon launched, and the quick success of it allowed Nekotekina to work on RPCS3 full time. Graphics developer kd-11 also unofficially joined soon thereafter, and from there everything was set in motion. A day before the official English release of the game in April of 2017 we got an i7-5930K to record a video of the first hour or so of the game. This got a lot of attention, close to 200,000 views and articles in various gaming sites (and a look of disapproval tweet from Atlus).
Various fixes and a partially redone recompiler later we are here today where the game can finally be classified as playable on a hardware level such as an overclocked i5-4690K.
Download the Build
For now some of the changes required for Persona 5 are work in progress, therefore download and use this build for now. This needs to be overwritten to an existing RPCS3 setup, download that here, and please also read the quickstart guide for critical information on how to install the PS3 firmware in RPCS3 and how to dump the game disc or PSN download, as well as other information. Optimal settings for Persona 5 are the recommended settings in general: PPU and SPU recompiler, Vulkan renderer.
While Persona 5 is now playable this is only the beginning. RPCS3 still needs a lot of work in order to run games like Red Dead Redemption, Metal Gear Solid 4, and The Last of Us. If you want to help out Nekotekina and kd-11 and make RPCS3 progress even faster you can check out the Patreon page here.