Skip to content

Latest commit

 

History

History
101 lines (64 loc) · 4.43 KB

README.md

File metadata and controls

101 lines (64 loc) · 4.43 KB

If you're interested in PS Vita development in Rust, please check out the organization-wide docs and the Rust on Sony PlayStation Vita Book. There are also working examples at the examples repo.

vitasdk-sys

docs.rs Crates.io License: MIT

This crate exports bindings to functions available in vitasdk and statically links to its stubs libraries based on enabled features. Their official docs are here and the bindings are automatically generated from vitasdk's vita-headers repository. Which features required for which functions can be found on https://docs.rs/vitasdk-sys.

There's an example on how to use this crate at vita-rust/examples/crates/4-vitasdk.

To be able to use it, you need vitasdk available and the environment variable VITASDK set to its location. e.g.:

$ export VITASDK=/opt/vitasdk

Features

Stubs (*_stub)

To be able to use any function available in this crate, you'll need to enable the related features, which will cause the required stub to be linked. You can find which any function a stub requires by looking at docs.rs/vitasdk-sys.

Example: to find which stub is required to use sceDisplaySetFrameBuf, search for it on docs.rs. You'll find Available on crate feature SceDisplay_stub only. there, which means that you'll need to enable SceDisplay_stub to use it.

ℹ️ NOTE: There are a few (currently 4) conflicting stubs, which are stubs that define symbols that are also defined by compiler builtins or std. A list of those features can be found here.

vitasdk-utils

This feature just enables some functions provided by vitasdk. Just like the stubs, you can figure which functions require it by looking at docs.rs.

bindgen

The bindgen feature makes the crate generate bindings at compile-time using headers from the system's vitasdk (on $VITASDK), instead of using the pre-generated bindings.

To use this feature you also need bindgen's requirements, which may already be on your system.

Manually updating the submodule

Updating

To update the headers, we have a job that runs on GitHub Actions yearly or on demand that will create a PR. If you want to update manually, you can follow these steps:

Manually

Clone the repository with submodules (the C headers):

$ git clone --recurse-submodules https://github.com/pheki/vitasdk-sys.git

If the repository is already cloned, update the submodules with:

$ git submodule update --init --recursive

To update the headers, go to the vita-headers submodule and update it by the usual means:

$ cd vita-headers
$ git pull
$ cd ..

Then run cargo run -p vitasdk-sys-build-util -- bindgen

ℹ️ NOTE: The LLVM version currently used in CI is 16. Occasionally there may be slight differences in generated bindings depending on your LLVM version.

Versioning

Usual semver rules apply for this crate, but note that there may be differences between the version of the headers used to generate the bindings and the vitasdk version installed on your machine.

Updating

To update versions you can look for breaking changes at CHANGELOG.md. If you're coming from a version before 0.3, this comment has a migration guide.

Credits

License

This crate (library) is distributed under terms of MIT license or Apache License (Version 2.0), at your option. See LICENSE-MIT and LICENSE-APACHE for terms.