MCPcopy Index your code
hub / github.com/Grarak/DSVita

github.com/Grarak/DSVita @0.9.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.9.3 ↗ · + Follow
2,266 symbols 5,236 edges 149 files 37 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DSVita

Rust

Fast NDS Emulator for ARM32/PSVita

Status

DSVita Pokemon Black

This runs most games, however consider:

  • 3D rendering
    • Mostly implemented
    • Z fighting can occur
    • Games using 3D on both screen will have bad framerates and stutters
    • Some effects like fog are unimplemented
  • 2D rendering is mostly complete
  • ARM7 HLE will not work with some games
    • Disable it if certain games don't boot further, get stuck, crash or have any other issues
    • There are other emulation modes like SoundHle. You can pick them if full HLE breaks anything
  • Auto frameskip is always used
    • You will most likely hover around 20-30 fps, even if they run at full game speed
  • No scanline rendering, thus games that update VRAM mid frame will not render correctly
    • Not many games do this, however games that do use it for scrolling texts

Installation/Setup

  • Grab the latest vpk from releases
  • Install libshacccg.suprx, follow this guide or just install and open VitaDB
  • Install kubridge.skprx version >= 0.3.1 from https://github.com/bythos14/kubridge/releases
  • Make sure this plugin is in the *KERNEL section, otherwise the app might crash upon opening
  • If you have the wrong version installed, the app will either crash or will not be able to launch any games
  • It's strongly recommend to overclock your vita to 500MHz
  • Create the folder ux0:data/dsvita and put your roms there
    • They must have the file extensions *.nds
  • Check out the compatibility list for popular games

Bug reporting

Feel free to create an issue if you run into problems, however please make sure before reporting anything the game you are having issues with exhibits the same behavior with the AccurateLle setting enabled.

Building

Install cargo

You need to have both llvm-18 and llvm-21 installed. - llvm-18 is required for bindgen, newer versions struggle to parse class sizes correctly - llvm-21 is used for building C/C++ libraries

Clone the repo

$ git clone --recurse-submodules https://github.com/Grarak/DSVita.git

Linux

Get a armhf sysroot with libsdl2 development packages installed - On ubuntu >= 22.04 bash $ sudo apt install debootstrap qemu-user-static $ sudo debootstrap --foreign --variant=buildd --arch=armhf jammy ./ubuntu-armhf https://ports.ubuntu.com $ sudo cp /usr/bin/qemu-arm-static ubuntu-armhf/usr/bin/ $ sudo chroot ubuntu-armhf /debootstrap/debootstrap --second-stage $ apt update && apt install libsdl2-dev # If apt can't find the package make sure the source has "main restricted universe multiverse" defined in /etc/apt

$ LIBCLANG_PATH=<path to llvm-18 library> DSVITA_SYSROOT=<path to armhf sysroot> cargo build --target thumbv7neon-unknown-linux-gnueabihf --release

Vita

$ LIBCLANG_PATH=<path to llvm-18 library> cargo vita build vpk -- --release

Final optimized release build

To obtain the most optimized build you need to use a patched rust compiler due to LTO incompatibility. The upstream rust compiler doesn't set the target cpu and target features in the callsite attributes which prevents the clang linker from inlining cross language functions.

$ RUSTC=<path to compiled rustc> LIBCLANG_PATH=<path to llvm-18 library> RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none -Zub-checks=no -Zsaturating-float-casts=no -Ztrap-unreachable=no -Zmir-opt-level=4 -Clinker-plugin-lto -Clto=fat -Zunstable-options -Cpanic=immediate-abort" cargo vita build vpk -- --release

Currently we are also stuck with an older rust compiler, which still uses llvm-21, later versions of llvm seem to cause performance regressions.

Stream top screen over udcd-uvc (experimental)

  • Install (replace your existing udcd-uvc install) https://github.com/Grarak/vita-udcd-uvc/releases/tag/1.0 under the *KERNEL section of your config.txt
  • Install https://github.com/GrapheneCt/CapUnlocker
  • Enable the stream top screen setting

Credits

  • NooDS was used as reference. A lot of code was taken from there.
  • melonDS for ARM7 HLE implementation and jit optimizations.
  • DesmumePSPExperimental for ARM7 HLE implementation.
  • pokediamond for ARM7 HLE implementation.
  • DSHBA Copied some PPU hardware acceleration implementation (Thanks for xiro28 linking me the repo)
  • vitaGL 2D/3D hardware acceleration wouldn't be possible without it
  • Tonc GBA PPU documentation
  • GBATEK GBA/NDS documentation
  • kubridge For fastmem implementation
  • @TheIronUniverse for livearea assets
  • dolphin For audio stretching code

Extension points exported contracts — how you extend this code

Convert (Interface)
(no doc) [3 implementers]
src/utils.rs
IpcTrait (Interface)
(no doc) [2 implementers]
src/core/ipc.rs
UiBackend (Interface)
(no doc) [2 implementers]
src/presenter/ui.rs

Core symbols most depended-on inside this repo

into
called by 217
src/core/graphics/gpu_3d/renderer_3d.rs
as_ptr
called by 209
src/mmap/mod.rs
as_ptr
called by 172
src/core/memory/vram.rs
reg
called by 156
src/jit/disassembler/transfer_instructions.rs
len
called by 137
src/mmap/mod.rs
skip
called by 101
src/core/graphics/gpu_3d/registers_3d.rs
thread_regs
called by 87
src/core/mod.rs
clone
called by 67
src/utils.rs

Shape

Method 1,417
Function 480
Class 312
Enum 54
Interface 3

Languages

Rust100%
C++1%
C1%

Modules by API surface

src/core/graphics/gpu_3d/registers_3d.rs111 symbols
src/core/hle/sound_nitro.rs71 symbols
src/utils.rs62 symbols
src/jit/assembler/arm/alu_assembler.rs56 symbols
vixl/src/lib.rs55 symbols
src/presenter/ui.rs53 symbols
src/jit/jit_asm.rs50 symbols
src/jit/disassembler/transfer_instructions.rs49 symbols
src/jit/assembler/block_asm.rs49 symbols
src/core/wifi.rs49 symbols
src/core/graphics/gpu_3d/renderer_3d.rs48 symbols
src/settings.rs47 symbols

For agents

$ claude mcp add DSVita \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact