Create Your First Application
This guide will walk you through creating a simple “Hello World” application for PS3.Create the source file
Create
source/main.c with the following content:source/main.c
By default, PSL1GHT redirects stdout and stderr to the lv2 TTY interface. You can use Kammy’s ethdebug module to view this output over the network.
Build the application
Build the SELF executable:This will:
- Compile
source/main.ctosource/main.o - Link object files into
hello-world.elf - Strip and process the ELF to create
hello-world.self
.self file can be loaded directly on a jailbroken PS3.Understanding the Build Process
The PSL1GHT build system follows this workflow:Build Stages
1. Compilation (.c → .o)
1. Compilation (.c → .o)
Source files are compiled to object files using The PPU rules automatically include:
ppu-gcc:-mhard-float- Hardware floating point-fmodulo-sched- Optimized scheduling-ffunction-sections -fdata-sections- For dead code elimination
2. Linking (.o → .elf)
2. Linking (.o → .elf)
Object files are linked into an ELF executable:Common libraries:
-llv2- LV2 system calls-lrt- Runtime support-lio- I/O (pad, keyboard, mouse)-lrsx- RSX graphics-lgcm_sys- Graphics memory management-lsysutil- System utilities
3. SELF Creation (.elf → .self)
3. SELF Creation (.elf → .self)
The ELF is processed into a SELF (signed executable):
- Strip - Removes debug symbols
- SPRX Linker - Resolves dynamic library references
- make_self - Creates signed executable for CFW
4. PKG Creation (.self → .pkg)
4. PKG Creation (.self → .pkg)
The SELF is packaged for installation:Package structure:
A More Complex Example
Here’s a graphics example that displays colored rectangles using RSX:Package Metadata
Customize your application’s appearance in the XMB:PKGFILES directory contents are copied to /dev_hdd0/game/$APPID/ on the PS3.
Running Your Application
Option 1: ps3load (Network Loading)
For rapid testing without creating packages:Option 2: Install Package
- Copy the
.gnpdrm.pkgfile to a USB drive - Insert the USB drive into your PS3
- Navigate to Package Manager → Install Package Files
- Select your package and install
- Find your app under Game in the XMB
Common Build Issues
Error: 'Please set PSL1GHT in your environment'
Error: 'Please set PSL1GHT in your environment'
The Then reload:
$PSL1GHT environment variable is not set. Add to your shell profile:source ~/.bashrcundefined reference to library functions
undefined reference to library functions
You’re missing required libraries in the
LIBS variable. Common libraries:Application crashes on PS3
Application crashes on PS3
Common causes:
- Not calling
ioPadInit()before using controller functions - Not initializing video/RSX before graphics calls
- Stack overflow (try increasing stack size in linker flags)
- Not registering exit callback for XMB quit events
Next Steps
Project Structure
Learn about the SDK layout and build system
API Reference
Explore available libraries and functions
Graphics Programming
Learn RSX graphics programming
Sample Code
Browse complete example applications