Nugget
|
The easiest to get started with PSYQo, and with development on the PlayStation 1 in general, is through a Visual Studio Code extension. You can find it in the marketplace, and watch a video to see how to use it.
In order to develop for the PlayStation1 using the PSYQo library, a modern C++ toolchain is required. There are several different toolchains available for the PS1, but the PSYQo library is designed to work with at least gcc 10 targeting mips I. Here are some installation methods available:
The mipsel environment can be installed from AUR : cross-mipsel-linux-gnu-binutils and cross-mipsel-linux-gnu-gcc using your AURhelper of choice:
This script will spawn a working mips toolchain.
Using Homebrew, you can install the mips toolchain after downloading these two scripts (or cloning the whole PCSX-Redux repository).
It is possible to install a mips toolchain on Windows by first running the following command:
The computer might need to be rebooted after the installation of this script.
Next, run the following command to install the proper toolchain and its dependencies:
For users who don't want to modify their environments, it is possible to use Docker to run the mips toolchain. There are two scripts provided at the root of this repository, called dockermake.sh
for Unix users and dockermake.bat
for Windows users.
These scripts will behave like the make
command, running in the same directory where the command was run. It'll be in a Linux environment with an adequate mips toolchain to use.
The canonical method to use PSYQo
is to use the nugget repository as a submodule for your own project, say in the third_party
directory. You can create a hello.cpp
file at the root of your directory that's a copy of the example hello world. Doing a simple code drop of the nugget repository is also acceptable.
Here's how to get all this going. The commands are aimed at Unix environments, but the spirit of what's going on should be very simple to understand for Windows too.
First, let's create a folder for your project:
Then, initialize the git repository:
And then, let's add nugget as a submodule:
Now, download the example hello world and drop it in your project folder.
Finally, create a Makefile
at the root of your project, which follows the following structure:
Once done, you can simply run make
(or use the dockermake
script) in your project root to create the application. This should create the binary called hello.ps-exe
, which you can then run in the emulator of your choice, or on the real hardware using for example unirom and nops.
See the [examples](examples) directory for more complex project structures you can use. Since the examples are subfolders of the psyqo library, their Makefile
s will have a different method to include the file psyqo.mk
, but that's otherwise the only difference.
If a more complex build system is required, compiling PSYQo itself is very simple, and should be straightforward to integrate. Refer to the [Makefile](Makefile) for what to do exactly.
The recommended IDE is Visual Studio Code. The clangd extension is configured within PSYQo, and will provide valuable IDE features such as completion or code navigation. It is also possible to debug PSYQo binaries, using the Native Debug extension. See the PCSX-Redux's launch.json for some examples.
When using the psyqo.mk
file, you can specify build options for the PSYQo library and your binary. It is possible to specify the following options:
make BUILD=Release
make BUILD=Debug
make BUILD=SmallDebug
make BUILD=LTO
Moving on to the Concepts page is the next step in understanding how the library functions. The library itself is also thoroughly documented, and the nugget website has a render of the doxygen documentation.
To discuss PlayStation1's development, hacking, and reverse engineering in general, please join the PSX.Dev Discord server: