Switch Remote Play Switch

From GameBrew
Switch Remote Play
Switchremoteplay.png
General
AuthorMoehammered
TypeRemote Play and Streaming
Version1.0.0
LicenseGPL-3.0
Last Updated2021/11/28
Links
Download
Website
Source

Let the switch remotely play PC games (similar to steam link or remote play)

This project is inspired by the GitHub project In-Home-Switching and SkyNX. The goal is to make a convenient streamer/client application to be used to remote play PC games on the Switch.

Features

  • No system crashing when going to sleep (stream will disconnect though and application is closeable).
  • Desktop application to host remote connection stream.
  • Stream input from the Switch to remote connection.
  • Stream audio from remote connection to the Switch.
  • Automatically connect Switch and PC stream applications.
  • Automatically mute PC when audio is streaming to the Switch.
  • Allow manual configuration of Switch to PC connection.
  • Disconnect / Reconnect stream at will.
  • Toggle Input Mode to Mouse.
  • Toggle Input Mode to DS4(PS4) controller.
  • Toggle Input Mode to Xbox controller.
  • Rich configuration options for h264 CPU encoder.
  • Rich configuration options for h264 AMF encoder (AMD hardware encoder).
  • Multiple controller support.
  • Touch screen emulate mouse support.
  • Controller gyro support.

Installation

Download the 7z or zip archive and follow the instructions to setup.

If you're just updating, simply delete the old switch-remote-play folder on your Switch's SD card and delete the PC program on your computer.

Then replace them with the updated versions in this release and off you go! (Make sure to reconfigure the settings in the application).

User guide

Switch-Project

This project consists of an application written for the switch that will decode stream data received from FFMPEG and send its input to an application to emulate a controller. The rendering is done with SDL2 and the project is written in C++.

Windows-Project

This project consists of an application written for Windows that will launch an FFMPEG stream to encode and send data. The application, after launching the FFMPEG stream, will then listen to receive input data and emulate a controller via the ViGEm Client SDK. The ViGEm Client SDK expects the ViGEm Bus Kernel Driver to be installed on the machine in order to work. For more info on the kernel driver code see the ViGEmBus GitHub page. For the driver installation, see the ViGEmBus Releases page.

The Windows project is also written in C++ and uses Winsock to do socket communication with the switch application.

Mac-Project

Mac Prototype: Switch Remote Play (Mac PoC -- Not in development).

Limited functionality. No virtual gamepad drivers = no gamepad support.

Stream Encoder Settings Examples

Below are some simple suggestions on what configuration to choose for certain quality targets (these also depend on your CPU's performance and what you're running at the time).

  • Common Settings:
    • Desktop Resolution: 1280 x 720.
    • Switch Resolution: 1280 x 720.
    • Vsync Mode: variable frame rate.
    • Hardware Accel Mode: auto.
    • Video Codec: h264.
  • Perfect Image Quality:
    • Bitrate: 5120.
    • Quality Control Factor: 0.
    • Encoder Preset: very slow.
  • Low Latency quality:
    • Bitrate: 5120.
    • Quality Control Factor: 20(or higher).
    • Encoder Preset: ultra fast.
  • Balanced quality:
    • Bitrate: 8192.
    • Quality Control Factor: 8 ~ 15.
    • Encoder Preset: medium or fast.

Screenshots

switchremoteplay2.pngswitchremoteplay4.pngswitchremoteplay3.png

Media

SkyNX 상위 호환,Nvidia가 필요없는 스트리밍 끝판왕? Switch-Remote-Play 설치 가이드 (OpenCourse)

Compatibility

Tested on:

Atmosphere 0.16.2 - FW 10.1.0 (switch-remote-play 0.9.0)
Atmosphere 0.19.5 - FW 10.1.0 (switch-remote-play 1.0.0)

Your Switch must be using Atmosphere CFW. SX OS is not supported.

Changelog

v1.0.0 2021/11/28

Switch Application Changes:

  • Touch Configuration and Virtual Input support added #17:
    • Added a new configuration menu screen for 'Touch Configuration'.
    • 2 modes of virtual touch interfacing are available: Virtual Touch and Simulated Mouse.
    • Virtual Touch.
      • Makes the Switch touch screen behave like a touch monitor for the PC.
    • Simulated Mouse.
      • Makes the Switch touch screen behave like a mouse (similar to a laptop trackpad).
      • Includes support for absolute and trackpad behaviour.
        • Absolute behaviour means the mouse will be under your finger.
        • Trackpad behaviour means the mouse matches the movement of your finger (like a laptop trackpad).
      • Please be aware, as the name implies it is simulated behaviour, so I've had to mimic how a mouse would work. It won't be perfect, but it is there for compatibility purposes.
      • I've enjoyed using trackpad mode personally (didn't think I would) but whenever I use absolute mode, I always prefer to switch to the Virtual Touch. I recommend Virtual Touch whenever you can use it.
    • Tested using it with cemu and Virtual Touch mode worked without issue while playing Super Mario Maker.
  • Monitor Selection Added in Encoder Configuration Screen #21:
    • Added the ability to select the monitor for streaming.
    • Number starts at 0 for primary monitor and increases for secondary monitors.
  • Multiple Controllers, Guide Button, and JoyCon Support:
    • Home(PS4)/Guide(X360) Button Configuration Added #24.
      • Added the ability to bind the Home button hotkey in the Controller Menu.
      • Added the ability to configure the Home button hotkey trigger time (how long to hold the home button hotkey to trigger it).
    • Multiple controller support added #22 (yay!).
      • Added the ability to configure how many virtual controllers are created and streamed to the PC.
      • IMPORTANT: PS4 controller mode will not respect player number order (joycon 1 might not be DS4 controller 1 on the PC).
        • Xbox 360 mode seems fine and I haven't had issues with out of order player/controller ordering.
        • I cannot control how the driver assigns player numbers, so for now this is considered a minor inconvenience. If you need player ordering, configure it in the game, use Xbox 360 mode, or simply hand over the controller.
    • JoyCons can be separated and used as individual controllers.
      • You'll need to separate and pair the JoyCons individually in the Switch OS.
      • The buttons always get remapped in horizontal orientation as follows:
      • Face buttons = ABXY
      • Analog stick = Left Analog Stick
      • SL/SR = L/R
      • Plus/Minus = Plus
      • There are no plans to make this configurable in the near future (but I will revisit it after the Linux port has been completed).
  • Mouse Configuration Screen Added #27:
    • Mouse configuration options have been removed from the 'controller' menu and been promoted to their own menu screen.
    • Mouse wheel (scrolling up/down and left/right) is now configurable and assignable to the left or right analog stick.
    • Mouse/Controller mode toggle hotkey is now configurable and assignable.
    • Mouse/Controller mode toggle time is now configurable.
  • Keyboard Configuration Screen Added #38:
    • PC Keyboard keys can now be simulated when the program is in 'Mouse mode'.
    • Keyboard buttons can be configured and assigned to the Switch Buttons.
    • This initially was just a request to implement arrow keys, but I couldn't help plan ahead in case of expansion of the feature. Enjoy.
  • Software Keyboard User Configuration Input #40:
    • The built in Switch software keyboard has now been used everywhere applicable.
    • Number inputs have been replaced with keyboard input prompts.
    • IP Address input in the network configuration screen is now done via the software keyboard.
  • Network Configuration Menu Cleanup #41:
    • Created a new configuration menu to allow users to configure all aspects of connecting to the PC.
    • IP, Broadcast Address, Manual IP Toggle, and data ports can all be configured.
    • The PC program also has a respective network configuration file to allow for configuring the data ports.
      • Make sure the settings on the Switch match the settings in the PC's network config file.
  • Project Refactor and Cleanup #43:
    • Did some long overdue cleaning through the code base for the Switch and PC application.
    • Removed redundant code.
    • Replaced magic variables with constants.
    • Streaming code moved into separate helper classes for both the Switch and PC application.
    • Added the ability to configure logging. File logging and verbosity are configurable.
    • Refactored code to separate common code into a folder shared between the Windows and Switch project.
      • This was done in preparation for starting the Linux host application version #32.
    • For the end user, this shouldn't matter much.

PC Application Changes:

  • Mouse centering on selected monitor #21 #27:
    • When the stream starts, the program will center the mouse to the middle of the screen.
  • Added configuration options #41, #43:
    • Can now control console window minimise/restore on stream connect/disconnect.
    • Logging verbosity is controllable.
    • Log files can be enabled (to help with issue reporting hopefully).
    • PC Audio mute behaviour can be configured.
    • Network data ports can be configured.
      • Please make sure they match the settings on the Switch app's network configuration.
  • Virtual Interfaces for touch, mouse and keyboard created #17 #27 #38:
    • Cleaned up mouse code to allow for configurable behaviour such as relative and absolute positioning.
    • Added a touch interface that injects touch data messages to Windows allowing for touch inputs to be simulated and interpreted as real touch inputs in Windows.
    • Added a keyboard interface that behaves similar to the mouse interface. Tries to behave similar to a regular keyboard.

v0.9.0-pc-audio-patch 2021/07/24

PC Host Application Changes:

  • Audio distortion fix for multi-channel audio hardware (see #31 for more info).
    • A commit back in February commented out the audio arguments used to tell ffmpeg to capture audio in stereo channel configuration. This caused users with greater than stereo audio channel setups to get invalid audio data streamed.
    • This also meant that even if you had stereo audio, ffmpeg was left in charge to decide the bitrate and audio codec. The missing code added back in also helps resolve this issue.

v0.9.0 2021/07/05

PC Host Application Changes:

  • Deleted old Switch HID Key definitions:
    • LibNX has finally deleted the deprecated HID input implementation. So they were removed from here too.
  • Updated Configuration Data payload:
    • This means that the pc program expects switch-remote-play v0.9.0 and will not work with older versions.
  • Updated network diagnostic output:
    • The broadcast address config line advice it outputs now reflects the new configuration file format for the app.
  • Ffmpeg Encoder argument parser added:
    • Created an ffmpeg argument parser that will create an ffmpeg argument line for CPU or AMD GPU encoder codecs.
  • Coloured console text:
    • Text output is now coloured to help distinguish between different diagnostic sections.
    • Any startup issues will be coloured in red to help identify problems.
  • Invert Controller Analog Axis added #20:
    • Added the ability to invert the X and Y analog axis for the left and right analog sticks.

Switch Application Changes:

  • Invert Controller Analog Axis added #20:
    • Added the ability to configure and invert the X and Y analog axis for the left and right analog sticks.
    • Thanks so much for being patient mathew77.
  • Deleted old Switch HID input API usage:
    • LibNX has finally deleted the deprecated HID input implementation. So they were removed from here too.
  • UI Refactor:
    • Almost all the UI screens had their code re-written and refactored to make it easier for myself to add parameters and more screens.
    • This does not have any effect on the users, the behaviour of the UI is still the same, just the code behind it has changed so much.
      • and I'm still not satisfied with it.
  • Configuration File Refactor:
    • Configuration is now broken up into separate files for each respective configuration screen/option.
    • You will see a configuration file now for network, decoder, common, etc.
    • Old configuration files are not compatible anymore. You can delete them or back them up and see if there are any settings you'd like to replicate in the new configuration screens.
  • Encoder Configuration Overhaul - Includes h264_amf codec (AMD GPU encoder):
    • Encoder configuration menu has been overhauled now to allow for choosing which h264 encoder to use.
      • To choose different codec, cycle through the 'codec' option on the Encoder Configuration page.
      • Use d-pad left/right to change to the codec's parameters page to configure the respective options.
  • h264 CPU encoder was simplified and had some other options added:
      • Bitrate mode can be chosen now (constant or variable - before it was always variable).
      • Profile option was added (this can help low end hardware or latency by choosing 'baseline').
    • h264 AMF encoder added (AMD GPU hardware encoder).
      • This was the sole reason why I needed to completely overhaul and refactor the UI code.
      • Added options that I found had the most dramatic effects in testing.
  • Built with latest LibNX(v4.1.3 at this time of release):
    • Meaning it should work fine for latest firmware (12.0.3 at this time).

v0.8.3 2021/02/07

PC Host Application Changes:

  • Controller Bug Fixes:
    • Fixed an issue where controller gamepad data was not being streamed correctly on certain network cards.
      • Basically, needed to confirm the size of the gamepad data payload and if it wasn't as expected, keep reading the socket before proceeding.
    • Fixed the incorrect button mapping for the joycon's 'minus' button being mapped to the 'guide' button on the Xbox 360 controller.
      • Now 'minus' is mapped to 'back' on the 360 controller.
    • Fixed a potential overflow bug with the virtual controller analog sticks for the DS4 and X360 controller.
  • Diagnostic Output:
    • Network configuration information is checked and displayed by the program.
      • This will help when users report networking issues as well as help users be able to easily determine the IP address of the PC without having to use ipconfig.
    • Monitor display information is displayed. This will be useful when users report clipped desktops coming through the Switch.
    • Virtual controller sanity checks are performed now. This is to make sure the virtual controller driver is installed and working.
    • The output from FFMPEG when encoding video and audio is now a configuration option. Users can choose to show the encoder logging data or not. This will mainly be useful for debugging odd situations where audio isn't coming through or video seems to fail.
      • This is in a configuration file called 'config.ini'. It is located in the same place as 'switch-remote-play-host.exe'.

Switch Application Changes:

  • Configuration Options:
    • Broadcast Address added as a configuration option. The PC application will display the broadcast address to be added to the switch application's config file. Adding it will allow automatic network discovery to work when pressing the 'L' button.
      • Without this option being specified it will default to 192.168.0.255. If you do not specify your broadcast address in the config file then you will have to use Manual IP Mode.
    • Manual IP Mode Enabled option is now stored in the config file. This will allow users to now be able to just press 'R' once the application opens to connect without having to go to the manual IP mode screen and press 'enabled'.

v0.8.1-Mac 2021/01/16

  • M1 macs use the M1 version as it includes an ffmpeg binary compiled for M1.
  • Intel macs use the Intel version as it includes an ffmpeg binary compiled for Intel.
  • What works:
    • Mouse clicking and cursor movement is working.
    • Video streaming and connection is working.
    • Limited Encoder Configuration settings.
    • Preset, Desktop resolution (limited), Quality Control Rate.
  • What doesn't work:
    • Gamepad input. There are no virtual drivers and I don't have the time to learn DriverKit framework or IOKit to create my own.
    • Audio. Requires a 3rd party program and doesn't work well on M1 macs.
    • Bitrate settings. You can only use Quality Control Rate factor. Bitrate settings interfere and cause stream cutouts on Mac.

v0.8.1 2021/01/04

  • Added extra options in the Controller Configuration Menu.
    • Left mouse button can be mapped to any of the Switch shoulder buttons.
    • Right mouse button can be mapped to any of the Switch shoulder buttons.

v0.8.0 2021/01/03

  • Re-wrote how the menu system works to make it less of a hassle to add more configuration screens.
  • Added Decoder Configuration Menu.
    • Available decoder options that can modify how the Switch decodes the ffmpeg stream are available.
    • Offers some good performance options to allow for better quality streams to come through.
  • Added Controller Configuration Options.
    • Moved mouse sensitivity to the Controller Configuration screen.
    • Added option to toggle if Mouse is default input mode on stream connect.
    • Added Controller type option to choose between X360 or DS4 controller.
    • Added button inversion options for XYAB.
  • Added X360 Controller support to the PC application (thanks theosirian).

v0.7.4 2020/12/30

  • Added Mouse Sensitivity as a configuration option.
  • Configuration settings are now saved upon starting a stream.
  • Last saved configuration settings are loaded on application start.

v0.7.3 2020/12/27

  • Added Encoder Preset, Codec, Control Rate Factor, and HWAccel ffmpeg options to the Switch app.
  • Fixed a control mapping bug for diagonal directions on the D-Pad being flipped accidentally.
  • Increased input send rate to 100 fps from 60 fps.
  • Updated UI to be more concise and make room for the extra configuration options.

v0.7.2 2020/12/25

  • Stream desktop to switch.
  • Use the switch as a controller to play games or a mouse to open applications and then play games.

Credits

Thanks:

External links

Advertising: