Skip to content

Commit

Permalink
Improve Various Documentation (#46)
Browse files Browse the repository at this point in the history
* README: Simplify instructions
* server: Add networking docs to help address #45
* server: Correct titles levels for sections in API
* client: Do not run client-test action on push since the deploy action will do it
* client/deploy: Add lint step
* client: Say to you can click/tap/drag the buttons/sticks
  • Loading branch information
juharris authored Dec 26, 2020
1 parent dd79a6b commit 245f02c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/client-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ jobs:
pushd website-client
docker build -t juharris/switch-remoteplay-client:latest .
docker run --rm -e CI=true --name switch-remoteplay-client juharris/switch-remoteplay-client:latest yarn test
docker run --rm -e CI=true --name switch-remoteplay-client juharris/switch-remoteplay-client:latest yarn lint
docker login --username juharris --password ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
docker push juharris/switch-remoteplay-client:latest
6 changes: 0 additions & 6 deletions .github/workflows/client-test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Client Test

on:
push:
branches:
- main
paths:
- 'website-client/**'
- '.github/workflows/client-**'
pull_request:
branches:
- main
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ For more videos, check out this [playlist](https://www.youtube.com/playlist?list
# Status
One keyboard layout, gaming controller layout, using you mouse, or touchscreen is supported to map input to the control sticks and the buttons on a Nintendo Switch controller.
I've mainly tested this with Animal Crossing and Mixer - FTL low latency streaming.
This is very much a work in progress right now but you can indeed play your Switch remotely using a keyboard/controller/mouse/touchscreen.

# Macros
You can record and run **macros**!
Expand All @@ -44,13 +43,14 @@ See the supported commands [here](/server#api).
# Requirements
The host (person setting this up) needs:
* A Nintendo Switch
* A **Linux** machine to host the service and connect via Bluetooth to the Switch (tested with a Raspberry Pi 4B) (a Linux machine is required by the code that actually connects to the Switch via Bluetooth: [joycontrol][joycontrol])
* A **Linux** machine to host the service and connect via Bluetooth to the Switch (tested with a Raspberry Pi 4B) (a Linux machine is required by the code that actually connects to the Switch via Bluetooth: [joycontrol][joycontrol]). See the [server page](/server) to learn how to set this up.
* (optional) A video capture card to see the video (or just have bad quality and lag by pointing your camera at your Switch and use a video chat app)

The client (your friend) needs:
* A web browser to open the client and send commands
* You can use the already [hosted client][client] but you may have to enable mixed content for that site in your browser's settings if the server your friend is hosting does not have SSL (a link that starts with https).
* You can use the already [hosted client][client] but you may have to enable mixed content for that site in your browser's settings if the server your friend is hosting to connect to their Switch does not use SSL (a link that starts with https).
* A keyboard or **gaming controller** is recommended or just use your mouse/touchscreen for simple stuff
* (optional) See [this folder](/website-client) if you want to customize or run your own client

# Plans
* Support custom key bindings.
Expand All @@ -70,11 +70,6 @@ I'm looking for help with implementing the above plans. Some more specific thing
* Mapping controller, keyboards, and mice for game specific controls (once custom bindings are supported)
* Phone apps to talk to the Switch and host the service instead of the a Linux machine.

# Setup
See:
* [server](/server): a service to run on a device near your Switch (full API docs are there)
* [client](/website-client): a website for your friends to "connect" to your Switch

# Acknowledgements
A very special thank you to [joycontrol][joycontrol] for the very conveninent and full API and the acknowledgements there as well for so much of the great research into how to communicate with the Switch.

Expand Down
27 changes: 23 additions & 4 deletions server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ sudo python3 switchremoteplay/server.py --help

You can change the controller type, the port used by the socket service, and the log level.

# Networking Setup
The client webpage in your browser will need to know the address of the server.

## Same Network
You will need the local IP address or hostname of your device running the server.
Your public IP address will likely not work.
On linux, you can run `hostname` and you should get what you need.
For example, on a Rapsberry Pi, it my just be "raspberrypi".
Once the server has started, you can enter http://raspberrypi:5000 (5000 for the default port) as the "Server Address" on the client page.
If you just have the local network IP address (usually starts with `192.168`), then enter that as the server address, for example: `http://192.168.2.17:5000`.

## Over the Internet
Do this if you are connecting to a server on another network, for example, your friend's Switch and server device at their house.
The person with the Switch and running the server will need to find their public IP address.
One way to do this is for this person to open https://ifconfig.me and check what is says for "IP Address".
They will also have to make sure to set up "port forwarding" in their router settings so that requests from outside of their local network get mapped to the server.

You might be able to avoid port forwarding if you use [ngrok](https://ngrok.com/) but it might not be as secure and will likely reduce speed.

# API
This sections discusses the format of commands that the server expects.
This section is useful for developers and people writing macros.
Expand Down Expand Up @@ -123,7 +142,7 @@ Example: Push the right stick halfway to the right and halfway up: `'s r hv 0.5

Example: Push the left stick halfway to the right and halfway down: `'s l hv 0.5 0.5'`.

# Wait
## Wait
This is mainly for macros.
This server itself will not recognize `wait` commands.
There is an ongoing discussion [here](https://github.com/juharris/switch-remoteplay/issues/8).
Expand All @@ -134,9 +153,9 @@ Example: Do not send any input for 300ms: `'wait 300'`.

The amount of time must be an integer.

# Sending Multiple Commands
## Sending Multiple Commands

## Simultaneous
### Simultaneous
To run multiple commands at the same time: join commands with `&`.
This is supported in macros.

Expand All @@ -145,7 +164,7 @@ Example: Press A and B down: `'a d&b d'`
Do **not** use single press command like just `'a'`.
It might seems like it works but the behavior is not guaranteed.

## Sequence
### Sequence
Run one command after another: join commands with `,`.
This is not guaranteed to work with macros since it is not really needed because you can just split up the command: `["a,b"]` should be: `["a", "b"]`.
This takes precedence over `&`.
Expand Down
3 changes: 3 additions & 0 deletions website-client/src/components/PlayGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ class PlayGame extends React.Component<any, any> {
<Typography component="p">
Keyboard Controls
</Typography>
<Typography component="p">
{"You can click/tap/drag the buttons/sticks below or use these mapped keys:"}
</Typography>
<Grid container>
<Grid className={classes.leftButtons} item container direction="column" xs={4}>
<Grid item>L: Q, ZL: Shift+Q</Grid>
Expand Down

0 comments on commit 245f02c

Please sign in to comment.