Skip to content
OpenLua Bot edited this page Nov 11, 2026 · 1 revision

Demos

Small scripts that exercise the public Lua API. They are deliberately standalone: the engine loads a single script.lua from its working directory.

The authoritative index is demos/README.md.

Running a demo

  1. Build or install the engine (see Building or Installation).

  2. Copy a demo to the app directory as script.lua:

    cp demos/smoke.lua /path/to/PSP/GAME/OpenLua/script.lua
  3. Copy assets/ next to script.lua, or run from the repository root where assets/ already exists.

All paths in the demos are relative to the working directory, not the demo file.

Index

Demo What it shows Assets
smoke.lua Minimal boot check: clear, fill, outline, line none
flip.lua image.fliph / image.flipv, sprite frames, source rects assets/test_sheet.png
pgf.lua PGF font through font.load/font.setdefault (opt-in builds) flash0:/font/ltn0.pgf
font.lua Fixed-cell font loading, screen.print, tint, text width assets/font.png
sfont.lua Classic variable-width SFont and fixed-font header assets/sfont.png, assets/font.png
math.lua math.minmax clamping and bitwise helpers none
battery.lua Read-only batt.* telemetry none
power.lua power.*: AC status, switch lock/unlock, tick none
os.lua os.* system info and non-run destructive calls none
hardware.lua hw.* identity, firmware, volume/mute, audio route none
sound.lua WAV load/loop/volume, audio pumped by screen.flip assets/beep.wav
transforms.lua Rotation, scale, tint, pivot assets/test_sheet.png
3d.lua Textured rotating OBJ cube and 3D→2D HUD switch assets/3d/*
splash.lua splash.show/old/oldschool, single images and slideshow assets/splash*.png
osk.lua osk.init with a 20-character limit and English mode assets/font.png
game.lua Read-only PBP metadata and ICON0/PIC0/PIC1 extraction assets/sample.pbp, assets/font.png
cam.lua GO! CAM lifecycle, live render and snapshot assets/font.png
peripherals.lua UMD, USB, SIO/IR availability assets/font.png
network.lua WLAN, loopback socket, HTTP failure paths, FTP, adhoc assets/font.png
storage.lua files, os.infoms0/infoef0, savedata, cleanup assets/font.png
tester.lua Full on-device test menu all of assets/

Hardware test menu

tester.lua is the self-contained menu used to exercise the whole engine on a PSP-1000, PSP-2000/3000, PSP-E1000 and PSP Go. It is documented separately:

Quick deploy:

bash tools/package_tester.sh

Then copy the generated PSP/ tree to ms0: or ef0:.

Assets

File Size Regenerate with
assets/font.png ASCII 0x20..0x7E, 8x16 cells python3 tools/gen_font.py
assets/sfont.png Classic SFont, magenta separators python3 tools/gen_font.py
assets/beep.wav 2 s, 440 Hz mono tone python3 tools/gen_tone.py
assets/test_sheet.png 4-frame 64x64 sprite sheet checked in
assets/3d/cube.obj Original 8-vertex textured cube python3 tools/gen_3d_assets.py
assets/3d/cube.mtl Cube material python3 tools/gen_3d_assets.py
assets/3d/checker.png Original 128x128 checker texture python3 tools/gen_3d_assets.py
assets/splash*.png Splash screens, 480x272 python3 tools/gen_splash.py
assets/sample.pbp Synthetic PBP with SFO and artwork python3 tools/gen_pbp.py

Caveats

  • Image functions accept both module-call and method forms.
  • Transforms are per-surface state; reset flips/angle/scale/tint between draws.
  • screen.print requires a font; load a PNG/SFont in the standard PSP build.
  • 3D demos must use amg.begin(), return with amg.mode2d(1) before 2D calls, and present with amg.update() instead of screen.flip().
  • splash.* and osk.init are blocking; use them before the main loop.
  • cam, umd, usb, sio, ir and networking demos are safe without the hardware and show the documented fallback paths.

Related

Clone this wiki locally