Progress Report: Demon’s Souls Nearly Playable and RPCS3 v0.0.2

It finally happened! The PlayStation 3 emulator RPCS3 has launched one of the most iconic games on the platform: Demon’s Souls. Are you curious to know how it all happened? What the developers went through? Welcome to this first of hopefully many to come developer logs where we will now tell you everything.

It all began in our Discord channel where a user going by the nickname, Numan approached us with some interesting news. He claimed to have conducted a detailed investigation of what Demon’s Souls was trying to do when it was crashing one second after booting. He drew the conclusion that the game was trying to allocate memory pages of different sizes, access levels, and different attributes. When the game then tried to access a specific memory address, it crashed with an access violation. Consequently, these discoveries lead to a more accurate implementation of the function sys_memory_get_page_attribute() which was responsible for this particular crash. Suddenly the game booted up in RPCS3 for the first time ever and showed a loading animation!

The Beginning Hours

After loading for a while, the loading screen faded out and we faced a black screen and nothing more. Analysis showed that the game was trying to communicate with PSN and connect to the servers for online play. Some changes in the sceNp module were made to tell the game that “the console” is offline and no connections should be made. The game now loaded a bit further, started a few more thread… and we faced even more disappointment: still a black screen and nothing unusual in the logs. A dead end. For another day or two, no progress was made.

You know what they say about not being able to see what is right under one’s nose. A very common thing was happening; the game was loading encrypted .sdat files. However, the emulator was not decrypting these on the fly at this point in time (last week that is, now it does thanks to Jarveson). So the game loaded encrypted files which could not be processed and the game got stuck. When Numan went through the logs again and noticed this oversight, he made a big facepalm and then decrypted the 26 .sdat files manually. Then the miracle happened, the game started to show some introduction screens!

The game then complained about a lack of space on the hard disk. This problem was quickly circumvented by creating some empty directories that it failed to create itself. This will be fixed properly later on with some changes in the cellGame module.

The opening video now started to play, although one could only hear it as the display was black. The video was skipped and the game reached the main menu:

With much anticipation a new game was started!

And… we are ingame!

But the graphics are not very impressive. Let’s try again.

Much better. So what happened here? ssshadow channeled the power of the soul arts and managed to get the game to display the ingame graphics. However, it happened by accident, he played around with the ingame brightness slider while reloading the save. When setting brightness to zero, reloading, and then setting it to the maximum value of 10 graphics would sometimes randomly display. Most often however, they would still be black. This lucky person ran through the first tutorial level, killed all the enemies and was generally pleased by the performance.

Meanwhile it became obvious that much more work was still needed. The game makes use of many of the features the platform provides, and thanks to this many imperfections in the graphics implementation surfaced. Lead graphics developer kd-11 immediately started debugging and soon enough fixed the videos and the main menu:

The most difficult task still remained, to find the reason why the ingame graphics were almost always completely black. Kd-11 rolled up his sleeves and started to rewrite parts of the shader cache and image buffers. It took another full week of experimenting, debugging, and retesting but the actual reason for the missing graphic were finally found. The value of a uniform fragment shader variable responsible for overall scene brightness was found to be calculated to negative zero. The resulting vector was therefore nullified and the image was not visible (although still drawn correctly in the dark). During the search of a solution dozens of other bugs were detected and fixed in among many parts of the emulator the shader decompiler ( which fixed a lot of issues in many other games too. Finally, at the end of the week the game consequently looked like this:

With a few more fixes the graphics and performance were improved even further. The game is mostly correctly displayed, special effects such as fog, motion blur, bloom, particle effects and much more are all there:

Last but not least it was time for Nekotekina to work his magic as well. Almost three weeks in the making he finally committed his reservations re-rewrite which not only increases performance in this game by some 50%, but also gives a nice boost to the overall performance of RPCS3 in general. For example, [redacted] is almost ten times faster than it was before, now reaching 10 – 30FPS on a fast CPU. This commit finally made it possible to reach a “smooth” 30FPS in many parts of Demon’s Souls:

At the moment, there are still several known problems with Demon’s Souls:

  • Performance. The game is very demanding of resources, and while Ryzen @ 4 ghz or 6 cores of Haswell-E can run some areas of the game at 30 fps, it can also drop down to as little as 10 fps in big open areas such as in front of The Boletarian Castle. One really wants a stable 30 fps (native frame rate, maybe someone will mod it to 60 fps), and preferably also on “normal” CPU’s. But there are both short and long term plans to improve performance, for example by making the LLVM recompiler not crash in this game.

  • The player character shadow is missing, and there are other minor graphical bugs here and there.

  • The sound is a bit unstable. It can work fine for a while, but after some 5-10 minutes it can suddenly stop. There are also problems where sound effects are repeated before they are finished or they sound very loud and strange.

  • The game can randomly get stuck on loading screens. Not critical as it auto-saves continuously.

RPCS3 v0.0.2

As you probably noticed by the title already, we are entering a new version (and no more Pre-Alpha now, just Alpha!). It has been a really long time since the last version bump (v0.0.1 Pre-Alpha on 17 Jun 2016). Since then, a lot of improvements were made, improvements big enough that we finally decided to finally bump the version again. The version will be officially bumped on GitHub as soon as the last pull requests related to Demon’s Souls are posted.

Resumed Changelog since v0.0.1 Pre-Alpha:

– PPU LLVM AOT recompiler reimplemented
– PPU LLVM caching implemented
– PPU thread scheduler implemented
– PPU breakpoints reimplemented
– PPU analyzer improved
– Various LV2 system improvements
– IdManager improvements
– Debugger fixed and enhanced
– PPU/SPU accuracy improvements

– Memory system cleanup
– sys_memory_get_page_attribute improvements

A LOT of bugfixes and accuracy improvements for all Graphic backends. (There were really a lot of improvements here and we can’t list them all!)
– Shader decompiler improvements
– Several RSX bugfixes and accuracy improvements

– Major sys_net improvements
– cellOsk implemented
– cellVDec fixes and improvements
– Several other small improvements

– MMJoystick implemented

– Several Linux specific bugfixes were made. Some are still being worked on as there are still a few Linux specific bugs.

– Initial package unpacking implemented
– Small Interpreter improvements

– Logging system cleanup
– TLS bugfixes and improvements

– Automatic LLE loading
– MSELF, SDAT, EDAT, SPRX: Decryption on the fly!
– Firmware update file (PS3UPDAT.PUP) installer
– XAudio fixes

Many other unlisted bugfixes and improvements

The Conclusion

Regardless, the fact that Demon’s Souls goes ingame and is playable to some extent is certainly a huge milestone for RPCS3. I would like to thank every developer who made this possible. Numan that did the initial investigations and got the first boot, Oil who helped work on the same issues, kd-11 that fixed countless of graphical issues, and Nekotekina who improved the overall performance. Of course even only tangentially related improvements by a lot of other people have helped a lot too. Jarvesson implemented automatic .sdat decryption that increases ease of use and ssshadow implemented cellOsk (on screen keyboard) earlier this year which this game uses for player name input in the beginning.

Do you want to try it out? It seems like only the US and EU disc versions of the game currently work. Simply download the latest RPCS3 build here and turn on the setting “write color buffers”. Also read the quickstart guide, check the forum thread, and ask for help on our Discord channel where all of this started.

You can support lead developer Nekotekina on Patreon. Your support will help speed up the development of the emulator so that one day this game will be perfectly playable from start to finish with good performance and accurate graphics.