OK, let’s take a trip back in time, shall we? Imagine yourself sitting at your computer at the 28th of October, 2017. If you were somewhat curious, you might have searched for a PS4 emulator that day. And in any other day, you would find only lies and scams. But that day, someone made a tiny little repository on Github, containing nothing more than a license and a tiny readme. That readme. What did it say, I want to believe you said that in your head? “Orbital: Playstation 4 Emulator.” Most people would simply think it’s just another scam or of the sort. But this developer was the real thing. The reason? “I’m in only for the technical challenge hehe”
Before I start, yes. That is a real quote the developer, AlexAltea, has said in a conversation with me. Now, let’s get technical.
What is Orbital? Orbital is a low-level virtualization-based Playstation 4 emulator. “Low-level? Virtualization? Diver, are you drunk? What are these?”
This image gives a perfect example of what LLE vs HLE does.
“Why did the developer use LLE instead of HLE?” Low-level emulation (LLE), as opposed to high-level emulation (HLE), requires understanding hardware rather than understanding software libraries. It’s not immediately obvious which is the better choice in this case in terms of development/reversing time so Alex went for LLE out of personal taste and also because:
A LLE emulator can help debugging kernel crashes, which could be of use while developing kernel exploits with legitimate uses (custom firmwares, ps4-linux, etc.).
Unlike previous console generations, PS4 ships an x86 CPU, which makes virtualization possible with HAXM. (More on HAXM later)
Gain insightful knowledge about PS4 hardware that could be used by other developers.
And as in any emulator: preservation, enhancements, homebrew development, etc. are good reasons to work on this.
Now, the reason the title is named that way.
Just like the little narration said at the start informed you, Orbital started being worked on by AlexAltea, real name Alexandro Sanchez Bach, on the 28 of October, 2017. Orbital is the combination of three separate projects which together allow us to boot into PS4 kernels. Those being:
orbital-bios, orbital-grub and the most important part: orbital-qemu. A summary of these would be that orbital-bios is a SeaBIOS fork to add support to the PS4 quirks (no VGA, no ISA bus, etc.). This is needed because the PS4 is not really a PC. orbital-grub simply forks GRUB and adds a modified freebsd bootloader to add support for Orbis kernels, since they include custom sections written by Sony and orbital-qemu is a QEMU fork that adds support for PS4 hardware: Aeolia (USB, Ethernet, etc. etc.) and Liverpool (GPU and Audio). But the endgame is for the emulator to be completely dependent from these dependencies, so AlexAltea is working on a QEMU replacement called orbital-NG. (More on that later.)
Now that you have a rough concept of the emulator, let’s talk about all things that were preventing us from getting here.
Firstly, we had the problem of translating instructions from the PS4 to the PC. Since the PS4 and modern PC’s use the same architecture, that being x86, we don’t need to use interpreters or recompilers. What we need is Virtualization. So we need a hypervisor that was open source, cross-platform and easy to install. The choice was HAXM. It’s compatible with Linux, Windows, MacOS, NetBSD. It was compatible with Intel CPU’s only but thanks to contributions by members of the project, it can now be used with AMD CPU’s as well, there are more contributions as significant as this such as:
New x86 instruction emulator.
Creating test suites and setting-up CI.
Code refactoring, cleanup, improvements, etc.
All that is enough to successfully boot up the kernel!
Now there was another problem. The kernel worked but there was not a renderer yet. Thankfully, the GPU’s instructions are compatible with Vulkan.
Primary focused on GFX MMIO registers. It describes the pipeline state can be modelled with Vulkan.
CP emulation: Consumes PM4 commands, which can trigger MMIO/memory accesses, draws, among other actions, which are mapped to Vulkan commands.
GCN emulation: GCN shader bytecode can be translated to SPIR-V consumed by the Vulkan drivers.
Fellow developer jhfs made an ImGui window for the renderer to take place and on the 19th of MArch 2018, AlexAltea completed the graphical pipeline and the emulator showed graphics for the first time although somewhat buggy at first.
But after some fixing, it worked perfectly may I say.
That error that you see it was for the HDD but it got fixed.
Now that all those problems got fixed, we had one last thing to do before our journey was completed. Controllers did not work so there was work to be done, mostly implementing xHCI. Thankfully, former RPCS3 developer Jarves came to the rescue and helped a lot on this endeavor.
Current status: After last update, we have implemented the Aeolia XHCI device (USB 3.0) to get past the “Connect DualShock” message by connecting an actual gamepad to the PS4 VM via host passthrough. There were many issues in our way there and we have fixed those with the invaluable help of @jarves. As a future goal, we also want to implement a virtual USB device for the DualShock 4 (as opposed to using an actual physical device).
Below you’ll find a more in-depth explanation on the emulator as a whole.
Now as you may have heard in the video, we want to completely drop QEMU and use a stripped down version of it that has the things we want. We also want to HLE the BIOS and bootloader to get rid of the need for orbital-bios and orbital-grub.
orbital-ng is an emulator similar to QEMU, written in C++ (not C) and stripping away most features that we don’t need from QEMU (no binary translator, no hardware from foreign architectures, no legacy PC hardware, etc.). In other words, we just care about the essentials here: a hypervisor backend for haxm, memory/io management, support for PCIe devices, and implementing Aeolia/Liverpool GPU on top of that. Once this project is ready (i.e. we reach the same safe mode menu), orbital-qemu (which is the legacy QEMU-based emulator) will be removed, and replaced with orbital-ng (which I’ll publish at that point!). Finally, by HLE’ing the BIOS and the Bootloader, we will eventually get rid of orbital-bios and orbital-grub as well. At that point, orbital-ng will become just orbital and be merged into the main repo.
Now the only thing left to do is to install the firmware onto the virtual HDD and get to see the main menu!
I’m rooting for you Alex, and thank you if you read the article until the end!