Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vitadev

Toolkit for porting standard SDL2 programs to PlayStation Vita with minimal changes to the app itself.

Link vitadev, call vitadev_init(), swap fopenvd_fopen and texture helpers where needed, add a vitadev_package() CMake stanza — done.

Prerequisites

  • vdpm packages installed (SDL2 etc.)
  • CMake 3.16+

Build

Native (macOS / desktop)

Uses raylib from ~/src/raylib (override with -DRAYLIB_ROOT=/path/to/raylib).

cd ~/src/vitadev
cmake -S . -B build-native
cmake --build build-native --target raylib-demo
./build-native/examples/raylib-demo/raylib-demo

Vita (VPK)

Follows raylib-5.5-vita. Requires full vitaGL with GLSL translator (vdpm's minimal vitaGL is not enough — the install script rebuilds it).

Vita device prerequisite: libshacccg.suprx (runtime shader compiler). Without it, apps crash during the first shader link.

On many Vitas, files copied via USB land in ux0:data/ but vitaShaRK looks in ur0:/data/ — our vitaGL build tries both. Copy the file:

# After USB mount (VitaShell → USB)
cp /path/to/libshacccg.suprx /Volumes/Untitled/data/

Or install properly with ShaRKF00D (writes to ur0:/data/).

export VITASDK=~/vitasdk
export PATH=$VITASDK/bin:$PATH
./scripts/install-raylib-vita-deps.sh

Then build:

cmake -S . -B build-vita -DVITADEV_VITA_BUILD=ON \
  -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake
cmake --build build-vita --target raylib-demo.vpk-vpk

Output: build-vita/examples/raylib-demo/raylib-demo.vpk

Note: This replaces SDL2 in vitasdk with the vitagl fork. Restore vdpm SDL for pac-c:

./scripts/restore-vdpm-sdl.sh

SDL-based ports (pac-c) and raylib ports use different SDL builds — don't mix without restoring.

Deploy to Vita (USB)

  1. VitaShell → USB (mounts as /Volumes/Untitled on macOS)
  2. Copy the VPK and ROMs:
cp build-vita/examples/pac-c/pac.vpk /Volumes/Untitled/
mkdir -p /Volumes/Untitled/data/PACM00001/roms
cp /path/to/pacman/roms/* /Volumes/Untitled/data/PACM00001/roms/
  1. Eject, VitaShell → install pac.vpk → launch

What vitadev provides

Module Purpose
vitadev/init Heap cap, AppUtil boot, ux0:data/<TITLEID>/, SDL Vita hints
vitadev/fs vd_fopen, vd_read_file, vd_mkdir_p — desktop + Vita
vitadev/sdl ABGR8888 textures; RGB24 → GPU lock (no UpdateTexture copy on Vita)
vitadev/timing vitadev_frame_tick(), vitadev_set_turbo(), vitadev_real_get_ticks()
vitadev/fps On-screen FPS counter (vitadev_fps_draw)
vitadev/input Vita joystick button constants (VITA_JOY_*)
vitadev_package() CMake macro: ELF → VPK
vitadev_link_raylib_app() CMake helper: desktop raylib from ~/src/raylib, Vita from third_party/raylib-5.5-vita

Automatic layer hooks (no app code required)

When linked against vitadev on Vita, these SDL functions are wrapped:

  • SDL_GetTicks — logical clock capped to ~60 Hz for stable simulation
  • SDL_RenderPresent — flushes pending texture uploads; advances logical clock

Call vitadev_set_turbo(true) to disable the frame cap (hold-to-run-fast).

Porting checklist

  1. vitadev_init() with your TITLEID at startup (before SDL_Init)
  2. Replace file I/O with vd_fopen / vd_read_file where paths hit ux0:data/
  3. Use vd_create_texture + vd_update_texture_rgb24 for RGB24 framebuffers
  4. Map Vita joystick in #ifdef __vita__ blocks (handheld is SDL_Joystick, not GameController)
  5. Add vitadev_package() to CMake

Examples

raylib-demo

Small spinning-shapes demo. Same source compiles natively and for Vita.

# Native
cmake --build build-native --target raylib-demo

# Vita
cmake --build build-vita --target raylib-demo.vpk-vpk

pac-c (Vita only)

Copy of superzazu/pac in examples/pac-c/. Exercises display, audio, gamepad, and filesystem I/O.

Vita controls (pac-c)

Button Action
D-pad Move
Select Insert coin
Start 1-player start
R (hold) Uncapped speed — uses wall-clock emulation, skips most display refreshes

Yellow FPS counter top-left; orange bar = turbo active.

ROMs: ux0:data/PACM00001/roms/ — see examples/pac-c/roms/README.txt

Project layout

vitadev/
├── include/vitadev/    headers
├── src/                libvitadev.a
├── cmake/              Vitadev.cmake, VitadevRaylib.cmake, RaylibVita.cmake
├── third_party/
│   ├── raylib-5.5-vita/   Vita raylib port (vitaGL)
│   └── SDL-vitagl/        Northfear SDL2 fork (OpenGL via vitaGL)
└── examples/
    ├── raylib-demo/    native + Vita demo
    └── pac-c/          SDL reference port

Build pipeline (what CMake runs)

.c sources → arm-vita-eabi-gcc → ELF
           → vita-elf-create   → VELF
           → vita-make-fself  → eboot.bin
           → vita-mksfoex     → param.sfo
           → vita-pack-vpk    → .vpk

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages