从一个全新的 ubuntu 24.10 (x86_64) 开始配置开发环境,推荐编译 gxm 版(gles2 版不再维护)
echo "export VITASDK=/usr/local/vitasdk" >> ~/.bashrc
echo "export PATH=$VITASDK/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
sudo apt install git cmake xz-utils bzip2 wget pkg-config meson
# 远程开发用的 (可选)
sudo apt install rsync ccache
git clone https://github.com/vitasdk/vdpm
cd vdpm
./bootstrap-vitasdk.sh
vdpm mbedtls libass harfbuzz fribidi freetype libpng libwebp zlib bzip2
# 在后续编译设置 -DUSE_VITA_SHARK=ON 时需要(实时着色器编译,运行没问题不建议开启)
vdpm vitaShaRK SceShaccCgExt taihen
vitasdk自带的sdl2是 gxm 版的,这里我们需要手动编译 gles 版
1.下载 pvr psp2
sudo apt install unzip
pvr_psp2_version=3.9
mkdir -p /tmp/vita/include
mkdir -p /tmp/vita/lib
mkdir -p /tmp/vita/share/sdl2/suprx
# Configure PVR_PSP2 headers
wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp
unzip /tmp/v$pvr_psp2_version.zip -d/tmp
cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /tmp/vita/include
rm /tmp/v$pvr_psp2_version.zip
rm -rf /tmp/PVR_PSP2-$pvr_psp2_version
# include guard of PVR_PSP2's khrplatform.h does not match the usual one
sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /tmp/vita/include/KHR/khrplatform.h
# Configure PVR_PSP2 stub libraries
wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs
find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /tmp/vita/lib \;
rm /tmp/vitasdk_stubs.zip
rm -rf /tmp/pvr_psp2_stubs
# Configure PVR_PSP2 *.suprx
wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/PSVita_Release.zip -P/tmp
unzip /tmp/PSVita_Release.zip -d/tmp/PSVita_Release
rm /tmp/PSVita_Release/libGLESv1_CM.suprx
rm /tmp/PSVita_Release/libpvr2d.suprx
mv /tmp/PSVita_Release/*.suprx /tmp/vita/share/sdl2/suprx/
rm -rf /tmp/PSVita_Release.zip
rm -rf /tmp/PSVita_Release
# install header and suprx
cp -rv /tmp/vita/* $VITASDK/arm-vita-eabi
rm -rf /tmp/vita
- 安装 sdl2
wget https://raw.githubusercontent.com/xfangfang/wiliwili/f52043d8cc9639adf9cb4faf8bd25f5c5f1f2951/scripts/psv/sdl2/ime.patch
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.28.5.tar.gz
tar -xzvf release-2.28.5.tar.gz
cd SDL-release-2.28.5
patch --strip=1 --input=../ime.patch
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=$VITASDK/arm-vita-eabi \
-DCMAKE_BUILD_TYPE=Release \
-DVIDEO_VITA_PVR=ON \
-DSDL_TEST=OFF
make -j$(nproc) install
vitasdk 的 mbedtls 不支持自定义内存申请相关的函数,直接使用系统函数会导致 https 访问卡顿
git clone -b v3.4.1 --depth 1 https://github.com/Mbed-TLS/mbedtls.git
cd mbedtls
wget https://github.com/xfangfang/wiliwili/blob/b713f72534468b98da9aeb5a3a43b972cf4f6eb2/scripts/psv/mbedtls/mbedtls.patch
patch --strip=1 --input=./mbedtls.patch
mkdir build && cd build
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=$VITASDK/arm-vita-eabi \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_PROGRAMS=OFF \
-DENABLE_TESTING=OFF \
-DMBEDTLS_FATAL_WARNINGS=OFF
make -j$(nproc) mbedtls
make install
vitasdk 的 curl 使用了单线程 openssl,我们使用 mbedtls 来更好地运行在多线程环境。
git clone -b curl-8_9_1 --depth 1 https://github.com/curl/curl.git
cd curl && mkdir build && cd build
cmake ..
-DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=$VITASDK/arm-vita-eabi \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_CURL_EXE=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DENABLE_IPV6=OFF \
-DBUILD_LIBCURL_DOCS=OFF \
-DBUILD_MISC_DOCS=OFF \
-DENABLE_CURL_MANUAL=OFF \
-DCURL_USE_MBEDTLS=ON \
-DCURL_USE_OPENSSL=OFF \
-DCURL_CA_BUNDLE="vs0:data/external/cert/CA_LIST.cer"
make -j$(nproc) install
支持硬解 h264 的 ffmpeg
git clone -b vita_6.0 --depth 1 https://github.com/xfangfang/FFmpeg-vita.git
cd FFmpeg-vita
./configure --prefix=$VITASDK/arm-vita-eabi \
--enable-vita \
--target-os=vita \
--enable-cross-compile \
--disable-runtime-cpudetect \
--disable-armv5te \
--cross-prefix=$VITASDK/bin/arm-vita-eabi- \
--extra-ldflags=" -L$VITASDK/lib " \
--disable-shared \
--enable-static \
--disable-programs \
--disable-doc \
--disable-autodetect \
--enable-swscale \
--enable-swresample \
--disable-encoders \
--disable-muxers \
--disable-demuxers \
--enable-demuxer='hls,flac,flv,aac,h264,hevc,mp3,wav,mov,matroska' \
--disable-parsers \
--enable-parser='aac,aac_latm,bmp,flac,h264,hdr,hevc,mpeg4video,mpeg4audio,mpegvideo' \
--disable-decoders \
--enable-decoder='h264,aac,bmp,flv,flac,aac_vita,mp3_vita,h264_vita' \
--enable-network \
--disable-protocols \
--enable-protocol='file,http,tcp,tls,hls,https,rtp,crypto,httpproxy' \
--disable-iconv \
--disable-lzma \
--disable-sdl2 \
--disable-xlib \
--disable-avdevice \
--enable-mbedtls --enable-version3 \
--enable-pthreads
sed 's/#define HAVE_GETADDRINFO 1/#define HAVE_GETADDRINFO 0/g' -i config.h
make -j$(nproc) install
支持 gxm api 的libmpv
git clone -b psv36 --depth 1 https://github.com/xfangfang/mpv.git
cd mpv
meson setup buildMPV --prefix=$VITASDK/arm-vita-eabi --cross-file crossfile.txt \
--default-library static \
-Diconv=disabled \
-Dlua=disabled \
-Djpeg=disabled \
-Dopensles=disabled \
-Dlibavdevice=disabled \
-Dmanpage-build=disabled \
-Dhtml-build=disabled \
-Dsdl2=disabled \
-Dlibmpv=true \
-Dgxm=enabled \
-Dvitashark=disabled \
-Dcplayer=false
meson compile -C buildMPV
meson install -C buildMPV
git clone --recursive https://github.com/xfangfang/wiliwili.git
cd wiliwili
cmake -B build \
-DPLATFORM_PSV=ON \
-DUSE_SYSTEM_CURL=ON \
-DCMAKE_BUILD_TYPE=Release \
-DSIMPLE_HIGHLIGHT=ON \
-DUSE_GXM=ON \
-DUSE_VITA_SHARK=OFF
cmake --build build
mv $VITASDK/arm-vita-eabi/share/sdl2/suprx/*.suprx scripts/psv/module/
cmake -B build \
-DPLATFORM_PSV=ON \
-DUSE_SYSTEM_CURL=ON \
-DUSE_SYSTEM_SDL2=ON \
-DMPV_NO_FB=ON \
-DSIMPLE_HIGHLIGHT=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build