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
(Created page with "{{Infobox Switch Homebrews |title=Vita2hos |image=vita2hosswitch.png |description=Play vita games on Switch. |author=xerpi |lastupdated=2022/08/29 |type=Other Emulators |version=0.3 |license=Mixed |download=https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch.7z |website=https://wololo.net/2022/03/05/vita2hos-release-running-ps-vita-games-on-nintendo-switch-could-soon-become-a-reality/ |source=https://github.com/xerpi/vita2hos |donation= }} {{#seo: |title=Switch Home...")
 
No edit summary
Line 1: Line 1:
{{Infobox Switch Homebrews
{{Infobox Switch Homebrews
|title=Vita2hos
|title=Vita2hos
|image=vita2hosswitch.png
|image=vita2hosnx.png
|description=Play vita games on Switch.
|description=(WIP) PlayStation Vita to Horizon OS (Nintendo Switch OS) translation layer.
|author=xerpi
|author=xerpi
|lastupdated=2022/08/29
|lastupdated=2022/08/29
|type=Other Emulators
|type=Handheld
|version=0.3
|version=0.3
|license=Mixed
|license=Mixed
|download=https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch.7z
|download=https://dlhb.gamebrew.org/switchhomebrews/vita2hosnx.7z
|website=https://wololo.net/2022/03/05/vita2hos-release-running-ps-vita-games-on-nintendo-switch-could-soon-become-a-reality/
|website=https://wololo.net/2022/03/05/vita2hos-release-running-ps-vita-games-on-nintendo-switch-could-soon-become-a-reality/
|source=https://github.com/xerpi/vita2hos
|source=https://github.com/xerpi/vita2hos
|donation=
|donation=https://ko-fi.com/xerpi
}}
}}
{{#seo:
vita2hos is a PlayStation Vita to Horizon OS (Nintendo Switch OS) translation layer (not an emulator).
|title=Switch Homebrew Emulators (Other Emulators) - GameBrew
 
|title_mode=append
==Installation==
|image=vita2hosswitch.png
===On a real console===
|image_alt=Vita2hos
Copy vita2hos.nsp to your microSD card (i.e. to: <code>/atmosphere/vita2hos.nsp</code>)
}}
 
{{cleanup|article|Needs cleanup}}
Create <code>/atmosphere/config/override_config.ini</code> and add the following lines to it:
Play vita games on Switch.
[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 <code>override_config.ini</code> doesn't allow multiple <code>path</code> entries which is why it has to be done this way.)
 
Next, copy a PlayStation Vita executable (<code>.velf</code> or <code>.self/eboot.bin</code>) to <code>sdmc:/vita2hos/test.elf</code>.
 
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 (<code>.velf</code> or <code>.self/eboot.bin</code>) to <code>sdmc:/vita2hos/test.elf</code> (File > Open yuzu Folder > sdmc/).
 
Run vita2hos.nsp.
 
===Running on Ryujinx===
Copy a PlayStation Vita executable (<code>.velf</code> or <code>.self/eboot.bin</code>) to <code>sdmc:/vita2hos/test.elf</code> (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 [https://wiki.henkaku.xyz/vita/Modules 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.


==Media==
===Project status===
<youtube></youtube>
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).


==Screenshots==
[https://github.com/xerpi/vita2hos/releases List of sample PSVita homebrew].
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-01.png
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-02.png
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-03.png
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-04.png
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-05.png
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-06.png
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-07.png
https://dlhb.gamebrew.org/switchhomebrews/vita2hosswitch-08.png


==Changelog==
==Changelog==
'''v.1.0'''
'''Alpha 0.3'''
* First Release.
*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 <code>4 * W * H</code>, so we can't use the buffer provided by the Vita SW (<code>sceGxmBeginScene</code>'s <code>depthStencil</code>). Therefore we have to create a shadow DS surface with the proper size (returned by <code>dkImageLayoutGetSize</code>);
*Initial support for pitch-linear textures (in the fragment shader)!
 
'''Alpha 0.2'''
*Initial [https://vita3k.org/ Vita3K] shader recompiler support: it translates from GXP (PSVita's SceGxm shader format) to SPIR-V/GLSL shaders.
*Uses [https://github.com/devkitPro/uam 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 <code>sd:/test.elf</code> → <code>sd:/vita2hos/test.elf</code>.
*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 [https://vita3k.org/#donate donating] and [https://vita3k.org/#contribute contributing] to Vita3K.
*vita2hos uses UAM ([https://github.com/devkitPro/deko3d 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:
*[https://vita3k.org/ Vita3K]: vita2hos uses Vita3K's shader recompiler, and some parts of vita2hos's code are based on Vita3K's implementation. Please, consider [https://vita3k.org/#donate donating] and [https://vita3k.org/#contribute contributing] to Vita3K.
* [https://github.com/devkitPro/uam UAM - deko3d shader compiler]: vita2hos uses UAM ([https://github.com/devkitPro/deko3d deko3d]'s shader compiler) to compile shaders. Please, also consider contributing to that project and donating to the developers.
* [https://ryujinx.org/ Ryujinx].
* [https://yuzu-emu.org/ yuzu].
* [https://github.com/Atmosphere-NX/Atmosphere Atmosphère].
* [https://github.com/switchbrew/ Switchbrew].
 
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 ==
== External links ==
* Gbatemp - https://wololo.net/2022/03/05/vita2hos-release-running-ps-vita-games-on-nintendo-switch-could-soon-become-a-reality/
* GitHub - https://github.com/xerpi/vita2hos
* Github - https://github.com/xerpi/vita2hos
* Wololo - https://wololo.net/2022/03/05/vita2hos-release-running-ps-vita-games-on-nintendo-switch-could-soon-become-a-reality/
* Reddit -

Revision as of 04:29, 26 Mayıs 2023

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: