Overview
PSL1GHT supports dynamic linking with PlayStation 3 system libraries through SPRX (PlayStation 3 PRX) stub libraries. Any dynamic library available to normal PS3 applications can be used with PSL1GHT by creating a stub library and defining the exports.SPRX libraries allow you to access Sony’s official PS3 system libraries, giving you access to hardware features and system services that would otherwise be unavailable.
SPRX Library Architecture
SPRX stub libraries act as a bridge between your application and the PS3’s dynamic libraries loaded by the system.How SPRX Linking Works
- Stub Creation: Define function stubs that match the PS3 system library exports
- Symbol Export: Map function names to their Function IDs (FNIDs)
- Runtime Linking: The sprxlinker tool processes your ELF to set up dynamic linking
- Execution: The PS3 resolves symbols to actual system library functions at runtime
Supported Libraries
PSL1GHT currently provides stub libraries for the following PS3 system libraries (source:~/workspace/source/README.md:107-118):I/O Libraries
I/O Libraries
- libio - Core I/O operations
- libpad - Controller input
- libmouse - Mouse input
- libkb - Keyboard input
- liblv2 - Low-level system calls
Graphics & Media
Graphics & Media
- libgcm_sys - Graphics Command Manager
- libpngdec - PNG image decoding
- libjpgdec - JPEG image decoding
- libresc - Resolution conversion
- libfont - Font rendering
- libfontFT - FreeType font support
System Utilities
System Utilities
- libsysutil - System utility functions
- libsysmodule - Dynamic module loading
- libsysfs - System filesystem access
- liblv2dbg - Debug utilities
Networking
Networking
- libnet - Network operations
- libnetctl - Network control
- libhttp - HTTP client
- libhttputil - HTTP utilities
- libssl - SSL/TLS support
Advanced Features
Advanced Features
- libgem - PlayStation Move support
- libcamera - Camera/EyeToy support
- libaudio - Audio system
- libspurs - SPU Runtime System
- libvdec - Video decoding
- libusb - USB device access
Creating a SPRX Stub Library
Directory Structure
All SPRX libraries are located inppu/sprx/ with the following structure:
Step 1: Define Library Configuration
Create aconfig.h file with your library metadata (source:~/workspace/source/ppu/sprx/libio/config.h:1-6):
config.h
Step 2: Define Function Exports
Create anexports.h file mapping function names to their FNIDs (source:~/workspace/source/ppu/sprx/libio/exports.h:1-60):
exports.h
Step 3: Export Mechanism
The export mechanism uses PowerPC assembly to create trampolines (source:~/workspace/source/ppu/sprx/common/exports.S:13-37):exports.S
- Saves the link register and TOC pointer
- Loads the function stub pointer
- Calls the actual system library function
- Restores registers and returns
Step 4: Build Configuration
Create a Makefile following the SPRX pattern (source:~/workspace/source/ppu/sprx/libio/Makefile:79-94):Makefile
Using SPRX Libraries
Linking Against SPRX Libraries
In your application’s Makefile:Example: Using libio
The sprxlinker Tool
Thesprxlinker tool processes your compiled ELF to set up SPRX imports (source:~/workspace/source/ppu_rules:29-61):
- Scans for SPRX stub sections
- Creates import tables
- Sets up runtime linking information
- Prepares the ELF for SELF conversion
The sprxlinker is automatically invoked during the standard PSL1GHT build process. You typically don’t need to call it manually.
Advanced: Variadic Function Exports
For functions with variable arguments, use theEXPORT_VA macro (source:~/workspace/source/ppu/sprx/common/exports.S:39-81):
Best Practices
Debugging SPRX Issues
If your SPRX library isn’t working:- Verify FNIDs: Double-check all function IDs
- Check Library Name: Ensure
LIBRARY_NAMEmatches exactly - Inspect Linking: Use
ppu-objdump -xto verify stub sections - Test Incrementally: Add one function at a time
See Also
- Optimization - Optimize SPRX library calls
- Debugging - Debug dynamic linking issues