Orbital: The journey to the safe mode.
Sit tight, this is gonna be a long one.
Orbital: Playstation 4 Emulator
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?”
Here’s an explanation by the developer himself
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:
- New x86 instruction emulator.
- Debugging support.
- 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-ngis 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-grubas well. At that point,
orbital-ngwill become just
orbitaland be merged into the main repo.