This example hopefully gives an example on how to use Overlays without using the toolchain provided by the PSY-Q.
Overlays allow you to write code, that is part of your application, but will not be part of the executable. Instead, each overlay land in their own file and can be loaded at runtime, allowing you to actually use the overlay.
Overlays have a predefined address, where they are loaded too. Multiple overlays can have the same loading address, allowing to reduce the size of the main executable and providing a form of dynamic loading.
For this example, we have two overlays - there source files are located in "PlanschbeckenOverlay" and "SchwimmflugelOverlay" - the Overlay.ld describes which object files are part of which overlay, while the makefiles define which sections are part of the overlay - and therefor must be placed in their own files.
The overlays are loaded at the same address, &load_all_overlays_here
in this example, and occupy the same area in memory, so you can never load them both at the same time.
Therefore, the main.cpp contains a macro to swap between the overlays. This is done in a static fashion for this example, but can easily be done at runtime as well.
To change which overlay is used, just comment out #define RUN_OVERLAY1
at line 11.
At runtime, a different message will appear in pcsx-redux's console, depending on which overlay was loaded.
This example is designed to use VSCode and the WSL system. However, the example in general only relies on the GNU GCC for MIPS.
-
Download and install WSL OPTIONAL
- Install a Linux destribution like Ubuntu
- Install make git and mipsel-linux-gnu
-
Get VSCode OPTIONAL
-
Get mkpsxiso OPTIONAL
Get Lameguys mkpsxiso for creating the PSX iso files - or use any other tool you like.
-
Get pcsx-redux
Get grumpycoders pcsx-redux
-
Get the converted PSY-Q libraries
The converted files can be obtained here. Those files should be placed in the pcsx-redux folder under "pcsx-redux\src\mips\psyq\lib" for easier use
-
Adjust Makefile
Make sure the "PSCX_REDUX" value of the Makefile points to your "pcsx-redux" folder
-
Adjust tasks.json OPTIONAL
The "finalize" command of the tasks.json requires a valid path to your mkpsxiso
-
Adjust OverlayExample.xml OPTIONAL
Make sure the path to the license file in OverlayExample.xml under the config folder is correct or remove this entry.
-
Create the
iso
andbin
folders at the root of the project. -
Run
make
. -
Put the generated
.ps-exe
,.ovly0
and.ovly1
files in thebin
folder.
mkpsxiso -y config/OverlayExample.xml
The cue/bin will by default be generated in the iso
folder.
The tasks.json file provides a "build" and a "rebuild" task that should do the job