#vita #homebrew #cargo-command #cargo-build #sony #playstation #upload

app cargo-vita

Cargo为开发索尼PlayStation Vita家用机软件而设计的包装程序

14个版本

0.2.1 2024年4月2日
0.2.0 2024年1月12日
0.1.11 2023年10月30日
0.1.7 2023年9月26日

#79Cargo插件

MIT/Apache

57KB
1K SLoC

cargo-vita

Crates.io MIT/Apache 2.0

Cargo命令,用于处理索尼PlayStation Vita rust项目二进制文件。

有关一般指南,请参阅vita-rust书籍

要求

  • 必须安装VitaSDK,并且 VITASDK 环境变量必须指向其位置。
  • vitacompanion 用于 ftp 和命令服务器(上传和运行工件)
  • PrincessLog 需要 cargo vita logs
  • vita-parse-core 需要 cargo vita coredump parse

安装

cargo +nightly install cargo-vita

使用方法

使用nightly工具链构建Vita应用程序(通过为项目目录使用rustup override nightly或通过在cargo调用中添加+nightly)。

Cargo wrapper for developing Sony PlayStation Vita homebrew apps

Usage: cargo vita [OPTIONS] <COMMAND>

Commands:
  build     Builds the Rust binary/tests/examples into a VPK or any of the intermediate steps
  upload    Uploads files and directories to the Vita vita ftp
  run       Starts an installed title on the Vita by the title id
  logs      Start a TCP server on this machine, to which Vita can stream logs via PrincessLog
  coredump  Download coredump files from the Vita
  reboot    Reboot the Vita
  help      Print this message or the help of the given subcommand(s)

Options:
  -q, --quiet       By default, verbose level is 1. Setting quiet flag will reduce it by one
  -v, --verbose...  Print the exact commands `cargo-vita` is running. Passing this flag multiple times will enable verbose mode for the rust compiler
  -h, --help        Print help (see more with '--help')
  -V, --version     Print version

将传递给cargo build的参数作为build命令的参数传递。

设置环境

cargo-vita 要求您设置 VITASDK 环境变量。除此之外,如果您计划使用此工具上传文件、运行可执行文件以及处理核心转储,建议您设置 VITA_IP 环境变量,而不是将其作为每个命令的参数传递。

您可以在您的shell配置(如.bashrc)中设置这些环境变量,使用direnv,并且此工具还将解析您项目的 .cargo/config.toml 中的 [env] 部分。

参数化您的项目

cargo-vita使用Cargo.toml中的信息来构建您的vpk。

将以下部分添加到您的项目Cargo.toml

[package.metadata.vita]
# A unique identifier for your project. 9 chars, alphanumeric.
title_id = "RUSTAPP01"
# A title that will be shown on a bubble. Optional, will take the crate name as the default
title_name = "My application"
# Optional. A path to static files relative to the project.
assets = "static"
# Optional, this is the default
build_std = "std,panic_unwind"
# Optional, true by default. Will strip debug symbols from the resulting elf when enabled.
strip = true
# Optional, this is the default
vita_strip_flags = ["-g"]
# Optional, this is the default
vita_make_fself_flags = ["-s"]
# Optional, this is the default
vita_mksfoex_flags = ["-d", "ATTRIBUTE2=12"]

示例

# Build all current/all workspace projects in release mode as vpk
cargo vita build vpk -- --release

# Build tests of current/all workspace projects in release mode as vpk
cargo vita build vpk -- --release --tests

# Build examples of current/all workspace projects in release mode as vpk and upload vpk files to ux0:/download/
cargo vita build vpk --upload -- --release --examples

# Build a eboot.bin, upload it to Vita and run it. The VPK must already be installed for that to work.
cargo vita build eboot --update --run -- --release

# Start a TCP server and listen for logs. Send a termination signal to stop (e.g. ctrl+c)
cargo vita logs

附加工具

为了获得更好的开发体验,建议在您的Vita上安装额外的模块。

vitacompanion

启用此模块时,该模块将在Vita上运行端口为1337的FTP服务器,以及运行在端口1338的TCP命令服务器。

  • FTP服务器允许您轻松地将vpkeboot文件上传到您的Vita。此FTP服务器由cargo-vita用于以下命令和标志

    # Builds a eboot.bin, and uploads it to ux0:/app/TITLEID/eboot.bin
    cargo vita build eboot --update
    
    # Builds a vpk, and uploads it to ux0:/download/project_name.vpk
    cargo vita build vpk --upload
    
    # Recursively upload ~/test to ux0:/download
    cargo vita upload -s ~/test -d ux0:/download/
    
  • 命令服务器允许您终止和启动应用程序以及重启您的Vita

    # Reboot your Vita
    cargo vita reboot
    
    # After uploading the eboot.bin this command will kill the current app,
    # and launch your TITLEID
    cargo vita build eboot --update --run
    

PrincessLog

此模块允许从您的Vita捕获stdout和stderr。为了捕获日志,您需要在计算机上启动一个TCP服务器,并将PrincessLog配置为连接到它。

为了方便起见,cargo-vita提供了两个与日志相关的命令

  • 一个Vita将连接到的TCP服务器启动命令

    # Start a TCP server on 0.0.0.0, and print all bytes received via the socket to stdout
    cargo vita logs
    
  • 一个重新配置PrincessLog以使用新的ip/port的命令。这将使用由vitacompanion提供的FTP服务器上传新的配置。如果未明确提供机器的IP地址,则将使用local-ip-address crate进行猜测。当配置文件更新时,更改不会应用到Vita重启之前。

    # Generate and upload a new config for PrincessLog to your Vita.
    # Will guess a local IP address of the machine where this command is executed.
    # After reconfiguration reboots the Vita.
    cargo vita logs configure && cargo vita reboot
    
    
    # Explicitly sets the IP address Vita will connect to.
    # Also enables kernel debug messages in the log.
    cargo vita logs configure --host-ip-address 10.10.10.10 --kernel-debug
    

许可协议

除非另有说明(如下或单个文件中),此存储库中的所有代码均可在您的选择下双许可,以下任一:

依赖关系

~10–25MB
~332K SLoC