• PhoneZalo : 0987929209
  • Address89 lê thị chợ quận 7 TPHCM
  • Open Hours8:00 tới 18:00
  • PhoneZalo : 0987929209
  • Address89 lê thị chợ quận 7 TPHCM
  • Open Hours8:00 tới 18:00

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

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

  1. running a Homebrew Enabler such as GoldHEN on your PS4
    • Yes, in 2023, running homebrew on your PS4 still requires a hacked console, not all PS4s are compatible, check our guide here.
  2. programming in general, and C programming in particular
      • This guide doesn’t actually cover the “programming” part of homebrew making, but how to set up your environment and making sure you have all the tools up and running. If you don’t know programming, starting on the “unstable” environment that is a hacked console is not what you want to do.

Table of contents

  1. PS4 Homebrew creation Tutorial – The short version
  2. PS4 Homebrew creation – Troubleshooting
  3. Setting up a Debug environment

PS4 Homebrew creation Tutorial – The short version

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.

  1. Make sure your PS4 is hackable and is running a homebrew ENabler environment such as Mira+HEN or GoldHEN.
    • I have personally been using GoldHEN in my tests, which I have found a tad bit easier to handle debugging (see debugging section below).
    • I am on a PS4 with firmware 5.05, although at the time of writing, any PS4 between 5.05 and 9.00 included should work fine for homebrew.
  2. For PS4 Homebrew development, you will want to install the OpenOrbis PS4 Toolchain and its dependencies (https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain).
  3. On Windows, Visual Studio is optional, but recommended because the Toolchain provides some significant support for Visual Studio users
    • I personally use Visual Studio Community 2019 but a more recent version will most likely work as well
    • This is mentioned in the tutorial again below, but you’ll want to copy the Visual Studio Template files from the OpenOrbis Toolchain (PS4Toolchain/extra/OpenOrbis PS4 SELF Project.zip and PS4Toolchain/extra/OpenOrbis PS4 SPRX Project.zip into your Visual Studio Template Folder, which is along the lines of C:\Users\[your user]\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C++ Project). This will let you create projects with the basic tools to build your project into a PS4-compatible binary, and package it into an installable pkg files. <– none of this requires Visual Studio or the Templates, but they make it slightly easier if you want to avoid the command line entirely.
  4. Watch SpecterDev‘s 5-video tutorial which will guide you through the entire process, from Toolchain installation to running the game on your console. I’m not a big fan of video tutorials myself, but I swear that these ones are 100% worth your time:
      1. Overview + Installation

    1. Creating a project + Project Structure overview (using Visual Studio. Note: also includes the same how-to for Linux CLI)
    2. Sample CPU Rendering
    3. Sample Playing Audio
    4. Building and Testing on the PS4
      • Although Specter goes into details on how to create pkg files in this video, It is worth mentioning that the “build.bat” provided in the samples of the Toolchain handles basically all the pkg creation for you, so by only editing that single file, you should be good to go for your future homebrew
  5. Join the PS4 OpenOrbis Discord server for further help and if you have any questions

PS4 Homebrew creation – Troubleshooting

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:

1. Error CE-40740-5 (cannot start the application)

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.

2. Printf Log messages not appearing in debug terminal

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:

3. Where to put OpenOrbis Visual Studio Templates

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.

PS4 Homebrew – Realtime Debugging

TLDR: 

  1. Enable TTY Redirect in GoldHEN’s KLog settings
  2. Connect to your PS4’s port 3232 with Telnet, using a tool such as Putty

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.

    1. Install putty
    2. Run putty, and connect to your PS4. IP Address should be your PS4’s IP address on the local network, port should be 3232 for GoldHEN.Telnet for connection type
  1. I have found that the logs appeared messed up in my terminal (possibly unix/dos shenanigans?), adding an extra CR in the putty terminal settings fixed 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!

Conclusion

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-AzifIllusion, and Sleirsgoevy for their help with some of my dumb issues and questions!

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *