>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
C-sharp

PlayStation 5 in C#: How Enthusiasts Are Writing the SharpEmu Emulator

Writing an emulator for a modern console is a task that many associate with endless walls of pure C++ and low-level magic. However, the developers of the SharpEmu project decided to take a different path and chose .NET. It sounds ambitious, given that we're talking about the PlayStation 5 — an extremely complex system with x86-64 architecture and a specific graphics API.

Why Does a Programmer Need Another Emulator

If you follow the scene, you've probably heard of ShadPS4. This project is already making great strides in running Bloodborne and other PS4 hits. The SharpEmu authors immediately put up a disclaimer: they're not trying to compete or duplicate anyone else's work. Their goal is exclusively PS5.

SharpEmu is an experimental project. It's built from scratch for educational purposes and research. The developers simply enjoy digging into system architecture and doing reverse engineering. For us, this is a rare opportunity to see how a modern console works "under the hood" using a familiar .NET tech stack.

What the Project Can Do Today

The project is in an early stage. Don't expect to download a binary and run God of War Ragnarök in 4K. The team's focus is on infrastructure and emulation accuracy, not on running specific games.

Nevertheless, there are already results:

  • Loading eboot.bin and .elf files. The emulator correctly parses the structure of console executables.
  • Executing native CPU instructions.
  • Reading metadata: game names, versions, and other service information.
  • Working with system modules (PRX) and partial kernel function support.
  • Initial PlayGo scenario and video output support.

Interestingly, some games already reach the AGC (graphics shader engine) initialization stage and call sceVideoOut. For example, in Demon's Souls Remake, the emulator has already prepared shaders that the developers plan to convert to SPIR-V for rendering via Vulkan.

Technology Stack and Sources of Inspiration

Choosing C# for such a project is an interesting decision. Modern .NET (version 8 and above) provides excellent performance, and working with memory and data structures in it is often more pleasant than in C++.

The SharpEmu authors don't hide that they're building on the experience of colleagues. Several well-known projects have influenced their code and architecture:

  1. Ryujinx: from here they took patterns for implementing low-level operations in C# and file system handling.
  2. Kyty: one of the early PS5 emulators, which served as a textbook on native code execution.
  3. ShadPS4: helped understand the general principles of Sony console architecture for current and previous generations.

Currently, the primary target platform is Windows. This simplifies debugging in the early stages. Support for Linux and macOS is planned for later, once the codebase becomes more stable.

How to Try It

If you want to peek inside or even help the project with code, building it won't be difficult. You'll need the latest .NET SDK.

Clone the repository:

git clone https://github.com/par274/sharpemu.git

Build the project:

dotnet build

To run a game image via command line, use PowerShell:

.\SharpEmu "путь_к_eboot.bin" 2>&1 | Tee-Object -FilePath "log.txt"

Who This Project Is For

SharpEmu is unlikely to become your primary gaming client in the next couple of years. But it's ideal for those who want to learn:

  • Systems programming in C#.
  • How JIT compilers and instruction translation work.
  • Reverse engineering of closed platforms.

The project looks "clean" and academic. It has no proprietary files or keys; all testing is done on dumps of the authors' personal consoles.

*Dreaming Sarah already manages to render textures.*

SharpEmu is a cool example of how complex tasks like hardware emulation are solved using modern high-level languages. For now, the project is more of a "sandbox" for engineers. If you're interested in how GPU commands are sent in the PS5 or how the task scheduler works in its kernel, take a look at the source code. Reading C# code is clearly easier than figuring out C++ template intricacies.

You can follow updates in their Discord community, a link to which is in the repository. There, developers often share logs and successes in passing the next stage of loading heavy games.

Related projects