Exporting Games to PSvita
What? How?
recently i was interested in making games for the psvita. and i tried to export my first game made in rust (with sdl2)
What do we need?
- A jailbreaked ps vita
- rust (obviously)
make it nightly!
rustup install nightly
rustup default nightly
now here's the dark part (likely you wont find any information about these). You need to install vitasdk and make sure to:
- setup $VITAPKG and set $VITAPKG/bin in $PATH
vitasdk-update
If you want to use SDL2:
- install vitagl
- install this version of SDL
In the psvita you'll have to install libshacccg.suprx in order to use vitagl.
in this page you can find a link to download a vpk to set it up automatically.
finally you must install cargo-vita. Its a great package that gives you an easier way to build binaries for the psvita. just run cargo install cargo-vita
Done?
yeah kind of. now you can start a new project in rust and add this to the Cargo.toml:
[patch.crates-io] ring = { git = "https://github.com/vita-rust/ring", branch = "v0.16.20-vita-2" } # if you want SDL2 [dependencies] sdl2 = { version = "0.37", features = ["use-pkgconfig"] } [package.metadata.vita] title_id = "MYGAME001" title_name = "My game" assets = "static"
the titleid is the game id. This is important to set because all applications on the ps vita have their unique path in the sd memory. commonly located in ux0:app/
so if you make a program to read a file, you must place that file inside its path: ux0:/app/XXXXXXXXX/file.txt.
if you want to use SDL2 you need to add these bindings:
#[link(name = "SDL2", kind = "static")] #[link(name = "vitaGL", kind = "static")] #[link(name = "vitashark", kind = "static")] #[link(name = "SceShaccCg_stub", kind = "static")] #[link(name = "mathneon", kind = "static")] #[link(name = "SceShaccCgExt", kind = "static")] #[link(name = "taihen_stub", kind = "static")] #[link(name = "SceKernelDmacMgr_stub", kind = "static")] #[link(name = "SceIme_stub", kind = "static")] unsafe extern "C" {}
and write sdl2 code as always.
yeah, my game is bullshit. but i will make updates…