Sys-hidplus-client-rs Switch

From GameBrew
Sys-HidPlus-Client-RS
Syshidplusclientrsnx.png
General
Authorkenesu-h
TypeRemote Play and Streaming
Version1.1.0-alpha.5
LicenseGPL-3.0
Last Updated2021/09/17
Links
Download
Website
Source

Sys-hidplus-client-rs is an alternative client for the Nintendo Switch homebrew sysmodule sys-hidplus, written in Rust.

sys-hidplus is a sysmodule originally created by nachuz, that allows the Switch to receive controller inputs sent by a computer using a client. This in turn enables users to use normally unsupported controllers - such as an Xbox or PS4 controller. This can also be used alongside a remote game streaming service such as Parsec to allow people play Switch games from practically anywhere.

Sys-hidplus-client-rs mainly aims to push out new, experimental features that may or may not be on the more unstable side, such as:

  • Support for up to 8 controllers.
  • The ability to use the home button.
  • Individual controllers can be configured in the following ways:
  • Artificial input delay, useful for putting yourself at an even playing field with those who have some input delay playing through Parsec.
  • Left and right analog stick deadzones, useful for mitigating stick drift and helping stick flicks get recognized more easily.
  • These settings are saved to a file and will persist across different sessions.
  • Users have more choice over which controller goes into what slot; pressing right bumper on a controller assigns it to the first available slot, rather than all connected controllers being assigned immediately.

Installation

Download the latest version of the client from the releases page.

Extract the archive's files into a folder using 7zip or some equivalent - WinRAR works. Preferably, the folder should be dedicated to the client.

This client supports Windows, Mac OS X, and GNU/Linux, although support for the latter two have not been tested. You may have to consult the Compiling section if you are using either of them.

This is a currently intended to be a command line application and as such, it is recommended that you have a terminal or shell on hand to execute the following commands.

User guide

Differences between the clients

Some of the notable features sys-hidplus-client-rs has:

  • Is a command line application.
  • Settings are done from a single configuration file, but can be edited even through the client itself.
  • Users press a button (right bumper) to assign their controller to a slot.
  • Controllers are cleaned up and disconnected from the Switch when the client is stopped.
  • Uses SDL as an input library that supports 4+ controllers.
    • Note that this client cannot actually emulate 4+ controllers until sys-hidplus is updated to do the same. Although the framework for it is there.

Here's some of the features that sys-hidplus has:

  • Is not command line-based; uses a GUI.
  • Controllers are automatically assigned when connected and disconnected.
  • Has anarchy mode, where everyone uses the same controller.

Running the client

Open your OS's terminal/shell and navigate to the directory containing your executable.

  • Windows (cmd) client-rs.exe
  • Windows (PowerShell or other Unix-like shells, e.g. cygwin) ./client-rs.exe
  • Mac OS X and Linux ./client-rs

Either method should give you a welcome message. You'll find that typing start will notify you that you'll have to set a server IP first. You can set it by using the command set_server_ip 'server_ip', where 'server_ip' is replaced with the IP of the Switch you want to connect to. You can also edit config.toml, which is generated within your current directory, but you can generally edit all its fields through commands.

After you've set your Switch's IP, you can type start again to start the client. You'll find that the client should be ready to connect controllers to your Switch.

Additional configuration

The client offers additional configuration, such as changing a slot's controller type and input delay - input delay in particular is helpful for giving a host lag to match their clients.

You can change a slot's controller type using set_switch_pad 'i' 'switch_pad'. 'i' represents the "index" of the slot you want to change, and 'switch_pad' is any one of the following:

Disconnected
ProController
JoyConLSide
JoyConRSide

The "index" is just the slot # - 1. For example, if you wanted to change a controller in slot 2 to a sideways left JoyCon, run set_switch_pad 1 JoyConLSide. If you run this while the client is running, you may have to restart it (you can type restart) for the changes to take effect. For more information on this, you can use help set_switch_pad.

In a similar way, you can change a slot's input delay using set_input_delay 'i' 'input_delay'. 'input_delay' must be a positive number. Unlike set_switch_pad though, you don't need to restart the client for the changes to work. For more information on this, you can use help set_input_delay.

Alternatively, you can edit config.toml too. Just be sure to follow the existing format.

Connecting controllers

Plug into your computer the controllers you want to use on your Switch. If you're want to use a GameCube controller via an adapter, please install Delfinovin first.

