Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Vita2hos Switch: Difference between revisions

From GameBrew
No edit summary
No edit summary
Tag: Manual revert
 
(One intermediate revision by the same user not shown)
(No difference)

Latest revision as of 10:33, 5 February 2024

Vita2hos
Vita2hosnx.png
General
Authorxerpi
TypeHandheld
Version0.3
LicenseMixed
Last Updated2022/08/29
Links
Download
Website
Source
Support Author

vita2hos is a PlayStation Vita to Horizon OS (Nintendo Switch OS) translation layer (not an emulator).

Installation

On a real console

Copy vita2hos.nsp to your microSD card (i.e. to: /atmosphere/vita2hos.nsp)

Create /atmosphere/config/override_config.ini and add the following lines to it:

[hbl_config]
override_any_app=true
override_any_app_key=R
override_any_app_address_space=32_bit
; adjust the path according to the location of your file
path=atmosphere/vita2hos.nsp

(Note: As long as this file exists you won't be able to use the homebrew menu and instead will always run vita2hos. A quick workaround would be to rename the file and restart your Switch. Unfortunately override_config.ini doesn't allow multiple path entries which is why it has to be done this way.)

Next, copy a PlayStation Vita executable (.velf or .self/eboot.bin) to sdmc:/vita2hos/test.elf.

Boot (or reboot) your Switch and start any game while holding down R. Attempting to use vita2hos via applet mode (album button) will currently result in a fatal error and wouldn't be recommended anyway.

Running on yuzu

Copy a PlayStation Vita executable (.velf or .self/eboot.bin) to sdmc:/vita2hos/test.elf (File > Open yuzu Folder > sdmc/).

Run vita2hos.nsp.

Running on Ryujinx

Copy a PlayStation Vita executable (.velf or .self/eboot.bin) to sdmc:/vita2hos/test.elf (File > Open Ryujinx Folder > sdcard/).

Disable PPTC (Options > Settings > System > Unselect Enable PPTC (Profiled Persistent Translation Cache)).

Run vita2hos.nsp.

User guide

How it works

PlayStation Vita (ARMv7 CPU) executables can be run natively on Nintendo Switch ARMv8 CPU in 32-bit execution mode.

When loading a PlayStation Vita executable, vita2hos redirects the module imports of said executable to jump to routines that implement the same behavior, by using native Horizon OS services, like the one exposed by the original PlayStation Vita OS modules.

Project status

This is still in very early stages and therefore it can only run very simple CPU-rendered PlayStation Vita homebrews.

There is very initial 3D graphics support (it can run vitasdk's GXM triangle and cube samples by hardcoding vita2hos's GLSL shaders to match the Cg shaders the samples use).

List of sample PSVita homebrew.

Changelog

Alpha 0.3

  • vita2hos now points to upstream @Vita3K:
    • Vita3K now has a Vulkan renderer (special thanks to @Macdu)!
    • Along the Vulkan renderer for Vita3K, @Macdu also improved the shader recompiler, which vita2hos depends on!
  • Use a shadow depth/stencil buffer (only initial support is implemented).
    • This should fix the problem introduced in version Alpha 0,2 that made vita2hos unable to work on real hardware: Switch's GPU doesn't support pitch-linear depth/stencil (DS) surfaces, and the block-tiled layout takes more bytes than just 4 * W * H, so we can't use the buffer provided by the Vita SW (sceGxmBeginScene's depthStencil). Therefore we have to create a shadow DS surface with the proper size (returned by dkImageLayoutGetSize);
  • Initial support for pitch-linear textures (in the fragment shader)!

Alpha 0.2

  • Initial Vita3K shader recompiler support: it translates from GXP (PSVita's SceGxm shader format) to SPIR-V/GLSL shaders.
  • Uses UAM - deko3d shader compiler to compile the shaders generated by Vita3K's shader compiler (GLSL for now) to the Switch's GPU format.
  • 3D graphics: Initial depth and stencil support.
  • Changed PSVita executable path from sd:/test.elfsd:/vita2hos/test.elf.
  • Fixed inverted vertical analog sticks axis.
  • 3D graphics performance improvements.
  • General code improvements.
  • vita2hos uses Vita3K's shader recompiler, and some parts of vita2hos's code are based on Vita3K's implementation. Please, consider donating and contributing to Vita3K.
  • vita2hos uses UAM (deko3d's shader compiler) to compile shaders. Please, also consider contributing to that project and donating to the developers.

Alpha 0.1

  • Keep in mind this is still in the "proof of concept" stage. While it can run some simple CPU-rendered homebrews (such as VITA-8), there's still very initial 3D graphics support (it can run vitasdk's GXM triangle and cube samples by hardcoding vita2hos's shaders to match the ones the sample uses).
  • The most difficult task is shader translation from PSVita's SGX USSE bytecode to Nvidia Maxwell instructions. Ideally, I'd like to use Vita3K's shader recompiler, or even turn Vita3K into a translation layer (other than also acting as an emulator on x86 systems) so that we don't have to duplicate a lot of the code.
  • I have very hacky and PoC support for shader translation using copy-pasted Vita3K and UAM (open source shader compiler for the open-source Switch 3D graphics library: deko3d) code in the vita3k-shader-recompiler-uam branch.
  • Video showing vitasdk's GXM cube sample running on the Switch via vita2hos: https://i.imgur.com/w9HPluo.mp4

Credits

Special Thanks:

Also special thanks to @PixelyIon and @SciresM for their help, and to all the testers, especially @TSRBerry.

Disclaimer:

  • Nintendo Switch is a trademark of Nintendo Co., Ltd.
  • PlayStation Vita is a trademark of Sony Interactive Entertainment.

External links

Advertising: