|
| 1 | +# Switch Serial Controller - Server |
| 2 | + |
| 3 | +A web application that can manipulate Nintendo Switch from web page. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +```sh |
| 8 | +git clone --recursive https://github.com/r-ralph/Switch-Serial-Controller.git |
| 9 | +cd Switch-Serial-Controller |
| 10 | +cd controller |
| 11 | +./gradlew :server:run |
| 12 | +``` |
| 13 | + |
| 14 | +Then, open `http://localhost:8080` |
| 15 | + |
| 16 | +## How to use |
| 17 | + |
| 18 | +1. Prepare a device is treated as the Pro Controller. |
| 19 | + |
| 20 | + See [device's README](../device/README.md) |
| 21 | + |
| 22 | +2. Connect the device to Switch and PC. |
| 23 | +3. Run server |
| 24 | + |
| 25 | + ```sh |
| 26 | + # For Windows(cmd.exe) |
| 27 | + gradlew :server:run |
| 28 | + |
| 29 | + # For *nix |
| 30 | + ./gradlew :server:run |
| 31 | + ``` |
| 32 | + |
| 33 | +4. Access to `http://localhost:8080`. |
| 34 | +5. Select corresponding port id and control gamepad view. |
| 35 | +6. Click `SEND` button. |
| 36 | + |
| 37 | +## Features |
| 38 | + |
| 39 | +|  | |
| 40 | +|:-----------| |
| 41 | + |
| 42 | +### Control View |
| 43 | + |
| 44 | +- Serial Port |
| 45 | + - A name of serial port which send any commands to. |
| 46 | +- Direct Send |
| 47 | + - If turned on, send a command immediately when you change any button in Gamepad view. |
| 48 | +- Hold Gamepad Input |
| 49 | + - If turned on, button, stick, and hat buttons becomes like toggle button. |
| 50 | + - If turned off, it behaves like real controller. |
| 51 | + |
| 52 | +### Gamepad View |
| 53 | + |
| 54 | +#### Buttons |
| 55 | + |
| 56 | +If it is dark gray, it is pressed. |
| 57 | + |
| 58 | +#### Sticks |
| 59 | + |
| 60 | +Click and hold a black reticle to move. |
| 61 | +A button at the bottom right if for pressing stick. |
| 62 | +Click bottom left button (`+`) to reset the reticle to the center. |
| 63 | + |
| 64 | +#### Current input text view |
| 65 | + |
| 66 | +The current gamepad input values are displayed below the gamepad. It can be used as a macro command. |
| 67 | + |
| 68 | +### Macro View |
| 69 | + |
| 70 | +Puts macro text and click `START MACRO` to process commands in the order. |
| 71 | +If there is no more command that can be executed, stop executing the macro. |
| 72 | + |
| 73 | +#### Macro commands |
| 74 | + |
| 75 | +The following commands are available. |
| 76 | + |
| 77 | +- Change State |
| 78 | + - Puts the controller in the specified state |
| 79 | + - Joins the following keys with a semicolon. |
| 80 | + - Buttons |
| 81 | + - `A,B,X,Y,L,R,ZL,ZR,CLICK,RCLICK,START,SELECT,HOME,CAPTURE` |
| 82 | + - 8-direction hat |
| 83 | + - `HAT@{direction:0-8}` |
| 84 | + - 8 means center and top is 0. The numbers increase clockwise. |
| 85 | + - Sticks |
| 86 | + - `{L|R}STICK@{degrees:0.0-360.0},{tilt:0.0-1.0}` |
| 87 | + - When the tilt is 1, the stick is completely toppled. |
| 88 | +- Wait |
| 89 | + - Waits specified milli seconds to do next command. |
| 90 | + - `wait {number}` |
| 91 | +- Label |
| 92 | + - Indicates the location where you can move by Goto command. |
| 93 | + - `:{label name}` |
| 94 | +- Goto |
| 95 | + - Jumps to the specified label position. |
| 96 | + - `goto {label name}` |
| 97 | +- Comment |
| 98 | + - These lines are ignored as comment. |
| 99 | + - Starts with `#` or empty line. |
| 100 | + |
| 101 | +#### Macro example |
| 102 | + |
| 103 | +``` |
| 104 | +# Press the A,B,X,Y button in sequence every second. |
| 105 | +
|
| 106 | +:head |
| 107 | +A |
| 108 | +wait 1000 |
| 109 | +B |
| 110 | +wait 1000 |
| 111 | +X |
| 112 | +wait 1000 |
| 113 | +Y |
| 114 | +wait 1000 |
| 115 | +goto head |
| 116 | +``` |
| 117 | + |
| 118 | +``` |
| 119 | +# Keep the left stick up, and click the A button repeatedly. |
| 120 | +
|
| 121 | +:head |
| 122 | +A;LSTICK@90,1 |
| 123 | +wait 50 |
| 124 | +LSTICK@90,1 |
| 125 | +wait 50 |
| 126 | +goto head |
| 127 | +``` |
| 128 | + |
| 129 | +## LICENSE |
| 130 | + |
| 131 | +``` |
| 132 | +Copyright 2020 Tamaki Hidetsugu / Ralph |
| 133 | +
|
| 134 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 135 | +you may not use this file except in compliance with the License. |
| 136 | +You may obtain a copy of the License at |
| 137 | +
|
| 138 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 139 | +
|
| 140 | +Unless required by applicable law or agreed to in writing, software |
| 141 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 142 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 143 | +See the License for the specific language governing permissions and |
| 144 | +limitations under the License. |
| 145 | +``` |
0 commit comments