When you want to activate a controller, press your right bumper:

  • On Xbox controllers, this will be RB.
  • On PlayStation controllers, this will be R1.
  • On Switch controllers, this will be R.
  • On GameCube controllers, this will be Z assuming you have Delfinovin setup.
  • On any other controllers, you get the point.

Activating a controller will assign it to the first available slot, and will not override slots that are already connected. You may have to make a few button inputs for your controller to be recognized by your Switch.

Repeat this process for every controller you want to connect.

Disconnecting controllers

Disconnecting controllers is as easily as unplugging them from your computer.

The slot they occupied will become open and usable by other controllers. You can reconnect your controller and reactivate it at any time.

Closing the client

This is a pretty important step if you want to cleanly disconnect your controllers. You can run stop if you want to stop the client without closing it.

You should see a message where the client is cleaning up the controllers. After about 3 seconds, you should see another message telling you that the cleanup's done. You'll have to run exit to completely close the client. Alternatively, you can run exit while the client is still running to stop then close the client. Feel free to close your terminal/shell after this point.

Remote Play setup

Instructions for Parsec Setup.

Screenshots

syshidplusclientrsnx3.pngsyshidplusclientrsnx4.png

Known issues

  • sys-hidplus is known to have input delay in demanding games. I don't have any games to personally test this with, but initial obstacles in development seem to support this; namely, input delay was present when inputs were sent at a much higher frequency than the frame rate.
  • If a controller is forcibly disconnected by the Switch - like through the "Change Grip/Order" menu or the "Disconnect" button in Smash Ultimate - you cannot reconnect it until you restart your Switch. I'm also told that you can restart Parsec (if any of the affected controllers were through Parsec), but I'm not totally sure. Either way, it's possible a future sys-hidplus update can resolve this, but until then, try to avoid any menus and options that forcibly disconnect controllers (if you can).
  • As of an unofficial build for sys-hidplus (for 12.x support), sideways Joy-Con emulation doesn't seem to work properly. That said, this has yet to be tested in games that use sideways Joy-Cons, so feel free to try it out.
  • Using arrow keys in the command line interface messes up the next few commands. Not entirely sure how to fix this. For now, try to avoid using any arrow keys and if you do, try to move your cursor all the way to the last line.

Changelog

v1.1.0-alpha.5 2021/09/17

  • This release specifically, although partially, fixes one bug where controller input would not be recognized if the GUI or command line window wasn't focused. This fix should at least universally ensure background input for everyone, which should (hopefully) be independent of whatever window they have focused.
  • Special thanks goes out to ConspiracyFactualist on GBATemp for reporting this bug, testing the fix, and just being patient and great to work with.

v1.1.0-alpha4 2021/09/11

  • This release adds a GUI and anarchy mode support, so now users don't have to use the antiquated command line interface. It still, however, exists for those who want to test the performance difference between it and the GUI, or if you like it better. You can check out the instructions for it at the Installation & Usage page. Anarchy mode can be toggled through the GUI as well.
  • Watch out for an increased amount of input delay while using the GUI and anarchy mode. You may not encounter any (Kemosahbee and I haven't), but anything could happen.
  • NOTE: If you have used my client before, you're gonna have to delete your config.toml and set your Switch's IP again.

v1.1.0-alpha.3 2021/08/31

  • No bug fixes for this release. However, this update adds the long-awaited home button support. The capture button is technically usable too, but I'm leaving it unbound unless there's demand for it. One thing of note:
    • The home button will only theoretically work when the slots are set to ProController and JoyConRSide.
  • There shouldn't be any major issues introduced from this. You do not have to delete or edit your existing config.toml.

v1.1.0-alpha.2

  • Save for code cleanups, documentation, and bug fixes, this might be one of the last few pre-releases, or releases in general. A GUI is also in-development, but I might keep that on-hold until after I optimize all the other code and have more motivation. I want to reiterate that I'm not completely done with this project and intend to do more with it, but my motivation is at a bit of a low right now due to personal issues. There may be circumstances in the next few months that will likely prevent me from contributing to this anywhere nearly as much as before. I will still continue to work on small, easily-fixable bugs and the sort, but I might not implement huge, sweeping features for a while. I don't have any estimate for how long this'll take.
  • That said, this release has a lot of things. Hope I don't miss anything.
  • Bug Fixes:
    • On Xbox, PS4, and potentially other controllers, the north face button used to be mapped to west and vice-versa.
      • This should no longer be the case and both buttons should be correctly mapped to the corresponding face buttons.
    • A and B on Switch Pro Controllers were switched around.
      • Both buttons should be correctly mapped.
    • The analog stick buttons were not bound to anything.
      • They now emulate the Switch's stick buttons, as they originally should have.
    • "restart" wasn't acknowledged as a command.
      • This should no longer be the case.
  • QOL Change for Exiting:
    • Exiting will no longer attempt to disconnect controllers from the Switch if there are none plugged in.
      • This makes exiting pretty much instant as long as the above condition is satisfied.
  • New Feature: Deadzones:
    • Users can now manually set controller deadzones, or the area in which analog input isn't accepted.
      • This can be set through the new set_left_deadzone and set_right_deadzone commands, or by directly editing config.toml.
        • The values must be a decimal number equal to 0.0, 1.0, or somewhere in between.
      • Why: There are two reasons for implementing this:
        • Some controllers may have drifting analog sticks, which can allow for misinputs. While this isn't inherently fixable due to hardware, deadzones give users a way to circumvent the drift.
        • Not sure why this happens or if this is fixable, but it's harder for stick flicks to be registered through client-rs rather than when directly connected to the Switch. Deadzones can help controllers recognize stick flicks, but at the cost of being unable to "tilt" the stick within their area.
  • For testers and potential future developers:
    • Code Restructuring:
      • The code has been restructured to better support future GUI development.
        • Namely, there used to be a ClientView interface/trait, where the controller pulled input from and wrote text to the view. However, this strongly conflicted with the Rust GUI libraries I had access to since they didn't allow you to run the GUIs on a separate thread. The way I was taught the MVC design pattern conflicts with this, and I didn't see any conceivable way to effectively write to the view with this in mind. There's now a ClientApp interface/trait, where the application makes calls to the controller and retrieves results returned by those calls; this is much more different from the controller doing all the hard work. The application can write those results to stdout, the GUI, or whatever your output is.
        • A more strict adherence to the MVC design pattern still exists via the model and controller. Consider the application layer a bit loose in terms of the role of a view.
        • Because of this, command line behavior will be a little different than past releases, but the changes shouldn't be major.
      • Data types have also been changed in an attempt to optimize memory usage a tad bit, though this probably wasn't that effective.
        • I know for sure one bug was introduced because of this, though it's been fixed. I don't know if there are any other bugs, but be wary.
        • If you crash, do your best to note the exact things you were doing at the time of the crash - this includes button inputs.
    • Lack of Documentation and Not-so-great Organization:
      • A lot of frustration was put into restructuring the code, and as a result much of the new code will probably be undocumented and disorganized. It's possible that this will change in the coming month since I'm still motivated enough to at least document and clean up more code, but no promises.
  • To existing users:
    • You will have to either delete or edit your existing config.toml for this release. Deleting is preferred so we can *eliminate potential mistakes, but if you want to edit, add the following (on a new line):
left_deadzones = [
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
]
right_deadzones = [
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
]

v1.1.0-alpha.1 2021/08/12

  • This release is a hotfix to 1.1.0-alpha.0 that addresses a panic (crash).
  • rust-sdl2 panics when an unmapped button is pressed. The touchpad for PS4 controllers is one of these unmapped buttons.
    • The client should no longer crash from this panic.
    • For more technical details, the panic is caught and ignored when reading from the input adapter.
  • There is no need for you to delete your config.toml for this release.

v1.1.0-alpha.0 2021/08/10

  • This client should theoretically support 8 controllers at max now. This update goes hand-in-hand with the update for my sys-hidplus fork, so you're gonna have to grab that for this version of my client to work. Expect this to have bugs, and especially potential input delay.
  • NOTE: If you have used my client before, you're gonna have to delete your config.toml and set your Switch's IP again.

v1.0.0-beta.0 2021/08/05

  • Although I've spent a lot of time testing this personally through Smash 1v1s, this is a beta, so this client is likely to have a number of bugs. Support for 2+ players may also be pretty spotty as well. I'm pretty sure clients aren't capable of anything that will damage your computer or your Switch, but use this at your own risk, and please report issues over here in Issues.
  • Please consult the README for instructions on usage.

Credits

Special thanks go to:

  • Nachuz for sys-hidplus and their clients, as well as everyone who helped them out. I literally would not be working on this project if it weren't for them.
  • Kemosahbee for testing the client, reporting bugs, and giving suggestions as well as feedback. Many important bugs were found thanks to him and his testing efforts.
  • cathery for their sysmodule sys-con, which helped me figure out how to emulate the home button.

External links

Advertising: