banner

Blog

Jul 04, 2023

How to: Making PS4 Homebrew in 2023 (Tutorial, kind of)

by wololo · August 26, 2023

I’ve decided to take my old PS4 from its shelf and see how easy (or not) it has become to create homebrew for the PS4, since the last time I looked seriously into it, which was a long time ago.

The good news: there already are good tutorials on how to make PS4 homebrew, they’re still very valid in 2023, and for the most part, they’re all you need. The bad news: they’re surprisingly hard to find, in a sea of garbage that Google/Bing seem eager to surface. Seemingly simple queries such as “How to make PS4 Homebrew” or “PS4 Homebrew Tutorial” didn’t yield particularly exciting results (at least for me). But I did find my way to the right stuff, ultimately 🙂

For this guide I will be focusing on Windows and Visual Studio, but generally speaking the guides and resources I’m pointing to are valid for Linux and MacOS as well.

This guide assumes that you are reasonably familiar with

This section alone should be enough to get you started. However, once that is done, do yourself a favor and set up a debugging environment (see Debugging below). If you run into issues, check the Troubleshooting section.

Before downloading or installing anything, read the 5 points below from start to finish. Specter’s first video in particular guides you through the whole installation process (which is the entirety of point 2 below)! And, frankly, SpecterDev’s video series is probably the only thing you actually need if you don’t want to read this tutorial.

The 5 steps above should be enough to get you started and creating Homebrew for any hacked PS4. Although there exist other ways to create homebrew for the PS4 (including, infamously, through a leaked official Sony SDK with Unity), the OpenOrbis Toolchain is “the” tool that is up to date and supported by the community in 2023. And it is possible, once you get used to the Toolchain and its dependencies, to update to the latest and greatest version if you need to.

Nonetheless, in my quest to get a homebrew environment up and running on my windows machine, I ran into the following issues, some of which might also happen to you:

This is apparently an error that happens when you try to run a PS4 application that was created for a higher firmware than the one you’re running. People trying to “backport” PS4 games to lower firmwares are in particular familiar with this issue.

In my case, and in the context of Homebrew development, this happened to me because my PS4 was on Firmware 4.05, while the OpenOrbis Toolchain is written to support Firmwares 4.5x and above. Although that choice was arbitrary (SDK 4.508.101 was chosen at the time of creating the Toolchain, as the most up to date SDK number), and in theory you could patch your Homebrew to work on 4.05 by replacing that SDK version in the appropriate files of the Toolchain, I personally decided not to sweat it, and upgraded my PS4 to firmware 5.05.

Mira and GoldHEN offer ways to get runtime output of your Homebrew’s logs in a terminal (see “Debugging” below). But I was not seeing those in my tests, for the samples provided in the PS4 Toolchain. It appears that depending on your version of LLVM and other factors, the libc might be redirecting printf to the wrong pipe (don’t quote me on that). The solution, as suggested by Illusion, was to use the PS4’s internal libc in priority to the regular one. This was done by adding -lSceLibcInternal in the set libraries section of the build.bat file, before -lc:

I didn’t find a way to “install” the OpenOrbis VS templates from within Visual Studio itself. It turns out the only thing to do is copy them (without extracting them) into the C:\Users\[your user]\Documents\Visual Studio 20xx\Templates\ProjectTemplates\Visual C++ Project folder.

Specter mentions it also works in the parent folder, as so:

Either of these should work, and the result when you create a new project in Visual Studio is that you should have the templates ready. Those templates will allow you to create your project, but more importantly, to build it by using the Visual Studio “build” button, instead of running the make and package creating commands manually. This goes without saying, but those Visual Studio templates are just shortcuts for things you can do manually, they do not perform any magic. You don’t “need” them, but they’re good helpers that abstract a few things away.

TLDR:

The Long Story:

Real experts will tell you: the only good way to debug an application is printf. Joke aside, this is the quickest one to implement to get you started, and something most developers use on any platform.

At the time of this writing, SpecterDev’s tutorial videos don’t cover the “debug” part of development, although in my experience it is critical: running development code on your PS4 is bound to fail sometimes, and you’ll want to know what is going on. Trust me, every time I think I can do without it, I ended up regretting it. You’ll waste more time trying to “guess” what’s wrong with a specific Homebrew app on your console without any realtime log, than enabling this monitoring.

The easiest way to do this is to monitor your Homebrew’s output in real time, which is much easier to do than it sounds, thanks to the utilities included with popular PS4 exploits.

GoldHEN and Mira are outputting some logs to a specific port on the console, which you can listen to from your PC. In this example, I will be using goldHEN, which in my tests was easier to work with, but I believe Mira offers similar functionality.

GoldHEN output the contents of the kernel log to TCP port 3232 (and apparently, port 9998 for Mira). Additionally, GoldHEN has an option to add your homebrew’s stdout output (typically what you write with printf) to the kernel log (“klog”) output (a.k.a Enable TTY Redirect) . Those two things combined means it is easy to set up realtime monitoring of your homebrew’s printf, from your PC.

First, on your PS4,you will want to go to your GoldHEN KLog settings, and enable TTY Redirect. This will ensure your Homebrew’s logs get added to klog. Note that you should only enable this when you actually want to debug something, otherwise it’s recommended not to have it “on” when simply using the console.

Secondly, you can connect to your PS4’s 3232 port from your PC, on a Telnet terminal. I’m personally using Putty to do that.

Testing: Once you click on “Open” from the putty terminal you should almost instantly see the terminal filling with PS4 Kernel messages. To test that my homebrew is outputting correctly, I tried running the “graphics” sample homebrew from the PS4 Toolchain. That homebrew does some printf debugging here and there. In its main.cpp file:

When I start this specific homebrew on my PS4, with putty connected, I can see that it is working correctly:

There are “better” ways to debug code, but this one should give you a pretty good head start!

The open source tools to create PS4 Homebrew are here, properly documented, and well supported by a pretty active community. Cherry on top, Windows compatibility doesn’t appear to be the third wheel! Setting up this Windows environment on my end didn’t take too long (if you ignore the fact that I started with a 4.05 PS4 I hadn’t turned on in years, and had to figure out a bunch of issues related to that), and generally speaking, things worked out of the box.

I’ll try to keep this article updated (in particular if people run into problems or questions, I’m more than eager to update the troubleshooting section), so feel free to comment!

With my thanks to Al-Azif, Illusion, and Sleirsgoevy for their help with some of my dumb issues and questions!

Windows and Visual StudioSpecterDev’s video series is probably the only thing you actually need if you don’t want to read this tutorial.the OpenOrbis Toolchain is “the” tool that is up to date and supported by the community in 2023build.batTLDR: The Long Story:Enable TTY RedirectFirst,SecondlyIP AddressportTelnetTesting:
SHARE