Closed workingjubilee closed 9 months ago
Hey! When I have more time I'll go back to this and improve the docs. For now I'll explain my plan and include a sketch migration guide (with rationale) in case it's of interest. See also: CHANGELOG.md
If you're interested in 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 examples.
There are basically 2 breaking changes:
Before:
use vitasdk_sys::{
psp2::{
display::sceDisplaySetFrameBuf,
kernel::sysmem::{
sceKernelAllocMemBlock, sceKernelFreeMemBlock, sceKernelGetMemBlockBase,
},
},
psp2common::{
display::{SceDisplayFrameBuf, SceDisplaySetBufSync::SCE_DISPLAY_SETBUF_NEXTFRAME},
kernel::sysmem::SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW,
types::SceUID,
},
};
After:
use vitasdk_sys::{
sceDisplaySetFrameBuf, sceKernelAllocMemBlock, sceKernelFreeMemBlock, sceKernelGetMemBlockBase,
SceDisplayFrameBuf, SceUID, SCE_DISPLAY_SETBUF_NEXTFRAME,
SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW,
};
Using the example above, by searching the docs for sceDisplaySetFrameBuf we find: Available on crate feature SceDisplay_stub only
. Meaning you have to enable SceDisplay_stub
for vitasdk-sys
.
Considering all imports on the example above (1.), Cargo.toml would have:
[dependencies.vitasdk-sys]
version = "0.3.2"
features = [
"SceSysmem_stub",
"SceDisplay_stub",
]
Upstream (vita-headers) moves files all the time, which means breaking changes because of the tree structure. Using a flat structure is easier to use and also means there should be no more namespace changes.
On 0.1 and 0.2 I had setup build.rs
to always link to all vitasdk stubs (more than 200), except for a few with conflicting symbols. It was done that way mostly because I just wanted to get something out and I didn't know db.yml files existed (which allow us to "easily" trace which symbols depend on which stubs). @ZetaNumbers basically rewrote binding generation from scratch so you can now choose which stubs get included.
There probably should be a slightly more thorough migration guide to the new crate design, or more and more "modernized" examples of its use, especially in terms of features.